[GHC] #11298: Implicit call stack empty in instance declarations

GHC ghc-devs at haskell.org
Sun Dec 27 06:38:06 UTC 2015


#11298: Implicit call stack empty in instance declarations
-------------------------------------+-------------------------------------
        Reporter:  pikajude          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.11
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by pikajude:

Old description:

> Given the following code:
>
> {{{#!hs
> {-# LANGUAGE ImplicitParams #-}
>
> import GHC.Stack
>
> class Foo a where
>     foo :: a -> String
>
> main = putStrLn $ foo ()
> }}}
>
> In GHC 7.11.20151216, the following instances result in no output:
>
> {{{#!hs
> instance Foo () where
>     foo () = prettyCallStack ?loc
> }}}
>

> {{{#!hs
> fooHelper = prettyCallStack ?loc
>
> instance Foo () where
>     foo () = fooHelper
> }}}
>
> Though this one does:
>
> {{{#!hs
> fooHelper () = prettyCallStack ?loc
>
> instance Foo () where
>     foo = fooHelper
> }}}
>
> Including explicit signatures with `-XInstanceSigs` has no effect.
>
> The aforementioned instances all yield output with GHC 7.10.3 (after
> replacing `prettyCallStack` with `showCallStack`):
>
> {{{
> ?loc, called at implicit.hs:9:28 in main:Main
> }}}

New description:

 Given the following code:

 {{{#!hs
 {-# LANGUAGE ImplicitParams #-}

 import GHC.Stack

 class Foo a where
     foo :: a -> String

 main = putStrLn $ foo ()
 }}}

 In GHC 7.11.20151216, the following instances result in no output:

 {{{#!hs
 instance Foo () where
     foo () = prettyCallStack ?loc
 }}}


 {{{#!hs
 fooHelper = prettyCallStack ?loc

 instance Foo () where
     foo () = fooHelper
 }}}

 Though this one does:

 {{{#!hs
 fooHelper () = prettyCallStack ?loc

 instance Foo () where
     foo = fooHelper

 {-
 CallStack (from ImplicitParams):
   fooHelper, called at implicit.hs:11:11 in main:Main
 -}
 }}}

 Including explicit signatures with `-XInstanceSigs` has no effect.

 The aforementioned instances all yield output with GHC 7.10.3 (after
 replacing `prettyCallStack` with `showCallStack`):

 {{{
 ?loc, called at implicit.hs:9:28 in main:Main
 }}}

--

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


More information about the ghc-tickets mailing list