Permalink
Browse files

Update tests for Wrapped change

  • Loading branch information...
1 parent b6d6582 commit 5680e1331d223f1376706cd57faeab70639047cc @glguy glguy committed Oct 15, 2013
Showing with 6 additions and 8 deletions.
  1. +2 −2 src/Control/Lens/Iso.hs
  2. +0 −4 src/Control/Lens/Setter.hs
  3. +2 −0 src/Control/Lens/Tuple.hs
  4. +1 −1 src/Control/Lens/Type.hs
  5. +1 −1 src/Numeric/Lens.hs
@@ -155,7 +155,7 @@ cloneIso k = withIso k iso
--
-- This version is generalized to accept any 'Iso', not just a @newtype@.
--
--- >>> au (wrapping Sum) foldMap [1,2,3,4]
+-- >>> au (_Unwrapping Sum) foldMap [1,2,3,4]
-- 10
au :: AnIso s t a b -> ((s -> a) -> e -> b) -> e -> t
au k = withIso k $ \ sa bt f e -> bt (f sa e)
@@ -170,7 +170,7 @@ au k = withIso k $ \ sa bt f e -> bt (f sa e)
-- Mnemonically, the German /auf/ plays a similar role to /à la/, and the combinator
-- is 'au' with an extra function argument.
--
--- >>> auf (wrapping Sum) (foldMapOf both) Prelude.length ("hello","world")
+-- >>> auf (_Unwrapping Sum) (foldMapOf both) Prelude.length ("hello","world")
-- 10
auf :: Profunctor p => AnIso s t a b -> (p r a -> e -> b) -> p r s -> e -> t
auf k = withIso k $ \ sa bt f g e -> bt (f (rmap sa g) e)
@@ -116,8 +116,6 @@ infixr 2 <~
--
-- When consuming a setter directly to perform a mapping, you can use this type, but most
-- user code will not need to use this type.
---
--- By choosing 'Identity' rather than 'Data.Functor.Identity.Identity', we get nicer error messages.
type ASetter s t a b = (a -> Identity b) -> s -> Identity t
-- | This is a useful alias for use when consuming a 'Setter''.
@@ -133,8 +131,6 @@ type ASetter' s a = ASetter s s a a
--
-- When consuming a setter directly to perform a mapping, you can use this type, but most
-- user code will not need to use this type.
---
--- By choosing 'Identity' rather than 'Data.Functor.Identity.Identity', we get nicer error messages.
type AnIndexedSetter i s t a b = Indexed i a (Identity b) -> s -> Identity t
-- | @
@@ -80,10 +80,12 @@ class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s where
-- '_1' :: 'Lens' (a,b,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a'
-- @
_1 :: Lens s t a b
+#ifndef HLINT
default _1 :: (Generic s, Generic t, GAt N0 (Rep s) (Rep t) a b)
=> Lens s t a b
{-# INLINE _1 #-}
_1 f = fmap to . gat proxyN0 f . from
+#endif
instance Field1 (Identity a) (Identity b) a b where
_1 f (Identity a) = Identity <$> indexed f (0 :: Int) a
@@ -69,7 +69,7 @@ import Data.Functor.Apply
import Data.Profunctor
-- $setup
--- >>> :set -XNoOpticStrings
+-- >>> :set -XNoOverloadedStrings
-- >>> import Control.Lens
-- >>> import Debug.SimpleReflect.Expr
-- >>> import Debug.SimpleReflect.Vars as Vars hiding (f,g,h)
View
@@ -159,7 +159,7 @@ dividing n = iso (/n) (*n)
--
-- Note: This errors for n = 0
--
--- >>> au (exponentiating 2.wrapping Sum) (foldMapOf each) (3,4)
+-- >>> au (exponentiating 2._Unwrapping Sum) (foldMapOf each) (3,4)
-- 5.0
exponentiating :: (Floating a, Eq a) => a -> Iso' a a
exponentiating 0 = error "Numeric.Lens.exponentiating: exponent 0"

0 comments on commit 5680e13

Please sign in to comment.