Skip to content

Commit

Permalink
Catch error calls in doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
glguy committed Jun 3, 2016
1 parent 14c35e0 commit 816e02e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Control/Lens/Traversal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ import Prelude hiding ((.),id)
-- >>> :set -XNoOverloadedStrings
-- >>> import Control.Lens
-- >>> import Control.DeepSeq (NFData (..), force)
-- >>> import Control.Exception (evaluate)
-- >>> import Control.Exception (evaluate,try,ErrorCall)
-- >>> import Data.Maybe (fromMaybe)
-- >>> import Debug.SimpleReflect.Vars
-- >>> import Data.Void
Expand Down Expand Up @@ -636,8 +636,8 @@ holesOf l s = unTagged
-- >>> [1,2,3] ^. singular _head
-- 1
--
-- >>> [] ^. singular _head
-- *** Exception: singular: empty traversal
-- >>> try (evaluate ([] ^. singular _head)) :: IO (Either ErrorCall ())
-- Left singular: empty traversal
--
-- >>> Left 4 ^. singular _Left
-- 4
Expand Down Expand Up @@ -672,8 +672,8 @@ singular l = conjoined
-- The resulting 'Lens' or 'Getter' will be partial if the 'Traversal' targets nothing
-- or more than one element.
--
-- >>> [] & unsafeSingular traverse .~ 0
-- *** Exception: unsafeSingular: empty traversal
-- >>> try (evaluate ([] & unsafeSingular traverse .~ 0)) :: IO (Either ErrorCall ())
-- Left singular: empty traversal
--
-- @
-- 'unsafeSingular' :: 'Traversal' s t a b -> 'Lens' s t a b
Expand Down

0 comments on commit 816e02e

Please sign in to comment.