Skip to content

GHC 8.0 type assignment in arguments of lambda working without Scoped Type Variables

Not sure if this was intentional or not.

This compiles under GHC 8.0.0.20160221

module Main where

import Control.Exception
import System.IO

main =
  writeFile "zzz" "hi"
  `catch` (\(e :: SomeException) -> return ())

Run with an unwritable file named "zzz" in the directory, it ends without complaint.

Run under GHC 7.10.3, it throws an error at compilation time:

code/printPls.hs:8:19:
    Illegal type signature: ‘SomeException’
      Perhaps you intended to use ScopedTypeVariables
    In a pattern type-signature

Did something intentionally change to make this compile out of the box?

When I add:

{-# LANGUAGE ScopedTypeVariables #-}

Both versions compile. This distinction holds in GHCi as well.

Trac metadata
Trac field Value
Version 8.0.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by bitemyapp
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information