From 5b5caf2ad4be8030e4d78dbd98e07f7f247482b1 Mon Sep 17 00:00:00 2001 From: Maximilian Tagher Date: Fri, 6 Jun 2014 13:00:52 -0700 Subject: [PATCH] Break out the check for numeric-only words into a separate function, with comments --- yesod-bin/Scaffolding/Scaffolder.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yesod-bin/Scaffolding/Scaffolder.hs b/yesod-bin/Scaffolding/Scaffolder.hs index 0ccfa02c..6f6356a8 100644 --- a/yesod-bin/Scaffolding/Scaffolder.hs +++ b/yesod-bin/Scaffolding/Scaffolder.hs @@ -70,14 +70,18 @@ validPN c validPN '-' = True validPN _ = False - +-- | Cabal separates packages with a hyphen into words. A word can't consist of only digits +-- +-- Fixes +wordsHaveOneCharacter :: String -> Bool +wordsHaveOneCharacter s = not $ any (all isDigit) (splitOn "-" s) scaffold :: Bool -- ^ bare directory instead of a new subdirectory? -> IO () scaffold isBare = do puts $ renderTextUrl undefined $(textFile "input/welcome.cg") project <- prompt $ \s -> - if all validPN s && not (null s) && s /= "test" && (not $ any (all isDigit) (splitOn "-" s)) + if all validPN s && not (null s) && s /= "test" && wordsHaveOneCharacter s then Just s else Nothing let dir = project