[commit: ghc] master: Add reverse application operator Data.Function.(&) (1bf6c0e)

git at git.haskell.org git at git.haskell.org
Sat Apr 19 09:52:18 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1bf6c0e482cfe4b9dfa0b5ed18a5741ba44fc226/ghc

>---------------------------------------------------------------

commit 1bf6c0e482cfe4b9dfa0b5ed18a5741ba44fc226
Author: Alexander Berntsen <alexander at plaimi.net>
Date:   Thu Apr 17 21:43:35 2014 +0200

    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


>---------------------------------------------------------------

1bf6c0e482cfe4b9dfa0b5ed18a5741ba44fc226
 libraries/base/Data/Function.hs |   11 +++++++++++
 libraries/base/base.cabal       |    2 +-
 libraries/base/changelog.md     |    8 +++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/libraries/base/Data/Function.hs b/libraries/base/Data/Function.hs
index 54eabbb..afb6e56 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 at 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 at .
@@ -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 f8937dc..22b40db 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 c88c79e..75e7710 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
 



More information about the ghc-commits mailing list