psilo
Safe HaskellSafe-Inferred
LanguageHaskell2010

Types

Description

This is still a work in progress.

No really, what's this type system?

Eventually? I want

  • Linear
  • call-by-push-value with
  • arbitrary rank type and kind polymorphism and
  • graded (co)effects.

Papers and posts I am cribbing from:

Synopsis

(basic) Type language

data Type Source #

Instances

Instances details
Show Type Source # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Eq Type Source # 
Instance details

Defined in Types

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Ord Type Source # 
Instance details

Defined in Types

Methods

compare :: Type -> Type -> Ordering #

(<) :: Type -> Type -> Bool #

(<=) :: Type -> Type -> Bool #

(>) :: Type -> Type -> Bool #

(>=) :: Type -> Type -> Bool #

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Substitutable Constraint Source # 
Instance details

Defined in Types

Substitutable Type Source # 
Instance details

Defined in Types

type Rho = Type Source #

type Tau = Type Source #

Typing environment ("frame")

newtype Frame Source #

Constructors

Frame 

Fields

Instances

Instances details
Monoid Frame Source # 
Instance details

Defined in Types

Methods

mempty :: Frame #

mappend :: Frame -> Frame -> Frame #

mconcat :: [Frame] -> Frame #

Semigroup Frame Source # 
Instance details

Defined in Types

Methods

(<>) :: Frame -> Frame -> Frame #

sconcat :: NonEmpty Frame -> Frame #

stimes :: Integral b => b -> Frame -> Frame #

Show Frame Source # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Frame -> ShowS #

show :: Frame -> String #

showList :: [Frame] -> ShowS #

Eq Frame Source # 
Instance details

Defined in Types

Methods

(==) :: Frame -> Frame -> Bool #

(/=) :: Frame -> Frame -> Bool #

Substitutable Frame Source # 
Instance details

Defined in Types

Inference monad

newtype InferState Source #

Constructors

InferState 

Fields

Constraint solving monad

newtype Subst Source #

Constructors

Subst (Map TypeVar Rho) 

Instances

Instances details
Monoid Subst Source # 
Instance details

Defined in Types

Methods

mempty :: Subst #

mappend :: Subst -> Subst -> Subst #

mconcat :: [Subst] -> Subst #

Semigroup Subst Source # 
Instance details

Defined in Types

Methods

(<>) :: Subst -> Subst -> Subst #

sconcat :: NonEmpty Subst -> Subst #

stimes :: Integral b => b -> Subst -> Subst #

Show Subst Source # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Subst -> ShowS #

show :: Subst -> String #

showList :: [Subst] -> ShowS #

Eq Subst Source # 
Instance details

Defined in Types

Methods

(==) :: Subst -> Subst -> Bool #

(/=) :: Subst -> Subst -> Bool #

Ord Subst Source # 
Instance details

Defined in Types

Methods

compare :: Subst -> Subst -> Ordering #

(<) :: Subst -> Subst -> Bool #

(<=) :: Subst -> Subst -> Bool #

(>) :: Subst -> Subst -> Bool #

(>=) :: Subst -> Subst -> Bool #

max :: Subst -> Subst -> Subst #

min :: Subst -> Subst -> Subst #

class Substitutable t where Source #

Methods

substitute :: Subst -> t -> t Source #

ftv :: t -> Set TypeVar Source #

Instances

Instances details
Substitutable Constraint Source # 
Instance details

Defined in Types

Substitutable Frame Source # 
Instance details

Defined in Types

Substitutable Type Source # 
Instance details

Defined in Types

Substitutable a => Substitutable [a] Source # 
Instance details

Defined in Types

Methods

substitute :: Subst -> [a] -> [a] Source #

ftv :: [a] -> Set TypeVar Source #

Inference

inFrames :: [(Symbol, Type)] -> Infer a -> Infer a Source #

skolemize :: Sigma -> Infer ([TypeVar], Rho) Source #

Deep skolemization. Returns the skolem variables and the skolemized ρ-type.

infer :: CbpvExp -> Infer (Rho, [Constraint]) Source #

Type inference rules for CbpvExpressions. All functions have at least one (terminal) argument of type ⊥.

Constraint solver

compose :: Subst -> Subst -> Subst Source #

Compose substitutions (with a left bias IIRC).

primType :: Symbol -> Maybe Sigma Source #

Lookup table for primitive operators.

Graph implementation

data Graph node key Source #

Constructors

Graph 

Fields

graphFromList :: Ord key => [(node, key, [key])] -> Graph node key Source #

vertexLabels :: Functor f => Graph b t -> f Vertex -> f b Source #

topo :: Graph node key -> [node] Source #