[Haskell-cafe] Computing sums

Andrew Coppin andrewcoppin at btinternet.com
Sat Feb 20 06:11:46 EST 2010


>> Anyway, for yours: try to implement (.) :: Property b c -> Property a
>> b -> Property a c, and first :: Property a b -> Property (a,c) (b,c).
>> Then you will have an arrow.  
>
> (.) = flip (>==>)
>
> first p = p >==< pure id

No, not quite.

  \p -> p >==< pure id :: Property a b -> Property a (b, a)

What you want is

  first p = (pure fst >==> p) >==< (pure snd)

which has the required type.



More information about the Haskell-Cafe mailing list