unique-logic-tf-0.5.1: Solve simple simultaneous equations

Safe HaskellSafe
LanguageHaskell98

UniqueLogic.ST.TF.System.Simple

Contents

Synopsis

Preparation

globalVariable :: C s => s (Variable s a) Source #

Posing statements

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

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

assignment2 :: (C w, C s) => (a -> b) -> Variable w s a -> Variable w s b -> T w s () Source #

assignment2 f a b = runApply (f <$> arg a) b

assignment3 :: (C w, C s) => (a -> b -> c) -> Variable w s a -> Variable w s b -> Variable w s c -> T w s () Source #

assignment3 f a b c = runApply (liftA2 f (arg a) (arg b)) c

data Apply w s a Source #

Instances
C s => Functor (Apply w s) Source # 
Instance details

Defined in UniqueLogic.ST.TF.System

Methods

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

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

C s => Applicative (Apply w s) Source # 
Instance details

Defined in UniqueLogic.ST.TF.System

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 :: 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 :: (C w, C s) => Apply w s a -> Variable w s a -> T w s () Source #

Solution

solve :: C s => T s a -> s a Source #

query :: C s => Variable s a -> s (Maybe a) Source #