summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Berntsen <alexander@plaimi.net>2014-04-17 21:43:35 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2014-04-19 11:47:52 +0200
commit1bf6c0e482cfe4b9dfa0b5ed18a5741ba44fc226 (patch)
treeb564700cb689143fd3e46ee347a2893250dcce9e
parent1d2ffb6ab1ef973c85f893b5ea4a72cfa59ce484 (diff)
downloadhaskell-1bf6c0e482cfe4b9dfa0b5ed18a5741ba44fc226.tar.gz
Add reverse application operator Data.Function.(&)
Add `&` as the reverse application operator with `infixl 1`, which allows it to be nested in `$` (re #9008). Approved by the core libraries committee on 2013-10-14. This also bumps the `base` version number to 4.7.1.0
-rw-r--r--libraries/base/Data/Function.hs11
-rw-r--r--libraries/base/base.cabal2
-rw-r--r--libraries/base/changelog.md8
3 files changed, 19 insertions, 2 deletions
diff --git a/libraries/base/Data/Function.hs b/libraries/base/Data/Function.hs
index 54eabbb6e7..afb6e5693a 100644
--- a/libraries/base/Data/Function.hs
+++ b/libraries/base/Data/Function.hs
@@ -4,6 +4,7 @@
-- |
-- Module : Data.Function
-- Copyright : Nils Anders Danielsson 2006
+-- , Alexander Berntsen 2014
-- License : BSD-style (see the LICENSE file in the distribution)
--
-- Maintainer : libraries@haskell.org
@@ -18,6 +19,7 @@ module Data.Function
( -- * "Prelude" re-exports
id, const, (.), flip, ($)
-- * Other combinators
+ , (&)
, fix
, on
) where
@@ -25,6 +27,7 @@ module Data.Function
import Prelude
infixl 0 `on`
+infixl 1 &
-- | @'fix' f@ is the least fixed point of the function @f@,
-- i.e. the least defined @x@ such that @f x = x@.
@@ -86,3 +89,11 @@ fix f = let x = f x in x
on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
(.*.) `on` f = \x y -> f x .*. f y
+
+-- | '&' is a reverse application operator. This provides notational
+-- convenience. Its precedence is one higher than that of the forward
+-- application operator '$', which allows '&' to be nested in '$'.
+--
+-- /Since: 4.7.1.0/
+(&) :: a -> (a -> b) -> b
+x & f = f x
diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal
index f8937dcb1d..22b40db3c3 100644
--- a/libraries/base/base.cabal
+++ b/libraries/base/base.cabal
@@ -1,5 +1,5 @@
name: base
-version: 4.7.0.0
+version: 4.7.1.0
-- GHC 7.6.1 released with 4.6.0.0
license: BSD3
license-file: LICENSE
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index c88c79edb4..75e7710d55 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -1,6 +1,12 @@
# Changelog for [`base` package](http://hackage.haskell.org/package/base)
-## 4.7.0.0 *Feb 2014*
+## 4.7.1.0 *TBA*
+
+ * Bundled with GHC 7.10.1
+
+ * Add reverse application operator `Data.Function.(&)`
+
+## 4.7.0.0 *Apr 2014*
* Bundled with GHC 7.8.1