[GHC] #11552: ScopedTypeVariables / InstanceSigs do not work in GHC 8.0
GHC
ghc-devs at haskell.org
Sun Feb 7 05:18:29 UTC 2016
#11552: ScopedTypeVariables / InstanceSigs do not work in GHC 8.0
-------------------------------------+-------------------------------------
Reporter: bitemyapp | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version: 8.0.1-rc1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: GHC rejects
Unknown/Multiple | valid program
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
{{{
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE ScopedTypeVariables #-}
module MyMaybeT where
newtype MaybeT m a =
MaybeT { runMaybeT :: m (Maybe a) }
instance (Functor m) => Functor (MaybeT m) where
fmap f (MaybeT ma) =
MaybeT $ (fmap . fmap) f ma
instance forall f . (Applicative f) => Applicative (MaybeT f) where
pure :: a -> MaybeT f a
pure x = MaybeT (pure (pure x))
(<*>) :: forall a b . Applicative f => MaybeT f (a -> b) -> MaybeT f a
-> MaybeT f b
(MaybeT fab) <*> (MaybeT mma) =
let fab' :: f (Maybe (a -> b))
fab' = fab
in MaybeT $ undefined
}}}
Works fine in 7.10.3, breaks in GHC 8.0:
{{{
Prelude> :l code/myMaybeT1.hs
[1 of 1] Compiling MyMaybeT ( code/myMaybeT1.hs, interpreted )
code/myMaybeT1.hs:13:10: error:
Malformed instance: forall f.
(Applicative f) => Applicative (MaybeT f)
code/myMaybeT1.hs:14:3: error:
The class method signature for ‘pure’ lacks an accompanying binding
(The class method signature must be given where ‘pure’ is declared)
code/myMaybeT1.hs:17:3: error:
The class method signature for ‘<*>’ lacks an accompanying binding
(The class method signature must be given where ‘<*>’ is declared)
code/myMaybeT1.hs:17:37: error: Not in scope: type variable ‘f’
code/myMaybeT1.hs:17:49: error: Not in scope: type variable ‘f’
code/myMaybeT1.hs:17:70: error: Not in scope: type variable ‘f’
code/myMaybeT1.hs:17:84: error: Not in scope: type variable ‘f’
Failed, modules loaded: none.
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11552>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list