blob: 3e85e860d813c5394ed227997d8498adb8e63136 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
module Cmd where
import 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)
|