[commit: ghc] master: Remove PatSynBuilderId (2208011)

Simon Peyton Jones simonpj at microsoft.com
Mon Nov 9 11:48:36 UTC 2015


|  I don't think this would work in the case where there are no fields
|  initialised?

Oh yes, silly me.  I was thinking that then we wouldn’t need to look at 'labels' at all, but that's not true.

Well, at least then I'd replace [PostTc id [FieldLabel] with (PostTc ConLike).  This makes it like ConPatOut in HsPat.  Then the (Located id) field is redundant (we can get it from the ConLike), but that’s only true after typechecking, so maybe simpler to keep both.

It amounts to moving the call to conLikeFieldLabels from tcExpr (RecordCon ...) to dsExpr (RecordCon ...).  A small thing but I think it'd be better.

Simon

|  
|  Concretely, I am thinking of a case like this:
|  https://phabricator.haskell.org/P72
|  	
|  If I understand right, rbinds would be an empty list so there would be no
|  selector Id to get the relevant ConLike from.
|  
|  On Mon, Nov 9, 2015 at 10:20 AM, Simon Peyton Jones <simonpj at microsoft.com>
|  wrote:
|  > Matthew,
|  >
|  > |      Remove PatSynBuilderId
|  >
|  > Thanks for doing this.  But it can be simpler still!  Suggestion:
|  >
|  > - remove the new 'labels' field from RecordCon; you only use it in
|  > dsExpr
|  >
|  > - In dsExpr, use the hsRecFieldSel of the first item in 'rbinds' to
|  > get a selector-Id
|  >
|  > - Inside that selector-Id you'll find RecSelId IdInfo; you can use that to
|  >   get the labels.
|  >
|  > Would that work?
|  >
|  > Simon
|  >
|  > |  -----Original Message-----
|  > |  From: ghc-commits [mailto:ghc-commits-bounces at haskell.org] On
|  > | Behalf Of  git at git.haskell.org
|  > |  Sent: 07 November 2015 23:50
|  > |  To: ghc-commits at haskell.org
|  > |  Subject: [commit: ghc] master: Remove PatSynBuilderId (2208011)
|  > |
|  > |  Repository : ssh://git@git.haskell.org/ghc
|  > |
|  > |  On branch  : master
|  > |  Link       :
|  > |
|  https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fghc.haskell.
|  > |
|  > | org%2ftrac%2fghc%2fchangeset%2f22080113f02f6644e2a0e3ce8adb1502346ab
|  > | 3b4%2fgh
|  > |
|  > | c&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c761b0bb4068a4d3e
|  > | be4c08d2
|  > | e7ce3c86%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=SQ%2fUVBd2qpKc
|  > | BoN17ALE
|  > |  MES4qFLtEuWiJakOotW0IUM%3d
|  > |
|  > |  >---------------------------------------------------------------
|  > |
|  > |  commit 22080113f02f6644e2a0e3ce8adb1502346ab3b4
|  > |  Author: Matthew Pickering <matthewtpickering at gmail.com>
|  > |  Date:   Sat Nov 7 23:46:03 2015 +0000
|  > |
|  > |      Remove PatSynBuilderId
|  > |
|  > |      Summary:
|  > |      It was only used to pass field labels between the typechecker and
|  > |      desugarer. Instead we add an extra field the RecordCon to carry
|  this
|  > |      information.
|  > |
|  > |      Reviewers: austin, goldfire, bgamari
|  > |
|  > |      Reviewed By: bgamari
|  > |
|  > |      Subscribers: thomie
|  > |
|  > |      Differential Revision: https://phabricator.haskell.org/D1443
|  > |
|  > |      GHC Trac Issues: #11057
|  > |
|  > |
|  > |  >---------------------------------------------------------------
|  > |
|  > |  22080113f02f6644e2a0e3ce8adb1502346ab3b4
|  > |   compiler/basicTypes/Id.hs      | 11 +----------
|  > |   compiler/basicTypes/IdInfo.hs  |  3 ---
|  > |   compiler/deSugar/Coverage.hs   |  5 +++--
|  > |   compiler/deSugar/DsExpr.hs     |  4 +---
|  > |   compiler/deSugar/DsMeta.hs     |  2 +-
|  > |   compiler/hsSyn/Convert.hs      |  4 +++-
|  > |   compiler/hsSyn/HsExpr.hs       |  4 +++-
|  > |   compiler/hsSyn/PlaceHolder.hs  |  2 ++
|  > |   compiler/parser/RdrHsSyn.hs    |  4 ++--
|  > |   compiler/rename/RnExpr.hs      |  6 +++---
|  > |   compiler/typecheck/TcExpr.hs   |  5 +++--
|  > |   compiler/typecheck/TcHsSyn.hs  |  4 ++--
|  > | compiler/typecheck/TcPatSyn.hs |
|  > |  14 ++++++--------
|  > |   13 files changed, 30 insertions(+), 38 deletions(-)
|  > |
|  > |  Diff suppressed because of size. To see it, use:
|  > |
|  > |      git diff-tree --root --patch-with-stat --no-color
|  > | --find-copies-harder -  -ignore-space-at-eol --cc
|  > | 22080113f02f6644e2a0e3ce8adb1502346ab3b4
|  > |  _______________________________________________
|  > |  ghc-commits mailing list
|  > |  ghc-commits at haskell.org
|  > |
|  > | https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail
|  > | .haskell
|  > |  .org%2fcgi-bin%2fmailman%2flistinfo%2fghc-
|  > |
|  > | commits&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c761b0bb406
|  > | 8a4d3ebe
|  > | 4c08d2e7ce3c86%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=BnsSFmFF
|  > | BiglS%2b
|  > |  ZyKRkye9LUDZyIh7lDkRoyCLDvb9U%3d


More information about the ghc-devs mailing list