[GHC] #10448: Implement rest of "Add bifunctor related classes to base"-Proposal

#10448: Implement rest of "Add bifunctor related classes to base"-Proposal -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: new Priority: normal | Milestone: 7.12.1 Component: | Version: libraries/base | Operating System: Unknown/Multiple Keywords: | Type of failure: None/Unknown Architecture: | Blocked By: Unknown/Multiple | Related Tickets: #9682 Test Case: | Blocking: | Differential Revisions: Phab:D336 | -------------------------------------+------------------------------------- Cloned from #9682: ---- See [http://www.haskell.org/pipermail/libraries/2014-April/022844.html original libraries@ proposal] for more details -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10448 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10448: Implement rest of "Add bifunctor related classes to base"-Proposal -------------------------------------+------------------------------------- Reporter: hvr | Owner: ekmett Type: task | Status: new Priority: normal | Milestone: 7.12.1 Component: libraries/base | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9682 | Blocking: | Differential Revisions: Phab:D336 -------------------------------------+------------------------------------- Comment (by ekmett): I'll happily set up the API changes in `bifunctors` to match what we want to have move into `base. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10448#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10448: Implement rest of "Add bifunctor related classes to base"-Proposal -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: libraries/base | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9682 | Differential Rev(s): Phab:D336 -------------------------------------+------------------------------------- Comment (by RyanGlScott): Ed pointed out to me that one possible stumbling block in migrating `Bitraversable` to `base` is [http://hackage.haskell.org/package/bifunctors-5/docs/Data- Bitraversable.html its current definition]: {{{#!hs class (Bifunctor t, Bifoldable t) => Bitraversable t where bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> t a b -> f (t c d) bisequenceA :: Applicative f => t (f a) (f b) -> f (t a b) bimapM :: Monad m => (a -> m c) -> (b -> m d) -> t a b -> m (t c d) bisequence :: Monad m => t (m a) (m b) -> m (t a b) }}} Like `Traversable`, `Bitraversable` currently has two duplicate method signatures with stronger constraints (`Monad` instead of `Applicative`). We should probably aim to make `bimapM` and `bisequence` top-level definitions instead of class methods during the migration, but there has been a lingering question of whether this would affect runtime performance. AFAICT, the consensus is that any remaining obstacles to redefining `mapM = traverse` [https://mail.haskell.org/pipermail/libraries/2015-May/025723.html have been overcome] since #8189 was fixed, so is there any reason that we couldn't also redefine `bimapM = bitraverse` and `bisequence = bisequenceA`? Other than that, I don't see any reason why we couldn't migrate `Data.Bifoldable` and `Data.Bitraversable` as they're implemented right now. One thing that was a concern for `Foldable` (#9621) was turning functions like `toList` into class methods for efficiency purposes, but I can't think of a `Bifoldable` instance that would benefit significantly from this, so we can probably leave that aside. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10448#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10448: Implement rest of "Add bifunctor related classes to base"-Proposal -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: libraries/base | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9682 | Differential Rev(s): Phab:D336 -------------------------------------+------------------------------------- Comment (by ekmett): I support moving a minimal flavor of `Bifoldable`/`Bitraversable` in. They don't have any legacy users to consider in terms of any bad interactions with different `Monad`'s lack of implementation of `(*>)` vs. `(>>)`. In fact I'd go so far as to remove `bisequenceA`, `bimapM` and `bisequence` from the class entirely in anticipation of doing the same to `Traversable`, and as a much smaller, low-impact laboratory for exploring that change. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10448#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10448: Implement rest of "Add bifunctor related classes to base"-Proposal -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: libraries/base | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9682 | Differential Rev(s): -------------------------------------+------------------------------------- Changes (by hvr): * differential: Phab:D336 => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10448#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10448: Implement rest of "Add bifunctor related classes to base"-Proposal -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: libraries/base | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9682 | Differential Rev(s): -------------------------------------+------------------------------------- Comment (by RyanGlScott): Oh, I didn't realize that you wanted to remove `bisequenceA` from the `Bitraversable` class as well. What is your reasoning for that one? Is it because it's just `bitraverse id id`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10448#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10448: Implement rest of "Add bifunctor related classes to base"-Proposal -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: libraries/base | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9682 | Differential Rev(s): -------------------------------------+------------------------------------- Comment (by ekmett): It is in the list of simplifications to consider for `Traversable`. If we can show it doesn't help measurably, it'd be a win for simplicity, and the `(bi)sequenceA` name that nobody likes can then eventually die in favor of `(bi)sequence`, whereas the other way there is no actual viable upgrade path that supports its removal. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10448#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10448: Implement rest of "Add bifunctor related classes to base"-Proposal -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: task | Status: patch Priority: normal | Milestone: Component: libraries/base | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9682 | Differential Rev(s): Phab:D2284 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D2284 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10448#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10448: Implement rest of "Add bifunctor related classes to base"-Proposal
-------------------------------------+-------------------------------------
Reporter: hvr | Owner:
Type: task | Status: patch
Priority: normal | Milestone:
Component: libraries/base | Version:
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #9682 | Differential Rev(s): Phab:D2284
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#10448: Implement rest of "Add bifunctor related classes to base"-Proposal -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: task | Status: closed Priority: normal | Milestone: 8.2.1 Component: libraries/base | Version: Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9682 | Differential Rev(s): Phab:D2284 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * resolution: => fixed * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10448#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC