    module Lambdabot.ChanName
        ( ChanName
        , mkCN
        , getCN
        ) where

    import Lambdabot.Nick

    import Control.Applicative
    import Data.Char

    newtype ChanName = ChanName Nick -- always lowercase
      deriving (ChanName -> ChanName -> Bool
    (ChanName -> ChanName -> Bool)
    -> (ChanName -> ChanName -> Bool) -> Eq ChanName
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ChanName -> ChanName -> Bool
    == :: ChanName -> ChanName -> Bool
    $c/= :: ChanName -> ChanName -> Bool
    /= :: ChanName -> ChanName -> Bool
    Eq, Eq ChanName
    Eq ChanName =>
    (ChanName -> ChanName -> Ordering)
    -> (ChanName -> ChanName -> Bool)
    -> (ChanName -> ChanName -> Bool)
    -> (ChanName -> ChanName -> Bool)
    -> (ChanName -> ChanName -> Bool)
    -> (ChanName -> ChanName -> ChanName)
    -> (ChanName -> ChanName -> ChanName)
    -> Ord ChanName
    ChanName -> ChanName -> Bool
    ChanName -> ChanName -> Ordering
    ChanName -> ChanName -> ChanName
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: ChanName -> ChanName -> Ordering
    compare :: ChanName -> ChanName -> Ordering
    $c< :: ChanName -> ChanName -> Bool
    < :: ChanName -> ChanName -> Bool
    $c<= :: ChanName -> ChanName -> Bool
    <= :: ChanName -> ChanName -> Bool
    $c> :: ChanName -> ChanName -> Bool
    > :: ChanName -> ChanName -> Bool
    $c>= :: ChanName -> ChanName -> Bool
    >= :: ChanName -> ChanName -> Bool
    $cmax :: ChanName -> ChanName -> ChanName
    max :: ChanName -> ChanName -> ChanName
    $cmin :: ChanName -> ChanName -> ChanName
    min :: ChanName -> ChanName -> ChanName
    Ord)

    mkCN :: Nick -> ChanName
    mkCN :: Nick -> ChanName
    mkCN = Nick -> ChanName
    ChanName (Nick -> ChanName) -> (Nick -> Nick) -> Nick -> ChanName
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String -> String -> Nick)
    -> (Nick -> String) -> (Nick -> String) -> Nick -> Nick
    forall a b c.
    (a -> b -> c) -> (Nick -> a) -> (Nick -> b) -> Nick -> c
    forall (f :: * -> *) a b c.
    Applicative f =>
    (a -> b -> c) -> f a -> f b -> f c
    liftA2 String -> String -> Nick
    Nick Nick -> String
    nTag ((Char -> Char) -> String -> String
    forall a b. (a -> b) -> [a] -> [b]
    map Char -> Char
    toLower (String -> String) -> (Nick -> String) -> Nick -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Nick -> String
    nName)

    getCN :: ChanName -> Nick
    getCN :: ChanName -> Nick
    getCN (ChanName Nick
    n) = Nick
    n