[GHC] #14761: Incorrect diagnostic for UNPACK/missing strictness

GHC ghc-devs at haskell.org
Tue Feb 6 08:43:49 UTC 2018


#14761: Incorrect diagnostic for UNPACK/missing strictness
-------------------------------------+-------------------------------------
        Reporter:  dminuoso          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #7210             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Both `{-# UNPACK #-}` and `!` only make sense at the outer level of a type
 in a data constructor field. But in GADT-style declarations, they can
 appear to be "inside" a type
 {{{
 data T where
   K :: !(Maybe Int) -> {-# UNPACK #-} !Int -> T
 }}}
 Somehow `!` looks as if it should bind tightly. e.g.  `!Maybe Int -> T`
 looks wrong.  But I agree that `{-# UNPACK #-}` would be better with a
 lower precedence.

 Since these annotations/pragmas can't occur nested (except as above), I
 don't think it would be a breaking change to reduce the precedence of `{-#
 UNPACK #-}` if someone wants to make a proposal.

 Meanwhile, yes, the error message should be better.  Something about
 saying `{-# UNPACK #-}` cannot appear nested inside a type might help?

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14761#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list