nano-js-0.1.0.0: Small Language for Implementing Verification Algorithms

Safe HaskellNone

Language.Nano.Typecheck.Types

Contents

Description

Global type definitions for Refinement Type Checker

Synopsis

Programs

data Nano a t Source

Nano Program = Code + Types for all function binders

Constructors

Nano 

Fields

code :: !(Source a)

Code to check

specs :: !(Env t)

Imported Specifications

defs :: !(Env t)

Signatures for Code

consts :: !(Env t)

Measure Signatures

quals :: ![Qualifier]

Qualifiers

Instances

Functor (Nano a) 
Monoid (Nano a t) 
PP t => PP (Nano a t) 

newtype Source a Source

Constructors

Src [FunctionStatement a] 

Instances

type FunctionStatement a = Statement aSource

mapCode :: (a -> b) -> Nano a t -> Nano b tSource

(Refinement) Types

data RType r Source

(Raw) Refined Types

Constructors

TApp TCon [RType r] r 
TVar TVar r 
TFun [Bind r] (RType r) r 
TAll TVar (RType r) 

Instances

Functor RType 
RefTypable Type 
RefTypable RefType 
Inputable Type 
Inputable RefType 
(PP r, Reftable r) => Substitutable r (RType r) 
Eq r => Eq (RType r) 
Ord r => Ord (RType r) 
Show r => Show (RType r) 
Reftable r => PP (RType r) 
(Reftable r, Subable r) => Subable (RType r)

Substitutions -----------------------------------------------------------------------

Free (RType r) 

data Bind r Source

Constructors

B 

Fields

b_sym :: Symbol
 
b_type :: !(RType r)
 

Instances

Functor Bind 
(PP r, Reftable r) => Substitutable r (Bind r) 
Eq r => Eq (Bind r) 
Ord r => Ord (Bind r) 
Show r => Show (Bind r) 
Reftable r => PP (Bind r) 

toType :: RType a -> TypeSource

Stripping out Refinements

ofType :: Reftable r => Type -> RType rSource

Adding in Refinements

strengthen :: Reftable r => RType r -> r -> RType rSource

Deconstructing Types

bkFun :: RType r -> Maybe ([TVar], [Bind r], RType r)Source

bkAll :: RType a -> ([TVar], RType a)Source

Regular Types

type Type = RType ()Source

Standard Types

data TVar Source

Type Variables

Constructors

TV 

Fields

tv_sym :: Symbol
 
tv_loc :: SourcePos
 

Instances

Eq TVar 
Ord TVar 
Show TVar 
PP TVar 
Hashable TVar 
Symbolic TVar 
IsLocated TVar 

data TCon Source

Constructed Type Bodies data TBody r = TD { td_con :: !TCon , td_args :: ![TVar] , td_body :: !(RType r) , td_pos :: !SourcePos } deriving (Show, Functor)

Type Constructors

Constructors

TInt 
TBool 
TVoid 
TDef Symbol 

Instances

Primitive Types

tInt :: Reftable r => RType rSource

tBool :: Reftable r => RType rSource

tVoid :: Reftable r => RType rSource

tErr :: Reftable r => RType rSource

tVar :: Reftable r => TVar -> RType rSource

Primitive / Base Types -------------------------------------------

Operator Types

infixOpTy :: InfixOp -> Env t -> tSource

Operator Types ---------------------------------------------------

prefixOpTy :: PrefixOp -> Env t -> tSource

Annotations

data Annot b a Source

Constructors

Ann 

Fields

ann :: a
 
ann_fact :: [b]
 

Instances

HasAnnotation (Annot b) 
(Show b, Show a) => Show (Annot b a) 
(PP a, PP b) => PP (Annot b a) 
IsLocated (Annot a SourcePos) 

data Fact Source

Annotations ------------------------------------------------------------

Annotations: Extra-code decorations needed for Refinement Type Checking Ideally, we'd have room for these inside the Statement and Expression type, but are tucking them in using the a parameter.

Constructors

PhiVar !(Id SourcePos) 
TypInst ![Type] 

type AnnBare = Annot Fact SourcePosSource

type AnnSSA = Annot Fact SourcePosSource

type AnnType = Annot Fact SourcePosSource

type AnnInfo = HashMap SourcePos [Fact]Source