Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Synopsis
- type Variable w = Variable (WriterT w)
- globalVariable :: (Monoid w, C s) => (a -> Writer w a) -> s (Variable w s a)
- type T w = T (WriterT w)
- localVariable :: (C w, Value w a, C s) => T w s (Variable w s a)
- constant :: (C w, Value w a, C s) => a -> T w s (Variable w s a)
- assignment2 :: (C w, C s) => (a -> b) -> Variable w s a -> Variable w s b -> T w s ()
- assignment3 :: (C w, C s) => (a -> b -> c) -> Variable w s a -> Variable w s b -> Variable w s c -> T w s ()
- data Apply w s a
- arg :: Variable w s a -> Apply w s a
- runApply :: (C w, C s) => Apply w s a -> Variable w s a -> T w s ()
- solve :: (C w, C s) => T w s a -> w s a
- query :: Variable w s a -> s (Maybe a)
Preparation
Posing statements
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
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 (,)
.