Subtle difference between standard instances

David Sankel camior at gmail.com
Tue Oct 28 12:15:17 EDT 2008


We, at Anygma, noticed that a and b below have different behavior:

a, b :: (Int->Int) -> (Int,Int) -> (Int,Int)
a = fmap
b = second

See the blog post at http://netsuperbrain.com/blog/?p=74.

The standard instances for Functor, Monad, and Applicative for tuples is
strict. The Arrow on (->) when applied to tuples with first and second,
however is non-strict.

It is a subtle discrepancy, but it does make a difference for FRP when
deriving these standard instances. Any objections to making the Functor,
Monad, and Applicative instances for tuples non-strict like Arrows?

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20081028/2ba0c00d/attachment.htm


More information about the Glasgow-haskell-users mailing list