@@ -15,8 +15,7 @@
1515
1616module Directive where
1717
18−import Control.Applicative
19−import Data.List (find, isPrefixOf)
18+import Data.List (isPrefixOf)
2019
2120data Directive
2221 = Help
@@ -47,7 +46,10 @@ commands Show = ["show"]
4746-- Tries to parse given string into a directive.
4847--
4948parseDirective :: String -> Maybe Directive
50−parseDirective cmd = fst <$> find (matches . snd) mapping
49+parseDirective cmd =
50+ case filter (matches . snd) mapping of
51+ [directive] -> Just $ fst directive
52+ _ -> Nothing
5153 where
5254 mapping :: [(Directive, [String])]
5355 mapping = zip directives (map commands directives)