From a37e54ee8cb280d1e604f9e75002785e5fc10127 Mon Sep 17 00:00:00 2001 From: Robert Lee Date: Thu, 22 May 2014 11:15:10 -0500 Subject: [PATCH 1/4] yesod-bin.cabal grant developers rtsopts Sometimes yesod (yesod-bin) needs a stack space boost. Large projects can suffer stack overflows during development rebuilds. --- yesod-bin/yesod-bin.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yesod-bin/yesod-bin.cabal b/yesod-bin/yesod-bin.cabal index 5d9c6192..f5cbb1a7 100644 --- a/yesod-bin/yesod-bin.cabal +++ b/yesod-bin/yesod-bin.cabal @@ -95,7 +95,7 @@ executable yesod , data-default-class , streaming-commons - ghc-options: -Wall -threaded + ghc-options: -Wall -threaded -rtsopts main-is: main.hs other-modules: Scaffolding.Scaffolder Devel From 59ded9e2b5f002564945c4e8865a6c21773ee5e7 Mon Sep 17 00:00:00 2001 From: Tad Doxsee Date: Fri, 23 May 2014 11:18:18 -0700 Subject: [PATCH 2/4] doubleField may add a zero to some text before sending it to Data.Text.Read so that text such as '.3' may be read as 0.3. --- yesod-form/Yesod/Form/Fields.hs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/yesod-form/Yesod/Form/Fields.hs b/yesod-form/Yesod/Form/Fields.hs index cd678207..c4170f5b 100644 --- a/yesod-form/Yesod/Form/Fields.hs +++ b/yesod-form/Yesod/Form/Fields.hs @@ -80,7 +80,10 @@ import Database.Persist (PersistMonadBackend, PersistEntityBackend) import Text.Blaze.Html.Renderer.String (renderHtml) import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L -import Data.Text as T (Text, concat, intercalate, unpack, pack, splitOn) +import Data.Text as T ( Text, append, concat, cons, head + , intercalate, isPrefixOf, null, unpack, pack, splitOn + ) +import qualified Data.Text as T (drop, dropWhile) import qualified Data.Text.Read import qualified Data.Map as Map @@ -117,7 +120,7 @@ $newline never doubleField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Double doubleField = Field { fieldParse = parseHelper $ \s -> - case Data.Text.Read.double s of + case Data.Text.Read.double (prependZero s) of Right (a, "") -> Right a _ -> Left $ MsgInvalidNumber s @@ -711,3 +714,19 @@ $newline never incrInts :: Ints -> Ints incrInts (IntSingle i) = IntSingle $ i + 1 incrInts (IntCons i is) = (i + 1) `IntCons` is + + +-- | Adds a '0' to some text so that it may be recognized as a double. +-- The read ftn does not recognize ".3" as 0.3 nor "-.3" as -0.3, so this +-- function changes ".xxx" to "0.xxx" and "-.xxx" to "-0.xxx" + +prependZero :: Text -> Text +prependZero t0 = if T.null t1 + then t1 + else if T.head t1 == '.' + then '0' `T.cons` t1 + else if "-." `T.isPrefixOf` t1 + then "-0." `T.append` (T.drop 2 t1) + else t1 + + where t1 = T.dropWhile ((==) ' ') t0 From e3055871434ad231b5f58c128875337a2d414447 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 25 May 2014 08:24:48 +0300 Subject: [PATCH 3/4] Don't warn about unlisted Setup module --- yesod-bin/Devel.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/yesod-bin/Devel.hs b/yesod-bin/Devel.hs index d10e3cf4..8a2d0760 100644 --- a/yesod-bin/Devel.hs +++ b/yesod-bin/Devel.hs @@ -422,7 +422,7 @@ failWith msg = do exitFailure checkFileList :: FileList -> D.Library -> [FilePath] -checkFileList fl lib = filter isUnlisted . filter isSrcFile $ sourceFiles +checkFileList fl lib = filter (not . isSetup) . filter isUnlisted . filter isSrcFile $ sourceFiles where al = allModules lib -- a file is only a possible 'module file' if all path pieces start with a capital letter @@ -432,6 +432,12 @@ checkFileList fl lib = filter isUnlisted . filter isSrcFile $ sourceFiles isUnlisted file = not (toModuleName file `Set.member` al) toModuleName = L.intercalate "." . filter (/=".") . splitDirectories . dropExtension + isSetup "Setup.hs" = True + isSetup "./Setup.hs" = True + isSetup "Setup.lhs" = True + isSetup "./Setup.lhs" = True + isSetup _ = False + allModules :: D.Library -> Set.Set String allModules lib = Set.fromList $ map toString $ D.exposedModules lib ++ (D.otherModules . D.libBuildInfo) lib where From f0d6e1adaaa934d4f17bd1eaa41bc152b34fa05d Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 25 May 2014 08:29:11 +0300 Subject: [PATCH 4/4] Version bump --- yesod-bin/yesod-bin.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yesod-bin/yesod-bin.cabal b/yesod-bin/yesod-bin.cabal index f5cbb1a7..faecfbb0 100644 --- a/yesod-bin/yesod-bin.cabal +++ b/yesod-bin/yesod-bin.cabal @@ -1,5 +1,5 @@ name: yesod-bin -version: 1.2.9.3 +version: 1.2.9.4 license: MIT license-file: LICENSE author: Michael Snoyman