Re: [GHC] #7808: data families and TH names do not mix well (e.g. cannot use TH deriving)

#7808: data families and TH names do not mix well (e.g. cannot use TH deriving) -------------------------------------+------------------------------------- Reporter: duncan | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.6.2 Resolution: | Keywords: TypeFamilies 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): Apologies for commenting on an extremely old Trac ticket. The way I tackle this problem in libraries like `bifunctors` (see [http://hackage.haskell.org/package/bifunctors-5.4.1/docs/Data-Bifunctor- TH.html#v:deriveBifunctor Data.Bifunctor.TH]) is by allowing functions of the form `:: Name -> Q a` to take either a type constructor `Name` (for a plain datatype) or a data constructor `Name` (for a data family instance). The TH code is able to look up the original data family instance from any of its data constructor names, so it works, although it's a bit awkward. There's also the drawback that you can't do this trick for data family instances with no constructors... but how useful are those, really? :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7808#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC