BNFC3-3.0: A compiler front-end generator.
Safe HaskellNone
LanguageHaskell2010

BNFC.Utils.Decoration

Description

 
Synopsis

Documentation

class Functor t => Decoration t where Source #

A decoration is a functor that is traversable into any functor.

The Functor superclass is given because of the limitations of the Haskell class system. traverseF actually implies functoriality.

Minimal complete definition: traverseF or distributeF.

Minimal complete definition

(traverseF | distributeF), (traverseF2 | distributeF2)

Methods

traverseF :: Functor m => (a -> m b) -> t a -> m (t b) Source #

traverseF is the defining property.

distributeF :: Functor m => t (m a) -> m (t a) Source #

Decorations commute into any functor.

traverseF2 :: Bifunctor m => (a -> m b c) -> t a -> m (t b) (t c) Source #

distributeF2 :: Bifunctor m => t (m a b) -> m (t a) (t b) Source #

Decorations commute into any bifunctor.

Instances

Instances details
Decoration Identity Source #

The identity functor is a decoration.

Instance details

Defined in BNFC.Utils.Decoration

Methods

traverseF :: Functor m => (a -> m b) -> Identity a -> m (Identity b) Source #

distributeF :: Functor m => Identity (m a) -> m (Identity a) Source #

traverseF2 :: Bifunctor m => (a -> m b c) -> Identity a -> m (Identity b) (Identity c) Source #

distributeF2 :: Bifunctor m => Identity (m a b) -> m (Identity a) (Identity b) Source #

Decoration WithPosition' Source # 
Instance details

Defined in BNFC.Types.Position

Decoration WithPosition Source # 
Instance details

Defined in BNFC.Types.Position

Methods

traverseF :: Functor m => (a -> m b) -> WithPosition a -> m (WithPosition b) Source #

distributeF :: Functor m => WithPosition (m a) -> m (WithPosition a) Source #

traverseF2 :: Bifunctor m => (a -> m b c) -> WithPosition a -> m (WithPosition b) (WithPosition c) Source #

distributeF2 :: Bifunctor m => WithPosition (m a b) -> m (WithPosition a) (WithPosition b) Source #

Decoration ((,) a) Source #

A typical decoration is pairing with some stuff.

Instance details

Defined in BNFC.Utils.Decoration

Methods

traverseF :: Functor m => (a0 -> m b) -> (a, a0) -> m (a, b) Source #

distributeF :: Functor m => (a, m a0) -> m (a, a0) Source #

traverseF2 :: Bifunctor m => (a0 -> m b c) -> (a, a0) -> m (a, b) (a, c) Source #

distributeF2 :: Bifunctor m => (a, m a0 b) -> m (a, a0) (a, b) Source #

Decoration (DecorationT d) Source # 
Instance details

Defined in BNFC.Utils.Decoration

Methods

traverseF :: Functor m => (a -> m b) -> DecorationT d a -> m (DecorationT d b) Source #

distributeF :: Functor m => DecorationT d (m a) -> m (DecorationT d a) Source #

traverseF2 :: Bifunctor m => (a -> m b c) -> DecorationT d a -> m (DecorationT d b) (DecorationT d c) Source #

distributeF2 :: Bifunctor m => DecorationT d (m a b) -> m (DecorationT d a) (DecorationT d b) Source #

(Decoration d, Decoration t) => Decoration (Compose d t) Source #

Decorations compose. (Thus, they form a category.)

Instance details

Defined in BNFC.Utils.Decoration

Methods

traverseF :: Functor m => (a -> m b) -> Compose d t a -> m (Compose d t b) Source #

distributeF :: Functor m => Compose d t (m a) -> m (Compose d t a) Source #

traverseF2 :: Bifunctor m => (a -> m b c) -> Compose d t a -> m (Compose d t b) (Compose d t c) Source #

distributeF2 :: Bifunctor m => Compose d t (m a b) -> m (Compose d t a) (Compose d t b) Source #

dmap :: Decoration t => (a -> b) -> t a -> t b Source #

Any decoration is traversable with traverse = traverseF. Just like any Traversable is a functor, so is any decoration, given by just traverseF, a functor.

dget :: Decoration t => t a -> a Source #

Any decoration is a lens. set is a special case of dmap.

The constant functor.

Maybe. Can only be traversed into pointed functors.

Other disjoint sum types, like lists etc.

data DecorationT d a Source #

A proper name for a generic decoration.

Constructors

DecorationT 

Fields

Instances

Instances details
Functor (DecorationT d) Source # 
Instance details

Defined in BNFC.Utils.Decoration

Methods

fmap :: (a -> b) -> DecorationT d a -> DecorationT d b Source #

(<$) :: a -> DecorationT d b -> DecorationT d a Source #

Foldable (DecorationT d) Source # 
Instance details

Defined in BNFC.Utils.Decoration

Methods

fold :: Monoid m => DecorationT d m -> m Source #

foldMap :: Monoid m => (a -> m) -> DecorationT d a -> m Source #

foldMap' :: Monoid m => (a -> m) -> DecorationT d a -> m Source #

foldr :: (a -> b -> b) -> b -> DecorationT d a -> b Source #

foldr' :: (a -> b -> b) -> b -> DecorationT d a -> b Source #

foldl :: (b -> a -> b) -> b -> DecorationT d a -> b Source #

foldl' :: (b -> a -> b) -> b -> DecorationT d a -> b Source #

foldr1 :: (a -> a -> a) -> DecorationT d a -> a Source #

foldl1 :: (a -> a -> a) -> DecorationT d a -> a Source #

toList :: DecorationT d a -> [a] Source #

null :: DecorationT d a -> Bool Source #

length :: DecorationT d a -> Int Source #

elem :: Eq a => a -> DecorationT d a -> Bool Source #

maximum :: Ord a => DecorationT d a -> a Source #

minimum :: Ord a => DecorationT d a -> a Source #

sum :: Num a => DecorationT d a -> a Source #

product :: Num a => DecorationT d a -> a Source #

Traversable (DecorationT d) Source # 
Instance details

Defined in BNFC.Utils.Decoration

Methods

traverse :: Applicative f => (a -> f b) -> DecorationT d a -> f (DecorationT d b) Source #

sequenceA :: Applicative f => DecorationT d (f a) -> f (DecorationT d a) Source #

mapM :: Monad m => (a -> m b) -> DecorationT d a -> m (DecorationT d b) Source #

sequence :: Monad m => DecorationT d (m a) -> m (DecorationT d a) Source #

Decoration (DecorationT d) Source # 
Instance details

Defined in BNFC.Utils.Decoration

Methods

traverseF :: Functor m => (a -> m b) -> DecorationT d a -> m (DecorationT d b) Source #

distributeF :: Functor m => DecorationT d (m a) -> m (DecorationT d a) Source #

traverseF2 :: Bifunctor m => (a -> m b c) -> DecorationT d a -> m (DecorationT d b) (DecorationT d c) Source #

distributeF2 :: Bifunctor m => DecorationT d (m a b) -> m (DecorationT d a) (DecorationT d b) Source #

(Eq d, Eq a) => Eq (DecorationT d a) Source # 
Instance details

Defined in BNFC.Utils.Decoration

Methods

(==) :: DecorationT d a -> DecorationT d a -> Bool Source #

(/=) :: DecorationT d a -> DecorationT d a -> Bool Source #

(Ord d, Ord a) => Ord (DecorationT d a) Source # 
Instance details

Defined in BNFC.Utils.Decoration

(Show d, Show a) => Show (DecorationT d a) Source # 
Instance details

Defined in BNFC.Utils.Decoration