
#8318: GHC does not infer type of `tagToEnum#` expression ----------------------------------------------+---------------------------- Reporter: jstolarek | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects valid program | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ----------------------------------------------+---------------------------- Comment (by jstolarek): Compiling this program: {{{ {-# LANGUAGE MagicHash, UnboxedTuples #-} module TTE where import GHC.Prim import GHC.Base g :: IO Bool g = IO $ \s# -> (# s#, tagToEnum# 1# #) }}} produces: {{{ [1 of 1] Compiling TTE ( tte.hs, tte.o ) tte.hs:11:24: Bad call to tagToEnum# at type a_azp Specify the type by giving a type signature e.g. (tagToEnum# x) :: Bool In the expression: tagToEnum# 1# In the expression: (# s#, tagToEnum# 1# #) In the second argument of ‛($)’, namely ‛\ s# -> (# s#, tagToEnum# 1# #) }}} So the informative error message is already somewhere in the compiler. I wonder why don't we infer the type here? After all the error message clearly states what type is necessary. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8318#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler