From 3b090644f148acf856e925be59e6915ea524a3f8 Mon Sep 17 00:00:00 2001 From: pb Date: Sun, 14 Mar 2010 12:42:20 +0000 Subject: git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@25 9f8f72e9-4bf4-416e-b76e-7d4203597157 --- User.hs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 User.hs (limited to 'User.hs') diff --git a/User.hs b/User.hs new file mode 100644 index 0000000..ba1a58c --- /dev/null +++ b/User.hs @@ -0,0 +1,28 @@ +module User where + +import List + +import Karma +import 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) + -- cgit v1.2.3