[Haskell-cafe] Client-extensible heterogeneous types (Duck-typed variadic functions?)

Ketil Malde ketil at malde.org
Thu Oct 14 03:58:40 EDT 2010


Jacek Generowicz <jacek.generowicz at cern.ch> writes:

> Let's say I need an Int -> String. Both
>
>     (fnA2 :: Banana -> String) . (fnA1:: Int -> Banana)
>
> and
>
>     (fnB2 :: Onion -> String) . (fnB1 :: Int -> Onion)
>
> will do. So please allow me to store (fnA1, fnA2) and (fnB1, fnB2) in
> the same place. 

I think you can do this fairly easy with existentials, but..

> The program can tell that it can combine them with (.)

..what else do you want to be able to do with them?  (Because, if this is
all, you'd just store the combination, no?).

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list