Commit f6b98ea7 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Tiny refactor; use guards instead of 'if'

parent 160765f8
......@@ -1237,13 +1237,13 @@ mkPiTypesPreferFunTy :: [TyVar] -> Type -> Type
mkPiTypesPreferFunTy vars inner_ty = fst $ go vars inner_ty
where
go :: [TyVar] -> Type -> (Type, VarSet) -- also returns the free vars
go [] ty = (ty, tyCoVarsOfType ty)
go (v:vs) ty
= if v `elemVarSet` fvs
then ( mkForAllTy (Named v Visible) qty
, fvs `delVarSet` v `unionVarSet` kind_vars )
else ( mkForAllTy (Anon (tyVarKind v)) qty
, fvs `unionVarSet` kind_vars )
go [] ty = (ty, tyCoVarsOfType ty)
go (v:vs) ty | v `elemVarSet` fvs
= ( mkForAllTy (Named v Visible) qty
, fvs `delVarSet` v `unionVarSet` kind_vars )
| otherwise
= ( mkForAllTy (Anon (tyVarKind v)) qty
, fvs `unionVarSet` kind_vars )
where
(qty, fvs) = go vs ty
kind_vars = tyCoVarsOfType $ tyVarKind v
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment