[GHC] #10845: Incorrect behavior when let binding implicit CallStack object

GHC ghc-devs at haskell.org
Sat Sep 5 23:26:49 UTC 2015


#10845: Incorrect behavior when let binding implicit CallStack object
-------------------------------------+-------------------------------------
              Reporter:              |             Owner:
  nitromaster101                     |
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.11
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 I'm trying out ghc HEAD at 062feee4e7408ad5b9d882e5fed2c700e337db72.

 {{{#!hs

 {-# LANGUAGE ImplicitParams #-}

 import GHC.Types

 f :: (?loc :: CallStack) => Int
 f = let y = length $ getCallStack ?loc
     in if y < 2 then 3 else 4

 f2 :: (?loc :: CallStack) => Int
 f2 = if (length $ getCallStack ?loc) < 2 then 3 else 4

 f3 :: (?loc :: [Int]) => Int
 f3 = let y = length ?loc
     in if y < 2 then 3 else 4
 }}}

 produces:

 {{{
 [1 of 1] Compiling Main             ( Bug.hs, interpreted )

 Bug.hs:5:6: warning:
     Redundant constraint: ?loc::CallStack
     In the type signature for:
          f :: (?loc::CallStack) => Int
 }}}

 f3 doesn't produce an error which makes me think it's related to CallStack
 handling. The warning seems accurate: the returned callstack only contains
 the entry at f.

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


More information about the ghc-tickets mailing list