-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Representable functors -- -- Representable functors @package representable-functors @version 0.4.3 -- | Representable endofunctors over the category of Haskell types are -- isomorphic to the reader monad and so inherit a very large number of -- properties for free. module Data.Functor.Representable -- | A Functor f is Representable if tabulate -- and index witness an isomorphism to (->) x. -- --
--   tabulate . index = id
--   index . tabulate = id
--   tabulate . return f = return f
--   
class (Indexable f, Distributive f, Keyed f, Apply f, Applicative f) => Representable f tabulate :: Representable f => (Key f -> a) -> f a -- | We extend lens across a representable functor, due to the preservation -- of limits. repLens :: Representable f => Lens a b -> Lens (f a) (f b) fmapRep :: Representable f => (a -> b) -> f a -> f b distributeRep :: (Representable f, Functor w) => w (f a) -> f (w a) mapWithKeyRep :: Representable f => (Key f -> a -> b) -> f a -> f b apRep :: Representable f => f (a -> b) -> f a -> f b pureRep :: Representable f => a -> f a bindRep :: Representable f => f a -> (a -> f b) -> f b bindWithKeyRep :: Representable f => f a -> (Key f -> a -> f b) -> f b askRep :: Representable f => f (Key f) localRep :: Representable f => (Key f -> Key f) -> f a -> f a duplicateRep :: (Representable f, Semigroup (Key f)) => f a -> f (f a) extendRep :: (Representable f, Semigroup (Key f)) => (f a -> b) -> f a -> f b extractRep :: (Indexable f, Monoid (Key f)) => f a -> a instance (Representable f, Representable g) => Representable (Product f g) instance Representable w => Representable (TracedT s w) instance (Representable f, Representable g) => Representable (Compose f g) instance Representable m => Representable (ReaderT e m) instance Representable ((->) e) instance Representable m => Representable (IdentityT m) instance Representable Identity -- | Representable functors on Hask all monads, being isomorphic to a -- reader monad. module Control.Monad.Representable type Rep f = RepT f Identity rep :: Functor f => f b -> Rep f b runRep :: Functor f => Rep f b -> f b newtype RepT f m b RepT :: f (m b) -> RepT f m b runRepT :: RepT f m b -> f (m b) instance (Representable f, MonadWriter w m) => MonadWriter w (RepT f m) instance (Representable f, MonadIO m) => MonadIO (RepT f m) instance (Representable f, Representable m, Semigroup (Key f), Semigroup (Key m), Monoid (Key f), Monoid (Key m)) => Comonad (RepT f m) instance (Representable f, Representable m, Semigroup (Key f), Semigroup (Key m)) => Extend (RepT f m) instance (TraversableWithKey1 f, TraversableWithKey1 m) => TraversableWithKey1 (RepT f m) instance (TraversableWithKey f, TraversableWithKey m) => TraversableWithKey (RepT f m) instance (Traversable1 f, Traversable1 m) => Traversable1 (RepT f m) instance (Traversable f, Traversable m) => Traversable (RepT f m) instance (FoldableWithKey1 f, FoldableWithKey1 m) => FoldableWithKey1 (RepT f m) instance (FoldableWithKey f, FoldableWithKey m) => FoldableWithKey (RepT f m) instance (Foldable1 f, Foldable1 m) => Foldable1 (RepT f m) instance (Foldable f, Foldable m) => Foldable (RepT f m) instance (Representable f, Representable m) => Representable (RepT f m) instance (Lookup f, Lookup m) => Lookup (RepT f m) instance (Indexable f, Indexable m) => Indexable (RepT f m) instance (Keyed f, Keyed m) => Keyed (RepT f m) instance (Representable f, Distributive m) => Distributive (RepT f m) instance Representable f => MonadTrans (RepT f) instance (Representable f, Monad m) => Monad (RepT f m) instance (Representable f, Bind m) => Bind (RepT f m) instance (Representable f, Applicative m) => Applicative (RepT f m) instance (Representable f, Apply m) => Apply (RepT f m) instance (Functor f, Functor m) => Functor (RepT f m) -- | Representable contravariant endofunctors over the category of Haskell -- types are isomorphic to (_ -> r) and resemble mappings to -- a fixed range. module Data.Functor.Corepresentable -- | Dual to Keyed. class Contravariant f => Valued f contramapWithValue :: Valued f => (b -> Either a (Value f)) -> f a -> f b -- | Dual to Indexed. class Coindexed f coindex :: Coindexed f => f a -> a -> Value f -- | A Functor f is Corepresentable if corep -- and coindex witness an isomorphism to (_ -> Value -- f). -- --
--   tabulate . index = id
--   index . tabulate = id
--   tabulate . return f = return f
--   
class (Coindexed f, Valued f) => Corepresentable f corep :: Corepresentable f => (a -> Value f) -> f a contramapDefault :: Corepresentable f => (a -> b) -> f b -> f a contramapWithValueDefault :: Corepresentable f => (b -> Either a (Value f)) -> f a -> f b instance (Coindexed f, Coindexed g) => Coindexed (Coproduct f g) instance (Corepresentable f, Corepresentable g) => Corepresentable (Product f g) instance (Coindexed f, Coindexed g) => Coindexed (Product f g) instance (Valued f, Valued g) => Valued (Product f g) instance Corepresentable Predicate instance Coindexed Predicate instance Valued Predicate instance Corepresentable (Op r) instance Coindexed (Op r) instance Valued (Op r)