module Lambdabot.ChanName
( ChanName
, mkCN
, getCN
) where
import Lambdabot.Nick
import Control.Applicative
import Data.Char
newtype ChanName = ChanName Nick
deriving (ChanName -> ChanName -> Bool
(ChanName -> ChanName -> Bool)
-> (ChanName -> ChanName -> Bool) -> Eq ChanName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChanName -> ChanName -> Bool
$c/= :: ChanName -> ChanName -> Bool
== :: ChanName -> ChanName -> Bool
$c== :: 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
min :: ChanName -> ChanName -> ChanName
$cmin :: ChanName -> ChanName -> ChanName
max :: ChanName -> ChanName -> ChanName
$cmax :: ChanName -> ChanName -> ChanName
>= :: ChanName -> ChanName -> Bool
$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
compare :: ChanName -> ChanName -> Ordering
$ccompare :: ChanName -> ChanName -> Ordering
$cp1Ord :: Eq 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 (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