[Type-constraints] Proof-of-concept

This commit is contained in:
Nikolay Yakimov
2016-01-18 03:51:03 +03:00
parent 566dbebe29
commit 88f61724d4
3 changed files with 33 additions and 3 deletions

View File

@@ -316,11 +316,13 @@ setWarnTypedHoles = id
----------------------------------------------------------------
class HasType a where
getId :: GhcMonad m => TypecheckedModule -> a -> m ([Id])
getType :: GhcMonad m => TypecheckedModule -> a -> m (Maybe (SrcSpan, Type))
instance HasType (LHsBind Id) where
#if __GLASGOW_HASKELL__ >= 708
getId _ b = return $ collectHsBindBinders (unLoc b)
getType _ (L spn FunBind{fun_matches = m}) = return $ Just (spn, typ)
where in_tys = mg_arg_tys m
out_typ = mg_res_ty m