From c96b237147574e33ad9189024bb88fe4819f1ea1 Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Sun, 6 Dec 2015 19:47:11 +0300 Subject: [PATCH] Better legacy-interactive args parser --- src/GHCMod.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GHCMod.hs b/src/GHCMod.hs index b03dcaf..cf6f1ad 100644 --- a/src/GHCMod.hs +++ b/src/GHCMod.hs @@ -187,10 +187,10 @@ legacyInteractiveLoop symdbreq world = do , GHandler $ \e@(ExitFailure _) -> throw e , GHandler $ \(SomeException e) -> gmErrStrLn (show e) >> return "" ] - locArgs a (f:l:c:_) = a f (read l) (read c) - locArgs _ _ = throw $ InvalidCommandLine $ Left "Invalid command line" - locArgs' a (f:l:c:xs) = a f (read l) (read c) (Expression $ concat xs) - locArgs' _ _ = throw $ InvalidCommandLine $ Left "Invalid command line" + locArgs a [f,l,c] = a f (read l) (read c) + locArgs _ args = throw $ InvalidCommandLine $ Left $ unwords args + locArgs' a (f:l:c:xs) = a f (read l) (read c) (Expression $ unwords xs) + locArgs' _ args = throw $ InvalidCommandLine $ Left $ unwords args getFileSourceFromStdin :: IO String getFileSourceFromStdin = do