Skip to content

PartialTypeSignatures change implicit CallStack behavior

I'm using GHC head at 062feee4

I have two functions, f and f2 which are identical expect for the use of PartialTypeSignatures in f2. GHC produces a warning and says that f2's wildcard is filled in by String, which is correct.

{-# LANGUAGE ImplicitParams, PartialTypeSignatures #-}

import GHC.Types

f :: (?loc :: CallStack) => String
f = show $ map (srcLocStartLine . snd) $ getCallStack ?loc

f2 :: (?loc :: CallStack) => _
f2 = show $ map (srcLocStartLine . snd) $ getCallStack ?loc

f_caller = f
f2_caller = f2
[1 of 1] Compiling Main             ( Bug2.hs, interpreted )

Bug2.hs:8:30: warning:
    Found type wildcard ‘_’ standing for ‘String’
    In the type signature for:
      f2 :: (?loc :: CallStack) => _
Ok, modules loaded: Main.
*Main> f_caller
"[6,11]"
*Main> f2_caller
"[9]"

f2_caller should have two entries (f2_caller's line and f2's line), just like f_caller.

Edited by nitromaster101
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information