[GHC] #14776: Add equality rule for `eqString`

#14776: Add equality rule for `eqString` -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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: -------------------------------------+------------------------------------- Locally I sometimes have to define a rule {{{ {-# RULES "eqStringEQ" forall x . eqString x x = True #-} }}} in order for "stuck" expressions to evaluate to `True` and for a case expression to be eliminated. Is there is a reason not to include this RULE directly in GHC.Base? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14776 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14776: Add equality rule for `eqString` -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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): I see no reason not to do that. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14776#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14776: Add equality rule for `eqString` -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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 carter): That’s no sound for floating point when nan is treated as a valid value rather than an error/ exception trigger. In the former case this optimization will break ALL isNan code in Haskell. If we also have a mode where calculations that would produce a nan throw an exception, this rule would be safe. Is there a way to provide this rule but prevent it from running on floats and doubles ? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14776#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14776: Add equality rule for `eqString` -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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 carter): To clarify, x==x evaluates to false for nans... at least with value equality.. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14776#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14776: Add equality rule for `eqString` -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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): This is specifically about `eqString` rather than generally `==` so I don't think that applies? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14776#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14776: Add equality rule for `eqString` -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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 carter): woops, i misread this ticket, please ignore my remarks :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14776#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC