Functor -package:ghc-internal
A type
f is a Functor if it provides a function
fmap
which, given any types
a and
b lets you apply any
function from
(a -> b) to turn an
f a into an
f b, preserving the structure of
f. Furthermore
f needs to adhere to the following:
Note, that the second law follows from the free theorem of the type
fmap and the first law, so you need only check that the former
condition holds. See these articles by
School of Haskell or
David Luposchainsky for an explanation.
A type
f is a Functor if it provides a function
fmap
which, given any types
a and
b, lets you apply any
function of type
(a -> b) to turn an
f a into an
f b, preserving the structure of
f.
The deriving code for the Functor, Foldable, and Traversable classes
Convenient functions to work with
Functor.
A type
f is a Functor if it provides a function
fmap
which, given any types
a and
b lets you apply any
function from
(a -> b) to turn an
f a into an
f b, preserving the structure of
f. Furthermore
f needs to adhere to the following:
Note, that the second law follows from the free theorem of the type
fmap and the first law, so you need only check that the former
condition holds.
Functor properties
You will need TypeApplications to use these.
The
Functor class is used for types that can be mapped over.
Instances of
Functor should satisfy the following laws:
fmap id == id
fmap (f . g) == fmap f . fmap g
The instances of
Functor for lists,
Maybe and
IO
satisfy these laws.
Functor properties
You will need TypeApplications to use these.
The
Functor class is used for types that can be mapped over.
Instances of
Functor should satisfy the following laws:
fmap id == id
fmap (f . g) == fmap f . fmap g
The instances of
Functor for lists,
Maybe and
IO
satisfy these laws.
Equivalent of
Functor for rank 2 data types, satisfying the
usual functor laws
id <$> g == g
(p . q) <$> g == p <$> (q <$> g)
Provides a
Functor instance for
Dimensional.
Note that this instance is dubious, because it allows you to break the
dimensional abstraction. See
dmap for more information.
Note that, while this instance overlaps with that given for
Dimensionless, it is confluent with that instance.
Note that this is an orphan instance.
This should probably be a separate library, but it provides a number
of functor type classes between various categories.