Reputation: 35
I am trying to create an infinite list with my own data type in haskell
data Color = Black | White deriving (Show, Eq)
data Cell = Empty | Stone Color deriving (Show, Eq)
makeRow :: Int -> Row
makeRow 0 = []
makeRow n = take n (repeat Cell Empty)
And it gives me the error :
Data constructor not in scope: Cell
Upvotes: 1
Views: 489
Reputation: 12505
You get this error because Cell
is - indeed - not a value constructor. Just use plain Empty
instead (note that you don't write Bool True
or Bool False
- you just write True
or False
).
Upvotes: 2