-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathConfig.hs
More file actions
61 lines (53 loc) · 1.46 KB
/
Copy pathConfig.hs
File metadata and controls
61 lines (53 loc) · 1.46 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
module Config where
import Calamity.Types
import Data.Aeson
import Data.List.NonEmpty (NonEmpty)
import Data.Map (Map)
import Data.Set (Set)
import Data.Text (Text)
import GHC.Generics (Generic)
newtype InterpreterName = InterpreterName Text
deriving newtype (Eq, Ord, Show, FromJSONKey, ToJSONKey, FromJSON, ToJSON)
newtype Blocks = Blocks Int
deriving newtype (FromJSON, ToJSON)
type CmdLine = NonEmpty FilePath
data Interpreter
= LiveState
{ runCommand :: !CmdLine
, resetCommand :: !CmdLine
}
| IndexedState
{ runCommand :: !CmdLine
, pruneCommand :: !CmdLine
}
deriving stock (Generic)
deriving anyclass (FromJSON, ToJSON)
data Wrapper = Wrapper
{ prefix :: !(Maybe Text)
, suffix :: !(Maybe Text)
, stripControl :: !(Maybe Bool)
, interpreter :: !InterpreterName
}
deriving stock (Generic)
deriving anyclass (FromJSON, ToJSON)
data EvalConfig = EvalConfig
{ logFile :: !FilePath
, token :: !Text
, testGuilds :: !(Set (Snowflake Guild))
, isTest :: !Bool
, forgetAfterSeconds :: !Int
, blockCountLimit :: !Blocks
, msgSizeLimit :: !Int
, pastebinSizeLimit :: !Int
, reactWait :: !RawEmoji
, reactCancel :: !RawEmoji
, emptyOutput :: !Text
, interpreters :: !(Map InterpreterName Interpreter)
, defaultInline :: Wrapper
, defaultCodeBlock :: Wrapper
, codeBlockLanguages :: !(Map Text Wrapper)
}
deriving stock (Generic)
deriving anyclass (FromJSON, ToJSON)
configFile :: FilePath
configFile = "eval.yaml"