fixed the doctests

This commit is contained in:
Yann Esposito (Yogsototh) 2018-09-13 12:13:11 +02:00
parent 7b5f8862ed
commit 1372c2470e
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
4 changed files with 28 additions and 8 deletions

13
shell.nix Normal file
View file

@ -0,0 +1,13 @@
let
rev = "16d475334409f7fa632929b2838421b4ffe34927";
_nixpkgs = import <nixpkgs> { };
pkgs = import ( fetchTarball "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz" ) { };
ghc = pkgs.haskellPackages;
ghcPackages = ghc.ghcWithPackages (ps: [ ps.protolude ps.turtle ]);
in with pkgs;
stdenv.mkDerivation {
name = "gpm";
buildInputs = [ ghcPackages ];
buildDepends = [ libiconv ];
}

View file

@ -4,4 +4,11 @@ import System.FilePath.Glob
import Test.DocTest
main :: IO ()
main = glob "src/**/*.hs" >>= doctest
main = do
files <- glob "src/**/*.hs"
doctest (params <> files)
where
params = [ "-XOverloadedStrings"
, "-XNoImplicitPrelude"
, "-XScopedTypeVariables"
]

View file

@ -32,8 +32,8 @@ data AppOptions = AppOptions { genMode :: GenMode
optParser :: Parser AppOptions
optParser = AppOptions
<$> (fromMaybe Short <$> optional (opt toGenMode "gen" 'g' "Possible values: short, dict"))
<*> optional (optPath "dict" 'd' "dictionary (predefined names are: english, first-names, generic, literary) or use any file path (one word per line)")
<$> (fromMaybe Short <$> optional (opt toGenMode "gen" 'g' "Possible values: short, lovecraftian, dict"))
<*> optional (optPath "dict" 'd' "dictionary file path (the file should contain one word per line)")
<*> optional (optInt "len" 'n' "complexity depends on the gen chosen")
toGenMode :: Text -> Maybe GenMode

View file

@ -15,14 +15,14 @@ module HFIG.Helpers
)
where
import Protolude
import Protolude
import qualified System.Random.MWC as Random
import qualified Control.Monad.Primitive as Prim
import qualified Data.Vector as V
import Data.Vector ((!))
import Data.Vector ((!))
import qualified Data.Vector as V
import qualified System.Random.MWC as Random
import qualified Data.Text as Text
import qualified Data.Text as Text
-- | Generic id generator from using nameparts
idgen :: Text -> NameParts -> Int -> IO Text