[Haskell-cafe] point-free ADT pattern matching ?

Mike Dillon mike at embody.org
Thu Jul 15 21:50:44 EDT 2010

begin Vo Minh Thu quotation:
> I guess it is short because you make use of second... so you can
> define second' for your B data type, or make B an instance of Arrow.

I don't think that's the case. The code for "f" is making use of the
Arrow instance for (->):

    second          :: Arrow a => a b c -> a (d, b) (d, c)
    (str ++)        :: [Char] -> [Char]
    second (str ++) :: (d, [Char]) -> (d, [Char])

All the caller can control here is what sort of "d" is passed through
unchanged, not the fact that the resulting function expects a pair and
returns a pair.


More information about the Haskell-Cafe mailing list