From 1372c2470e1530f9b0a9b6fbb2b78c50c9b09a7b Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Thu, 13 Sep 2018 12:13:11 +0200 Subject: [PATCH] fixed the doctests --- shell.nix | 13 +++++++++++++ src-doctest/Main.hs | 9 ++++++++- src-exe/Main.hs | 4 ++-- src/HFIG/Helpers.hs | 10 +++++----- 4 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 shell.nix diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..dbd4d4a --- /dev/null +++ b/shell.nix @@ -0,0 +1,13 @@ +let + rev = "16d475334409f7fa632929b2838421b4ffe34927"; + _nixpkgs = import { }; + 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 ]; +} \ No newline at end of file diff --git a/src-doctest/Main.hs b/src-doctest/Main.hs index 03d5ae7..64fd4c7 100644 --- a/src-doctest/Main.hs +++ b/src-doctest/Main.hs @@ -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" + ] diff --git a/src-exe/Main.hs b/src-exe/Main.hs index 2cfaf6d..dec7f89 100644 --- a/src-exe/Main.hs +++ b/src-exe/Main.hs @@ -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 diff --git a/src/HFIG/Helpers.hs b/src/HFIG/Helpers.hs index b50afaa..5ab1ef0 100644 --- a/src/HFIG/Helpers.hs +++ b/src/HFIG/Helpers.hs @@ -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