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

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.1 Component: | Version: 7.9 libraries/haskell2010 | Operating System: Keywords: AMP | Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: GHC Difficulty: Unknown | rejects valid program Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- (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> ``` -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Description changed by hvr: 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. 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> }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Changes (by hvr): * cc: ekmett, thoughtpolice (added) Comment: One obvious way to fix this would be to have `haskell2010` have its own `Monad` typeclass, but this would make it incompatible with `base`'s `Monad`, effectively breaking interoperability between packages depending on `base` and those depending on `haskell2010`... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Comment (by ekmett): The fact that the AMP broke strict Haskell2010 compatibility for the `haskell2010` package was a known going in. We already broke it with `Num` a few years ago. We really have two options going forward. We can say that `haskell2010` and `haskell98` and the like are what they are, rough compatibility shims that get you as close as we can to the semantics of those standards without breaking compatibility with other packages... Or we can sink more effort into making them more accurate to their corresponding standards but in the process doom any code that bothers to compile with them to second-class citizen status. I'm rather ambivalent about the choice we make here. So the question comes down to: who is the audience of `haskell2010` the package? Is it educators who want a given standard they can teach to? Folks who have students who mayl eventually cast off the training wheels and move on to write real GHC if they want to build code that fits with the rest of the ecosystem? Or is it users who don't want to let a GHC monoculture set the standard and would prefer to work with a smaller subset of the language, but still want to have access to the ecosystem of packages through cabal? Folks who may have other compilers in mind, who would prefer to implement against a standard or at least have the ability to have their code compile against a compiler that implements the standard. If it is the former, then the story of making haskell2010-specific `Monad` and `Num` classes with their own supplies of instances has some merit. If it is the latter, we'd cripple the ability of that group to work with both packages to make `haskell2010` and `haskell98` export their own version of `Monad` and `Num`. I'm personally inclined to go with the status quo, which is that `haskell2010` is a fairly weak compatibility shim that more directly suits the needs of the second audience, if only because it is the audience who can grow the most, and it takes the least amount of effort investiture on our behalf. If, however, a champion were to stand up and offer to do all the work to maintain a more pedantic `haskell2010` package replete with its own instances for its own `Monad` / `Num`, I wouldn't stand in their way. Frankly, as it stands that could probably be done as an end user project without really involving any input from GHC HQ. If that were done it needn't even conflict with the existing `haskell2010` package. So, with that in mind I'd be content to see the existing package for what it is, and push back the effort to make a better shim on the user who actually wants to confront all the issues involved. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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

#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: | -------------------------------------+------------------------------------- Comment (by ekmett): Ack! Now I see what you mean. `Applicative` not even being in the package _is_ a problem. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Comment (by singpolyma):
Or is it users who don't want to let a GHC monoculture set the standard and would prefer to work with a smaller subset of the language, but still want to have access to the ecosystem of packages through cabal? Folks who may have other compilers in mind, who would prefer to implement against a standard or at least have the ability to have their code compile against a compiler that implements the standard.
This is me. My primary use of the haskell2010 package is to test my code against it, as well as base, in order to check that it is more likely to work on a standards-conformant Haskell implementation. To that end, I would prefer it if haskell2010 were basically just cut-n-paste the code from the report and be done with it. This would mean a different Monad instance, which I gather might cause some complexity for `do` notation (though will it really? GHC already has rebindable do, it seems like this would just be a special case of that). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Comment (by ekmett): It is a bit more complex than just pasting the report. GHC internals actually know where `Monad` comes from for instance, so you'd have knock- on consequences. If we `do` adopt a `haskell2010` fully standards compliant package: 1.) We'd need to make some modifications to GHC itself to tell it where to desugar to for the `Monad` syntax and internal hackery. We'd need to figure out how to tell tools like cabal to do the right thing. 2.) Code that previously worked with the `haskell2010` or `haskell98` packages would cease to work with `base` and vice versa where those instances are concerned. You'd be giving up, say, `containers`, not just the rest of `base`. This actually comes at a price to a dozen or two packages that are built right now with the `haskell98` package and with these other dependencies as well, possibly breaking in non-obvious ways. It may be that to fully support both of these two very different usecases for `haskell2010` that you'd get two `haskell2010`-like packages to support both user pools. This makes for a very complex story to explain to end users, and a lot of engineering. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: new Priority: high | Milestone: 7.10.1 Component: Core | Version: 7.9 Libraries | 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: | -------------------------------------+------------------------------------- Changes (by simonpj): * owner: => ekmett * component: libraries/haskell2010 => Core Libraries Comment: I'm open to whatever the Core Libraries committee thinks is best here, including discussing magical GHC support for whatever you need. I confess that I am reluctant to invest much GHC-development effort in this, but I respect the need to avoid killing off lots of useful libraries by mistake. Hence making "Core Libraries" the "Component". (We are removing libraries/* components... too much noise.) Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: new Priority: high | Milestone: 7.10.1 Component: Core | Version: 7.9 Libraries | 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: | -------------------------------------+------------------------------------- Comment (by singpolyma):
We'd need to make some modifications to GHC itself to tell it where to desugar to for the Monad syntax and internal hackery. We'd need to figure out how to tell tools like cabal to do the right thing.
Isn't this already needed for RebindableSyntax? Is this not a special case of that, or it more different than I think? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: new Priority: high | Milestone: 7.10.1 Component: Core | Version: 7.9 Libraries | 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: | -------------------------------------+------------------------------------- Comment (by hvr): Replying to [comment:9 singpolyma]:
Isn't this already needed for RebindableSyntax? Is this not a special case of that, or it more different than I think?
Here's some sketchy idea I also wrote in a reddit comment about an hypothetical `RebindableSyntax`-variant called `ExportedRebindedSyntax` (modulo bikeshed): - Code using a non-default Prelude (like e.g. `haskell2010` or `haskell98`) shall just need to hide the `base` package and bring `haskell2010` into scope - Particularly, code importing that non-default Prelude shall not need to enable any language extensions - The non-default Prelude module would rebind all syntax elements like with `RebindableSyntax`, but it would only export the desugaring rules, but does not need to export the symbols such as `IfThenElse` the desugaring rules are bound to for client code to work - If a module `X` directly or indirectly imports a Prelude module using the `ExportedRebindedSyntax` extension, it inherits the desugaring rules, and exports them to other modules that import that module `X`. It would be illegal to have conflicting desugaring rules brought into scope (c.f. conflicting typeclass instances being an error) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: new Priority: high | Milestone: 7.10.1 Component: Core | Version: 7.9 Libraries | 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: | -------------------------------------+------------------------------------- Changes (by hvr): * cc: core-libraries-committee@… (added) Comment: Replying to [comment:5 ekmett]:
Ack! Now I see what you mean.
`Applicative` not even being in the package _is_ a problem.
As a reminder this is still an issue, here's a suggestion together with a counter-argument: As a pragmatic solution, one could simply make available the `Applicative` typeclass in `haskell2010`. That way you can define `Monad` instance, iff you also define `Functor` **and** `Applicative` instances. However, now you end up with a "Haskell2010" program that works with GHC 7.10 but not GHC 7.{0,2,4,8} (or any other strict-Haskell2010 mode compiler), as the program refers to a non-standard `Applicative` only available in GHC 7.10. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: new Priority: high | Milestone: 7.10.1 Component: Core | Version: 7.9 Libraries | 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: | -------------------------------------+------------------------------------- Comment (by ekmett): There is no silver bullet here. The more I think on it, the more it strikes me that the best option is for us to just give up on these packages as a failed experiment. Neither hackage has ever really received any traction or picked up a coherent usage story. Every attempt folks (including me) have made to put forth them as something someone might use in practice has been rather rightly derided as unrealistic. We'd also get to clear `old-locale` and `old-time` out of the core. Any solution that involves bringing `Applicative` in could just as well be done outside of the GHC development process, so if a user base wanted to rally behind a `haskell98` / `haskell2010` package, it could be built out in `cabal` by anyone; we could put out a call for an active maintainer who wants to own it. It is only if we wanted to isolate `haskell2010` users further from the community by making them use their own `Monad`, etc. that we might have to keep `haskell2010` and `haskell98` as core packages -- but then only for compiler support for do sugar, and even that could probably be done with enough work. It doesn't strike me as a thing we're remotely ready to do though. It isn't clear it'd work sufficiently well for any appreciable number of users to at all justify the time and maintenance. Which brings us back to the option of just cutting these packages loose. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: new Priority: high | Milestone: 7.10.1 Component: Core | Version: 7.9 Libraries | 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: Phab:D510 | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * differential: => Phab:D510 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package
-------------------------------------+-------------------------------------
Reporter: hvr | Owner: ekmett
Type: bug | Status: new
Priority: high | Milestone: 7.10.1
Component: Core | Version: 7.9
Libraries | 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: Phab:D510 |
-------------------------------------+-------------------------------------
Comment (by Austin Seipp

#9590: AMP breaks `haskell2010` package
-------------------------------------+-------------------------------------
Reporter: hvr | Owner: ekmett
Type: bug | Status: new
Priority: high | Milestone: 7.10.1
Component: Core | Version: 7.9
Libraries | 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: Phab:D510 |
-------------------------------------+-------------------------------------
Comment (by Austin Seipp

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: closed Priority: high | Milestone: 7.10.1 Component: Core | Version: 7.9 Libraries | Keywords: AMP Resolution: fixed | 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: Phab:D510 | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: new => closed * resolution: => fixed Comment: Fixed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: closed Priority: high | Milestone: 7.10.1 Component: Core Libraries | Version: 7.9 Resolution: fixed | Keywords: AMP, Operating System: Unknown/Multiple | report-impact Type of failure: GHC rejects | Architecture: valid program | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D510 -------------------------------------+------------------------------------- Comment (by hvr): Fyi, here's an attempt at updating/reviving the `haskell2010` package: http://git.haskell.org/packages/haskell2010.git/commitdiff/refs/heads/wip/T9... but it's unsatisfying at this moment; as expected, `do`-syntax still refers to the `base`-version of the `Monad`-class, so you need to use `-XRebindableSyntax` and be careful to bring into local scope whatever functions are needed for syntax desugaring. Maybe we can improve the alternative-Prelude support in GHC 7.12 to allow a more seamless `-XRebindableSyntax` support which is less brittle, and allows to better emulate a strict `haskell2010` mode, which only requires to select the respective `-XHaskell....` flag for the language-part, and the respective `Prelude`-providing library-package instead of `base`, and would then drop you into a (reasonably) strictly standard-conforming language+std-library environment... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: closed Priority: high | Milestone: 7.10.1 Component: Core Libraries | Version: 7.9 Resolution: fixed | Keywords: AMP, Operating System: Unknown/Multiple | report-impact Type of failure: GHC rejects | Architecture: valid program | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D510 -------------------------------------+------------------------------------- Comment (by hvr): Even something like `{-# LANGUAGE RebindableSyntax=haskell2010:Prelude.Syntax -#}` would already be an improvement with the following semantic: - desugaring like `-XRebindableSyntax`, - *but* rather than the local scope, only what's exported by the `Prelude.Syntax` module (from the `haskell2010` package) is used for desugaring, - and `Prelude.Syntax` can be a hidden module of the `haskell2010` package (to avoid polluting the module namespace) This could allow (maybe) to write a simple shell-script wrapper `ghci2010` (or `ghc2010`) in the style of {{{#!bash #!/bin/sh ghci -XHaskell2010 \ -hide-all-packages -package haskell2010 \ -XRebindableSyntax=haskell2010:Prelude.Syntax $* }}} This is similar to the `{-# LANGUAGE Prelude=AlternatePrelude #-}` idea we were floating recently, but also takes into account desugaring. NB: this doesn't solve the issue of packages compiled against `base` and `haskell2010` to have diverging typeclass hierarchies. But I don't think we can solve that without a significant amount of complexity. I'd rather suggest to instead have packages actively support `haskell2010` (maybe as Cabal configuration option via flags, or via hs2010-compat-layer packages -- not sure yet which is best) for those few packages where there's enough demand to (like e.g. something like `containers`). My main motivation for a `haskell2010` package is to have a reference implementation for the Haskell 2010 report (which can be useful for teaching, or for being able to compile some ancient "pure" Haskell2010 code with the latest GHC), rather than having full Hackage compatibility... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: closed Priority: high | Milestone: 7.10.1 Component: Core Libraries | Version: 7.9 Resolution: fixed | Keywords: AMP, Operating System: Unknown/Multiple | report-impact Type of failure: GHC rejects | Architecture: valid program | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D510 -------------------------------------+------------------------------------- Comment (by hvr): Agda seems to have support via pragmas to inform the compiler about desugaring primitives (citing https://pay.reddit.com/r/haskell/comments/2vzqqa/picking_your_prelude/comxs6...):
Agda has a nice mechanism for avoiding this problem. The compiler/typechecker uses various functions and constants that are not built in to the language: for instance rewriting requires `PropositionalEquality` and its `refl` constructor, and desugaring numerals requires knowledge of the natural number type and the `zero` and `suc` constructors.
All of these are made known to the Agda system in the standard library with a pragma: {{{ {-# LANGUAGE BUILTIN REFL refl #-} {-# LANGUAGE BUILTIN ZERO zero #-} }}} etc.
It's then possible to completely throw out the standard library and replace it with one of your own by using these pragmas to tell Agda to use your definitions instead.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: bug | Status: closed Priority: high | Milestone: 7.10.1 Component: Core Libraries | Version: 7.9 Resolution: fixed | Keywords: AMP, Operating System: Unknown/Multiple | report-impact Type of failure: GHC rejects | Architecture: valid program | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D510 -------------------------------------+------------------------------------- Comment (by nomeata): Nice finding. But what is their scope? Do they leak to other modules like instance declarations? What if there are conflicts? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.1 Component: Core Libraries | Version: 7.9 Resolution: | Keywords: AMP, report- | impact Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D510 -------------------------------------+------------------------------------- Changes (by hvr): * owner: ekmett => * status: closed => new * resolution: fixed => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:22 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.10.1 Component: Core Libraries | Version: 7.9 Resolution: wontfix | Keywords: AMP, report- | impact Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D510 -------------------------------------+------------------------------------- Changes (by hvr): * status: new => closed * resolution: => wontfix Comment: (it's not really fixed, more like wontfix for the meantime IMO) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:23 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9590: AMP breaks `haskell2010` package -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.10.1 Component: Core Libraries | Version: 7.9 Resolution: wontfix | Keywords: AMP, report- | impact Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D510 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Lemming): I am also one of these programmers who care about portability. How about creating a Haskell 2010 report with an addendum? It would maintain the language part of Haskell 2010 but add the modules Control.Applicative, Data.Monoid, Data.Foldable, Data.Traversable. I have several packages that use very basic functionality and I would like to show this by importing haskell2010 or haskell2010add. Alternatively, the split-base project would serve my needs. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9590#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC