Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Converted remit to re in doctests and other test suites.
  • Loading branch information
ekmett committed Jan 10, 2013
1 parent 59efcf0 commit 1d79c2d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/Control/Lens/Prism.hs
Expand Up @@ -143,7 +143,7 @@ without k = case runPrism k of
--
-- It also can be turned around to obtain the embedding into the 'Left' half of an 'Either':
--
-- >>> 5^.remit _left
-- >>> 5^.re _left
-- Left 5
_left :: Prism (Either a c) (Either b c) a b
_left = prism Left $ either Right (Left . Right)
Expand All @@ -165,7 +165,7 @@ _left = prism Left $ either Right (Left . Right)
--
-- It also can be turned around to obtain the embedding into the 'Right' half of an 'Either':
--
-- >>> 5^.remit _right
-- >>> 5^.re _right
-- Right 5
_right :: Prism (Either c a) (Either c b) a b
_right = prism Right $ either (Left . Left) Right
Expand All @@ -178,7 +178,7 @@ _right = prism Right $ either (Left . Left) Right
--
-- Unlike 'Data.Traversable.traverse' this is a 'Prism', and so you can use it to inject as well:
--
-- >>> 5^.remit _just
-- >>> 5^.re _just
-- Just 5
_just :: Prism (Maybe a) (Maybe b) a b
_just = prism Just $ maybe (Left Nothing) Right
Expand Down
6 changes: 3 additions & 3 deletions src/Control/Lens/Type.hs
Expand Up @@ -319,7 +319,7 @@ type Iso' s a = Iso s s a a
--
-- And we can then convert from a 'Numeric.Natural.Natural' to an 'Integer'.
--
-- >>> 5 ^. remit nat -- :: Natural
-- >>> 5 ^. re nat -- :: Natural
-- 5
--
-- Similarly we can use a 'Prism' to 'Data.Traversable.traverse' the left half of an 'Either':
Expand All @@ -329,12 +329,12 @@ type Iso' s a = Iso s s a a
--
-- or to construct an 'Either':
--
-- >>> 5^.remit _left
-- >>> 5^.re _left
-- Left 5
--
-- such that if you query it with the 'Prism', you will get your original input back.
--
-- >>> 5^.remit _left ^? _left
-- >>> 5^.re _left ^? _left
-- Just 5
--
-- Another interesting way to think of a 'Prism' is as the categorical dual of a 'Lens'
Expand Down
2 changes: 1 addition & 1 deletion src/Data/List/Lens.hs
Expand Up @@ -172,7 +172,7 @@ _init f as = (++ [Prelude.last as]) <$> f (Prelude.init as)
-- >>> "review" ^? strippingPrefix "pre"
-- Nothing
--
-- >>> "amble"^.remit (strippingPrefix "pre")
-- >>> "amble"^.re (strippingPrefix "pre")
-- "preamble"
strippingPrefix :: Eq a => [a] -> Prism' [a] [a]
strippingPrefix ps = prism (ps ++) $ \xs -> case stripPrefix ps xs of
Expand Down
2 changes: 1 addition & 1 deletion src/Numeric/Lens.hs
Expand Up @@ -20,7 +20,7 @@ import Numeric (readInt, showIntAtBase)
-- >>> "100" ^? base 16
-- Just 256
--
-- >>> 1767707668033969 ^. remit (base 36)
-- >>> 1767707668033969 ^. re (base 36)
-- "helloworld"
base :: (Integral a, Show a) => a -> Prism' String a
base b
Expand Down
6 changes: 3 additions & 3 deletions tests/properties.hs
Expand Up @@ -135,9 +135,9 @@ prop_text s = s^.packed.from packed == s

-- Numeric.Lens
prop_base_show (n :: Integer) =
conjoin [ show n == n ^. remit (base 10)
, showSigned showOct 0 n "" == n ^. remit (base 8)
, showSigned showHex 0 n "" == n ^. remit (base 16)
conjoin [ show n == n ^. re (base 10)
, showSigned showOct 0 n "" == n ^. re (base 8)
, showSigned showHex 0 n "" == n ^. re (base 16)
]
prop_base_read (n :: Integer) =
conjoin [ show n ^? base 10 == Just n
Expand Down

0 comments on commit 1d79c2d

Please sign in to comment.