[Haskell-cafe] create a type for selecting functions already in the module

Tomasz Zielonka tomasz.zielonka at gmail.com
Fri Feb 4 09:30:04 EST 2005

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,

More information about the Haskell-Cafe mailing list