[Haskell-beginners] error: Not in scope: data constructor `BinTree'
Kak Dod
kak.dod2008 at yahoo.com
Fri Apr 13 19:02:58 CEST 2012
Thanks Tom. this is what i wanted
I do not want "Node a" there, I wants only Node and Tom's solution works.
Thanks to all .
________________________________
From: Tom Murphy <amindfv at gmail.com>
To: Kak Dod <kak.dod2008 at yahoo.com>
Cc: Kyle Murphy <orclev at gmail.com>; "beginners at haskell.org" <beginners at haskell.org>
Sent: Friday, 13 April 2012 4:53 PM
Subject: Re: [Haskell-beginners] error: Not in scope: data constructor `BinTree'
"(BinTree a)" needs to be in parentheses to pattern-match properly.
data BinTree a = Node (BinTree a) (BinTree) a | EmptyBinTree
deriving Show
On 4/13/12, Kak Dod <kak.dod2008 at yahoo.com> wrote:
> Thank you but
>
> if I change the code like this:
>
> data BinTree a = Node BinTree a BinTree a | EmptyBinTree deriving Show
>
> b1 = Node 3 EmptyBinTreeEmptyBinTree
>
> Then I am get this error:
>
> bintree.hs:1:23:
> `BinTree' is not applied to enough type arguments
> Expected kind `?', but `BinTree' has kind `k0 -> *'
> In the type `BinTree'
> In the definition of data constructor `Node'
> In the data type declaration for `BinTree'
> Failed, modules loaded: none.
>
>
>
>
> ________________________________
> From: Kyle Murphy <orclev at gmail.com>
> To: Kak Dod <kak.dod2008 at yahoo.com>
> Cc: "beginners at haskell.org" <beginners at haskell.org>
> Sent: Friday, 13 April 2012 4:38 PM
> Subject: Re: [Haskell-beginners] error: Not in scope: data constructor
> `BinTree'
>
>
> Your constructor is called Node, not BinTree.
> data BinTree a = Node a (BinTree a) (BinTree a) | EmptyNode
> b1 = Node 3 EmptyNode EmptyNode
> -R. Kyle Murphy
> Sent from my phone.
> On Apr 13, 2012 12:24 PM, "Kak Dod" <kak.dod2008 at yahoo.com> wrote:
>
> if i compile the following code I get "bintree.hs:3:13: Not in scope: data
> constructor `BinTree'"
>>
>>
>>
>>data BinTree a = Node BinTree a BinTree a | EmptyBinTree deriving Show
>>
>>b1 = (Node (BinTree 3) EmptyBinTree)
>>
>>
>>
>>please help
>>
>>
>>-kak
>>
>>
>>_______________________________________________
>>Beginners mailing list
>>Beginners at haskell.org
>>http://www.haskell.org/mailman/listinfo/beginners
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120414/18f76ca9/attachment.htm>
More information about the Beginners
mailing list