
#10447: DeriveFoldable rejects instances with constraints in last argument of data type -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #8678 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by RyanGlScott): OK, I can live with that. That way, I can derive {{{Foldable}}} for any GADT and still fold over all the terms that have types equal to the last type parameter (up to rewriting {{{Con :: PlainTy -> PlainTy -> ... -> GADT PlainTy}}} as {{{Con :: a ~ PlainTy => a -> a -> ... -> GADT a}}}). I'm not the original author of the {{{DeriveFunctor/Foldable/Traversable}}} extensions, but I'd be willing to help write a wiki article on how they currently work (and how {{{DeriveFoldable}}} will eventually work). Is there a good template article from which I could adapt? All I know about the {{{deriving}}} algorithms is what I gleaned from [http://git.haskell.org/ghc.git/blob/9f968e97a0de9c2509da00f6337b612dd72a0389... comments] in [http://git.haskell.org/ghc.git/blob/9f968e97a0de9c2509da00f6337b612dd72a0389... TcDeriv.hs], [http://git.haskell.org/ghc.git/blob/9f968e97a0de9c2509da00f6337b612dd72a0389... as] well [http://git.haskell.org/ghc.git/blob/9f968e97a0de9c2509da00f6337b612dd72a0389... as] from [http://git.haskell.org/ghc.git/blob/9f968e97a0de9c2509da00f6337b612dd72a0389... TcGenDeriv.hs], but they may be too formal for wiki purposes. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10447#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler