[GHC] #9590: AMP breaks `haskell2010` package

GHC ghc-devs at haskell.org
Mon Sep 15 06:56:46 UTC 2014


#9590: AMP breaks `haskell2010` package
-------------------------------------+-------------------------------------
              Reporter:  hvr         |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  high        |        Milestone:  7.10.1
             Component:              |          Version:  7.9
  libraries/haskell2010              |         Keywords:  AMP
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:  GHC         |  Related Tickets:
  rejects valid program              |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Old description:

> (and probably also `haskell98`)
>
> I hate to be the one pointing this out, but the AMP has one ugly side-
> effect.
>
> Consider the following session:
>
> {{{
> $ inplace/bin/ghc-stage2 --interactive -XHaskell2010 -hide-all-packages
> -package haskell2010
> GHCi, version 7.9.20140914: http://www.haskell.org/ghc/  :? for help
> Loading package ghc-prim-0.3.1.0 ... linking ... done.
> Loading package integer-gmp-0.5.1.0 ... linking ... done.
> Loading package base-4.8.0.0 ... linking ... done.
> Loading package array-0.5.0.1 ... linking ... done.
> Loading package haskell2010-1.1.2.1 ... linking ... done.
>
> λ:2> data Identity a = Identity a
> data Identity a = Identity a
>
> λ:3> instance Monad Identity
>
> <interactive>:3:10:
>     No instance for (base-4.8.0.0:GHC.Base.Applicative Identity) arising
> from the superclasses of an instance declaration
>     In the instance declaration for ‘Monad Identity’
>
> λ:4> :info Monad
> class base-4.8.0.0:GHC.Base.Applicative m => Monad (m :: * -> *) where
>   (>>=) :: m a -> (a -> m b) -> m b
>   (>>) :: m a -> m b -> m b
>   return :: a -> m a
>   fail :: String -> m a
>         -- Defined in ‘base-4.8.0.0:GHC.Base’
> instance Monad (Either e) -- Defined in ‘base-4.8.0.0:Data.Either’
> instance Monad Maybe -- Defined in ‘base-4.8.0.0:Data.Maybe’
> instance Monad [] -- Defined in ‘base-4.8.0.0:GHC.Base’
> instance Monad IO -- Defined in ‘base-4.8.0.0:GHC.Base’
> instance Monad ((->) r) -- Defined in ‘base-4.8.0.0:GHC.Base’
> λ:5>
>

> }}}

New description:

 (and probably also `haskell98`)

 I hate to be the one pointing this out, but the AMP has one ugly side-
 effect:

 As of now, GHC HEAD rejects Haskell2010 programs (which know nothing about
 the `Applicative` class). Moreover, there's no simple way to access the
 `Applicative` class in order to write an instance to satisfy non-standard
 superclass requirement, so it's impossible to define custom `Monad`
 instances.

 For instance, consider the following session which worked in GHC 7.6.3
 (albeit with an AMP warning):

 {{{
 $ inplace/bin/ghc-stage2 --interactive -XHaskell2010 -hide-all-packages
 -package haskell2010
 GHCi, version 7.9.20140914: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim-0.3.1.0 ... linking ... done.
 Loading package integer-gmp-0.5.1.0 ... linking ... done.
 Loading package base-4.8.0.0 ... linking ... done.
 Loading package array-0.5.0.1 ... linking ... done.
 Loading package haskell2010-1.1.2.1 ... linking ... done.

 λ:2> data Identity a = Identity a
 data Identity a = Identity a

 λ:3> instance Monad Identity

 <interactive>:3:10:
     No instance for (base-4.8.0.0:GHC.Base.Applicative Identity) arising
 from the superclasses of an instance declaration
     In the instance declaration for ‘Monad Identity’

 λ:4> :info Monad
 class base-4.8.0.0:GHC.Base.Applicative m => Monad (m :: * -> *) where
   (>>=) :: m a -> (a -> m b) -> m b
   (>>) :: m a -> m b -> m b
   return :: a -> m a
   fail :: String -> m a
         -- Defined in ‘base-4.8.0.0:GHC.Base’
 instance Monad (Either e) -- Defined in ‘base-4.8.0.0:Data.Either’
 instance Monad Maybe -- Defined in ‘base-4.8.0.0:Data.Maybe’
 instance Monad [] -- Defined in ‘base-4.8.0.0:GHC.Base’
 instance Monad IO -- Defined in ‘base-4.8.0.0:GHC.Base’
 instance Monad ((->) r) -- Defined in ‘base-4.8.0.0:GHC.Base’

 λ:5>
 }}}

--

Comment (by hvr):

 (point out the problem in the description more explicitly)

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9590#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list