servant-examples 0.4.4.3 → 0.4.4.4
raw patch · 11 files changed
+15/−17 lines, 11 filesdep ~aeson
Dependency ranges changed: aeson
Files
- auth-combinator/auth-combinator.hs +1/−0
- hackage/hackage.hs +2/−0
- servant-examples.cabal +3/−2
- tutorial/T1.hs +1/−6
- tutorial/T10.hs +1/−0
- tutorial/T2.hs +0/−5
- tutorial/T3.hs +1/−1
- tutorial/T4.hs +3/−2
- tutorial/T8.hs +1/−1
- tutorial/T9.hs +1/−0
- wai-middleware/wai-middleware.hs +1/−0
auth-combinator/auth-combinator.hs view
@@ -5,6 +5,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# OPTIONS_GHC -fno-warn-unused-binds #-} import Data.Aeson import Data.ByteString (ByteString) import Data.Text (Text)
hackage/hackage.hs view
@@ -2,6 +2,8 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-unused-binds #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} import Control.Applicative import Control.Monad import Control.Monad.IO.Class
servant-examples.cabal view
@@ -1,5 +1,5 @@ name: servant-examples-version: 0.4.4.3+version: 0.4.4.4 synopsis: Example programs for servant description: Example programs for servant, showcasing solutions to common needs.@@ -21,7 +21,7 @@ main-is: tutorial.hs other-modules: T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 build-depends:- aeson >= 0.8+ aeson >= 0.10 , base >= 4.7 && < 5 , bytestring , directory@@ -45,6 +45,7 @@ executable t8-main main-is: t8-main.hs+ other-modules: T3, T8 hs-source-dirs: tutorial default-language: Haskell2010 build-depends:
tutorial/T1.hs view
@@ -17,17 +17,12 @@ , registration_date :: Day } deriving (Eq, Show, Generic) --- orphan ToJSON instance for Day. necessary to derive one for User-instance ToJSON Day where- -- display a day in YYYY-mm-dd format- toJSON d = toJSON (showGregorian d)- instance ToJSON User type UserAPI = "users" :> Get '[JSON] [User] users :: [User]-users = +users = [ User "Isaac Newton" 372 "isaac@newton.co.uk" (fromGregorian 1683 3 1) , User "Albert Einstein" 136 "ae@mc2.org" (fromGregorian 1905 12 1) ]
tutorial/T10.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# OPTIONS_GHC -fno-warn-orphans #-} module T10 where import Data.ByteString.Lazy (ByteString)
tutorial/T2.hs view
@@ -17,11 +17,6 @@ , registration_date :: Day } deriving (Eq, Show, Generic) --- orphan ToJSON instance for Day. necessary to derive one for User-instance ToJSON Day where- -- display a day in YYYY-mm-dd format- toJSON d = toJSON (showGregorian d)- instance ToJSON User type UserAPI = "users" :> Get '[JSON] [User]
tutorial/T3.hs view
@@ -70,7 +70,7 @@ :<|> marketing where position :: Int -> Int -> EitherT ServantErr IO Position- position x y = return (Position x y)+ position a b = return (Position a b) hello :: Maybe String -> EitherT ServantErr IO HelloMessage hello mname = return . HelloMessage $ case mname of
tutorial/T4.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} module T4 where import Data.Aeson@@ -35,13 +36,13 @@ -- HTML serialization of a list of persons instance ToHtml [Person] where- toHtml persons = table_ $ do+ toHtml ps = table_ $ do tr_ $ do th_ "first name" th_ "last name" th_ "age" - foldMap toHtml persons+ foldMap toHtml ps toHtmlRaw = toHtml
tutorial/T8.hs view
@@ -1,10 +1,10 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}+{-# OPTIONS_GHC -fno-warn-name-shadowing #-} module T8 where import Control.Monad.Trans.Either-import Data.Aeson import Servant import Servant.Client
tutorial/T9.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} module T9 where import Control.Applicative
wai-middleware/wai-middleware.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-unused-binds #-} import Data.Aeson import Data.Text import GHC.Generics