servant-lucid 0.7.1 → 0.8
raw patch · 5 files changed
+80/−32 lines, 5 filesdep +servant-luciddep +servant-serverdep +waidep ~basedep ~http-mediadep ~lucidnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: servant-lucid, servant-server, wai, warp
Dependency ranges changed: base, http-media, lucid, servant
API changes (from Hackage documentation)
- Servant.HTML.Lucid: instance Servant.API.ContentTypes.MimeRender Servant.HTML.Lucid.HTML (Lucid.Base.Html a)
Files
- CHANGELOG.md +3/−0
- example/Main.hs +42/−0
- include/overlapping-compat.h +0/−8
- servant-lucid.cabal +34/−16
- src/Servant/HTML/Lucid.hs +1/−8
+ CHANGELOG.md view
@@ -0,0 +1,3 @@+# 0.8++- Only single `MimeRender HTML a` instance. `lucid-2.9.8` has `ToHtml (HtmlT m a)` instance.
+ example/Main.hs view
@@ -0,0 +1,42 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE OverloadedStrings #-}+module Main (main) where++import Lucid+import Data.Maybe (fromMaybe)+import Network.Wai (Application)+import Servant+import Servant.HTML.Lucid+import System.Environment (getArgs, lookupEnv)+import Text.Read (readMaybe)++import qualified Network.Wai.Handler.Warp as Warp++type API = "string" :> Get '[HTML] String+ :<|> "html" :> Get '[HTML] (Html ())++api :: Proxy API+api = Proxy++server :: Server API+server = return "example" :<|> return html where+ html :: Html ()+ html = do+ b_ "bar"+ 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-lucid.cabal view
@@ -1,34 +1,52 @@--- Initial servant-lucid.cabal generated by cabal init. For further--- documentation, see http://haskell.org/cabal/users-guide/- name: servant-lucid-version: 0.7.1+version: 0.8 synopsis: Servant support for lucid--- description:+description:+ Servant support for lucid.+ .+ 'HTML' content type which will use `ToHtml` 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+extra-source-files: CHANGELOG.md cabal-version: >=1.10-bug-reports: http://github.com/haskell-servant/servant/issues+bug-reports: http://github.com/haskell-servant/servant-lucid/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-lucid.git library exposed-modules: Servant.HTML.Lucid- -- other-modules:- -- other-extensions:- build-depends: base >=4.7 && <5- , http-media- , lucid- , servant == 0.7.*+ build-depends: base >=4.7 && <5+ , http-media >=0.6.4 && <0.8+ , lucid >=2.9.8 && <2.10+ , servant >=0.7 && <0.14 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+ , lucid+ , servant-lucid+ , 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/Lucid.hs view
@@ -4,8 +4,6 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} -#include "overlapping-compat.h"- -- | An @HTML@ empty data type with `MimeRender` instances for @lucid@'s -- `ToHtml` class and `Html` datatype. -- You should only need to import this module for it's instances and the@@ -27,10 +25,5 @@ instance Accept HTML where contentType _ = "text" M.// "html" M./: ("charset", "utf-8") -instance OVERLAPPABLE_- ToHtml a => MimeRender HTML a where+instance ToHtml a => MimeRender HTML a where mimeRender _ = renderBS . toHtml--instance OVERLAPPING_- MimeRender HTML (Html a) where- mimeRender _ = renderBS