apiary-cookie 1.2.0 → 1.3.0
raw patch · 2 files changed
+8/−8 lines, 2 filesdep +web-routingdep ~apiarydep ~blaze-builderPVP ok
version bump matches the API change (PVP)
Dependencies added: web-routing
Dependency ranges changed: apiary, blaze-builder
API changes (from Hackage documentation)
- Web.Apiary.Cookie: cookie :: (Strategy w, Monad actM, NotMember k prms, KnownSymbol k) => proxy k -> w ByteString -> ApiaryT exts (SNext w k ByteString prms) actM m () -> ApiaryT exts prms actM m ()
+ Web.Apiary.Cookie: cookie :: (Strategy w, Monad actM, k </ prms, KnownSymbol k) => proxy k -> w ByteString -> Filter exts actM m prms (SNext w k ByteString prms)
Files
- apiary-cookie.cabal +4/−3
- src/Web/Apiary/Cookie.hs +4/−5
apiary-cookie.cabal view
@@ -1,5 +1,5 @@ name: apiary-cookie-version: 1.2.0+version: 1.3.0 synopsis: Cookie support for apiary web framework. description: example: <https://github.com/philopon/apiary/blob/master/examples/auth.hs>@@ -9,7 +9,7 @@ maintainer: HirotomoMoriwaki<philopon.dependence@gmail.com> Homepage: https://github.com/philopon/apiary Bug-reports: https://github.com/philopon/apiary/issues-copyright: (c) 2014 Hirotomo Moriwaki+copyright: (c) 2014-2015 Hirotomo Moriwaki category: Web build-type: Simple stability: stable@@ -19,7 +19,7 @@ library exposed-modules: Web.Apiary.Cookie build-depends: base >=4.6 && <4.8- , apiary >=1.1 && <1.3+ , apiary >=1.3 && <1.4 , wai >=3.0 && <3.1 , bytestring >=0.10 && <0.11@@ -27,6 +27,7 @@ , time >=1.4 && <1.6 , blaze-builder >=0.3 && <0.4 , blaze-html >=0.7 && <0.8+ , web-routing hs-source-dirs: src ghc-options: -O2 -Wall
src/Web/Apiary/Cookie.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeFamilies #-} module Web.Apiary.Cookie @@ -19,17 +20,16 @@ import Control.Applicative((<$>)) +import Network.Routing.Dict(type (</)) import qualified Network.Wai as Wai import Web.Cookie (SetCookie(..)) import qualified Web.Cookie as Cookie -import Control.Monad.Apiary(ApiaryT) import Control.Monad.Apiary.Action(ActionT, getHeaders, addHeader) import Control.Monad.Apiary.Filter import Data.Apiary.Compat(KnownSymbol, symbolVal)-import Data.Apiary.Dict(NotMember) import Data.Apiary.Param(Strategy(..)) import Data.Maybe(mapMaybe)@@ -56,11 +56,10 @@ -- cookie [key|baz|] (pMany (pMaybe pString)) -- get zero or more baz cookies. allows cookie decrypt failure. -- cookie [key|baz|] (Proxy :: Proxy (LimitSome [int|100|] ByteString)) -- get raw cookies up to 100 entries. -- @-cookie :: (Strategy w, Monad actM, NotMember k prms, KnownSymbol k)+cookie :: (Strategy w, Monad actM, k </ prms, KnownSymbol k) => proxy k -> w S.ByteString- -> ApiaryT exts (SNext w k S.ByteString prms) actM m ()- -> ApiaryT exts prms actM m ()+ -> Filter exts actM m prms (SNext w k S.ByteString prms) cookie k p = function (DocPrecondition $ toHtml (symbolVal k) <> " cookie required") $ \l r -> strategy p k (map (Just . snd) . filter ((SC.pack (symbolVal k) ==) . fst) $ cookie' r) l