unique-logic-0.3: Solve simple simultaneous equations

Safe HaskellSafe
LanguageHaskell98

UniqueLogic.ST.SystemLog

Contents

Synopsis

Preparation

data Variable w s a Source #

Instances

Var Variable Source # 

Methods

plainVariable :: Variable w s a -> Variable w s a Source #

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

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

localVariable :: Monoid w => T w s (Variable w s a) Source #

Posing statements

data T w s a Source #

Instances

Monad (T w s) Source # 

Methods

(>>=) :: T w s a -> (a -> T w s b) -> T w s b #

(>>) :: T w s a -> T w s b -> T w s b #

return :: a -> T w s a #

fail :: String -> T w s a #

Functor (T w s) Source # 

Methods

fmap :: (a -> b) -> T w s a -> T w s b #

(<$) :: a -> T w s b -> T w s a #

Applicative (T w s) Source # 

Methods

pure :: a -> T w s a #

(<*>) :: T w s (a -> b) -> T w s a -> T w s b #

liftA2 :: (a -> b -> c) -> T w s a -> T w s b -> T w s c #

(*>) :: T w s a -> T w s b -> T w s b #

(<*) :: T w s a -> T w s b -> T w s a #

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) Source # 

Methods

fmap :: (a -> b) -> Apply w s a -> Apply w s b #

(<$) :: a -> Apply w s b -> Apply w s a #

Monoid w => Applicative (Apply w s) Source # 

Methods

pure :: a -> Apply w s a #

(<*>) :: Apply w s (a -> b) -> Apply w s a -> Apply w s b #

liftA2 :: (a -> b -> c) -> Apply w s a -> Apply w s b -> Apply w s c #

(*>) :: Apply w s a -> Apply w s b -> Apply w s b #

(<*) :: Apply w s a -> Apply w s b -> Apply w s a #

arg :: Monoid w => Variable w s a -> Apply w s a Source #

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) a Source #

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