diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2024-06-01 15:25:41 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2024-06-01 19:21:09 +0200 |
commit | 25d384c07bfd47e661d21883cfb3a6fe21cfef37 (patch) | |
tree | e783b86967553d34484b1039c22d3e46c4f45ea3 /src/Command.hs | |
parent | 7aa84dc168556f65b09d2b0b0281bc9404155145 (diff) |
Explicit run command in separate module
Changelog: Explicit run command
Diffstat (limited to 'src/Command.hs')
-rw-r--r-- | src/Command.hs | 23 |
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 |