From 29e84fb4a5fc81ebadfc4266b0b753eef44fa558 Mon Sep 17 00:00:00 2001 From: pb Date: Sun, 14 Mar 2010 15:32:50 +0000 Subject: git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@31 9f8f72e9-4bf4-416e-b76e-7d4203597157 --- Cmd.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Cmd.hs') diff --git a/Cmd.hs b/Cmd.hs index d4c617a..3e85e86 100644 --- a/Cmd.hs +++ b/Cmd.hs @@ -7,4 +7,10 @@ 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