doctest-lib 0.1.1 → 0.1.1.1
raw patch · 2 files changed
+14/−6 lines, 2 filesdep −utility-htPVP ok
version bump matches the API change (PVP)
Dependencies removed: utility-ht
API changes (from Hackage documentation)
Files
- doctest-lib.cabal +2/−3
- src/Test/DocTest/Parse.hs +12/−3
doctest-lib.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: 2.2 Name: doctest-lib-Version: 0.1.1+Version: 0.1.1.1 License: MIT License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>, Simon Hengel <sol@typeful.net>@@ -15,7 +15,7 @@ Build-Type: Simple Source-Repository this- Tag: 0.1.1+ Tag: 0.1.1.1 Type: darcs Location: https://hub.darcs.net/thielema/doctest-lib/ @@ -25,7 +25,6 @@ Library Build-Depends:- utility-ht >=0.0.14 && <0.1, base >=4.3 && <5 GHC-Options: -Wall
src/Test/DocTest/Parse.hs view
@@ -8,12 +8,12 @@ import Test.DocTest.Location (Located(Located), unLoc) import Test.DocTest.Base -import qualified Data.List.HT as ListHT-import Data.List (stripPrefix, isPrefixOf)+import Data.List (stripPrefix, isPrefixOf, tails) import Data.Maybe (fromMaybe, isJust) import Data.Char (isSpace) import Control.Arrow (second)+import Control.Monad (msum) import Control.Applicative ((<$>), (<|>)) @@ -58,7 +58,7 @@ isEndOfInteraction x = isJust (maybePrompt x) || isBlankLine x go xs =- case ListHT.dropWhileNothing maybePrompt xs of+ case dropWhileNothing maybePrompt xs of Nothing -> [] Just ((ind, (prompt, firstLine@(Located loc firstLineStr))), rest) -> let firstLineUnindented = dropWhile isSpace firstLineStr in@@ -81,6 +81,15 @@ (Example exprStr $ map mkExpectedLine $ unindent ind ys) : go zs+++-- Cf. utility-ht:Data.List.HT+dropWhileNothing :: (a -> Maybe b) -> [a] -> Maybe (b, [a])+dropWhileNothing f =+ msum .+ map (\at -> case at of [] -> Nothing; a:as -> fmap (flip (,) as) (f a)) .+ tails+ unindent :: String -> [Located pos String] -> [String] unindent pre = map (tryStripPrefix pre . unLoc)