Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Utilities for constructing and destructing compound expressions.
For the generic version of the AST.
- module DDC.Type.Compounds
- makeXAbs :: [GAbs l] -> GExp l -> GExp l
- takeXAbs :: GExp l -> Maybe ([GAbs l], GExp l)
- makeXLAMs :: [GBind l] -> GExp l -> GExp l
- takeXLAMs :: GExp l -> Maybe ([GBind l], GExp l)
- makeXLams :: [GBind l] -> GExp l -> GExp l
- takeXLams :: GExp l -> Maybe ([GBind l], GExp l)
- makeXApps :: GExp l -> [GArg l] -> GExp l
- takeXApps :: GExp l -> Maybe (GExp l, [GArg l])
- splitXApps :: GExp l -> (GExp l, [GArg l])
- takeXConApps :: GExp l -> Maybe (DaCon l, [GArg l])
- takeXPrimApps :: GExp l -> Maybe (GPrim l, [GArg l])
- dcUnit :: DaCon n
- takeNameOfDaCon :: DaCon n -> Maybe n
- takeTypeOfDaCon :: DaCon n -> Maybe (Type n)
Documentation
module DDC.Type.Compounds
Abstractions
takeXAbs :: GExp l -> Maybe ([GAbs l], GExp l) Source
Split type and value/witness abstractions from the front of an expression,
or Nothing
if there aren't any.
takeXLAMs :: GExp l -> Maybe ([GBind l], GExp l) Source
Split type lambdas from the front of an expression,
or Nothing
if there aren't any.
takeXLams :: GExp l -> Maybe ([GBind l], GExp l) Source
Split nested value or witness lambdas from the front of an expression,
or Nothing
if there aren't any.
Applications
takeXApps :: GExp l -> Maybe (GExp l, [GArg l]) Source
Flatten an application into the functional expression and its arguments, or `Nothing if this is not an application.
splitXApps :: GExp l -> (GExp l, [GArg l]) Source
Flatten an application into a functional expression and its arguments, or just return the expression with no arguments if this is not an application.
takeXConApps :: GExp l -> Maybe (DaCon l, [GArg l]) Source
Flatten an application of a data constructor into the constructor itself
and its arguments, or Nothing
if this is not an application of a
data constructor.
takeXPrimApps :: GExp l -> Maybe (GPrim l, [GArg l]) Source
Flatten an application of a primitive operators into the operator itself
and its arguments, or Nothing
if this is not an application of a
primitive.
Data Constructors
takeNameOfDaCon :: DaCon n -> Maybe n Source
Take the name of data constructor, if there is one.
takeTypeOfDaCon :: DaCon n -> Maybe (Type n) Source
Take the type annotation of a data constructor, if we know it locally.