blob: c4a6725d7b0eda3b36913c8e5fc6c6c50ff28f84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
{-# LANGUAGE TemplateHaskell #-}
module Spm.Server.Wordlist
( wordlist, consonants
) where
import Prelude
import Language.Haskell.TH.Syntax
import Control.Monad.IO.Class
import Data.Text (Text)
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import Data.Vector (Vector)
import qualified Data.Vector as Vector
import Instances.TH.Lift ()
{-# NOINLINE wordlist #-}
{-# NOINLINE consonants #-}
wordlist, consonants :: Vector Text
wordlist = $( do
fPath <- makeRelativeToProject "wordlist.txt"
addDependentFile fPath
lift . Vector.fromList =<< liftIO (filter (not . Text.null) . Text.words <$> Text.readFile fPath)
)
consonants = Vector.fromList $ map Text.singleton "bcdfghjklmnpqrstvwxz"
|