ddc-core-flow-0.4.2.1: Disciplined Disciple Compiler data flow compiler.

Safe HaskellNone
LanguageHaskell98

DDC.Core.Flow.Transform.Rates.SizeInference

Description

Performing size inference on a program in Combinator Normal Form

Synopsis

Documentation

data Type v Source

tau ::=

Constructors

TVar (K v)

k

TCross (Type v) (Type v)

tau * tau

Instances

Eq v => Eq (Type v) Source 
Ord v => Ord (Type v) Source 
Show v => Show (Type v) Source 
Pretty v => Pretty (Maybe (Type v)) Source 
Pretty v => Pretty (Type v) Source 

data K v Source

Given some variable type, append a number of primes onto it. We want to be able to distinguish between the raw variable types and unification, existential Klock (rate) variables. We generate constraints so that raw variables will appear on the left of equalities, and Ks may appear on the right.

Constructors

KV v 
K' (K v) 

Instances

Eq v => Eq (K v) Source 
Ord v => Ord (K v) Source 
Show v => Show (K v) Source 
Pretty v => Pretty (K v) Source 

type Env v = [Scope v] Source

Gamma ::= • | Gamma, Gamma...

data Scope v Source

Gamma ::= ...

Constructors

EVar v (Type v)

v : k

EUnify (K v)

k

ERigid (K v)

exists k

Instances

Show v => Show (Scope v) Source 
Pretty v => Pretty (Scope v) Source 

data Scheme v Source

sigma ::= forall k... exists k... (x : t)... -> (x : t)... Note that these are all raw variable types. There is no point mentioning unification variables in this solved form.

Constructors

Scheme 

Fields

_forall :: [K v]
 
_exists :: [K v]
 
_from :: [(v, Type v)]
 
_to :: [(v, Type v)]
 

Instances

generate :: Ord a => Program s a -> Maybe (Env a, Scheme a) Source

program :_s sigma

lookupV :: Eq v => Env v -> v -> Maybe (Type v) Source

Search for first (should be only) mention of k in environment, along with its index

iter :: (Eq a, Eq s) => Program s a -> Env a -> CName s a -> Maybe (Type a) Source

Find iteration size of given combinator

parents :: (Eq a, Eq s) => Program s a -> Env a -> CName s a -> CName s a -> Maybe (CName s a, CName s a) Source

Find pair of parent transducers with same iteration size

trans :: (Eq a, Eq s) => Program s a -> CName s a -> Maybe (CName s a) Source

Find a bindings' transducer. Only array bindings can have transducers.