Functor module:Data is:module

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.

Examples

>>> fmap show (Just 1)  --  (a   -> b)      -> f a       -> f b
Just "1"                --  (Int -> String) -> Maybe Int -> Maybe String
>>> fmap show Nothing   --  (a   -> b)      -> f a       -> f b
Nothing                 --  (Int -> String) -> Maybe Int -> Maybe String
>>> fmap show [1,2,3]   --  (a   -> b)      -> f a       -> f b
["1","2","3"]           --  (Int -> String) -> [Int]     -> [String]
>>> fmap show []        --  (a   -> b)      -> f a       -> f b
[]                      --  (Int -> String) -> [Int]     -> [String]
The fmap function is also available as the infix operator <$>:
>>> fmap show (Just 1) --  (Int -> String) -> Maybe Int -> Maybe String
Just "1"

>>> show <$> (Just 1)  --  (Int -> String) -> Maybe Int -> Maybe String
Just "1"
Bidirectional version of Data.Functor.
Poly-kinded Functor type class. KFunctor generalizes functors, bifunctors, profunctors, ... by declaring a list of Variances for a type constructor.
Eliminator functions for data types in the Data.Functor.* module namespace. All of these are re-exported from Data.Eliminator with the exceptions of Sum and Product, as these clash with eliminators of the same names in Data.Eliminator.Semigroup and Data.Eliminator.Monoid.
Consider the category of Haskell quivers with
  • objects are types of higher kind
  • p :: k -> k -> Type
  • morphisms are terms of RankNType,
  • forall x y. p x y -> q x y
  • identity is id
  • composition is .
There is a natural hierarchy of typeclasses for endofunctors of the category of Haskell quivers, analagous to that for Haskell types.
For a good explanation of profunctors in Haskell see Dan Piponi's article: http://blog.sigfpe.com/2011/07/profunctors-in-haskell.html For more information on strength and costrength, see: http://comonad.com/reader/2008/deriving-strength-from-laziness/
Basic functors. Definitions of the type-level equivalents of const, id, and (.), and a definition of the lifted function space. These datatypes are generally useful, but in this library, they're primarily used as parameters for the NP, NS, POP, and SOP types. We define own variants of Const, Identity and Compose for various reasons.
This module defines higher-order functors (Johann, Ghani, POPL '08), i.e. endofunctors on the category of endofunctors.
This module provides an abstraction for "two-argument functor combinators", HBifunctor, as well as some useful combinators.
This module provides abstractions for working with unary functor combinators. Principally, it defines the HFunctor itself, as well as some classes that expose extra functionality that some HFunctors have (Inject and HBind). See Data.HFunctor.Interpret for tools to use HFunctors as functor combinators that can represent interpretable schemas, and Data.HBifunctor for an abstraction over binary functor combinators.
TextShow instances for data types in the bifunctors library. Since: 2
The category of quivers forms a closed monoidal category in two ways, under ProductQ or ComposeQ. The relations between these and their adjoints can be characterized by typeclasses below.