unique-logic-0.3: Solve simple simultaneous equations

Safe HaskellNone

UniqueLogic.ST.SystemLog

Contents

Synopsis

Preparation

data Variable w s a Source

Instances

Posing statements

data T w s a Source

Instances

Monad (T w s) 
Functor (T w s) 
Applicative (T w s) 

constant :: a -> T w s (Variable w s a)Source

assignment2 :: Monoid w => (a -> Writer w b) -> Variable w s a -> Variable w s b -> T w s ()Source

assignment3 :: Monoid w => (a -> b -> Writer w c) -> Variable w s a -> Variable w s b -> Variable w s c -> T w s ()Source

data Apply w s a Source

Instances

Monoid w => Functor (Apply w s) 
Monoid w => Applicative (Apply w s) 

arg :: Monoid w => Variable w s a -> Apply w s aSource

This function allows to generalize assignment2 and assignment3 to more arguments. You could achieve the same with nested applications of assignment3 (,).

runApply :: Monoid w => Apply w s (Writer w a) -> Variable w s a -> T w s ()Source

Solution

solve :: Monoid w => T w s a -> WriterT w (ST s) aSource

query :: Variable w s a -> ST s (Maybe a)Source