emgm-0.2: Extensible and Modular Generics for the MassesSource codeContentsIndex
Generics.EMGM.Functions.Map
Portabilitynon-portable
Stabilityexperimental
Maintainergenerics@haskell.org
Description

Summary: Generic function that applies a (non-generic) function to all elements contained in a polymorphic datatype.

map is a generic version of the Prelude map function. It works on all supported container datatypes of kind * -> *. The map function is equivalent to fmap after deriving Functor if that were possible.

Synopsis
newtype Map a b = Map {
selMap :: a -> b
}
map :: FRep2 Map f => (a -> b) -> f a -> f b
replace :: FRep2 Map f => f a -> b -> f b
bimap :: BiFRep2 Map f => (a -> c) -> (b -> d) -> f a b -> f c d
Documentation
newtype Map a b Source
The type of a generic function that takes a value of one type and returns a value of a different type.
Constructors
Map
selMap :: a -> b
show/hide Instances
map :: FRep2 Map f => (a -> b) -> f a -> f bSource
Apply a function to all elements of a container datatype (kind * -> *).
replace :: FRep2 Map f => f a -> b -> f bSource
Replace all a-values in as with b.
bimap :: BiFRep2 Map f => (a -> c) -> (b -> d) -> f a b -> f c dSource
Given a datatype F a b, bimap f g applies the function f :: a -> c to every a-element and the function g :: b -> d to every b-element. The result is a value with transformed elements: F c d.
Produced by Haddock version 2.4.2