[GHC] #13558: Inconsistency in `CoreUtils.exprIsOk`

GHC ghc-devs at haskell.org
Mon Apr 10 14:21:27 UTC 2017


#13558: Inconsistency in `CoreUtils.exprIsOk`
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Consider
 {{{
 f1 = \x y -> let t = case x of
                       True  -> let v = Just y
                                in (v, v)
                       False -> (Nothing, Nothing)
              in \w -> t

 f2 = \x y -> let t = case x of
                       True  -> (Just y, Just y)
                       False -> (Nothing, Nothing)
              in \w -> t
 }}}
 We give `f1` arity 1, but `f2` gets arity 2.  That's bizarre, because all
 we've done is turn a `let` into a function application.

 Reason: in `CoreUtils.exprIsOk`, we recursively apply `go` in the `App`
 case, but we fail unconditionally in the `Let` case.  That is simply
 inconsistent, and it bit me when trying something else.

 Incidentally `exprIsOk` is badly named.

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


More information about the ghc-tickets mailing list