summaryrefslogtreecommitdiff
path: root/HsBot/IRC/User.hs
blob: 422f9109eb129e52e3e5202faf1e609f9e3e7ddb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module HsBot.IRC.User where

import List

import HsBot.General.Render

data User = User { 
      userName :: String,
      userPts :: Int 
   } deriving (Show, Read) 

instance Eq User where 
   x == y = (userPts x) == (userPts y)

instance Ord User where
	x < y = (userPts x) < (userPts y)
	x > y = (userPts x) > (userPts y)
	x >= y = not (x < y)
	x <= y = not (x > y)

instance Render User where
	render user = userName user ++ ": " ++ 
		(show $ userPts user) ++ "pts"

userEquals :: User -> User -> Bool
userEquals x y = (userName x) == (userName y)