[Haskell-cafe] Tupling functions

Richard O'Keefe ok at cs.otago.ac.nz
Thu Sep 15 05:09:40 CEST 2011


On 14/09/2011, at 2:45 PM, Casey McCann wrote:

> 
>    class Tuple t where
>        type Arg t :: *
>        type Result t :: *
>        tuple :: t -> Arg t -> Result t
> 
>    instance (x1 ~ x2) => Tuple (x1 -> a, x2 -> b) where
>        type Arg (x1 -> a, x2 -> b) = x1
>        type Result (x1 -> a, x2 -> b) = (a, b)
>        tuple (f, g) x = (f x, g x)

That's it, that's what I was after.  Thanks.




More information about the Haskell-Cafe mailing list