stripUnknowns names id = setIdType id . sigmaType . fst . go names . idType
$ id
where
- sigmaType ty = mkForAllTys (varSetElems$ tyVarsOfType (dropForAlls ty)) ty
go tyvarsNames@(v:vv) ty
| Just (ty1,ty2) <- splitFunTy_maybe ty = let
(ty1',vv') = go tyvarsNames ty1
isPointed,
isFullyEvaluatedTerm,
-- unsafeDeepSeq,
+
+ sigmaType
) where
#include "HsVersions.h"
| Nothing <- mb_ty = runTR hsc_env . go argTypeKind $ hval
| Just ty <- mb_ty = runTR hsc_env $ do
term <- go argTypeKind hval
- ty' <- instScheme ty
+ ty' <- instScheme (sigmaType ty)
addConstraint ty' (fromMaybe (error "by definition")
(termType term))
return term
,fSuspension = \ct ty v b -> fmapMMaybe zonkTcType ty >>= \ty ->
return (Suspension ct ty v b)}
+
+-- Is this defined elsewhere?
+-- Find all free tyvars and insert the appropiate ForAll.
+sigmaType ty = mkForAllTys (varSetElems$ tyVarsOfType (dropForAlls ty)) ty
+
{-
Example of Type Reconstruction
--------------------------------