    {-# 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 :: Command -> [Parameter] -> Message
    mkMessage :: Command -> [Command] -> Message
    mkMessage = Maybe Prefix -> Command -> [Command] -> Message
    Message Maybe Prefix
    forall a. Maybe a
    Nothing

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

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

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

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

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

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

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

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