Re: Getting the constructor from flat curry

From: Sebastian Fischer <sebf_at_informatik.uni-kiel.de>
Date: Wed, 30 Jun 2010 10:31:15 +0200

Hello Hema,

hema kumar wrote:

> I want to get the constructor (data contructor) from flat curry of a
> program. is there any function which can give it directly the list
> of the contructors.If not can any one help on how should I go about
> it???

The Module FlatCurryGoodies provides auxiliary functions to process
FlatCurry programs. An functions that returns a list of all construtor
names that are defined in a program can be written as follows:

     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 ]

Cheers,
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 Mi Jun 30 2010 - 10:43:07 CEST

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