[GHC] #15512: Rewrite rules should be able to produce custom compiler errors

#15512: Rewrite rules should be able to produce custom compiler errors -------------------------------------+------------------------------------- Reporter: ChaiTRex | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 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: -------------------------------------+------------------------------------- It would be nice if rewrite rules could produce compiler errors with custom messages when a certain combination of functions can only produce bottom or some other suitably undesirable outcome. For example, `length . cycle` is either never going to terminate or is going to give an error message (''e''.''g''., if the input list is empty). It would be nice to be able to tell the programmer that at compile time. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15512 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15512: Rewrite rules should be able to produce custom compiler errors -------------------------------------+------------------------------------- Reporter: ChaiTRex | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 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 mpickering): I don't think this is the place of the simple mechanism of rewrite rules. This can be implemented using a compiler plugin and users could specify rules in the same manner as a rewrite rule. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15512#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15512: Rewrite rules should be able to produce custom compiler errors -------------------------------------+------------------------------------- Reporter: ChaiTRex | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: fixed | 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: | -------------------------------------+------------------------------------- Changes (by ChaiTRex): * status: new => closed * resolution: => fixed Comment: OK, no problem. On these sorts of suggestions that I find out are not good ideas, how should I close the tickets? As "invalid"? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15512#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15512: Rewrite rules should be able to produce custom compiler errors -------------------------------------+------------------------------------- Reporter: ChaiTRex | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 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: | -------------------------------------+------------------------------------- Changes (by ChaiTRex): * status: closed => new * resolution: fixed => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15512#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15512: Rewrite rules should be able to produce custom compiler errors -------------------------------------+------------------------------------- Reporter: ChaiTRex | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 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 simonpj): You could rewrite {{{ forall x. length (cycle x) = error "length of cycle error" }}} but it would still be a run-time error, not a compile-time error. It's not clear how to achieve the latter. e.g. {{{ let v = length (cycle x) in if ... then ...v... else True }}} then `v` might never be evaluated. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15512#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC