Safe Haskell | None |
---|---|
Language | Haskell2010 |
Type schemes
Synopsis
- data Scheme varTypes typ h = Scheme {}
- sForAlls :: forall varTypes typ h varTypes. Lens (Scheme varTypes typ h) (Scheme varTypes typ h) ((#) varTypes QVars) ((#) varTypes QVars)
- sTyp :: forall varTypes typ h typ h. Lens (Scheme varTypes typ h) (Scheme varTypes typ h) ((:#) h typ) ((:#) h typ)
- data W_Scheme (varTypes :: AHyperType -> Type) (typ :: HyperType) node where
- W_Scheme_typ :: W_Scheme varTypes typ typ
- newtype QVars typ = QVars (Map (QVar (GetHyperType typ)) (TypeConstraintsOf (GetHyperType typ)))
- _QVars :: forall typ typ. Iso (QVars typ) (QVars typ) (Map (QVar (GetHyperType typ)) (TypeConstraintsOf (GetHyperType typ))) (Map (QVar (GetHyperType typ)) (TypeConstraintsOf (GetHyperType typ)))
- class (UnifyGen m t, HNodeLens varTypes t, Ord (QVar t)) => HasScheme varTypes m t where
- hasSchemeRecursive :: Proxy varTypes -> Proxy m -> Proxy t -> Dict (HNodesConstraint t (HasScheme varTypes m))
- loadScheme :: forall m varTypes typ. (Monad m, HTraversable varTypes, HNodesConstraint varTypes (UnifyGen m), HasScheme varTypes m typ) => (Pure # Scheme varTypes typ) -> m (GTerm (UVarOf m) # typ)
- saveScheme :: (HNodesConstraint varTypes OrdQVar, HPointed varTypes, HasScheme varTypes m typ) => (GTerm (UVarOf m) # typ) -> m (Pure # Scheme varTypes typ)
- class UnifyGen m t => MonadInstantiate m t where
- localInstantiations :: (QVarInstances (UVarOf m) # t) -> m a -> m a
- lookupQVar :: QVar t -> m (UVarOf m # t)
- inferType :: (InferOf t ~ ANode t, HTraversable t, HNodesConstraint t HasInferredValue, UnifyGen m t, MonadInstantiate m t) => (t # InferChild m h) -> m (t # h, InferOf t # UVarOf m)
- newtype QVarInstances h typ = QVarInstances (Map (QVar (GetHyperType typ)) (h typ))
- _QVarInstances :: forall h typ h typ. Iso (QVarInstances h typ) (QVarInstances h typ) (Map (QVar (GetHyperType typ)) (h typ)) (Map (QVar (GetHyperType typ)) (h typ))
- makeQVarInstances :: Unify m typ => (QVars # typ) -> m (QVarInstances (UVarOf m) # typ)
Documentation
data Scheme varTypes typ h Source #
A type scheme representing a polymorphic type.
Instances
sForAlls :: forall varTypes typ h varTypes. Lens (Scheme varTypes typ h) (Scheme varTypes typ h) ((#) varTypes QVars) ((#) varTypes QVars) Source #
sTyp :: forall varTypes typ h typ h. Lens (Scheme varTypes typ h) (Scheme varTypes typ h) ((:#) h typ) ((:#) h typ) Source #
data W_Scheme (varTypes :: AHyperType -> Type) (typ :: HyperType) node where Source #
W_Scheme_typ :: W_Scheme varTypes typ typ |
QVars (Map (QVar (GetHyperType typ)) (TypeConstraintsOf (GetHyperType typ))) |
Instances
_QVars :: forall typ typ. Iso (QVars typ) (QVars typ) (Map (QVar (GetHyperType typ)) (TypeConstraintsOf (GetHyperType typ))) (Map (QVar (GetHyperType typ)) (TypeConstraintsOf (GetHyperType typ))) Source #
class (UnifyGen m t, HNodeLens varTypes t, Ord (QVar t)) => HasScheme varTypes m t where Source #
Nothing
hasSchemeRecursive :: Proxy varTypes -> Proxy m -> Proxy t -> Dict (HNodesConstraint t (HasScheme varTypes m)) Source #
default hasSchemeRecursive :: HNodesConstraint t (HasScheme varTypes m) => Proxy varTypes -> Proxy m -> Proxy t -> Dict (HNodesConstraint t (HasScheme varTypes m)) Source #
loadScheme :: forall m varTypes typ. (Monad m, HTraversable varTypes, HNodesConstraint varTypes (UnifyGen m), HasScheme varTypes m typ) => (Pure # Scheme varTypes typ) -> m (GTerm (UVarOf m) # typ) Source #
Load scheme into unification monad so that different instantiations share the scheme's monomorphic parts - their unification is O(1) as it is the same shared unification term.
saveScheme :: (HNodesConstraint varTypes OrdQVar, HPointed varTypes, HasScheme varTypes m typ) => (GTerm (UVarOf m) # typ) -> m (Pure # Scheme varTypes typ) Source #
class UnifyGen m t => MonadInstantiate m t where Source #
localInstantiations :: (QVarInstances (UVarOf m) # t) -> m a -> m a Source #
inferType :: (InferOf t ~ ANode t, HTraversable t, HNodesConstraint t HasInferredValue, UnifyGen m t, MonadInstantiate m t) => (t # InferChild m h) -> m (t # h, InferOf t # UVarOf m) Source #
newtype QVarInstances h typ Source #
QVarInstances (Map (QVar (GetHyperType typ)) (h typ)) |
Instances
_QVarInstances :: forall h typ h typ. Iso (QVarInstances h typ) (QVarInstances h typ) (Map (QVar (GetHyperType typ)) (h typ)) (Map (QVar (GetHyperType typ)) (h typ)) Source #
makeQVarInstances :: Unify m typ => (QVars # typ) -> m (QVarInstances (UVarOf m) # typ) Source #