Keith Wansbrough <[EMAIL PROTECTED]> writes:

> Instead, you should pass around data items that
> contain both the function and its name - either just pairs, [...]
> or proper data types

...or both, using records:

   data NamedFunc a b = NamedFunc { nameOf :: String, apply :: (a->b) }

   f = NamedFunc "successor" (\x -> x+1)
   apply f 4
   => 5
   nameOf f
   => "successor"

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to