Instantiating a type with fresh, flexi type variables
Dr. ERDI Gergo
gergo at erdi.hu
Thu Aug 8 19:36:45 CEST 2013
For my pattern-synonyms branch (see prev. email) I had to write the
following function, incl. making TcValidity.fvTypes public:
tcInstTypes :: [TcType] -> TcM [TcType]
tcInstTypes tys
= do { let tvs = fvTypes tys
; (_, _, subst) <- tcInstTyVars tvs
; return $ map (substTy subst) tys }
I'm surprised I had to write this myself, and this made me wonder if
there's a much better way to handle cases where I have some kind of
definition which has some inferred type, and then various use sites
of that definition must all have types that can be unified with this
original inferred type.
Is there?
Thanks,
Gergo
More information about the ghc-devs
mailing list