From fa98452452b705a2703b4489fca9ee48362922f9 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 21 Apr 2010 18:07:03 -0700 Subject: [PATCH] Slimmed down dependencies --- Yesod/Form.hs | 9 ++++----- Yesod/Request.hs | 6 ++++-- yesod.cabal | 14 +++----------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Yesod/Form.hs b/Yesod/Form.hs index cc0a3e0b..4f01afd5 100644 --- a/Yesod/Form.hs +++ b/Yesod/Form.hs @@ -25,10 +25,9 @@ import Yesod.Handler import Control.Applicative hiding (optional) import Data.Time (Day) import Data.Convertible.Text -import Data.Attempt +import Control.Monad.Attempt import Data.Maybe (fromMaybe) import "transformers" Control.Monad.IO.Class (MonadIO) -import qualified Safe.Failure noParamNameError :: String noParamNameError = "No param name (miscalling of Yesod.Form library)" @@ -118,9 +117,9 @@ checkBool = applyForm $ \pv -> Right $ case pv of checkInteger :: Form ParamValue -> Form Integer checkInteger = applyForm $ \pv -> - case Safe.Failure.read pv of - Nothing -> Left "Invalid integer" - Just i -> Right i + case reads pv of + [] -> Left "Invalid integer" + ((i, _):_) -> Right i -- | Instead of calling 'failure' with an 'InvalidArgs', return the error -- messages. diff --git a/Yesod/Request.hs b/Yesod/Request.hs index 0b5e59cc..5c1ae5e1 100644 --- a/Yesod/Request.hs +++ b/Yesod/Request.hs @@ -39,7 +39,6 @@ module Yesod.Request ) where import qualified Network.Wai as W -import Data.Function.Predicate (equals) import Yesod.Definitions import Web.Encodings import qualified Data.ByteString as B @@ -119,7 +118,10 @@ iothunk = fmap go . newMVar . Left where -- | All cookies with the given name. cookies :: Request -> ParamName -> [ParamValue] -cookies rr name = map snd . filter (fst `equals` name) . reqCookies $ rr +cookies rr name = + map snd . filter (fst `equals` name) . reqCookies $ rr + where + equals f x y = f y == x parseWaiRequest :: W.Request -> [(B.ByteString, B.ByteString)] -- ^ session diff --git a/yesod.cabal b/yesod.cabal index fc8cd07d..eacce498 100644 --- a/yesod.cabal +++ b/yesod.cabal @@ -37,27 +37,19 @@ library else Buildable: True build-depends: base >= 4 && < 5, - old-locale >= 1.0.0.1 && < 1.1, time >= 1.1.3 && < 1.2, - wai >= 0.0.0 && < 0.1, - wai-extra >= 0.0.0 && < 0.1, - split >= 0.1.1 && < 0.2, + wai >= 0.2.0 && < 0.3, + wai-extra >= 0.0.0 && < 0.3, authenticate >= 0.6 && < 0.7, - predicates >= 0.1 && < 0.2, bytestring >= 0.9.1.4 && < 0.10, - web-encodings >= 0.2.4 && < 0.3, + web-encodings >= 0.2.4 && < 0.5, data-object >= 0.2.0 && < 0.3, directory >= 1 && < 1.1, transformers >= 0.2.0 && < 0.3, control-monad-attempt >= 0.2.0 && < 0.3, - syb, text >= 0.5 && < 0.8, convertible-text >= 0.2.0 && < 0.3, - data-object-json >= 0.0.0 && < 0.1, - attempt >= 0.2.1 && < 0.3, template-haskell, - failure >= 0.0.0 && < 0.1, - safe-failure >= 0.4.0 && < 0.5, web-routes >= 0.22 && < 0.23, web-routes-quasi >= 0.0 && < 0.1, hamlet >= 0.0 && < 0.1