    {-# LANGUAGE OverloadedStrings #-}

    module Network.IRC.Commands (
        -- * Types
        Channel
      , Password

        -- * IRC Functions
      , nick
      , user
      , joinChan
      , part
      , quit
      , privmsg
      , kick
      , pong
      ) where

    import Data.ByteString

    import Network.IRC.Base

    type Channel    = ByteString
    type Password   = ByteString
    type Reason     = ByteString

    mkMessage           :: ByteString -> [Parameter] -> Message
    mkMessage :: ByteString -> [ByteString] -> Message
    mkMessage cmd :: ByteString
    cmd params :: [ByteString]
    params = Maybe Prefix -> ByteString -> [ByteString] -> Message
    Message Maybe Prefix
    forall a. Maybe a
    Nothing ByteString
    cmd [ByteString]
    params

    nick  :: UserName -> Message
    nick :: ByteString -> Message
    nick u :: ByteString
    u = ByteString -> [ByteString] -> Message
    mkMessage "NICK" [ByteString
    u]

    user        :: UserName -> ServerName -> ServerName -> RealName -> Message
    user :: ByteString -> ByteString -> ByteString -> ByteString -> Message
    user u :: ByteString
    u h :: ByteString
    h s :: ByteString
    s r :: ByteString
    r = ByteString -> [ByteString] -> Message
    mkMessage "USER" [ByteString
    u,ByteString
    h,ByteString
    s,ByteString
    r]

    joinChan  :: Channel -> Message
    joinChan :: ByteString -> Message
    joinChan c :: ByteString
    c = ByteString -> [ByteString] -> Message
    mkMessage "JOIN" [ByteString
    c]

    kick :: Channel -> UserName -> Maybe Reason -> Message
    kick :: ByteString -> ByteString -> Maybe ByteString -> Message
    kick c :: ByteString
    c u :: ByteString
    u (Just r :: ByteString
    r) = ByteString -> [ByteString] -> Message
    mkMessage "KICK" [ByteString
    c,ByteString
    u,ByteString
    r]
    kick c :: ByteString
    c u :: ByteString
    u Nothing  = ByteString -> [ByteString] -> Message
    mkMessage "KICK" [ByteString
    c,ByteString
    u]

    part  :: Channel -> Message
    part :: ByteString -> Message
    part c :: ByteString
    c = ByteString -> [ByteString] -> Message
    mkMessage "PART" [ByteString
    c]

    quit :: Maybe ByteString -> Message
    quit :: Maybe ByteString -> Message
    quit (Just m :: ByteString
    m) = ByteString -> [ByteString] -> Message
    mkMessage "QUIT" [ByteString
    m]
    quit Nothing  = ByteString -> [ByteString] -> Message
    mkMessage "QUIT" []

    privmsg    :: ByteString -> ByteString -> Message
    privmsg :: ByteString -> ByteString -> Message
    privmsg c :: ByteString
    c m :: ByteString
    m = ByteString -> [ByteString] -> Message
    mkMessage "PRIVMSG" [ByteString
    c,ByteString
    m]

    pong  :: ServerName -> Message
    pong :: ByteString -> Message
    pong s :: ByteString
    s = ByteString -> [ByteString] -> Message
    mkMessage "PONG" [ByteString
    s]