ddc-core-0.4.2.1: Disciplined Disciple Compiler core language and type checker.

Safe HaskellSafe
LanguageHaskell98

DDC.Core.Exp.Generic.Compounds

Contents

Description

Utilities for constructing and destructing compound expressions.

For the generic version of the AST.

Synopsis

Documentation

Abstractions

makeXAbs :: [GAbs l] -> GExp l -> GExp l Source

Make some nested 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.

makeXLAMs :: [GBind l] -> GExp l -> GExp l Source

Make some nested type lambdas.

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.

makeXLams :: [GBind l] -> GExp l -> GExp l Source

Make some nested value or witness lambdas.

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

makeXApps :: GExp l -> [GArg l] -> GExp l Source

Build sequence of 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

dcUnit :: DaCon n Source

The unit data constructor.

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.