[GHC] #10181: Lint check: arity invariant

GHC ghc-devs at haskell.org
Sun Mar 22 17:53:24 UTC 2015


#10181: Lint check: arity invariant
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                   Owner:  nomeata
            Type:  task              |                  Status:  infoneeded
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.11
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by nomeata):

 * status:  new => infoneeded


Comment:

 GHC compiles with this lint check, but not the test suite:

 The invariant `idArity <= typeArity` fails to hold in the situation of
 #8743:

 {{{
 T8743.hs-boot:3:10: Warning:
     [RHS of $fxToRowMaybe :: forall a_ani. ToRow (Maybe a_ani)]
     idArity 1 exceeds typeArity 0: $fxToRowMaybe
 }}}

 Here `ToRow` is a one-member class that is also imported with a self-
 source-import
 {{{
 module T8743 where
 import {-# SOURCE #-} T8743 ()
 class ToRow a where toRow :: a -> [()]
 instance ToRow (Maybe a) where
     toRow Nothing  = [()]
     toRow (Just _) = [()]
 }}}

 So presumably due to the SOURCE import, `typeArity` is unable to look
 through the newtype `ToRow`.

 Maybe it is better done as a lint warning, and not a lint error?

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


More information about the ghc-tickets mailing list