
4 Feb
2005
4 Feb
'05
9:30 a.m.
On Thu, Feb 03, 2005 at 03:49:55PM -0000, Oterman-Fernandez, Ana-Maria wrote:
Hi!
I have implemented a module with some functions and now I would like to create a type for selecting between this functions:
For example: if f1, f2,...fn are the names of the functions in the module, I need to do something like this:
data Consult = f1 | f2 |....| fn
for applying them whenever the user wants.
but by this way is not possible.
Why not simply treat the functions as data? You know that in Haskell functions are first-class citizens, don't you? I assumed they have the same type. If not, please give us some example. Best regards, Tomasz