effect-monad-0.8.1.0: Embeds effect systems and program logics into Haskell using graded monads and parameterised monads

Safe HaskellNone
LanguageHaskell98

Control.Effect.Counter

Synopsis

Documentation

data Z Source #

Provides a way to count in the type-level with a monadic interface to sum up the individual counts of subcomputations

Define type constructors for natural numbers

Instances

type n :+ Z Source # 
type n :+ Z = n

data S n Source #

Instances

type n :+ (S m) Source # 
type n :+ (S m) = S ((:+) n m)

data Counter n a Source #

The counter has no semantic meaning

Instances

Effect * Counter Source # 

Associated Types

type Unit Counter (m :: Counter -> * -> *) :: k Source #

type Plus Counter (m :: Counter -> * -> *) (f :: Counter) (g :: Counter) :: k Source #

type Inv Counter (m :: Counter -> * -> *) (f :: Counter) (g :: Counter) :: Constraint Source #

Methods

return :: a -> m (Unit Counter m) a Source #

(>>=) :: Inv Counter m f g => m f a -> (a -> m g b) -> m (Plus Counter m f g) b Source #

(>>) :: Inv Counter m f g => m f a -> m g b -> m (Plus Counter m f g) b Source #

type Unit * Counter Source # 
type Unit * Counter = Z
type Plus * Counter n m Source # 
type Plus * Counter n m = (:+) n m
type Inv * Counter n m Source # 
type Inv * Counter n m = ()

tick :: a -> Counter (S Z) a Source #

A tick provides a way to increment the counter

type family n :+ m Source #

Type-level addition

Instances

type n :+ Z Source # 
type n :+ Z = n
type n :+ (S m) Source # 
type n :+ (S m) = S ((:+) n m)