[GHC] #15470: Record projections with ambiguous types
GHC
ghc-devs at haskell.org
Wed Sep 12 15:22:40 UTC 2018
#15470: Record projections with ambiguous types
-------------------------------------+-------------------------------------
Reporter: sweirich | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: 8.8.1
Component: Compiler | Version: 8.4.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
I forgot to put in the diff
{{{
modified compiler/typecheck/TcTyDecls.hs
@@ -893,7 +893,7 @@ mkOneRecordSelector all_cons idDetails fl
| otherwise = map mk_match cons_w_field ++ deflt
mk_match con = mkSimpleMatch (mkPrefixFunRhs sel_lname)
[L loc (mk_sel_pat con)]
- (L loc (HsVar noExt (L loc field_var)))
+ match_body
mk_sel_pat con = ConPatIn (L loc (getName con)) (RecCon rec_fields)
rec_fields = HsRecFields { rec_flds = [rec_field], rec_dotdot =
Nothing }
rec_field = noLoc (HsRecField
@@ -905,6 +905,19 @@ mkOneRecordSelector all_cons idDetails fl
sel_lname = L loc sel_name
field_var = mkInternalName (mkBuiltinUnique 1) (getOccName sel_name)
loc
+ match_body = L loc (HsVar noExt (L loc field_var))
+{-
+ match_body = foldl app_tv (L loc (HsVar noExt (L loc field_var)))
field_tvs
+
+ app_tv :: LHsExpr GhcRn -> TyVar -> LHsExpr GhcRn
+ app_tv hs_fun tv = L loc (HsAppType (mk_tv_ty tv) hs_fun)
+
+ mk_tv_ty :: TyVar -> LHsWcType GhcRn
+ mk_tv_ty tv = mkEmptyWildCardBndrs $ L loc $
+ HsTyVar noExt NotPromoted $
+ L loc (getName tv)
+-}
}}}
If you try commenting out the definition of `match_body` and replacing it
with the one that is commented out in this diff, you get my attempt.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15470#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list