summaryrefslogtreecommitdiff
path: root/HsBot/User.hs
diff options
context:
space:
mode:
Diffstat (limited to 'HsBot/User.hs')
-rw-r--r--HsBot/User.hs28
1 files changed, 28 insertions, 0 deletions
diff --git a/HsBot/User.hs b/HsBot/User.hs
new file mode 100644
index 0000000..cd6d55f
--- /dev/null
+++ b/HsBot/User.hs
@@ -0,0 +1,28 @@
+module HsBot.User where
+
+import List
+
+import HsBot.Karma
+import HsBot.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)
+