futhark-0.11.1: An optimising compiler for a functional, array-oriented language.

Safe HaskellNone
LanguageHaskell2010

Language.Futhark.TypeChecker.Monad

Description

Main monad in which the type checker runs, as well as ancillary data definitions.

Synopsis

Documentation

data TypeM a Source #

The type checker runs in this monad.

Instances
Monad TypeM Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Monad

Methods

(>>=) :: TypeM a -> (a -> TypeM b) -> TypeM b #

(>>) :: TypeM a -> TypeM b -> TypeM b #

return :: a -> TypeM a #

fail :: String -> TypeM a #

Functor TypeM Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Monad

Methods

fmap :: (a -> b) -> TypeM a -> TypeM b #

(<$) :: a -> TypeM b -> TypeM a #

Applicative TypeM Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Monad

Methods

pure :: a -> TypeM a #

(<*>) :: TypeM (a -> b) -> TypeM a -> TypeM b #

liftA2 :: (a -> b -> c) -> TypeM a -> TypeM b -> TypeM c #

(*>) :: TypeM a -> TypeM b -> TypeM b #

(<*) :: TypeM a -> TypeM b -> TypeM a #

MonadTypeChecker TypeM Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Monad

MonadWriter Warnings TypeM Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Monad

Methods

writer :: (a, Warnings) -> TypeM a #

tell :: Warnings -> TypeM () #

listen :: TypeM a -> TypeM (a, Warnings) #

pass :: TypeM (a, Warnings -> Warnings) -> TypeM a #

MonadState VNameSource TypeM Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Monad

MonadError TypeError TypeM Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Monad

Methods

throwError :: TypeError -> TypeM a #

catchError :: TypeM a -> (TypeError -> TypeM a) -> TypeM a #

askImportName :: TypeM ImportName Source #

The name of the current file/import.

bindSpaced :: MonadTypeChecker m => [(Namespace, Name)] -> m a -> m a Source #

qualifyTypeVars :: ASTMappable t => Env -> [VName] -> [VName] -> t -> t Source #

getType :: TypeBase dim as -> Either ([(Maybe VName, TypeBase dim as)], TypeBase dim as) (TypeBase dim as) Source #

Extract from a type either a function type comprising a list of parameter types and a return type, or a first-order type.

data TypeError Source #

Information about an error during type checking. The Show instance for this type produces a human-readable description.

Constructors

TypeError SrcLoc String 

unexpectedType :: MonadTypeChecker m => SrcLoc -> TypeBase () () -> [TypeBase () ()] -> m a Source #

data BreadCrumb Source #

A piece of information that describes what process the type checker currently performing. This is used to give better error messages.

Constructors

MatchingTypes (TypeBase () ()) (TypeBase () ()) 
MatchingFields Name 

class Monad m => MonadBreadCrumbs m where Source #

Tracking breadcrumbs to give a kind of "stack trace" in errors.

Minimal complete definition

Nothing

class MonadError TypeError m => MonadTypeChecker m where Source #

quote :: String -> String Source #

Enclose a string in the prefered quotes used in error messages. These are picked to not collide with characters permitted in identifiers.

data Env Source #

Modules produces environment with this representation.

Instances
Show Env Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

showsPrec :: Int -> Env -> ShowS #

show :: Env -> String #

showList :: [Env] -> ShowS #

Semigroup Env Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

(<>) :: Env -> Env -> Env #

sconcat :: NonEmpty Env -> Env #

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

Monoid Env Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

mempty :: Env #

mappend :: Env -> Env -> Env #

mconcat :: [Env] -> Env #

Pretty Env Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

ppr :: Env -> Doc #

pprPrec :: Int -> Env -> Doc #

pprList :: [Env] -> Doc #

type TySet = Map (QualName VName) Liftedness Source #

A mapping of abstract types to their liftedness.

data FunSig Source #

A parametric functor consists of a set of abstract types, the environment of its parameter, and the resulting module type.

Constructors

FunSig 
Instances
Show FunSig Source # 
Instance details

Defined in Language.Futhark.Semantic

data BoundV Source #

Type parameters, list of parameter types (optinally named), and return type. The type parameters are in scope in both parameter types and the return type. Non-functional values have only a return type.

Constructors

BoundV [TypeParam] StructType 
Instances
Show BoundV Source # 
Instance details

Defined in Language.Futhark.Semantic

data Mod Source #

Representation of a module, which is either a plain environment, or a parametric module ("functor" in SML).

Constructors

ModEnv Env 
ModFun FunSig 
Instances
Show Mod Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

showsPrec :: Int -> Mod -> ShowS #

show :: Mod -> String #

showList :: [Mod] -> ShowS #

Pretty Mod Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

ppr :: Mod -> Doc #

pprPrec :: Int -> Mod -> Doc #

pprList :: [Mod] -> Doc #

data TypeBinding Source #

A binding from a name to its definition as a type.

data MTy Source #

Representation of a module type.

Constructors

MTy 

Fields

Instances
Show MTy Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

showsPrec :: Int -> MTy -> ShowS #

show :: MTy -> String #

showList :: [MTy] -> ShowS #

Pretty MTy Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

ppr :: MTy -> Doc #

pprPrec :: Int -> MTy -> Doc #

pprList :: [MTy] -> Doc #