ajhc- Haskell compiler that produce binary through C language

Safe HaskellNone



data ARules Source


Show ARules

ARules contains a set of rules for a single id, optimized for fast application

invarients for ARules sorted by number of arguments rule takes all hidden rule fields filled in free variables are up to date

Monoid ARules 
Binary ARules 
FreeVars ARules IdSet 

data Rule Source


Rule TVr [TVr] [E] !Int E RuleType (Module, Int) Atom 


Eq Rule 
Show Rule 
Binary Rule 
FreeVars Rule IdSet

we delete the free variables of the heads of a rule from the rule's free variables. the reason for doing this is that the rule cannot fire if all its heads are in scope, and if it were not done then many functions seem recursive when they arn't actually.

FreeVars Rule [Id] 

newtype Rules Source


Rules (IdMap [Rule]) 

applyRules :: MonadStats m => (Id -> Maybe E) -> ARules -> [E] -> m (Maybe (E, [E]))Source

builtinRule :: MonadStats m => TVr' t -> [E] -> m (Maybe (E, [E]))Source

dropArguments :: [(Int, E)] -> [Rule] -> [Rule]Source

mapRBodyArgs :: Monad m => (E -> m E) -> Rule -> m RuleSource



:: String

the rule name

-> (Module, Int)

a unique name for this rule

-> RuleType

type of rule

-> [TVr]

the free variables

-> TVr

the head

-> [E]

the args

-> E

the body

-> Rule 

mapBodies :: Monad m => (E -> m E) -> Rules -> m RulesSource