[GHC] #16364: Derived Enum for small number of constructors seems suboptimal
GHC
ghc-devs at haskell.org
Tue Feb 26 10:04:16 UTC 2019
#16364: Derived Enum for small number of constructors seems suboptimal
-------------------------------------+-------------------------------------
Reporter: Fuuzetsu | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.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):
I agree that a straight pattern-match on the tag might be better, at least
for small enumerations.
Another interesting question is this: what is the behaviour of the
primitive operation `tagToEnum#` when given an out-of-range tag? Does it
crash somehow, return a bogus answer, or call `error`? It think it might
be the former, relying on the caller to check for out-of-range cases, like
array indexing. We should document this properly.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16364#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list