[GHC] #9664: Add identity functor to base
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: new Priority: normal | Milestone: 7.10.1 Component: Core Libraries | Version: Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Easy (less than 1 | Type of failure: hour) | None/Unknown Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- `base` already provides a `Const`ant functor, but the even more useful `Id`entity (or `Identity`) functor does not exist in `base` yet. This was already [https://groups.google.com/forum/#!msg/haskell-core- libraries/_nReDCbROew/Mdmf0zIloysJ proposed to the CLC back in early 2013], and already missed inclusion in GHC 7.8 However, in order to implement this, coordination with `transformers` is desirable, as `transformers` currently provides a non-transforming `Data.Functor.Identity`, and we'd like to avoid name clashes. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: new Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by ross): I suggest doing a major release of transformers at the same time as the next major GHC release, with Data.Functor.Identity removed and added to base. This version would depend on the new version of base to force an upgrade. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: new Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by hvr): Replying to [comment:1 ross]:
I suggest doing a major release of transformers at the same time as the next major GHC release, with Data.Functor.Identity removed and added to base. This version would depend on the new version of base to force an upgrade.
Terrific! I'll draft a `transformers`-patch in our locally forked repo over at http://git.haskell.org/packages/transformers.git and migrate `Data.Functor.Identity` into GHC HEAD's `base` so we can start using that in GHC HEAD. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: patch Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D313 | -------------------------------------+------------------------------------- Changes (by hvr): * status: new => patch * differential: => Phab:D313 Comment: @ross: please take a look at http://git.haskell.org/packages/transformers.git/commitdiff/refs/heads/wip/T... ... does that look ok to you? I had to conditionally expose the `Data.Functor.Identity` module, as otherwise it gets more complicated to tweak GHC's build-system to cope with a `transformers` that would only work with GHC>=7.9 & base>=4.8, as the in-tree `transformers` packages needs to be compiled multiple times, once with the bootstrapping compiler (which is either GHC 7.6 or GHC 7.8 for GHC HEAD), and later-on on with GHC HEAD. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: patch Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D313 | -------------------------------------+------------------------------------- Changes (by hvr): * cc: core-libraries-committee@… (added) Comment: @ross, any comments? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: patch Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D313 | -------------------------------------+------------------------------------- Comment (by ross): Changing to have Data.Functor.Class import Data.Functor.Identity reduces the ifdefs. Ideally I'd like to avoid a release with conditional exports - is there any way to detect a GHC bootstrap build? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: patch Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D313 | -------------------------------------+------------------------------------- Comment (by hvr): Replying to [comment:5 ross]:
Changing to have Data.Functor.Class import Data.Functor.Identity reduces the ifdefs.
Sure, I can easily change that (at the cost of some minor code duplication)
Ideally I'd like to avoid a release with conditional exports - is there any way to detect a GHC bootstrap build?
As for this I'm not sure how that helps here. Assuming we have a way of setting a Cabal flag when we're bootstrapping GHC (i.e. building stage 1), how would this improve the situation of having the `Data.Functor.Identity` module conditionally exposed (which now would be depending on that Cabal flag setting rather than predicating on `impl(ghc>=7.9)`)? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: patch Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D313 | -------------------------------------+------------------------------------- Comment (by hvr): @ross, any comments to my last comment? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: patch Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D313 | -------------------------------------+------------------------------------- Comment (by hvr): @ross, I noticed you already reversed the Identity<->Class import-dependency in recent `transformers` commmits I've adapted http://git.haskell.org/packages/transformers.git/commitdiff/refs/heads/wip/T... which is now a rather minimal change to `transformers` (i.e. moving the `Identity.hs` file into a different source folder, and adapting `.cabal`) You write you "like to avoid a release with conditional exports". What problems do you anticipate that could occur by making use of such a conditional (non)export of `Data.Functor.Identity`? Specifically, I used `impl(ghc>=7.9)` instead of Cabal flags in order to avoid any Cabal-related problems I could think of. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: patch Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D313 | -------------------------------------+------------------------------------- Comment (by ross): I've uploaded a new version of transformers incorporating this patch (and some others). -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: patch Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D313 | -------------------------------------+------------------------------------- Comment (by Herbert Valerio Riedel <hvr@…>): In [changeset:"87101364e0c2db5e472c6331ad35503028b2ec3c/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="87101364e0c2db5e472c6331ad35503028b2ec3c" Move Data.Functor.Identity from transformers to base This also updates the `transformers` submodule to the just released `transformers-0.4.2.0` package version. See #9664 for more details Reviewed By: austin, ekmett Differential Revision: https://phabricator.haskell.org/D313 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: closed Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: fixed | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D313 | -------------------------------------+------------------------------------- Changes (by thomie): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:11> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: closed Priority: normal | Milestone: 7.10.1 Component: Core | Version: Libraries | Keywords: Resolution: fixed | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D313 | -------------------------------------+------------------------------------- Comment (by Herbert Valerio Riedel <hvr@…>): In [changeset:"8cbd25a49051171da7c73db57ebd87bb0296c2f7/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="8cbd25a49051171da7c73db57ebd87bb0296c2f7" Make Data.Functor.Identity trustworthy again Alas `{-# LANGUAGE Safe #-}` can't be used since `Data.Coerce` isn't "safe". However, we use `coerce` just as an optimisation (see also 4ba884bdd3a9521ea92fcda8f601a7d0f3537bc1 which broke the safe-inferred status of `Data.Functor.Identity`), so this module at least deserves `{-# LANGUAGE Trustworthy #-}`. NOTE: `Data.Functor.Identity` was added to `base` in the context of #9664 Reviewed By: luite Differential Revision: https://phabricator.haskell.org/D507 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:12> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9664: Add identity functor to base -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: closed Priority: normal | Milestone: 7.10.1 Component: Core Libraries | Version: Resolution: fixed | Keywords: report- Operating System: Unknown/Multiple | impact Type of failure: None/Unknown | Architecture: Blocked By: | Unknown/Multiple Related Tickets: | Test Case: | Blocking: | Differential Revisions: Phab:D313 -------------------------------------+------------------------------------- Comment (by Herbert Valerio Riedel <hvr@…>): In [changeset:"1f60d635cee1ff3db72e0129f9035b147f52c9c4/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="1f60d635cee1ff3db72e0129f9035b147f52c9c4" {Data,Generic(1),MonadZip} instances for Identity These instances were missed when the identity functor was added to the `base` package (re #9664). Reviewed By: ekmett Differential Revision: https://phabricator.haskell.org/D674 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9664#comment:14> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC