eo-phi-normalizer-3.2.0: Command line normalizer of 𝜑-calculus expressions.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.EO.Phi.Rules.Common

Synopsis

Documentation

>>> :set -XOverloadedStrings
>>> :set -XOverloadedLists
>>> import Language.EO.Phi.Syntax

type EvaluationState = () Source #

State of evaluation is not needed yet, but it might be in the future

data Context Source #

Constructors

Context 

Fields

type Rule = Context -> Object -> [Object] Source #

A rule tries to apply a transformation to the root object, if possible.

propagateName1 :: (a -> b) -> (name, a) -> (name, b) Source #

Given a unary function that operates only on plain objects, converts it to a function that operates on named objects

propagateName2 :: (a -> b -> c) -> (name, a) -> b -> (name, c) Source #

Given a binary function that operates only on plain objects, converts it to a function that operates on named objects

applyRules :: Context -> Object -> [Object] Source #

Apply rules until we get a normal form.

applyRulesWith :: ApplicationLimits -> Context -> Object -> [Object] Source #

A variant of applyRules with a maximum application depth.

Chain variants

data LogEntry log Source #

Constructors

LogEntry 

Instances

Instances details
Functor LogEntry Source # 
Instance details

Defined in Language.EO.Phi.Rules.Common

Methods

fmap :: (a -> b) -> LogEntry a -> LogEntry b #

(<$) :: a -> LogEntry b -> LogEntry a #

Show log => Show (LogEntry log) Source # 
Instance details

Defined in Language.EO.Phi.Rules.Common

Methods

showsPrec :: Int -> LogEntry log -> ShowS #

show :: LogEntry log -> String #

showList :: [LogEntry log] -> ShowS #

newtype Chain log result Source #

Constructors

Chain 

Fields

Instances

Instances details
MonadFail (Chain a) Source # 
Instance details

Defined in Language.EO.Phi.Rules.Common

Methods

fail :: String -> Chain a a0 #

Applicative (Chain a) Source # 
Instance details

Defined in Language.EO.Phi.Rules.Common

Methods

pure :: a0 -> Chain a a0 #

(<*>) :: Chain a (a0 -> b) -> Chain a a0 -> Chain a b #

liftA2 :: (a0 -> b -> c) -> Chain a a0 -> Chain a b -> Chain a c #

(*>) :: Chain a a0 -> Chain a b -> Chain a b #

(<*) :: Chain a a0 -> Chain a b -> Chain a a0 #

Functor (Chain log) Source # 
Instance details

Defined in Language.EO.Phi.Rules.Common

Methods

fmap :: (a -> b) -> Chain log a -> Chain log b #

(<$) :: a -> Chain log b -> Chain log a #

Monad (Chain a) Source # 
Instance details

Defined in Language.EO.Phi.Rules.Common

Methods

(>>=) :: Chain a a0 -> (a0 -> Chain a b) -> Chain a b #

(>>) :: Chain a a0 -> Chain a b -> Chain a b #

return :: a0 -> Chain a a0 #

logStep :: String -> info -> Chain info () Source #

incLogLevel :: Chain info a -> Chain info a Source #

choose :: [a] -> Chain log a Source #

msplit :: Chain log a -> Chain log (Maybe (a, Chain log a)) Source #

transformLogs :: (log1 -> log2) -> Chain log1 a -> Chain log2 a Source #

listen :: Chain log a -> Chain log (a, [LogEntry log]) Source #

withContext :: Context -> Chain log a -> Chain log a Source #

modifyContext :: (Context -> Context) -> Chain log a -> Chain log a Source #

applyRulesChain :: Object -> NormalizeChain Object Source #

Apply the rules until the object is normalized, preserving the history (chain) of applications.

applyRulesChainWith :: ApplicationLimits -> Object -> NormalizeChain Object Source #

A variant of applyRulesChain with a maximum application depth.

Helpers

lookupBinding :: Attribute -> [Binding] -> Maybe Object Source #

Lookup a binding by the attribute name.