From 356926db7763b21b9c4e1a9fd36e37caa04c25ca Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 11 Sep 2017 00:32:37 +0200 Subject: 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. --- src/Bot.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/Bot.hs (limited to 'src') 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) -- cgit v1.2.3