From 80ff91aa5d6cda6adc1c97dc39b950dd7daed9d5 Mon Sep 17 00:00:00 2001 From: pb Date: Sun, 28 Mar 2010 11:09:30 +0000 Subject: git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@50 9f8f72e9-4bf4-416e-b76e-7d4203597157 --- HsBot/Base/Cmd.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 HsBot/Base/Cmd.hs (limited to 'HsBot/Base/Cmd.hs') diff --git a/HsBot/Base/Cmd.hs b/HsBot/Base/Cmd.hs new file mode 100644 index 0000000..c4963ac --- /dev/null +++ b/HsBot/Base/Cmd.hs @@ -0,0 +1,16 @@ +module HsBot.Base.Cmd where + +import HsBot.Base.State + +data Cmd = Cmd String String (State -> IO ()) + +instance Show Cmd where + show (Cmd a b _) = a ++ " - " ++ b + +cmdGet :: String -> [Cmd] -> Maybe Cmd +cmdGet x commands = + let command = [ (Cmd a b c) | (Cmd a b c) <- commands, a == x ] + in if length command == 0 + then Nothing + else Just (head command) + -- cgit v1.2.3