jmacro-0.6.18: QuasiQuotation library for programmatic generation of Javascript code.

Safe Haskell | None
Language | Haskell2010

Language.Javascript.JMacro.TypeCheck

# Documentation

eitherIsLeft :: Either a b -> Bool Source #

partitionOut :: (a -> Maybe b) -> [a] -> ([b], [a]) Source #

zipWithOrChange :: (a -> a -> b) -> (a -> b) -> [a] -> [a] -> [b] Source #

zipWithOrIdM :: Monad m => (a -> a -> m a) -> [a] -> [a] -> m [a] Source #

unionWithM :: (Monad m, Ord key) => (val -> val -> m val) -> Map key val -> Map key val -> m (Map key val) Source #

intersectionWithM :: (Monad m, Ord key) => (val -> val -> m b) -> Map key val -> Map key val -> m (Map key b) Source #

class Compos1 t where Source #

Methods

compos1 :: (forall a. a -> m a) -> (forall a b. m (a -> b) -> m a -> m b) -> (t -> m t) -> t -> m t Source #

#### Instances

Instances details

Compos1 JType Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods compos1 :: (forall a. a -> m a) -> (forall a b. m (a -> b) -> m a -> m b) -> (JType -> m JType) -> JType -> m JType Source #

composOp1 :: Compos1 t => (t -> t) -> t -> t Source #

composOpM1 :: (Compos1 t, Monad m) => (t -> m t) -> t -> m t Source #

composOpM1_ :: (Compos1 t, Monad m) => (t -> m ()) -> t -> m () Source #

composOpFold1 :: Compos1 t => b -> (b -> b -> b) -> (t -> b) -> t -> b Source #

newtype C b a Source #

Constructors

C |

Fields

- unC :: b

data StoreVal Source #

Constructors

SVType JType |
SVConstrained (Set Constraint) |

#### Instances

Instances details

Show StoreVal Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods showsPrec :: Int -> StoreVal -> ShowS Source # show :: StoreVal -> String Source # showList :: [StoreVal] -> ShowS Source #

data TCState Source #

Constructors

TCS |

Fields

- tc_env :: [Map Ident JType]
- tc_vars :: Map Int StoreVal
- tc_stack :: [Set Int]
- tc_frozen :: Set Int
- tc_varCt :: Int
- tc_context :: [TMonad String]

#### Instances

Instances details

Show TCState Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods showsPrec :: Int -> TCState -> ShowS Source # show :: TCState -> String Source # showList :: [TCState] -> ShowS Source #
MonadState TCState TMonad Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods get :: TMonad TCState Source # put :: TCState -> TMonad () Source # state :: (TCState -> (a, TCState)) -> TMonad a Source #

tcStateEmpty :: TCState Source #

newtype TMonad a Source #

Constructors

TMonad (ExceptT String (State TCState) a) |

#### Instances

Instances details

Applicative TMonad Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods pure :: a -> TMonad a Source # (<*>) :: TMonad (a -> b) -> TMonad a -> TMonad b Source # liftA2 :: (a -> b -> c) -> TMonad a -> TMonad b -> TMonad c Source # (*>) :: TMonad a -> TMonad b -> TMonad b Source # (<*) :: TMonad a -> TMonad b -> TMonad a Source #
Functor TMonad Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods fmap :: (a -> b) -> TMonad a -> TMonad b Source # (<$) :: a -> TMonad b -> TMonad a Source #
Monad TMonad Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods (>>=) :: TMonad a -> (a -> TMonad b) -> TMonad b Source # (>>) :: TMonad a -> TMonad b -> TMonad b Source # return :: a -> TMonad a Source #
MonadError String TMonad Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods throwError :: String -> TMonad a Source # catchError :: TMonad a -> (String -> TMonad a) -> TMonad a Source #
MonadState TCState TMonad Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods get :: TMonad TCState Source # put :: TCState -> TMonad () Source # state :: (TCState -> (a, TCState)) -> TMonad a Source #

