state-bag-0.1.0.0: Monad transformers for holding bags of state.

Safe HaskellNone
LanguageHaskell2010

Control.Monad.Trans.StateBag.Class

Description

Abstraction over the primitive and pure versions of StateBagT.

Synopsis

Documentation

class Monad m => StateBagMonad m where Source #

Type-class which abstract over the primitive and pure versions of StateBagT.

Minimal complete definition

getItem, putItem

Associated Types

type Bag m :: [*] Source #

type BagBase m :: * -> * Source #

Methods

getItem :: ElementIndex item (Bag m) => m item Source #

Gets the current value of item from the bag.

putItem :: ElementIndex item (Bag m) => item -> m () Source #

Stores a new value of item in the bag.

modifyItemM :: ElementIndex item (Bag m) => (item -> m item) -> m () Source #

Applies a monadic function to an item in the bag and stores the result.

Instances

Monad m => StateBagMonad (StateBagT bag m) Source # 

Associated Types

type Bag (StateBagT bag m :: * -> *) :: [*] Source #

type BagBase (StateBagT bag m :: * -> *) :: * -> * Source #

Methods

getItem :: ElementIndex item (Bag (StateBagT bag m)) => StateBagT bag m item Source #

putItem :: ElementIndex item (Bag (StateBagT bag m)) => item -> StateBagT bag m () Source #

modifyItemM :: ElementIndex item (Bag (StateBagT bag m)) => (item -> StateBagT bag m item) -> StateBagT bag m () Source #

PrimMonad m => StateBagMonad (StateBagT bag m) Source # 

Associated Types

type Bag (StateBagT bag m :: * -> *) :: [*] Source #

type BagBase (StateBagT bag m :: * -> *) :: * -> * Source #

Methods

getItem :: ElementIndex item (Bag (StateBagT bag m)) => StateBagT bag m item Source #

putItem :: ElementIndex item (Bag (StateBagT bag m)) => item -> StateBagT bag m () Source #

modifyItemM :: ElementIndex item (Bag (StateBagT bag m)) => (item -> StateBagT bag m item) -> StateBagT bag m () Source #

class ElementCount a Source #

Type-class for counting the number of elements in a type-level list.

Minimal complete definition

elemCount

Instances

ElementCount ([] *) Source # 

Methods

elemCount :: Proxy [*] [*] -> Int

ElementCount xs => ElementCount ((:) * x xs) Source # 

Methods

elemCount :: Proxy [*] ((* ': x) xs) -> Int

class ElementIndex x xs Source #

Type-class for finding the index of an element in a type-level list.

Minimal complete definition

elemIndex

Instances

ElementIndex x xs => ElementIndex x ((:) * y xs) Source # 

Methods

elemIndex :: Proxy * x -> Proxy [*] ((* ': y) xs) -> Int

ElementIndex x ((:) * x xs) Source # 

Methods

elemIndex :: Proxy * x -> Proxy [*] ((* ': x) xs) -> Int