[Haskell] ListMap example

Ross Paterson ross at soi.city.ac.uk
Tue Aug 31 05:18:35 EDT 2004


On Thu, Aug 12, 2004 at 02:16:05PM +0900, jeff polakow wrote:
>   Why is the following not an arrow?
> 
> newtype ListMap i o = LM ([i] -> [o]
> instance Arrow ListMap where
>   pure f = LM (map f)
>   LM f >>> LM g = LM (g . f)
>   first (LM f) = LM ((uncurry zip) . (cross f id) . unzip)

Consider the functor and unit laws for first when f produces an output
list of a different length to its input.


More information about the Haskell mailing list