class JTypeCheck a where Source #

Methods

typecheck :: a -> TMonad JType Source #

#### Instances

Instances details

JTypeCheck JExpr Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods typecheck :: JExpr -> TMonad JType Source #
JTypeCheck JStat Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods typecheck :: JStat -> TMonad JType Source #
JTypeCheck JVal Source # |
Instance details Defined in Language.Javascript.JMacro.TypeCheck Methods typecheck :: JVal -> TMonad JType Source #

evalTMonad :: TMonad a -> Either String a Source #

runTMonad :: TMonad a -> (Either String a, TCState) Source #

withContext :: TMonad a -> TMonad String -> TMonad a Source #

traversem_ :: (Foldable t, Monad f) => (a -> f b) -> t a -> f () Source #

freeVarsWithNames :: JType -> TMonad (Map Int String) Source #

prettyType :: JType -> TMonad String Source #

tyErr0 :: String -> TMonad a Source #

tyErr1 :: String -> JType -> TMonad b Source #

tyErr2ext :: String -> String -> String -> JType -> JType -> TMonad a Source #

tyErr2Sub :: JType -> JType -> TMonad a Source #

prettyEnv :: TMonad [Map Ident String] Source #

runTypecheckRaw :: JTypeCheck a => a -> (Either String JType, TCState) Source #

runTypecheckFull :: JTypeCheck a => a -> (Either String (String, [Map Ident String]), TCState) Source #

runTypecheck :: JTypeCheck a => a -> Either String String Source #

evalTypecheck :: JTypeCheck a => a -> Either String [Map Ident String] Source #

typecheckMain :: JTypeCheck a => a -> TMonad JType Source #

addToStack :: Ord a => a -> [Set a] -> [Set a] Source #

newVarRef :: TMonad VarRef Source #

newTyVar :: TMonad JType Source #

mapConstraint :: (Monad m, Functor m) => (JType -> m JType) -> Constraint -> m Constraint Source #

partitionCs :: [Constraint] -> ([JType], [JType]) Source #

lookupConstraintsList :: VarRef -> TMonad [Constraint] Source #

instantiateVarRef :: VarRef -> JType -> TMonad () Source #

occursCheck :: Int -> JType -> TMonad () Source #

checkConstraints :: JType -> [Constraint] -> TMonad () Source #

addConstraint :: VarRef -> Constraint -> TMonad () Source #

cannonicalizeConstraints :: [Constraint] -> TMonad [Constraint] Source #

tryCloseFrozenVars :: TMonad () Source #

withLocalScope :: TMonad a -> TMonad (a, Set Int) Source #

setFrozen :: Set Int -> TMonad () Source #

frame2VarRefs :: Set t -> [(Maybe a, t)] Source #

addEnv :: Ident -> JType -> TMonad () Source #

newVarDecl :: Ident -> TMonad JType Source #

resolveTypeGen :: ((JType -> TMonad JType) -> JType -> TMonad JType) -> JType -> TMonad JType Source #

resolveType :: JType -> TMonad JType Source #

resolveTypeShallow :: JType -> TMonad JType Source #

integrateLocalType :: JLocalType -> TMonad JType Source #

lookupEnv :: Ident -> TMonad JType Source #

freeVars :: JType -> TMonad (Set Int) Source #

instantiateScheme :: [VarRef] -> JType -> TMonad JType Source #

instantiateRigidScheme :: [VarRef] -> JType -> TMonad JType Source #

checkEscapedVars :: [VarRef] -> JType -> TMonad () Source #

(<:) :: JType -> JType -> TMonad () Source #

(<<:>) :: TMonad JType -> TMonad JType -> TMonad () Source #

someUpperBound :: [JType] -> TMonad JType Source #

someLowerBound :: [JType] -> TMonad JType Source #

(=.=) :: JType -> JType -> TMonad JType Source #

typecheckWithBlock :: (JsToDoc a, JMacro a, JTypeCheck a) => a -> TMonad JType Source #