[Haskell-cafe] Are all arrows functors?
Andrew Coppin
andrewcoppin at btinternet.com
Thu Nov 5 16:34:57 EST 2009
Nicolas Pouillard wrote:
> Excerpts from Neil Brown's message of Tue Nov 03 13:45:42 +0100 2009:
>
>> Hi,
>>
>> I was thinking about some of my code today, and I realised that where I
>> have an arrow in my code, A b c, the type (A b) is also a functor. The
>> definition is (see
>> http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Arrow.html):
>>
>> fmap = (^<<)
>> -- Or, in long form:
>> fmap f x = arr f <<< x
>>
>> Out of curiosity, and since this is a typical haskell-cafe question,
>> does this definition of fmap hold for all arrows?
>>
>
> Yes, as shown by the 'WrappedArrow' newtype:
>
> http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Applicative.html#t%3AWrappedMonad
>
While I don't wish to suggest that "all arrows are functors" is false, I
think the argument "yes, because this library says so" is not too
strong. Let us not forget, according to *the libraries*, Double is in
Enum - which, I think you'll agree, is just weird...
More information about the Haskell-Cafe
mailing list