Re: Getting the constructor from flat curry

From: hema kumar <hemasid_at_gmail.com>
Date: Tue, 06 Jul 2010 04:05:59 -0700

Hi Sebastian,
Thanks for the effort for explaining me regarding the program. Really
appreciate your help

But, I m still getting the same error corresponding to constructorNames.

Prelude> :l flatConstrs.curry
Parsing 'flatConstrs.curry'...
generating flatConstrs.fcy ...
cymake:
"flatConstrs.curry", line 4.2: Unexpected token identifier
`constructorNames'
ERROR occurred during parsing!
Prelude>

Please help.
Thanks
Hema


On Fri, Jul 2, 2010 at 1:28 AM, Sebastian Fischer <
sebf_at_informatik.uni-kiel.de> wrote:

> Hi Hema,
>
>
> On Jul 1, 2010, at 11:58 PM, hema kumar wrote:
>
> I m trying to catch a constructor of a small program given below named
>> BinTree.curry
>>
>> data BinTree a = Leaf | Branch a (BinTree a) (BinTree a)
>>
>> The constructors will be Branch and Leaf.
>>
>>
>> I tried to execute the program you gave in your last mail:
>> [...]
>>
>> I m getting an error corresponding to constructorNames. It seems to me
>> that its a user defined fuction.
>>
>
> Which error do you get? Did you load the program which contains
> `constuctorNames` into PAKCS?
>
>
> Please tell me how should I go about it further. Do i have to specify the
>> file name as BinTree.fcy or BinTree.curry??
>>
>
> The module FlatCurry contains a function `readFlatCurry :: String -> IO
> Prog` that takes a module name (without suffix) and returns the
> corresponding FlatCurry program. You can test my program as follows:
>
> # cat BinTree.curry
>
> data BinTree a = Leaf | Branch a (BinTree a) (BinTree a)
>
> # cat flatConstrs.curry
>
> import FlatCurry
> import FlatCurryGoodies
>
> constructorNames :: Prog -> [QName]
> constructorNames prog =
> [ name | typ <- progTypes prog, name <- consNames typ ]
> where
> consNames typ =
> [ consName cons | not (isTypeSyn typ), cons <- typeConsDecls typ ]
>
> # pakcs
> [...]
> Prelude> :l flatConstrs.curry
> [...]
> flatConstrs> readFlatCurry "BinTree" >>= print . constructorNames
> [("BinTree","Leaf"),("BinTree","Branch")]
>
> hope that helps,
>
> Sebastian
>
> --
> Underestimating the novelty of the future is a time-honored tradition.
> (D.G.)
>
>
>
>



_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Di Jul 06 2010 - 13:26:43 CEST

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:10 CEST