summaryrefslogtreecommitdiff
path: root/src/Command.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Command.hs')
-rw-r--r--src/Command.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Command.hs b/src/Command.hs
new file mode 100644
index 0000000..78d0d6c
--- /dev/null
+++ b/src/Command.hs
@@ -0,0 +1,23 @@
+module Command (
+ Command(..),
+
+ CommandExec(..),
+ getConfig,
+) where
+
+import Control.Monad.Reader
+
+import Config
+
+class Command c where
+ commandName :: proxy c -> String
+
+ commandInit :: proxy c -> c
+ commandExec :: c -> CommandExec ()
+
+
+newtype CommandExec a = CommandExec (ReaderT Config IO a)
+ deriving (Functor, Applicative, Monad, MonadIO)
+
+getConfig :: CommandExec Config
+getConfig = CommandExec ask