Fixity of field-deconstructors incorrect
The example below
module Foo where
data SomeException
newtype ContT r m a = ContT {runContT :: (a -> m r) -> m r}
runContT' :: ContT r m a -> (a -> m r) -> m r
runContT' = runContT
catch_ :: IO a -> (SomeException -> IO a) -> IO a
catch_ = undefined
-- has type error
foo :: IO ()
foo = (undefined :: ContT () IO a) `runContT` (undefined :: a -> IO ()) `catch_` (undefined :: SomeException -> IO ())
-- typechecks
foo' :: IO ()
foo' = (undefined :: ContT () IO a) `runContT'` (undefined :: a -> IO ()) `catch_` (undefined :: SomeException -> IO ())
works with GHC 7.10 but breaks with GHC HEAD currently with:
foo.hs:15:47: error:
• Couldn't match expected type ‘a0 -> IO ()’
with actual type ‘IO ()’
• In the second argument of ‘runContT’, namely
‘(undefined :: a -> IO ())
`catch_` (undefined :: SomeException -> IO ())’
In the expression:
runContT
(undefined :: ContT () IO a)
(undefined :: a -> IO ())
`catch_` (undefined :: SomeException -> IO ())
In an equation for ‘foo’:
foo
= runContT
(undefined :: ContT () IO a)
(undefined :: a -> IO ())
`catch_` (undefined :: SomeException -> IO ())
foo.hs:15:48: error:
• Couldn't match expected type ‘IO ()’
with actual type ‘a1 -> IO ()’
• In the first argument of ‘catch_’, namely
‘(undefined :: a -> IO ())’
In the second argument of ‘runContT’, namely
‘(undefined :: a -> IO ())
`catch_` (undefined :: SomeException -> IO ())’
In the expression:
runContT
(undefined :: ContT () IO a)
(undefined :: a -> IO ())
`catch_` (undefined :: SomeException -> IO ())
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | highest |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |