summaryrefslogtreecommitdiff
path: root/src/Command.hs
blob: 78d0d6c17f91f32066332934fa1e9c0d938db432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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