Skip to content

Type checker no longer accepting code using function composition and rank-n types

The following program (reduced from Cabal code that uses HasCallStack) typechecks in GHC 8.0, but not on HEAD:

{-# LANGUAGE RankNTypes #-} 
{-# LANGUAGE ImplicitParams #-} 
module Foo where 

type T a = (?x :: Int) => a 
type M a = T (IO a) 

f :: T (T a -> a) 
f x = x 

g :: Int -> M () 
g = undefined 

h :: Int -> M () 
-- h x = f (g x) -- works on HEAD
h = f . g -- fails on HEAD, works on GHC 8.0

It's possible that this is just fall out from the recent impredicativity changes but I just wanted to make sure that this was on purpose.

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