create a type for selecting functions already in the module

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. Do you know how can I do this? Thank you! Ana Maria The data contained in, or attached to, this e-mail, may contain confidential information. If you have received it in error you should notify the sender immediately by reply e-mail, delete the message from your system and contact +44 (0) 1332 242424 (the Rolls-Royce IT Security Director) if you need assistance. Please do not copy it for any purpose, or disclose its contents to any other person. An e-mail response to this address may be subject to interception or monitoring for operational reasons or for lawful business practices. (c) 2005 Rolls-Royce plc Registered office: 65 Buckingham Gate, London SW1E 6AT Company number: 1003142. Registered in England.

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
participants (2)
-
Oterman-Fernandez, Ana-Maria
-
Tomasz Zielonka