
#14295: tagToEnum# leads to some silly closures -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: datacon-tags Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I think we can do better. Add a `BuiltInRule` for `tagToEnum#`. {{{ tagToEnum# Bool ===> \x -> case x of 0# -> False 1# -> True DEFAULT -> error "blah" }}} The rule can fire whenever `tagToEnum#` is applied to a known type, albeit perhaps one without too many constructors. It's a bit like inlining `tagToEnum#`. }}} The built-in rule mechanism works well; we can use it here too. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14295#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler