scotty-utils 0.1.0.0 → 0.2.0.0
raw patch · 2 files changed
+5/−5 lines, 2 filesdep ~aesonPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson
API changes (from Hackage documentation)
- Web.Scotty.Utils: ok :: (ToJSON a, ScottyError e, Monad m) => Text -> a -> ActionT e m ()
+ Web.Scotty.Utils: ok :: (ToJSON a, ScottyError e, Monad m) => Key -> a -> ActionT e m ()
- Web.Scotty.Utils: okListResult :: (ToJSON a, ScottyError e, Monad m) => Text -> List a -> ActionT e m ()
+ Web.Scotty.Utils: okListResult :: (ToJSON a, ScottyError e, Monad m) => Key -> List a -> ActionT e m ()
Files
- scotty-utils.cabal +2/−2
- src/Web/Scotty/Utils.hs +3/−3
scotty-utils.cabal view
@@ -1,5 +1,5 @@ name: scotty-utils-version: 0.1.0.0+version: 0.2.0.0 synopsis: Scotty utils library description: Scotty utils library. homepage: https://github.com/Lupino/yuntan-common/tree/master/scotty-utils#readme@@ -19,7 +19,7 @@ exposed-modules: Web.Scotty.Utils build-depends: base >= 4.7 && < 5 , http-types- , aeson+ , aeson >= 2.0 , scotty , text , aeson-result
src/Web/Scotty/Utils.hs view
@@ -19,7 +19,7 @@ import qualified Data.Aeson.Result as R (Err, List, err, fromList, fromOk, ok) import Data.Aeson (ToJSON)-import Data.Text (Text)+import Data.Aeson.Key (Key) import qualified Data.Text.Lazy as LT (Text) maybeNotFound :: (ToJSON a, ScottyError e, Monad m) => String -> Maybe a -> ActionT e m ()@@ -37,7 +37,7 @@ err :: (ScottyError e, Monad m) => Status -> String -> ActionT e m () err st msg = status st >> json (R.err msg) -ok :: (ToJSON a, ScottyError e, Monad m) => Text -> a -> ActionT e m ()+ok :: (ToJSON a, ScottyError e, Monad m) => Key -> a -> ActionT e m () ok key = json . R.fromOk key . R.ok errNotFound :: (ScottyError e, Monad m) => String -> ActionT e m ()@@ -46,7 +46,7 @@ errBadRequest :: (ScottyError e, Monad m) => String -> ActionT e m () errBadRequest = err status400 -okListResult :: (ToJSON a, ScottyError e, Monad m) => Text -> R.List a -> ActionT e m ()+okListResult :: (ToJSON a, ScottyError e, Monad m) => Key -> R.List a -> ActionT e m () okListResult key = json . R.fromList key safeParam ::(Parsable a, ScottyError e, Monad m) => LT.Text -> a -> ActionT e m a