Instantiating a type with fresh, flexi type variables
Simon Peyton-Jones
simonpj at microsoft.com
Tue Aug 20 00:11:22 CEST 2013
I'm a bit puzzled that you don't have a *quantified* type, something like
forall abc. ty1 -> ... -> tyn -> ty
to instantiate. I'm a bit suspicious about instantiating all the random free variables of a type (or types). We should talk now I'm back in circulation. What time zone are you in? What's your skype id? (Mine is simonpj0)
simon
| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Dr. ERDI
| Gergo
| Sent: 08 August 2013 18:37
| To: ghc-devs at haskell.org
| Subject: Instantiating a type with fresh, flexi type variables
|
| 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
|
| _______________________________________________
| ghc-devs mailing list
| ghc-devs at haskell.org
| http://www.haskell.org/mailman/listinfo/ghc-devs
More information about the ghc-devs
mailing list