[Git][ghc/ghc][master] Explicit methods for Alternative Compose
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Fri Nov 17 01:53:18 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
b4f84e4b by James Henri Haydon at 2023-11-16T20:52:53-05:00
Explicit methods for Alternative Compose
Explicitly define some and many in Alternative instance for
Data.Functor.Compose
Implementation of https://github.com/haskell/core-libraries-committee/issues/181
- - - - -
2 changed files:
- libraries/base/changelog.md
- libraries/base/src/Data/Functor/Compose.hs
Changes:
=====================================
libraries/base/changelog.md
=====================================
@@ -11,6 +11,7 @@
* Export List from Data.List ([CLC proposal #182](https://github.com/haskell/core-libraries-committee/issues/182)).
* Deprecate `Data.List.NonEmpty.unzip` ([CLC proposal #86](https://github.com/haskell/core-libraries-committee/issues/86))
* Fix exponent overflow/underflow bugs in the `Read` instances for `Float` and `Double` ([CLC proposal #192](https://github.com/haskell/core-libraries-committee/issues/192))
+ * Implement `many` and `some` methods of `instance Alternative (Compose f g)` explicitly. ([CLC proposal #181](https://github.com/haskell/core-libraries-committee/issues/181))
* The functions `GHC.Exts.dataToTag#` and `GHC.Base.getTag` have had
their types changed to the following:
=====================================
libraries/base/src/Data/Functor/Compose.hs
=====================================
@@ -147,6 +147,10 @@ instance (Alternative f, Applicative g) => Alternative (Compose f g) where
empty = Compose empty
(<|>) = coerce ((<|>) :: f (g a) -> f (g a) -> f (g a))
:: forall a . Compose f g a -> Compose f g a -> Compose f g a
+ some = coerce (fmap sequenceA . some :: f (g a) -> f (g [a]))
+ :: forall a . Compose f g a -> Compose f g [a]
+ many = coerce (fmap sequenceA . many :: f (g a) -> f (g [a]))
+ :: forall a . Compose f g a -> Compose f g [a]
-- | The deduction (via generativity) that if @g x :~: g y@ then @x :~: y at .
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b4f84e4bfac3648864d9482b7585a01d44b5eb58
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b4f84e4bfac3648864d9482b7585a01d44b5eb58
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231116/9205c8ec/attachment-0001.html>
More information about the ghc-commits
mailing list