开发者

Problem creating my own type in Haskell

So I'm trying to define my own tree type in haskell, but I'm getting an error.

data GTree a = Node a [Gtree a] deriving (Show, Read, Eq)  

results in

Not in scope: type constructor or class `Gtree'

Failed, modules loaded: none.

I'm not sure why my definition doesn't work 开发者_开发知识库while the one below will...

data Tree a = EmptyTree | Node a (Tree a) (Tree a) deriving (Show, Read, Eq)  

If anybody could explain this to me, it would be much appreciated. Thank you!


Your definition doesn't work because of the change in capitalization. See GTree vs Gtree.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