hask-irc/Network/IRC/Handlers/Auth/Types.hs

27 lines
692 B
Haskell
Raw Normal View History

2014-05-22 03:23:57 +05:30
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE NoImplicitPrelude #-}
2014-05-23 02:45:45 +05:30
{-# LANGUAGE TemplateHaskell #-}
2014-05-22 03:23:57 +05:30
module Network.IRC.Handlers.Auth.Types where
import ClassyPrelude
import Data.Data (Data)
2014-05-23 02:45:45 +05:30
import Data.SafeCopy (base, deriveSafeCopy)
2014-05-22 03:23:57 +05:30
import Network.IRC.Types hiding (user)
type Token = Text
newtype Auth = Auth { auth :: Map Nick Token } deriving (Eq, Show, Data, Typeable)
2014-05-22 20:59:02 +05:30
emptyAuth :: Auth
emptyAuth = Auth mempty
2014-05-23 02:45:45 +05:30
$(deriveSafeCopy 0 'base ''Auth)
2014-05-22 03:23:57 +05:30
data AuthEvent = AuthEvent Nick Token (MVar Bool) deriving (Typeable)
2014-05-22 20:59:02 +05:30
2014-05-22 03:23:57 +05:30
instance Event AuthEvent
2014-05-22 20:59:02 +05:30
2014-05-22 03:23:57 +05:30
instance Show AuthEvent where
show (AuthEvent user token _) = "AuthEvent[" ++ unpack user ++ ", " ++ unpack token ++ "]"