added skomeliation on given type signatures
This commit is contained in:
parent
7c5041d270
commit
f20b80cab3
1 changed files with 7 additions and 1 deletions
|
|
@ -66,7 +66,7 @@ preRun (x : xs) = case x of
|
||||||
"Duplicate signatures for function"
|
"Duplicate signatures for function"
|
||||||
quote $ printTree n
|
quote $ printTree n
|
||||||
)
|
)
|
||||||
insertSig (coerce n) (Just t) >> preRun xs
|
insertSig (coerce n) (Just $ skolemize t) >> preRun xs
|
||||||
DBind (Bind n _ e) -> do
|
DBind (Bind n _ e) -> do
|
||||||
collect (collectTVars e)
|
collect (collectTVars e)
|
||||||
s <- gets sigs
|
s <- gets sigs
|
||||||
|
|
@ -538,6 +538,12 @@ fresh = do
|
||||||
next 'z' = 'a'
|
next 'z' = 'a'
|
||||||
next a = succ a
|
next a = succ a
|
||||||
|
|
||||||
|
skolemize :: Type -> Type
|
||||||
|
skolemize (TVar (MkTVar a)) = TEVar $ MkTEVar a
|
||||||
|
skolemize (TAll x t) = TAll x (skolemize t)
|
||||||
|
skolemize (TFun t1 t2) = (TFun `on` skolemize) t1 t2
|
||||||
|
skolemize t = t
|
||||||
|
|
||||||
-- | A class for substitutions
|
-- | A class for substitutions
|
||||||
class SubstType t where
|
class SubstType t where
|
||||||
-- | Apply a substitution to t
|
-- | Apply a substitution to t
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue