diff options
author | Teddy Wing | 2017-09-11 00:32:37 +0200 |
---|---|---|
committer | Teddy Wing | 2017-09-11 00:32:37 +0200 |
commit | 356926db7763b21b9c4e1a9fd36e37caa04c25ca (patch) | |
tree | aa7e1eab2f4a2076683250191f459f9cb2b43b51 | |
parent | 8e5b862c9171af8af7c6c0d0456ae67a9e737633 (diff) | |
download | sorbot-356926db7763b21b9c4e1a9fd36e37caa04c25ca.tar.bz2 |
Create `Bot` type
This type will be used as an application-level monad, enabling us to
transmit configuration coming from CLI arguments (`Options`) to any
function that needs it.
The immediate benefit is that we'll be able to easily transmit the
specified language to functions to allow them to use the right
translation string.
-rw-r--r-- | sorbot.cabal | 2 | ||||
-rw-r--r-- | src/Bot.hs | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/sorbot.cabal b/sorbot.cabal index 6761349..26ecb20 100644 --- a/sorbot.cabal +++ b/sorbot.cabal @@ -16,6 +16,7 @@ cabal-version: >=1.10 library hs-source-dirs: src exposed-modules: Lib + , Bot , CliOptions , I18n , IRC @@ -30,6 +31,7 @@ library build-depends: base >= 4.7 && < 5 , bytestring , irc-client + , mtl , optparse-applicative , regex-tdfa , sqlite-simple diff --git a/src/Bot.hs b/src/Bot.hs new file mode 100644 index 0000000..a661ea4 --- /dev/null +++ b/src/Bot.hs @@ -0,0 +1,15 @@ +-- {-# LANGUAGE ConstraintKinds #-} +-- {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} + +module Bot + ( Bot(..) + ) where + +import Control.Monad.Reader + +import CliOptions (Options) + +newtype Bot a = Bot + { runBot :: ReaderT Options IO a + } deriving (Monad, Functor, Applicative, MonadIO) |