multirec-0.7.9: Generic programming for families of recursive datatypes

Copyright(c) 2008--2010 Universiteit Utrecht
LicenseBSD3
Maintainergenerics@haskell.org
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

Generics.MultiRec.HFunctor

Contents

Description

The definition of functorial map.

Synopsis
  • class HFunctor phi f where
    • hmapA :: Applicative a => (forall ix. phi ix -> r ix -> a (r' ix)) -> phi ix -> f r ix -> a (f r' ix)
  • hmap :: HFunctor phi f => (forall ix. phi ix -> r ix -> r' ix) -> phi ix -> f r ix -> f r' ix
  • hmapM :: (HFunctor phi f, Monad m) => (forall ix. phi ix -> r ix -> m (r' ix)) -> phi ix -> f r ix -> m (f r' ix)

Generic map

class HFunctor phi f where Source #

Methods

hmapA :: Applicative a => (forall ix. phi ix -> r ix -> a (r' ix)) -> phi ix -> f r ix -> a (f r' ix) Source #

Instances
HFunctor phi U Source # 
Instance details

Defined in Generics.MultiRec.HFunctor

Methods

hmapA :: Applicative a => (forall ix. phi ix -> r ix -> a (r' ix)) -> phi ix -> U r ix -> a (U r' ix) Source #

HFunctor phi (K x) Source # 
Instance details

Defined in Generics.MultiRec.HFunctor

Methods

hmapA :: Applicative a => (forall ix. phi ix -> r ix -> a (r' ix)) -> phi ix -> K x r ix -> a (K x r' ix) Source #

El phi xi => HFunctor phi (I xi) Source # 
Instance details

Defined in Generics.MultiRec.HFunctor

Methods

hmapA :: Applicative a => (forall ix. phi ix -> r ix -> a (r' ix)) -> phi ix -> I xi r ix -> a (I xi r' ix) Source #

(Constructor c, HFunctor phi f) => HFunctor phi (C c f) Source # 
Instance details

Defined in Generics.MultiRec.HFunctor

Methods

hmapA :: Applicative a => (forall ix. phi ix -> r ix -> a (r' ix)) -> phi ix -> C c f r ix -> a (C c f r' ix) Source #

(Traversable f, HFunctor phi g) => HFunctor phi (f :.: g) Source # 
Instance details

Defined in Generics.MultiRec.HFunctor

Methods

hmapA :: Applicative a => (forall ix. phi ix -> r ix -> a (r' ix)) -> phi ix -> (f :.: g) r ix -> a ((f :.: g) r' ix) Source #

HFunctor phi f => HFunctor phi (f :>: ix) Source # 
Instance details

Defined in Generics.MultiRec.HFunctor

Methods

hmapA :: Applicative a => (forall ix0. phi ix0 -> r ix0 -> a (r' ix0)) -> phi ix1 -> (f :>: ix) r ix1 -> a ((f :>: ix) r' ix1) Source #

(HFunctor phi f, HFunctor phi g) => HFunctor phi (f :*: g) Source # 
Instance details

Defined in Generics.MultiRec.HFunctor

Methods

hmapA :: Applicative a => (forall ix. phi ix -> r ix -> a (r' ix)) -> phi ix -> (f :*: g) r ix -> a ((f :*: g) r' ix) Source #

(HFunctor phi f, HFunctor phi g) => HFunctor phi (f :+: g) Source # 
Instance details

Defined in Generics.MultiRec.HFunctor

Methods

hmapA :: Applicative a => (forall ix. phi ix -> r ix -> a (r' ix)) -> phi ix -> (f :+: g) r ix -> a ((f :+: g) r' ix) Source #

hmap :: HFunctor phi f => (forall ix. phi ix -> r ix -> r' ix) -> phi ix -> f r ix -> f r' ix Source #

The function hmap takes a functor f. All the recursive instances in that functor are wrapped by an application of r. The argument to hmap takes a function that transformes r occurrences into r' occurrences, for every ix. In order to associate the index ix with the correct family phi, the argument to hmap is additionally parameterized by a witness of type phi ix.

hmapM :: (HFunctor phi f, Monad m) => (forall ix. phi ix -> r ix -> m (r' ix)) -> phi ix -> f r ix -> m (f r' ix) Source #

Monadic version of hmap.