[GHC] #16173: Move `Data.Profunctor` from `profunctors` package to `base`

#16173: Move `Data.Profunctor` from `profunctors` package to `base` -------------------------------------+------------------------------------- Reporter: chshersh | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Core | Version: 8.6.3 Libraries | Keywords: base, | Operating System: Unknown/Multiple profunctor, QuantifiedConstraints | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: #14767 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- `Contravariant` was added in GHC 8.6. * https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Functor- Contravariant.html `Profunctor` also looks like fundamental abstraction to be worth considering adding to `base`. Having both `Profunctor` and `Choice` typeclasses in the `base` library will also allow to write `microprism` package similar to `microlens`. Prisms often turns to be very useful since they allow to work nicely with sum types. {{{#!hs type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t) }}} Additional context for this ticket from Reddit: * https://www.reddit.com/r/haskell/comments/8v53cb/announce_ghc_861alpha1_avai... It was proposed on Reddit to use `QuantifiedConstraints` for `Profunctor`. I'm not quite fluent with `QuantifiedConstraints`, but I think this may looks like this (mostly copy-pasting code from `profunctors` package): {{{#!hs {-# LANGUAGE QuantifiedConstraints #-} class (forall a . Functor (p a)) => Profunctor p where {-# MINIMAL dimap | (lmap, rmap) #-} dimap :: (a -> b) -> (c -> d) -> p b c -> p a d dimap f g = lmap f . rmap g lmap :: (a -> b) -> p b c -> p a c lmap f = dimap f id rmap :: (b -> c) -> p a b -> p a c rmap = dimap id instance Profunctor (->) where dimap ab cd bc = cd . bc . ab lmap = flip (.) rmap = (.) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16173 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16173: Move `Data.Profunctor` from `profunctors` package to `base` -------------------------------------+------------------------------------- Reporter: chshersh | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Core Libraries | Version: 8.6.3 Resolution: | Keywords: base, | profunctor, QuantifiedConstraints Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14767 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Artyom.Kazak): * cc: Artyom.Kazak (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16173#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16173: Move `Data.Profunctor` from `profunctors` package to `base` -------------------------------------+------------------------------------- Reporter: chshersh | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Core Libraries | Version: 8.6.3 Resolution: | Keywords: base, | profunctor, QuantifiedConstraints Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14767 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ulysses4ever): This is something likely to be brought up in the [https://mail.haskell.org /cgi-bin/mailman/listinfo/libraries library mailing list] simultaneously. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16173#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16173: Move `Data.Profunctor` from `profunctors` package to `base` -------------------------------------+------------------------------------- Reporter: chshersh | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Core Libraries | Version: 8.6.3 Resolution: | Keywords: base, | profunctor, QuantifiedConstraints Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14767 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by glaebhoerl): * cc: glaebhoerl (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16173#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16173: Move `Data.Profunctor` from `profunctors` package to `base` -------------------------------------+------------------------------------- Reporter: chshersh | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Core Libraries | Version: 8.6.3 Resolution: | Keywords: base, | profunctor, QuantifiedConstraints Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14767 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by andrewthad): If is it decided that `Profunctor` should use `QuantifiedConstraints` to get its `Functor` superclass, that would need to happen in library-space, not as it's moving into `base`. Aside from that, I don't feel particularly strongly about the superclass one way or the other. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16173#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC