diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-05-26 13:58:07 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-05-26 13:58:07 +0200 |
| commit | fc6cf6169868e60c189e4b243330c3717ff159f3 (patch) | |
| tree | 3f6dea9c1420e23756257b5abea27ec9ed92d58a /overlays/spm/server/Spm/Server/Wordlist.hs | |
| parent | 84f2affd66a0ff3947b91a30308cb8e6a8ff7594 (diff) | |
| download | nixos-fc6cf6169868e60c189e4b243330c3717ff159f3.tar nixos-fc6cf6169868e60c189e4b243330c3717ff159f3.tar.gz nixos-fc6cf6169868e60c189e4b243330c3717ff159f3.tar.bz2 nixos-fc6cf6169868e60c189e4b243330c3717ff159f3.tar.xz nixos-fc6cf6169868e60c189e4b243330c3717ff159f3.zip | |
...
Diffstat (limited to 'overlays/spm/server/Spm/Server/Wordlist.hs')
| -rw-r--r-- | overlays/spm/server/Spm/Server/Wordlist.hs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/overlays/spm/server/Spm/Server/Wordlist.hs b/overlays/spm/server/Spm/Server/Wordlist.hs new file mode 100644 index 00000000..8109f07b --- /dev/null +++ b/overlays/spm/server/Spm/Server/Wordlist.hs | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | {-# LANGUAGE TemplateHaskell #-} | ||
| 2 | |||
| 3 | module Spm.Server.Wordlist | ||
| 4 | ( wordlist, consonants | ||
| 5 | ) where | ||
| 6 | |||
| 7 | import Prelude | ||
| 8 | import Language.Haskell.TH.Syntax | ||
| 9 | import Control.Monad.IO.Class | ||
| 10 | |||
| 11 | import Data.Text (Text) | ||
| 12 | import qualified Data.Text as Text | ||
| 13 | import qualified Data.Text.IO as Text | ||
| 14 | |||
| 15 | import Data.Vector (Vector) | ||
| 16 | import qualified Data.Vector as Vector | ||
| 17 | |||
| 18 | import Data.FileEmbed (makeRelativeToProject) | ||
| 19 | |||
| 20 | import Instances.TH.Lift () | ||
| 21 | |||
| 22 | |||
| 23 | {-# NOINLINE wordlist #-} | ||
| 24 | {-# NOINLINE consonants #-} | ||
| 25 | wordlist, consonants :: Vector Text | ||
| 26 | wordlist = $( do | ||
| 27 | fPath <- makeRelativeToProject "wordlist.txt" | ||
| 28 | addDependentFile fPath | ||
| 29 | lift . Vector.fromList =<< liftIO (filter (not . Text.null) . Text.words <$> Text.readFile fPath) | ||
| 30 | ) | ||
| 31 | consonants = Vector.fromList $ map Text.singleton "bcdfghjklmnpqrstvwxz" | ||
