diff options
| -rw-r--r-- | libraries/base/Control/Applicative.hs | 7 | ||||
| -rw-r--r-- | libraries/base/changelog.md | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/libraries/base/Control/Applicative.hs b/libraries/base/Control/Applicative.hs index 9045bcd742..559cceda66 100644 --- a/libraries/base/Control/Applicative.hs +++ b/libraries/base/Control/Applicative.hs @@ -59,7 +59,7 @@ import Data.Functor.Const (Const(..)) import GHC.Base import GHC.Generics -import GHC.List (repeat, zipWith) +import GHC.List (repeat, zipWith, drop) import GHC.Read (Read) import GHC.Show (Show) @@ -121,6 +121,11 @@ instance Applicative ZipList where pure x = ZipList (repeat x) liftA2 f (ZipList xs) (ZipList ys) = ZipList (zipWith f xs ys) +-- | @since 4.11.0.0 +instance Alternative ZipList where + empty = ZipList [] + ZipList xs <|> ZipList ys = ZipList (xs ++ drop (length xs) ys) + -- extra functions -- | One or none. diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index f2ea265a0d..854a9b81ed 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -1,5 +1,10 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) +## 4.11.0.0 *TBA* + * Bundled with GHC *TBA* + + * Add `Alternative` instance for `ZipList` (#13520) + ## 4.10.0.0 *April 2017* * Bundled with GHC *TBA* |
