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

GHC ghc-devs at haskell.org
Mon Feb 5 16:46:03 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 RyanGlScott):

 This happens because both strictness annotations (`!`) and `UNPACK`
 annotations can decorate //any// type, and moreover, they bind more
 tightly than application. Therefore, this:

 {{{#!hs
 {-# UNPACK #-} Maybe Int
 }}}

 is shorthand for this:

 {{{#!hs
 ({-# UNPACK #-} Maybe) Int
 }}}

 You'll notice that you'll get a similar error if you had written `a :: !
 Maybe Int`. So the error isn't incorrect—you are in fact putting `{-#
 UNPACK #-}` in the wrong place, and should have written it as `{-# UNPACK
 #-} (Maybe Int)`.

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


More information about the ghc-tickets mailing list