[Haskell-cafe] Are all arrows functors?
Neil Brown
nccb2 at kent.ac.uk
Tue Nov 3 07:45:42 EST 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?
And is there a wiki page somewhere that has a table of all of these
Haskell type-classes (Functor, Monad, Category, Arrow, Applicative and
so on), and says that if you are an instance of class A you must have
some corresponding instance of B? (e.g. all Monads are Functors and
Applicatives) I'm fairly certain my arrow isn't a Monad or Applicative,
although of course it must be a Category, given the type-class
dependency, but it would be nice when using one of these things to see
what other instances you should automatically supply.
Thanks,
Neil.
More information about the Haskell-Cafe
mailing list