doctest-extract 0.1.0.1 → 0.1.1
raw patch · 3 files changed
+19/−9 lines, 3 files
Files
- doctest-extract.cabal +10/−4
- src/Main.hs +3/−4
- src/ModuleName.hs +6/−1
doctest-extract.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: 2.2 Name: doctest-extract-Version: 0.1.0.1+Version: 0.1.1 License: BSD-3-Clause License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -74,15 +74,21 @@ * You need tools additional to @Cabal@, e.g. @make@ and a @Makefile@, in order generate test modules. .- See packages @utility-ht@, @apportionment@ or @pathtype@ for a package- with a working setup of @doctest-extract@.+ Known Problems: .+ * In Literal Haskell files+ only @\\begin{code} ... \\end{code}@ blocks are scanned,+ but not bird style code blocks.+ .+ See packages @utility-ht@, @apportionment@ or @pathtype@ for packages+ with working setups of @doctest-extract@.+ . Alternatives: @cabal-docspec@, @cabal-doctest@ Tested-With: GHC==7.4.2, GHC==8.6.5 Build-Type: Simple Source-Repository this- Tag: 0.1.0.1+ Tag: 0.1.1 Type: darcs Location: https://hub.darcs.net/thielema/doctest-extract/
src/Main.hs view
@@ -18,7 +18,7 @@ import Data.Semigroup ((<>)) import Control.Monad (when)-import Control.Applicative ((<$>))+import Control.Applicative (liftA2, (<$>)) {-@@ -44,9 +44,8 @@ modules <- fmap (map Parse.parseModule) $ for moduleNames $ \moduleName -> do- let fileName = ModuleName.filePath moduleName- alternatives $ flip fmap inDirs $ \inDir -> do- let path = inDir </> fileName+ let altPaths = liftA2 (</>) inDirs (ModuleName.filePaths moduleName)+ alternatives $ flip fmap altPaths $ \path -> do Parse.moduleFromLines moduleName path . Parse.numberedLines . filter ('\r'/=) <$> PathIO.readFile path
src/ModuleName.hs view
@@ -4,11 +4,13 @@ parse, dirPath, filePath,+ filePaths, ) where import qualified Data.NonEmpty.Class as NonEmptyC import qualified Data.NonEmpty as NonEmpty import qualified Data.Foldable as Fold+import Data.NonEmpty ((!:)) import Data.Semigroup (Semigroup, (<>)) import qualified System.Path.PartClass as PathClass@@ -40,10 +42,13 @@ genericPath :: (PathClass.FileDir fd) => T -> Path.Rel fd-genericPath = joinPath . NonEmpty.flatten . ModuleName.components+genericPath = joinPath . NonEmpty.flatten . components dirPath :: T -> Path.RelDir dirPath = genericPath filePath :: T -> Path.RelFile filePath name = genericPath name <.> "hs"++filePaths :: T -> NonEmpty.T [] Path.RelFile+filePaths name = fmap (genericPath name <.>) ("hs" !: "lhs" : [])