Hoogle Search
Within LTS Haskell 24.46 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
gmapRep :: GMap1 arr f g => arr -> f () -> g ()generic-functor Generic.Functor.Internal No documentation available.
gmultimap :: forall arr x y . (Generic x, Generic y, GMultimap arr x y) => arr -> x -> ygeneric-functor Generic.Functor.Internal Generic n-ary functor. A generalization of gsolomap to map over multiple parameters simultaneously. gmultimap takes a list of functions separated by (:+) and terminated by (). gmultimap is unsafe: misuse will break your programs. The type of every function in the list must be some (a -> b) where a and b are distinct type variables. See the Usage section of gsolomap for details.
Example
{-# LANGUAGE DeriveGeneric #-} import GHC.Generics (Generic) import Generic.Functor (gmultimap) data Three a b c = One a | Two b | Three c deriving Generic mapThree :: (a -> a') -> (b -> b') -> (c -> c') -> Three a b c -> Three a' b' c' mapThree f g h = gmultimap (f :+ g :+ h :+ ())gmultimapK :: GMultimapK m arr f g => arr -> f () -> m (g ())generic-functor Generic.Functor.Internal No documentation available.
gsolomap :: forall a b x y . (Generic x, Generic y, GSolomap a b x y) => (a -> b) -> x -> ygeneric-functor Generic.Functor.Internal Generalized generic functor. gsolomap is a generalization of gfmap (generic fmap), where the type parameter to be "mapped" does not have to be the last one. gsolomap is unsafe: misuse will break your programs. Read the Usage section below for details.
Example
{-# LANGUAGE DeriveGeneric #-} import GHC.Generics (Generic) import Generic.Functor (gsolomap) data Result a r = Error a | Ok r -- Another name for Either deriving Generic mapError :: (a -> b) -> Result a r -> Result b r mapError = gsolomap mapOk :: (r -> s) -> Result a r -> Result a s mapOk = gsolomap mapBoth :: (a -> b) -> Result a a -> Result b b mapBoth = gsolomapUsage
(This also applies to solomap, gmultimap, and multimap.) gsolomap should only be used to define polymorphic "fmap-like functions". It works only in contexts where a and b are two distinct, non-unifiable type variables. This is usually the case when they are bound by universal quantification (forall a b. ...), with no equality constraints on a and b. The one guarantee of gsolomap is that gsolomap id = id. Under the above conditions, that law and the types should uniquely determine the implementation, which gsolomap seeks automatically. The unsafety is due to the use of incoherent instances as part of the definition of GSolomap. Functions are safe to specialize after GSolomap (and Solomap) constraints have been discharged. Note also that the type parameters of gsolomap must all be determined by the context. For instance, composing two gsolomap, as in gsolomap f . gsolomap g, is a type error because the type in the middle cannot be inferred.multimap :: Multimap arr x y => arr -> x -> ygeneric-functor Generic.Functor.Internal Implicit n-ary functor. A generalization of solomap to map over multiple parameters simultaneously. multimap takes a list of functions separated by (:+) and terminated by (). multimap is unsafe: misuse will break your programs. The type of every function in the list must be some (a -> b) where a and b are distinct type variables. See the Usage section of gsolomap for details.
Example
type F a b c = Either a (b, c) map3 :: (a -> a') -> (b -> b') -> (c -> c') -> F a b c -> F a' b' c' map3 f g h = multimap (f :+ g :+ h :+ ()) -- equivalent to: \f g h -> bimap f (bimap g h)
solomap :: Solomap a b x y => (a -> b) -> x -> ygeneric-functor Generic.Functor.Internal Generalized implicit functor. Use this when x and y are applications of existing functors (Functor, Bifunctor). This is a different use case from gfmap and gsolomap, which make functors out of freshly declared data types. solomap is unsafe: misuse will break your programs. See the Usage section of gsolomap for details.
Example
map1 :: (a -> b) -> Either e (Maybe [IO a]) -> Either e (Maybe [IO b]) map1 = solomap -- equivalent to: fmap . fmap . fmap . fmap map2 :: (a -> b) -> (e -> Either [a] r) -> (e -> Either [b] r) map2 = solomap -- equivalent to: \f -> fmap (bimap (fmap f) id)
class MultimapOf (->) arr x y =>
MultimapI arr x ygeneric-functor Generic.Functor.Internal.Implicit Core of multimap.
class Multimap_ cat S2 arr x y =>
MultimapOf (cat :: Type -> Type -> Type) arr x ygeneric-functor Generic.Functor.Internal.Implicit No documentation available.
class
Multimap_ (cat :: Type -> Type -> Type) arr x ygeneric-functor Generic.Functor.Internal.Implicit Internal implementation of MultimapOf.
catbimap :: BifunctorOf cat t => cat a b -> cat c d -> cat (t a c) (t b d)generic-functor Generic.Functor.Internal.Implicit No documentation available.