Subtle difference between standard instances
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Glasgow-haskell-users