packages feed

servant-blaze 0.7.1 → 0.9.1

raw patch · 5 files changed

Files

+ CHANGELOG.md view
@@ -0,0 +1,8 @@+# 0.9++- Also accept content type without character set i.e `text/html`+- Support only GHC >= 8.0++# 0.8++- Only single `MimeRender HTML a` instance. `blaze-markup` has `ToMarkup Markup` instance.
+ example/Main.hs view
@@ -0,0 +1,42 @@+{-# LANGUAGE DataKinds       #-}+{-# LANGUAGE TypeOperators   #-}+{-# LANGUAGE OverloadedStrings #-}+module Main (main) where++import Data.Maybe         (fromMaybe)+import Network.Wai        (Application)+import Servant+import Servant.HTML.Blaze+import System.Environment (getArgs, lookupEnv)+import Text.Read          (readMaybe)++import qualified Text.Blaze.Html5 as H+import qualified Network.Wai.Handler.Warp as Warp++type API = "string" :> Get '[HTML] String+    :<|> "html" :> Get '[HTML] H.Html++api :: Proxy API+api = Proxy++server :: Server API+server = return "example" :<|> return html where+    html :: H.Html+    html = do+        H.b "bar"+        H.i "iik"++app :: Application+app = serve api server++main :: IO ()+main = do+    args <- getArgs+    case args of+        ("run":_) -> do+            port <- fmap (fromMaybe 8000 . (>>= readMaybe)) (lookupEnv "PORT")+            putStrLn $ "http://localhost:" ++ show port ++ "/"+            Warp.run port app+        _ -> do+            putStrLn "Example application, used as a compilation check"+            putStrLn "To run, pass run argument: --test-arguments run"
− include/overlapping-compat.h
@@ -1,8 +0,0 @@-#if __GLASGOW_HASKELL__ >= 710-#define OVERLAPPABLE_ {-# OVERLAPPABLE #-}-#define OVERLAPPING_  {-# OVERLAPPING #-}-#else-{-# LANGUAGE OverlappingInstances #-}-#define OVERLAPPABLE_-#define OVERLAPPING_-#endif
servant-blaze.cabal view
@@ -1,34 +1,50 @@--- Initial servant-blaze.cabal generated by cabal init.  For further--- documentation, see http://haskell.org/cabal/users-guide/-+cabal-version:       >=1.10 name:                servant-blaze-version:             0.7.1+version:             0.9.1+ synopsis:            Blaze-html support for servant--- description:+category:            Servant, Web+description:+  Servant support for blaze-html+  .+  'HTML' content type which will use `ToMarkup` class.+ homepage:            http://haskell-servant.readthedocs.org/+bug-reports:         http://github.com/haskell-servant/servant-blaze/issues license:             BSD3 license-file:        LICENSE author:              Servant Contributors maintainer:          haskell-servant-maintainers@googlegroups.com-copyright:           2015-2016 Servant Contributors-category:            Web+copyright:           2015-2018 Servant Contributors build-type:          Simple-extra-source-files:  include/*.h-cabal-version:       >=1.10-bug-reports:         http://github.com/haskell-servant/servant/issues+tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.2+extra-source-files: CHANGELOG.md+ source-repository head   type: git-  location: http://github.com/haskell-servant/servant.git+  location: http://github.com/haskell-servant/servant-blaze.git  library   exposed-modules:     Servant.HTML.Blaze-  -- other-modules:-  -- other-extensions:-  build-depends:       base >=4.7 && <5-                     , servant == 0.7.*-                     , http-media-                     , blaze-html+  build-depends:       base       >=4.9     && <5+                     , servant    >=0.10    && <0.19+                     , http-media >=0.6.4   && <0.9+                     , blaze-html >=0.9.0.1 && <0.10   hs-source-dirs:      src   default-language:    Haskell2010-  include-dirs: include   ghc-options: -Wall++test-suite example+  type: exitcode-stdio-1.0+  main-is: Main.hs+  hs-source-dirs:+    example+  ghc-options: -Wall+  build-depends:+      base+    , blaze-html+    , servant-blaze+    , servant-server >=0.4.4.5  && <0.19+    , wai            >=3.0.3.0  && <3.3+    , warp           >=3.0.13.1 && <3.4+  default-language: Haskell2010
src/Servant/HTML/Blaze.hs view
@@ -4,11 +4,10 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings     #-} -#include "overlapping-compat.h" -- | An @HTML@ empty data type with `MimeRender` instances for @blaze-html@'s -- `ToMarkup` class and `Html` datatype.--- You should only need to import this module for it's instances and the--- `HTML` datatype.:+-- You should only need to import this module for its instances and the+-- `HTML` datatype: -- -- >>> type Eg = Get '[HTML] a --@@ -20,16 +19,15 @@ import           Servant.API                   (Accept (..), MimeRender (..)) import           Text.Blaze.Html               (Html, ToMarkup, toHtml) import           Text.Blaze.Html.Renderer.Utf8 (renderHtml)+import qualified Data.List.NonEmpty            as NE  data HTML deriving Typeable  -- | @text/html;charset=utf-8@ instance Accept HTML where-    contentType _ = "text" M.// "html" M./: ("charset", "utf-8")+    contentTypes _ =+      "text" M.// "html" M./: ("charset", "utf-8") NE.:|+      ["text" M.// "html"] -instance OVERLAPPABLE_ ToMarkup a => MimeRender HTML a where+instance ToMarkup a => MimeRender HTML a where     mimeRender _ = renderHtml . toHtml--instance OVERLAPPING_ MimeRender HTML Html where-    mimeRender _ = renderHtml-