diff --git a/Web/Scotty.hs b/Web/Scotty.hs index a58f5f8..414eb3f 100644 --- a/Web/Scotty.hs +++ b/Web/Scotty.hs @@ -52,6 +52,8 @@ module Web.Scotty -- * Types , ScottyM, ActionM, RoutePattern, File, Content(..), Kilobytes, ErrorHandler, Handler(..) , ScottyState, defaultScottyState + -- ** Functions from Cookie module + , setSimpleCookie,getCookie,getCookies,deleteCookie,makeSimpleCookie ) where import qualified Web.Scotty.Trans as Trans @@ -71,6 +73,7 @@ import qualified Network.Wai.Parse as W import Web.Scotty.Internal.Types (ScottyT, ActionT, ErrorHandler, Param, RoutePattern, Options, defaultOptions, File, Kilobytes, ScottyState, defaultScottyState, ScottyException, StatusError(..), Content(..)) import UnliftIO.Exception (Handler(..), catch) +import Web.Scotty.Cookie (setSimpleCookie,getCookie,getCookies,deleteCookie,makeSimpleCookie) {- $setup >>> :{ diff --git a/Web/Scotty/Trans.hs b/Web/Scotty/Trans.hs index 2320735..8188c0b 100644 --- a/Web/Scotty/Trans.hs +++ b/Web/Scotty/Trans.hs @@ -60,6 +60,8 @@ module Web.Scotty.Trans -- * Monad Transformers , ScottyT, ActionT , ScottyState, defaultScottyState + -- ** Functions from Cookie module + , setSimpleCookie,getCookie,getCookies,deleteCookie,makeSimpleCookie ) where import Blaze.ByteString.Builder (fromByteString) @@ -84,6 +86,7 @@ import Web.Scotty.Util (socketDescription) import Web.Scotty.Body (newBodyInfo) import UnliftIO.Exception (Handler(..), catch) +import Web.Scotty.Cookie (setSimpleCookie,getCookie,getCookies,deleteCookie,makeSimpleCookie) -- | Run a scotty application using the warp server. diff --git a/changelog.md b/changelog.md index e944046..409c788 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ ## next [????.??.??] * Fixed cookie example from `Cookie` module documentation. `getCookie` Function would return strict variant of `Text`. Will convert it into lazy variant using `fromStrict`. +* Exposed simple functions of `Cookie` module via `Web.Scotty` & `Web.Scotty.Trans`. ### Breaking changes * Remove dependency on data-default class (#386). We have been exporting constants for default config values since 0.20, and this dependency was simply unnecessary. diff --git a/examples/cookies.hs b/examples/cookies.hs index 7820c87..a6d19df 100644 --- a/examples/cookies.hs +++ b/examples/cookies.hs @@ -5,10 +5,10 @@ module Main (main) where import Control.Monad (forM_) import qualified Text.Blaze.Html5 as H -import Text.Blaze.Html5.Attributes -import Text.Blaze.Html.Renderer.Text (renderHtml) -import Web.Scotty -import Web.Scotty.Cookie (CookiesText, setSimpleCookie, getCookies) +import Text.Blaze.Html5.Attributes +import Text.Blaze.Html.Renderer.Text (renderHtml) +import Web.Scotty -- Web.Scotty exports setSimpleCookie,getCookies +import Web.Scotty.Cookie (CookiesText) renderCookiesTable :: CookiesText -> H.Html renderCookiesTable cs =