module Channel.Match where

import           Type
import           Channel.Event

join :: Monad m => (UserName -> m ()) -> Event -> m ()
join action ev = case ev of
  Join nick -> action nick
  _ -> return ()

message :: Monad m => (UserName -> String -> m ()) -> Event -> m ()
message action ev = case ev of
  Message nick msg -> action nick msg
  _ -> return ()

kick :: Monad m => (UserName -> UserName -> Maybe String -> m ()) -> Event -> m ()
kick action ev = case ev of
  Kick from to reason -> action from to reason
  _ -> return ()
