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

Safe HaskellSafe
LanguageHaskell98

DDC.Core.Collect.BindStruct

Description

Collecting sets of variables and constructors.

Synopsis

Documentation

data BindTree n Source #

A description of the binding structure of some type or expression.

Constructors

BindDef BindWay [Bind n] [BindTree n]

An abstract binding expression.

BindUse BoundLevel (Bound n)

Use of a variable.

BindCon BoundLevel (Bound n) (Maybe (Kind n))

Use of a constructor.

Instances

Eq n => Eq (BindTree n) Source # 

Methods

(==) :: BindTree n -> BindTree n -> Bool #

(/=) :: BindTree n -> BindTree n -> Bool #

Show n => Show (BindTree n) Source # 

Methods

showsPrec :: Int -> BindTree n -> ShowS #

show :: BindTree n -> String #

showList :: [BindTree n] -> ShowS #

data BindWay Source #

Describes how a variable was bound.

data BoundLevel Source #

What level this binder is at.

Constructors

BoundSpec 
BoundExp 
BoundWit 

class BindStruct c n | c -> n where Source #

Minimal complete definition

slurpBindTree

Methods

slurpBindTree :: c -> [BindTree n] Source #

isBoundExpWit :: BoundLevel -> Bool Source #

Check if a boundlevel is expression or witness

bindDefT :: BindStruct c n => BindWay -> [Bind n] -> [c] -> BindTree n Source #

Helper for constructing the BindTree for a type binder.

freeT :: (BindStruct c n, Ord n) => Env n -> c -> Set (Bound n) Source #

Collect the free Spec variables in a thing (level-1).

freeOfTreeT :: Ord n => Env n -> BindTree n -> Set (Bound n) Source #

collectBound :: (BindStruct c n, Ord n) => c -> Set (Bound n) Source #

Collect all the bound variables in a thing, independent of whether they are free or not.

collectBinds :: (BindStruct c n, Ord n) => c -> ([Bind n], [Bind n]) Source #

Collect all the spec and exp binders in a thing.