Skip to content

Commit

Permalink
Update tests for Wrapped change
Browse files Browse the repository at this point in the history
  • Loading branch information
glguy committed Oct 15, 2013
1 parent b6d6582 commit 5680e13
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Control/Lens/Iso.hs
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions src/Control/Lens/Setter.hs
Expand Up @@ -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''.
Expand All @@ -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

-- | @
Expand Down
2 changes: 2 additions & 0 deletions src/Control/Lens/Tuple.hs
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Control/Lens/Type.hs
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Numeric/Lens.hs
Expand Up @@ -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"
Expand Down

0 comments on commit 5680e13

Please sign in to comment.