2010/7/14 Felipe Lessa <[email protected]>:
> On Wed, Jul 14, 2010 at 8:25 AM, Arnaud Bailly <[email protected]> wrote:
>> Hello,
>> I would like to construct a collection of function-like objects on
>> which I could apply some value, in a typesafe and clean way.
>
> You could use Data.Typeable.cast [1]
>
> [1] 
> http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0.0/Data-Typeable.html#v%3Acast
> [snip]

Or maybe Data.Dynamic

with type Callables = Map String Dynamic
You can extract the function with fromDynamic in a type-safe way (it
returns a Maybe).
Probalby you might want 'invoke' to return a Maybe too (just like Felipe did).

Cheers,
Thu
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to