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.CounterNat

Synopsis

Documentation

data Counter (n :: Nat) a Source #

Provides a way to count in the type-level with a monadic interface to sum up the individual counts of subcomputations. Instead of using our own inductive natural number typ, this uses the Nat kind from TypeLits

The counter has no semantic meaning

Constructors

Counter 

Fields

Instances

Effect Nat 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 Nat Counter Source # 
type Unit Nat Counter = 0
type Plus Nat Counter n m Source # 
type Plus Nat Counter n m = (+) n m
type Inv Nat Counter n m Source # 
type Inv Nat Counter n m = ()

tick :: a -> Counter 1 a Source #

A tick provides a way to increment the counter