
#13403: Derive instances (Applicative, Monad, ...) for structures lifted over functors -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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): This feels extremely //ad hoc// and not nearly formalized enough to where I'd be comfortable with it. One nice thing about `deriving` is that it tends to work with ~90% of the datatypes you'd use regularly, but with this proposal, it feels closer to <50%. I have no idea how you could teach GHC to recognize "product types" in a way that's uniform and comprehensive. What happens when there are more than two fields? What happens when you have arbitrary nestings of types like `data Product f g h a = Product (f (g (f a))) (h (f (g a)))`? What if there are constants like `data Product a = Product Int a`? But I'm even more concerned about what this proposed feature would do on things that //aren't// of the particular form that you've labeled "product types". What happens with: * `newtype Compose f g a = Compose (f (g a))` * `data Proxy a = Proxy` and so on? What would the error messages be like in cases where it wouldn't work? I'm quite skeptical that this could be made workable. -1 from me. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13403#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler