effect-monad-0.6.1: Embeds effect systems into Haskell using parameteric effect 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 = n 

data S n Source

Instances

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

data Counter n a Source

The counter has no semantic meaning

Instances

Effect * Counter 
type Unit * Counter = Z 
type Plus * Counter n m = (:+) n m 
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 = n 
type n :+ (S m) = S ((:+) n m)