symantic-6.0.0.20170623: Library for Typed Tagless-Final Higher-Order Composable DSL

Safe HaskellNone
LanguageHaskell2010

Language.Symantic.Compiling.Read

Contents

Synopsis

Type ReadTerm

type ReadTerm src ss ts = Source src => Inj_Source (TypeVT src) src => Inj_Source (KindK src) src => Inj_Source (AST_Type src) src => Constable (->) => Name2Type src -> CtxTy src ts -> AST_Term src ss -> Either (Error_Term src) (TermVT src ss ts) Source #

Convenient type alias for readTerm and related functions.

readTerm :: forall src ss ts. ReadTerm src ss ts Source #

Read a TermVT from and AST_Term.

teVar :: forall ss src ts. Source src => NameTe -> CtxTy src ts -> Either (Error_Term src) (TermVT src ss ts) Source #

teApp :: Source src => Constable (->) => Term src ss ts '[Proxy (a :: Type), Proxy (b :: Type)] (() #> ((a -> b) -> a -> b)) Source #

reduceTeApp :: AST_Term src ss -> AST_Term src ss Source #

Reduce number of Token_Term_App in given AST_Term by converting them into BinTree2.

NOTE: Token_Term_App exists only to handle unifix operators applied to arguments.

Type ReadTermCF

newtype ReadTermCF src ss Source #

Like ReadTerm, but CtxTe-free.

Useful in readTermWithCtx to help GHC's type solver, which "Cannot instantiate unification variable with a type involving foralls".

Constructors

ReadTermCF 

Fields

readTermWithCtx :: Foldable f => Source src => Inj_Source (TypeVT src) src => Inj_Source (KindK src) src => Inj_Source (AST_Type src) src => Constable (->) => f (NameTe, TermT src ss '[] '[]) -> Name2Type src -> AST_Term src ss -> Either (Error_Term src) (TermVT src ss '[]) Source #

Like readTerm but with given context, and no more.

readTermWithCtxPush :: Foldable f => f (NameTe, TermT src ss '[] '[]) -> (forall ts'. ReadTerm src ss ts') -> ReadTerm src ss ts Source #

Like readTerm but with given context.

readTermWithCtxPush1 :: (NameTe, TermT src ss '[] '[]) -> (forall ts'. ReadTerm src ss ts') -> ReadTerm src ss ts Source #

Like readTerm but with given TermT pushed onto CtxTy and CtxTe.

readTermWithCtxClose :: (forall ts'. ReadTerm src ss ts') -> Source src => Inj_Source (TypeVT src) src => Inj_Source (KindK src) src => Inj_Source (AST_Type src) src => Constable (->) => Name2Type src -> AST_Term src ss -> Either (Error_Term src) (TermVT src ss '[]) Source #

Close a ReadTerm context.

Type Error_Term

Type SrcTe

data SrcTe inp ss Source #

A Source usable when using readTerm.

Constructors

SrcTe_Less 
SrcTe_Input (Span inp) 
SrcTe_AST_Term (AST_Term (SrcTe inp ss) ss) 
SrcTe_AST_Type (AST_Type (SrcTe inp ss)) 
SrcTe_Kind (KindK (SrcTe inp ss)) 
SrcTe_Type (TypeVT (SrcTe inp ss)) 
SrcTe_Term 

Instances

Inj_Source (Span inp) (SrcTe inp ss) Source # 

Methods

inj_Source :: Span inp -> SrcTe inp ss #

Inj_Source (KindK (SrcTe inp ss)) (SrcTe inp ss) Source # 

Methods

inj_Source :: KindK (SrcTe inp ss) -> SrcTe inp ss #

Inj_Source (TypeVT (SrcTe inp ss)) (SrcTe inp ss) Source # 

Methods

inj_Source :: TypeVT (SrcTe inp ss) -> SrcTe inp ss #

Inj_Source (AST_Type (SrcTe inp ss)) (SrcTe inp ss) Source # 

Methods

inj_Source :: AST_Type (SrcTe inp ss) -> SrcTe inp ss #

Eq inp => Eq (SrcTe inp ss) Source # 

Methods

(==) :: SrcTe inp ss -> SrcTe inp ss -> Bool #

(/=) :: SrcTe inp ss -> SrcTe inp ss -> Bool #

Show inp => Show (SrcTe inp ss) Source # 

Methods

showsPrec :: Int -> SrcTe inp ss -> ShowS #

show :: SrcTe inp ss -> String #

showList :: [SrcTe inp ss] -> ShowS #

Source (SrcTe inp ss) Source # 

Methods

noSource :: SrcTe inp ss #

Inj_Source (AST_Term (SrcTe inp ss) ss) (SrcTe inp ss) Source # 

Methods

inj_Source :: AST_Term (SrcTe inp ss) ss -> SrcTe inp ss #

type Source_Input (SrcTe inp ss) Source # 
type Source_Input (SrcTe inp ss) = inp