summaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Types.hs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-21 19:44:39 +0100
committertv <tv@krebsco.de>2019-01-21 19:44:39 +0100
commita00da57346c195b1b15d1c6aca2891483901aae6 (patch)
treefab49308ba6a4a96a0eb01fa7eb8f727d9c95f07 /src/Reaktor/Types.hs
parent2842e05c232505c670daee0fffb9a34d5c866217 (diff)
src: Types -> Internal
Diffstat (limited to 'src/Reaktor/Types.hs')
-rw-r--r--src/Reaktor/Types.hs58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/Reaktor/Types.hs b/src/Reaktor/Types.hs
deleted file mode 100644
index 7b5e8fa..0000000
--- a/src/Reaktor/Types.hs
+++ /dev/null
@@ -1,58 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-module Reaktor.Types (module Reaktor.Types, module X) where
-
-import Blessings (Blessings)
-import Control.Monad.Trans.Class as X (lift)
-import Control.Monad.Trans.State as X (gets,modify)
-import Control.Monad.Trans.State (StateT)
-import Data.Aeson
-import Data.Aeson.Types
-import qualified Data.ByteString.Char8.Extended as BS
-import Network.Socket as X (HostName,ServiceName)
-
-
-type Prefix = BS.ByteString
-
-type Nickname = BS.ByteString
-type Password = BS.ByteString
-type MsgTarget = BS.ByteString
-type Channel = MsgTarget
-
-data PluginState = PluginState {
- s_putLog :: Blessings BS.ByteString -> IO (),
- s_nick :: BS.ByteString,
- s_sendMsg :: Message -> IO (),
- s_sendMsg' :: Message -> Message -> IO ()
- }
-
-setNick :: Nickname -> PluginIO ()
-setNick newnick = modify (\q -> q { s_nick = newnick })
-
-getNick :: PluginIO Nickname
-getNick = gets s_nick
-
-sendMsg :: Message -> PluginIO ()
-sendMsg msg = gets s_sendMsg >>= \f -> lift $ f msg
-
-sendMsg' :: Message -> Message -> PluginIO ()
-sendMsg' msg logMsg = gets s_sendMsg' >>= \f -> lift $ f msg logMsg
-
-
-type PluginIO = StateT PluginState IO
-
-type PluginFunc = Message -> PluginIO ()
-
-data Plugin = Plugin {
- pluginFunc :: PluginFunc,
- requireTLS :: Bool
- }
-
-simplePlugin :: FromJSON a => (a -> PluginFunc) -> Value -> IO Plugin
-simplePlugin f v =
- either error (\x -> return $ Plugin (f x) False) (parseEither parseJSON v)
-
-
-type Param = BS.ByteString
-type Command = BS.ByteString
-data Message = Message (Maybe Prefix) Command [Param]
- deriving Show