Type inference regression with Any
The following module typechecks with GHC 7.8.3, but GHC 7.10.1 gives an error:
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module Foo where
import GHC.Exts (Any)
class MonadState s m where
get :: m s
newtype State s a = State (s -> (s, a))
instance MonadState s (State s) where
get = State $ \s -> (s, s)
foo :: State Any Any
foo = get
[1 of 1] Compiling Foo ( any.hs, any.o )
any.hs:15:7:
No instance for (MonadState Any (State Any))
arising from a use of ‘get’
In the expression: get
In an equation for ‘foo’: foo = get
If I replace the uses of Any with Int, the problem goes away.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |