Skip to content

`:type-at` shows wrong type for some expressions that contain `case`

Summary

:type-at shows wrong type for some expressions that contain case. See below for example

Steps to reproduce

Using this code

module Main where

main :: IO ()
main = putStrLn (case (undefined :: Int) of _ -> undefined)

In GHCi:

ghci> :set +c
ghci> :l buggy.hs 
ghci> :type-at buggy.hs 4 8 4 59
 :: Int

Expected behavior

(4,8)-(4,59) is the whole expression putStrLn (... -> undefined) so the type should be:

 :: IO ()

Environment

  • GHC version used: 8.6.4

Optional:

  • Operating System: Linux
  • System Architecture: x86-64

/label ~bug /label needs triage

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