Safe Haskell | None |
---|---|
Language | GHC2021 |
Language.Futhark.TypeChecker.Modules
Description
Implementation of the Futhark module system (at least most of it; some is scattered elsewhere in the type checker).
Synopsis
- matchMTys :: MTy -> MTy -> Loc -> Either TypeError (Map VName VName)
- newNamesForMTy :: MTy -> TypeM (MTy, Map VName VName)
- refineEnv :: SrcLoc -> TySet -> Env -> QualName Name -> [TypeParam] -> StructRetType -> TypeM (QualName VName, TySet, Env)
- applyFunctor :: Loc -> FunModType -> MTy -> TypeM (MTy, Map VName VName, Map VName VName)
Documentation
matchMTys :: MTy -> MTy -> Loc -> Either TypeError (Map VName VName) Source #
Return new renamed/abstracted env, as well as a mapping from names in the signature to names in the new env. This is used for functor application. The first env is the module env, and the second the env it must match.
newNamesForMTy :: MTy -> TypeM (MTy, Map VName VName) Source #
Create unique renames for the module type. This is used for e.g. generative functor application.
refineEnv :: SrcLoc -> TySet -> Env -> QualName Name -> [TypeParam] -> StructRetType -> TypeM (QualName VName, TySet, Env) Source #
Refine the given type name in the given env.
XXX: we do not check whether this results in a meaningful module type. In particular, we may refine a nonlifted type to contain a function or existentially quantified sizes. However, it is still not possible to construct a module that matches such malformed module types, so this is not a soundness issue, merely an ergonomic issue.