Browse Source

fixed the doctests

master
parent
commit
1372c2470e
Signed by: Yann Esposito (Yogsototh) <yann.esposito@gmail.com> GPG Key ID: 7B19A4C650D59646
4 changed files with 28 additions and 8 deletions
  1. 13
    0
      shell.nix
  2. 8
    1
      src-doctest/Main.hs
  3. 2
    2
      src-exe/Main.hs
  4. 5
    5
      src/HFIG/Helpers.hs

+ 13
- 0
shell.nix 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 ];
}

+ 8
- 1
src-doctest/Main.hs 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"
]

+ 2
- 2
src-exe/Main.hs 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

+ 5
- 5
src/HFIG/Helpers.hs 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

Loading…
Cancel
Save