Everything related to untyped core
- type Ident = String
- type Identifier = String
- data Const
- class VarContainer a where
- vars :: a -> [Identifier]
- data Op where
- data CoreExpr where
- BinOp :: Op -> CoreExpr -> CoreExpr -> CoreExpr
- Constant :: Const -> CoreExpr
- Var :: String -> CoreExpr
- App :: CoreExpr -> Param -> CoreExpr
- Let :: String -> CoreExpr -> CoreExpr -> CoreExpr
- Rec :: [RecElem] -> CoreExpr
- Cons :: CoreExpr -> CoreExpr -> CoreExpr
- Nil :: CoreExpr
- Elem :: CoreExpr -> String -> CoreExpr
- Table :: String -> [Column] -> [Key] -> CoreExpr
- If :: CoreExpr -> CoreExpr -> CoreExpr -> CoreExpr
- data RecElem where
- data Param where
- data Column where
- data Key where
- data Type
- class Dotify a where
- dot :: a -> Either FerryError String
- class Pretty a where
- prettyPrint :: Pretty a => a -> String
- newLine :: Int -> String
- mapIntersperseConcat :: (a -> [b]) -> [b] -> [a] -> [b]
- intersperseComma :: Pretty a => [a] -> Int -> String
Documentation
type Identifier = StringSource
Identifiers are represented as strings
Constant values
class VarContainer a whereSource
Type class for extracting all variables that occur in a value of type a
vars :: a -> [Identifier]Source
Datatype for building untyped core ASTs
BinOp :: Op -> CoreExpr -> CoreExpr -> CoreExpr | |
Constant :: Const -> CoreExpr | |
Var :: String -> CoreExpr | |
App :: CoreExpr -> Param -> CoreExpr | |
Let :: String -> CoreExpr -> CoreExpr -> CoreExpr | |
Rec :: [RecElem] -> CoreExpr | |
Cons :: CoreExpr -> CoreExpr -> CoreExpr | |
Nil :: CoreExpr | |
Elem :: CoreExpr -> String -> CoreExpr | |
Table :: String -> [Column] -> [Key] -> CoreExpr | |
If :: CoreExpr -> CoreExpr -> CoreExpr -> CoreExpr |
Function arguments In future, that is when defunctionalisation is implemented function arguments should just be expressions.
Class for transforming values into either an error or a string representing a dot file.
dot :: a -> Either FerryError StringSource
Class for pretty printing a value of a.
prettyPrint :: Pretty a => a -> StringSource
Shorthand for pretty without the identation argument
mapIntersperseConcat :: (a -> [b]) -> [b] -> [a] -> [b]Source
maps its first argument over the third, then intersperses the result with the second argument, and finally concatenates everything.
intersperseComma :: Pretty a => [a] -> Int -> StringSource
Pretty print the values xs then intersperse with a comma and transform it into one string