Feldspar.DSL.Lambda
Description
A module for lambda expressions
- type Ident = String
- data Lam expr role a where
- Variable :: Ident -> Lam expr role a
- Value :: a -> Lam expr role a
- Lambda :: (Typeable rb, Typeable b) => (Lam expr ra a -> Lam expr rb b) -> Lam expr (ra -> rb) (a -> b)
- :$: :: (Typeable ra, Typeable a) => Lam expr (ra -> rb) (a -> b) -> Lam expr ra a -> Lam expr rb b
- Let :: String -> Lam expr (ra -> (ra -> rb) -> rb) (a -> (a -> b) -> b)
- Inject :: expr role a -> Lam expr role a
- let_ :: (Typeable ra, Typeable a, Typeable rb, Typeable b) => String -> Lam expr ra a -> (Lam expr ra a -> Lam expr rb b) -> Lam expr rb b
- freshVar :: String -> State Integer (Lam expr role a)
- exprEqLam :: ExprEq expr => Lam expr ra a -> Lam expr rb b -> State Integer Bool
- shallowApply :: Lam expr (ra -> rb) (a -> b) -> Lam expr ra a -> Lam expr rb b
- isVar :: Lam expr role a -> Bool
- isLet :: Lam expr role a -> Bool
- viewInfix :: String -> Maybe String
- exprShowApp :: ExprShow expr => [String] -> Lam expr role a -> State Integer String
- exprShowLam :: ExprShow expr => Lam expr role a -> State Integer String
- lamToTreeApp :: ExprShow expr => Forest String -> Lam expr role a -> State Integer (Tree String)
- lamToTree :: ExprShow expr => Lam expr role a -> State Integer (Tree String)
- showLamTree :: ExprShow expr => Lam expr role a -> String
- drawLambda :: ExprShow expr => Lam expr role a -> IO ()
Documentation
data Lam expr role a where
Extensible lambda expressions
Constructors
| Variable :: Ident -> Lam expr role a | |
| Value :: a -> Lam expr role a | |
| Lambda :: (Typeable rb, Typeable b) => (Lam expr ra a -> Lam expr rb b) -> Lam expr (ra -> rb) (a -> b) | |
| :$: :: (Typeable ra, Typeable a) => Lam expr (ra -> rb) (a -> b) -> Lam expr ra a -> Lam expr rb b | |
| Let :: String -> Lam expr (ra -> (ra -> rb) -> rb) (a -> (a -> b) -> b) | |
| Inject :: expr role a -> Lam expr role a |
Instances
| ExprShow expr => ExprShow (Lam expr) | |
| Eval expr => Eval (Lam expr) | |
| ExprEq expr => ExprEq (Lam expr) | |
| ExprEq expr => Eq (Lam expr role a) | |
| (Num a, Typeable a) => Num (Lam Val () a) | |
| ExprShow (Lam expr) => Show (Lam expr role a) | |
| EdgeInfo (Network edge node (In ()) a) | |
| Typeable a => MultiEdge (Network edge node (In ()) a) node edge |
Arguments
| :: (Typeable ra, Typeable a, Typeable rb, Typeable b) | |
| => String | Preferred base name |
| -> Lam expr ra a | |
| -> (Lam expr ra a -> Lam expr rb b) | |
| -> Lam expr rb b |
Let binding
shallowApply :: Lam expr (ra -> rb) (a -> b) -> Lam expr ra a -> Lam expr rb b
Shallow application. Function argument must be a Lambda.
Arguments
| :: ExprShow expr | |
| => [String] | Missing arguments |
| -> Lam expr role a | Partially applied expression |
| -> State Integer String |
Shows a partially applied expression
Arguments
| :: ExprShow expr | |
| => Forest String | Missing arguments |
| -> Lam expr role a | Partially applied expression |
| -> State Integer (Tree String) |
Converts a partially applied expression to a tree
lamToTree :: ExprShow expr => Lam expr role a -> State Integer (Tree String)
Converts a lambda expression to a tree
showLamTree :: ExprShow expr => Lam expr role a -> String
Show a lambda expression as a tree
drawLambda :: ExprShow expr => Lam expr role a -> IO ()
Print a lambda expression as a tree