[GHC] #13117: Derived functor instance for void types handles errors badly

#13117: Derived functor instance for void types handles errors badly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: feature | Status: new request | Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If we have {{{#!hs data V a deriving (Functor) }}} and we evaluate {{{#!hs f <$> (error "Boo!" :: Void) }}} we should really get a "Boo" error, rather than a useless "Void fmap" one. The offending code is in `compiler/typecheck/TcGenFunctor.hs`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13117 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13117: Derived functor instance for void types handles errors badly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 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 andreas.abel): What should the implementation of `fmap` be here? {{{#!hs fmap _ x = x `seq` error "Void fmap" }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13117#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13117: Derived functor instance for void types handles errors badly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 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 dfeuer): My preference would be {{{#!hs fmap _ x = case x of }}} (effectively using `EmptyCase`). mpickering indicates there was some prior dispute about this, but I don't know where. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13117#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13117: Derived functor instance for void types handles errors badly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 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: #7401 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #7401 Comment: The discussion is at #7401, which proposed an overhaul of the way derived instances for void types work. Ultimately, a consensus was never reached as to how derived `Eq` instances should work. See https://ghc.haskell.org/trac/ghc/ticket/7401#comment:46. If someone would be willing revive that discussion and advocate for a position, I'd be very appreciative, as I'm hesitant to poke that sleeping dragon again :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13117#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13117: Derived functor instance for void types handles errors badly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 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: #7401 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): David has started a new discussion about this proposed change at the Haskell libraries mailing list here: https://mail.haskell.org/pipermail/libraries/2017-January/027590.html -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13117#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13117: Derived functor instance for void types handles errors badly
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: dfeuer
Type: feature request | Status: new
Priority: normal | Milestone: 8.2.1
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: #7401 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by David Feuer

#13117: Derived functor instance for void types handles errors badly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 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: #7401 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): There are still several types that have not reached what I'd consider a good final status, but as Ryan indicates, we need more discussion to get that done. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13117#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13117: Derived functor instance for void types handles errors badly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 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: #7401, #10577 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: #7401 => #7401, #10577 Comment: Indeed. However, this ticket specifically concerns `Functor`, right? It might be best to tackle the other classes in #10577. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13117#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13117: Derived functor instance for void types handles errors badly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: feature request | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #7401, #10577 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by dfeuer): * status: new => closed * resolution: => fixed Comment: Replying to [comment:7 RyanGlScott]:
Indeed. However, this ticket specifically concerns `Functor`, right? It might be best to tackle the other classes in #10577.
Indeed! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13117#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13117: Derived functor instance for void types handles errors badly -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: dfeuer Type: feature request | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: deriving Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #7401, #10577 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => deriving -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13117#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13117: Derived functor instance for void types handles errors badly
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: dfeuer
Type: feature request | Status: closed
Priority: normal | Milestone: 8.2.1
Component: Compiler | Version: 8.0.1
Resolution: fixed | Keywords: deriving
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #7401, #10577 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari
participants (1)
-
GHC