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

Safe HaskellSafe
LanguageHaskell98

DDC.Core.Collect

Contents

Description

Collecting sets of variables and constructors.

Synopsis

Free Variables

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

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

freeVarsT :: Ord n => KindEnv n -> Type n -> Set (Bound n) Source #

Collect the free type variables in a type.

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

Collect the free Data and Witness variables in a thing (level-0).

Bounds and Binds

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.

Abstract Binding Structures

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 #

Support

data Support n Source #

Constructors

Support 

Fields

Instances

Show n => Show (Support n) Source # 

Methods

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

show :: Support n -> String #

showList :: [Support n] -> ShowS #

Ord n => Monoid (Support n) Source # 

Methods

mempty :: Support n #

mappend :: Support n -> Support n -> Support n #

mconcat :: [Support n] -> Support n #

class SupportX c where Source #

Minimal complete definition

support

Methods

support :: Ord n => KindEnv n -> TypeEnv n -> c n -> Support n Source #

Instances

SupportX Type Source # 

Methods

support :: Ord n => KindEnv n -> TypeEnv n -> Type n -> Support n Source #

SupportX Bind Source # 

Methods

support :: Ord n => KindEnv n -> TypeEnv n -> Bind n -> Support n Source #

SupportX (Witness a) Source # 

Methods

support :: Ord n => KindEnv n -> TypeEnv n -> Witness a n -> Support n Source #

SupportX (Cast a) Source # 

Methods

support :: Ord n => KindEnv n -> TypeEnv n -> Cast a n -> Support n Source #

SupportX (Alt a) Source # 

Methods

support :: Ord n => KindEnv n -> TypeEnv n -> Alt a n -> Support n Source #

SupportX (Lets a) Source # 

Methods

support :: Ord n => KindEnv n -> TypeEnv n -> Lets a n -> Support n Source #

SupportX (Exp a) Source # 

Methods

support :: Ord n => KindEnv n -> TypeEnv n -> Exp a n -> Support n Source #

SupportX (Module a) Source # 

Methods

support :: Ord n => KindEnv n -> TypeEnv n -> Module a n -> Support n Source #