Copyright | (c) 2014 Patrick Bahr |
---|---|
License | BSD3 |
Maintainer | Patrick Bahr <paba@diku.dk> |
Stability | experimental |
Portability | non-portable (GHC Extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module provides functionality to construct mappings from positions in a functorial value.
Synopsis
- data Numbered a i = Numbered Int (a i)
- unNumbered :: Numbered a :-> a
- number :: HTraversable f => f a :-> f (Numbered a)
- class HFoldable t => HTraversable t
- class Mapping m (k :: Type -> Type) | m -> k where
- (&) :: m v -> m v -> m v
- (|->) :: k i -> v -> m v
- empty :: m v
- prodMap :: v1 -> v2 -> m v1 -> m v2 -> m (v1, v2)
- findWithDefault :: a -> k i -> m a -> a
- lookupNumMap :: a -> Int -> NumMap t a -> a
Documentation
This type is used for numbering components of a functorial value.
unNumbered :: Numbered a :-> a Source #
number :: HTraversable f => f a :-> f (Numbered a) Source #
This function numbers the components of the given functorial value with consecutive integers starting at 0.
class HFoldable t => HTraversable t Source #
Instances
HTraversable f => HTraversable (Cxt h f) Source # | |
Defined in Data.Comp.Multi.Term | |
HTraversable f => HTraversable (f :&: a) Source # | |
Defined in Data.Comp.Multi.Ops hmapM :: forall (m :: Type -> Type) (a0 :: Type -> Type) (b :: Type -> Type). Monad m => NatM m a0 b -> NatM m ((f :&: a) a0) ((f :&: a) b) Source # htraverse :: forall (f0 :: Type -> Type) (a0 :: Type -> Type) (b :: Type -> Type). Applicative f0 => NatM f0 a0 b -> NatM f0 ((f :&: a) a0) ((f :&: a) b) Source # | |
(HTraversable f, HTraversable g) => HTraversable (f :+: g) Source # | |
Defined in Data.Comp.Multi.Ops hmapM :: forall (m :: Type -> Type) (a :: Type -> Type) (b :: Type -> Type). Monad m => NatM m a b -> NatM m ((f :+: g) a) ((f :+: g) b) Source # htraverse :: forall (f0 :: Type -> Type) (a :: Type -> Type) (b :: Type -> Type). Applicative f0 => NatM f0 a b -> NatM f0 ((f :+: g) a) ((f :+: g) b) Source # |
class Mapping m (k :: Type -> Type) | m -> k where Source #
(&) :: m v -> m v -> m v infixr 0 Source #
left-biased union of two mappings.
(|->) :: k i -> v -> m v infix 1 Source #
This operator constructs a singleton mapping.
This is the empty mapping.
prodMap :: v1 -> v2 -> m v1 -> m v2 -> m (v1, v2) Source #
This function constructs the pointwise product of two maps each with a default value.
findWithDefault :: a -> k i -> m a -> a Source #
Returns the value at the given key or returns the given default when the key is not an element of the map.
lookupNumMap :: a -> Int -> NumMap t a -> a Source #