From 650722db7e06f98e49b9dcc5178e734dc7a8a13c Mon Sep 17 00:00:00 2001 From: Anupam Jain Date: Sat, 23 Apr 2016 19:56:25 +0530 Subject: [PATCH] Allow lines of dashes in route files Code taken from - yesodweb/yesod@3640d75 --- src/Network/Wai/Middleware/Routes/Parse.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Network/Wai/Middleware/Routes/Parse.hs b/src/Network/Wai/Middleware/Routes/Parse.hs index 6bddf76..5ec4dff 100644 --- a/src/Network/Wai/Middleware/Routes/Parse.hs +++ b/src/Network/Wai/Middleware/Routes/Parse.hs @@ -18,7 +18,7 @@ import Language.Haskell.TH.Quote import qualified System.IO as SIO import Network.Wai.Middleware.Routes.TH import Network.Wai.Middleware.Routes.Overlap (findOverlapNames) -import Data.List (foldl') +import Data.List (foldl', isPrefixOf) import Data.Maybe (mapMaybe) import qualified Data.Set as Set @@ -86,7 +86,7 @@ resourcesFromString = spaces = takeWhile (== ' ') thisLine (others, remainder) = parse indent otherLines' (this, otherLines') = - case takeWhile (/= "--") $ words thisLine of + case takeWhile (not . isPrefixOf "--") $ words thisLine of (pattern:rest0) | Just (constr:rest) <- stripColonLast rest0 , Just attrs <- mapM parseAttr rest ->