servant-blaze 0.7.1 → 0.8
raw patch · 4 files changed
+76/−30 lines, 4 filesdep +servant-blazedep +servant-serverdep +waidep ~basedep ~blaze-htmldep ~http-medianew-uploader
Dependencies added: servant-blaze, servant-server, wai, warp
Dependency ranges changed: base, blaze-html, http-media, servant
Files
- example/Main.hs +42/−0
- include/overlapping-compat.h +0/−8
- servant-blaze.cabal +33/−16
- src/Servant/HTML/Blaze.hs +1/−6
+ 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,51 @@--- Initial servant-blaze.cabal generated by cabal init. For further--- documentation, see http://haskell.org/cabal/users-guide/- name: servant-blaze-version: 0.7.1+version: 0.8 synopsis: Blaze-html support for servant--- description:+description:+ Servant support for blaze-html+ .+ 'HTML' content type which will use `ToMarkup` class. homepage: http://haskell-servant.readthedocs.org/ license: BSD3 license-file: LICENSE author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com copyright: 2015-2016 Servant Contributors-category: Web+category: Web, Servant build-type: Simple-extra-source-files: include/*.h cabal-version: >=1.10-bug-reports: http://github.com/haskell-servant/servant/issues+bug-reports: http://github.com/haskell-servant/servant-blaze/issues+tested-with:+ GHC==7.8.4,+ GHC==7.10.3,+ GHC==8.0.2,+ GHC==8.2.2+ 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.7 && <5+ , servant >=0.7 && <0.14+ , http-media >=0.6.4 && <0.8+ , 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.14+ , wai >=3.0.3.0 && <3.3+ , warp >=3.0.13.1 && <3.3+ default-language: Haskell2010
src/Servant/HTML/Blaze.hs view
@@ -4,7 +4,6 @@ {-# 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@@ -27,9 +26,5 @@ instance Accept HTML where contentType _ = "text" M.// "html" M./: ("charset", "utf-8") -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-