Skip to content
Snippets Groups Projects
Commit b4f84e4b authored by James Haydon's avatar James Haydon Committed by Marge Bot
Browse files

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
parent 49f5264b
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
......@@ -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@.
--
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment