on master help sign in
Simplify implementation of trim
commitfd5c45842166b898d4b655e55a93f70f696e4686 authorJohannes Griebler <johannes.griebler@gmail.com> dateFri 19 Jun 2015, 16:15 (11 years ago) parent8e550c1
1 file changed+2−5
src/Idris/REPLParser.hs+2−5
src/Idris/REPLParser.hs+2−5
@@ -26,11 +26,8 @@ import qualified Data.ByteString.UTF8 as UTF8
2626
2727parseCmd :: IState -> String -> String -> Result (Either String Command)
2828parseCmd i inputname = P.runparser pCmd i inputname . trim
29− where trim = fst . foldr f ("", True) . dropWhile isSpace
30− where f e (xs, False) = (e : xs, False)
31− f e (xs, True)
32− | isSpace e = (xs, True)
33− | otherwise = (e : xs, False)
29+ where trim = f . f
30+ where f = reverse . dropWhile isSpace
3431
3532type CommandTable = [ ( [String], CmdArg, String
3633 , String -> P.IdrisParser (Either String Command) ) ]