telomare-0.1.0.0: A simple but robust virtual machine
Safe HaskellSafe-Inferred
LanguageHaskell2010

Telomare.Resolver

Synopsis

Documentation

debugTrace :: String -> a -> a Source #

i2t :: LocTag -> Int -> Cofree (ParserTermF l v) LocTag Source #

Int to ParserTerm

ints2t :: LocTag -> [Int] -> Cofree (ParserTermF l v) LocTag Source #

List of Int's to ParserTerm

s2t :: LocTag -> String -> Cofree (ParserTermF l v) LocTag Source #

String to ParserTerm

findInts :: LocTag -> Pattern -> [AnnotatedUPT -> AnnotatedUPT] Source #

Finds all PatternInt leaves returning "directions" to these leaves through pairs in the form of a combination of RightUP and LeftUP from the root e.g. PatternPair (PatternVar "x") (PatternPair (PatternInt 0) (PatternVar "y")) will return [LeftUP . RightUP]

findStrings :: LocTag -> Pattern -> [AnnotatedUPT -> AnnotatedUPT] Source #

Finds all PatternString leaves returning "directions" to these leaves through pairs in the form of a combination of RightUP and LeftUP from the root e.g. PatternPair (PatternVar "x") (PatternPair (PatternString "Hello, world!") (PatternVar "y")) will return [LeftUP . RightUP]

varsUPT :: UnprocessedParsedTerm -> Set String Source #

Collect all free variable names in a AnnotatedUPT expresion

mkCaseAlternative Source #

Arguments

:: AnnotatedUPT

UPT to be cased

-> AnnotatedUPT

Case result to be made lambda and applied

-> Pattern

Pattern

-> AnnotatedUPT

case result as a lambda applied to the appropirate part of the UPT to be cased

case2annidatedIfs Source #

Arguments

:: AnnotatedUPT

Term to be pattern matched

-> [Pattern]

All patterns in a case expression

-> [AnnotatedUPT]

Int leaves as ListUPs on UPT

-> [AnnotatedUPT]

Int leaves as ListUPs on pattern

-> [AnnotatedUPT]

String leaves as ListUPs on UPT

-> [AnnotatedUPT]

String leaves as ListUPs on pattern

-> [AnnotatedUPT]

Case's alternatives

-> AnnotatedUPT 

rewriteOuterTag :: anno -> Cofree a anno -> Cofree a anno Source #

newtype Term3' Source #

Instances

Instances details
Show Term3' Source # 
Instance details

Defined in Telomare.Resolver

Eq Term3' Source # 
Instance details

Defined in Telomare.Resolver

makeLambda Source #

Arguments

:: [(String, AnnotatedUPT)]

Bindings

-> String

Variable name

-> Term1

Lambda body

-> Term1 

`makeLambda ps vl t1` makes a TLam around t1 with vl as arguments. Automatic recognition of Close or Open type of TLam.

validateVariables Source #

Arguments

:: [(String, AnnotatedUPT)]

Prelude

-> AnnotatedUPT 
-> Either String Term1 

Transformation from AnnotatedUPT to Term1 validating and inlining VarUPs

varsTerm1 :: Term1 -> Set String Source #

Collect all free variable names in a Term1 expresion

generateAllHashes :: Term2 -> Term2 Source #

Process an Term2 to have all HashUP replaced by a unique number. The unique number is constructed by doing a SHA1 hash of the Term2 and adding one for all consecutive HashUP's.

process Source #

Arguments

:: [(String, AnnotatedUPT)]

Prelude

-> AnnotatedUPT 
-> Either String Term3 

Process an AnnotatedUPT to a Term3 with failing capability.

runTelomareParser2Term2 Source #

Arguments

:: TelomareParser AnnotatedUPT

Parser to run

-> [(String, AnnotatedUPT)]

Prelude

-> String

Raw string to be parsed

-> Either String Term2

Error on Left

Helper function to compile to Term2

parseMain Source #

Arguments

:: [(String, AnnotatedUPT)]

Prelude: [(VariableName, BindedUPT)]

-> String

Raw string to be parserd.

-> Either String Term3

Error on Left.

Orphan instances

MonadFail (Either String) Source #

Int to Church encoding

Instance details

Methods

fail :: String -> Either String a Source #