Skip to content
Browse files

Revert "Remove headOf, _at, resultAt, Control.Lens.Simple"

We are attempting to remain 3.7 compatible for the time being

This reverts commit e79af7f.
  • Loading branch information...
1 parent a82b8b0 commit 9217c723341293a5cc3ed2582614beaea568bc4b @glguy glguy committed Mar 25, 2013
Showing with 94 additions and 0 deletions.
  1. +1 −0 lens.cabal
  2. +2 −0 src/Control/Lens.hs
  3. +9 −0 src/Control/Lens/At.hs
  4. +13 −0 src/Control/Lens/Fold.hs
  5. +69 −0 src/Control/Lens/Simple.hs
View
1 lens.cabal
@@ -240,6 +240,7 @@ library
Control.Lens.Reified
Control.Lens.Review
Control.Lens.Setter
+ Control.Lens.Simple
Control.Lens.TH
Control.Lens.Traversal
Control.Lens.Tuple
View
2 src/Control/Lens.hs
@@ -58,6 +58,7 @@ module Control.Lens
, module Control.Lens.Reified
, module Control.Lens.Review
, module Control.Lens.Setter
+ , module Control.Lens.Simple
#ifndef DISABLE_TEMPLATE_HASKELL
, module Control.Lens.TH
#endif
@@ -87,6 +88,7 @@ import Control.Lens.Prism
import Control.Lens.Reified
import Control.Lens.Review
import Control.Lens.Setter
+import Control.Lens.Simple
#ifndef DISABLE_TEMPLATE_HASKELL
import Control.Lens.TH
#endif
View
9 src/Control/Lens/At.hs
@@ -40,6 +40,9 @@ module Control.Lens.At
-- * Contains
, Contains(..)
, containsIx, containsAt, containsLength, containsN, containsTest, containsLookup
+ -- * Deprecated
+ , _at
+ , resultAt
) where
import Control.Applicative
@@ -84,6 +87,12 @@ import Data.Word
-- >>> let f :: Expr -> Expr; f = Debug.SimpleReflect.Vars.f
-- >>> let g :: Expr -> Expr; g = Debug.SimpleReflect.Vars.g
+-- | Deprecated aliases for 'ix'.
+_at, resultAt :: Ixed f m => Index m -> IndexedLensLike' (Index m) f m (IxValue m)
+_at = ix
+resultAt = ix
+{-# DEPRECATED _at, resultAt "use 'ix'. This function will be removed in version 3.9" #-}
+
-- |
-- This class provides a simple 'IndexedFold' (or 'IndexedTraversal') that lets you view (and modify)
-- information about whether or not a container contains a given 'Index'.
View
13 src/Control/Lens/Fold.hs
@@ -117,6 +117,9 @@ module Control.Lens.Fold
, itakingWhile
, idroppingWhile
+ -- * Deprecated
+ , headOf
+
-- * Internal types
, Leftmost
, Rightmost
@@ -2480,6 +2483,16 @@ idroppingWhile p l f = (flip evalState True .# getCompose) `rmap` l g where
{-# INLINE idroppingWhile #-}
------------------------------------------------------------------------------
+-- Deprecated
+------------------------------------------------------------------------------
+
+-- | A deprecated alias for 'firstOf'.
+headOf :: Getting (First a) s t a b -> s -> Maybe a
+headOf l = getFirst #. foldMapOf l (First #. Just)
+{-# INLINE headOf #-}
+{-# DEPRECATED headOf "`headOf' will be removed in 3.9. (Use `preview' or `firstOf')" #-}
+
+------------------------------------------------------------------------------
-- Misc.
------------------------------------------------------------------------------
View
69 src/Control/Lens/Simple.hs
@@ -0,0 +1,69 @@
+{-# LANGUAGE Rank2Types #-}
+-----------------------------------------------------------------------------
+-- |
+-- Module : Control.Lens.Simple
+-- Copyright : (C) 2012-13 Edward Kmett
+-- License : BSD-style (see the file LICENSE)
+-- Maintainer : Edward Kmett <ekmett@gmail.com>
+-- Stability : experimental
+-- Portability : non-portable
+--
+-- Deprecated names for simple lenses, etc.
+-----------------------------------------------------------------------------
+module Control.Lens.Simple where
+
+import Control.Lens.Reified
+import Control.Lens.Setter
+import Control.Lens.Type
+
+------------------------------------------------------------------------------
+-- Deprecated
+------------------------------------------------------------------------------
+
+-- | Deprecated. Use 'Lens''.
+type SimpleLens s a = Lens s s a a
+{-# DEPRECATED SimpleLens "use Lens'" #-}
+
+-- | Deprecated. Use 'ReifiedLens''.
+type SimpleReifiedLens s a = Lens s s a a
+{-# DEPRECATED SimpleReifiedLens "use Lens'" #-}
+
+-- | Deprecated. Use 'Traversal''.
+type SimpleTraversal s a = Traversal s s a a
+{-# DEPRECATED SimpleTraversal "use Traversal'" #-}
+
+-- | Deprecated. Use 'ReifiedTraversal''.
+type SimpleReifiedTraversal s a = ReifiedTraversal s s a a
+{-# DEPRECATED SimpleReifiedTraversal "use ReifiedTraversal'" #-}
+
+-- | Deprecated. Use 'IndexedTraversal''.
+type SimpleIndexedTraversal i s a = IndexedTraversal i s s a a
+{-# DEPRECATED SimpleIndexedTraversal "use IndexedTraversal'" #-}
+
+-- | Deprecated. Use 'ReifiedIndexedTraversal''.
+type SimpleReifiedIndexedTraversal i s a = ReifiedIndexedTraversal i s s a a
+{-# DEPRECATED SimpleReifiedIndexedTraversal "use ReifiedIndexedTraversal'" #-}
+
+-- | Deprecated. Use 'Setter''.
+type SimpleSetter s a = Setter s s a a
+{-# DEPRECATED SimpleSetter "use Setter'" #-}
+
+-- | Deprecated. Use 'ReifiedSetter''.
+type SimpleReifiedSetter s a = ReifiedSetter s s a a
+{-# DEPRECATED SimpleReifiedSetter "use ReifiedSetter'" #-}
+
+-- | Deprecated. Use 'IndexedSetter''.
+type SimpleIndexedSetter i s a = IndexedSetter i s s a a
+{-# DEPRECATED SimpleIndexedSetter "use IndexedSetter'" #-}
+
+-- | Deprecated. Use 'ReifiedIndexedSetter''.
+type SimpleReifiedIndexedSetter i s a = ReifiedIndexedSetter i s s a a
+{-# DEPRECATED SimpleReifiedIndexedSetter "use ReifiedIndexedSetter'" #-}
+
+-- | Deprecated. Use 'Iso''.
+type SimpleIso s a = Iso s s a a
+{-# DEPRECATED SimpleIso "use Iso'" #-}
+
+-- | Deprecated. Use 'Prism''.
+type SimplePrism s a = Prism s s a a
+{-# DEPRECATED SimplePrism "use Prism'" #-}

0 comments on commit 9217c72

Please sign in to comment.
Something went wrong with that request. Please try again.