[GHC] #12224: Replace placeHolderPunRhs with a PlaceHolder value
GHC
ghc-devs at haskell.org
Sun Nov 6 16:46:25 UTC 2016
#12224: Replace placeHolderPunRhs with a PlaceHolder value
-------------------------------------+-------------------------------------
Reporter: alanz | Owner: alanz
Type: task | Status: new
Priority: normal | Milestone: 8.2.1
Component: Compiler | Version: 8.0.1
(Parser) |
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 RyanGlScott):
alanz, presumably you're talking this datatype in `HsPat`?
{{{#!hs
-- For details on above see note [Api annotations] in ApiAnnotation
data HsRecField' id arg = HsRecField {
hsRecFieldLbl :: Located id,
hsRecFieldArg :: arg, -- ^ Filled in by renamer when
punning
hsRecPun :: Bool -- ^ Note [Punning]
} deriving (Data, Functor, Foldable, Traversable)
}}}
And you want to change `hsRecFieldArg` to be of type `PostRn id arg`? If
so, I don't think you'll be able to derive `Functor`, `Foldable`, or
`Traversable` anymore, since GHC won't know what code to fill in for the
irreducible type family `PostRn id arg`. One possible workaround is to
define your `Functor` instances manually:
{{{#!hs
instance Functor (HsRecField' Id) where
fmap f (HsRecField a b c) = HsRecField a (f b) c
instance Functor (HsRecField' Name) where
fmap _ (HsRecField a b c) = HsRecField a b c
instance Functor (HsRecField' RdrName) where
fmap _ (HsRecField a b c) = HsRecField a b c
}}}
and similarly for `Foldable` and `Traversable`. It's not the prettiest
solution, but I think it might work for GHC's purposes.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12224#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list