From 84211d4a0f8f378eebe69a6d66906b1ae2d78d03 Mon Sep 17 00:00:00 2001 From: "Julian K. Arni" Date: Sun, 3 May 2015 01:49:23 +0200 Subject: [PATCH] Fix ToSample issues --- servant-docs/example/greet.hs | 1 - servant-docs/src/Servant/Docs.hs | 6 +++--- servant-docs/src/Servant/Docs/Internal.hs | 5 ++--- servant-docs/test/Servant/DocsSpec.hs | 12 ++++++------ 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/servant-docs/example/greet.hs b/servant-docs/example/greet.hs index 3e7422d3..0a8cdb2b 100644 --- a/servant-docs/example/greet.hs +++ b/servant-docs/example/greet.hs @@ -8,7 +8,6 @@ import Control.Lens import Data.Aeson import Data.Proxy -import Data.ByteString.Conversion import Data.String.Conversions import Data.Text (Text) import GHC.Generics diff --git a/servant-docs/src/Servant/Docs.hs b/servant-docs/src/Servant/Docs.hs index d2c4722e..706ede3e 100644 --- a/servant-docs/src/Servant/Docs.hs +++ b/servant-docs/src/Servant/Docs.hs @@ -77,10 +77,10 @@ -- > "Get the greeting message selected language. Default is en." -- > Normal -- > --- > instance ToSample Greet where --- > toSample = Just $ Greet "Hello, haskeller!" +-- > instance ToSample Greet Greet where +-- > toSample _ = Just $ Greet "Hello, haskeller!" -- > --- > toSamples = +-- > toSamples _ = -- > [ ("If you use ?capital=true", Greet "HELLO, HASKELLER") -- > , ("If you use ?capital=false", Greet "Hello, haskeller") -- > ] diff --git a/servant-docs/src/Servant/Docs/Internal.hs b/servant-docs/src/Servant/Docs/Internal.hs index cfe7e57a..88f512d8 100644 --- a/servant-docs/src/Servant/Docs/Internal.hs +++ b/servant-docs/src/Servant/Docs/Internal.hs @@ -40,7 +40,6 @@ import GHC.Generics import GHC.TypeLits import Servant.API import Servant.API.ContentTypes -import Servant.API.ResponseHeaders import Servant.Utils.Links import qualified Data.HashMap.Strict as HM @@ -373,8 +372,8 @@ class HasDocs layout where -- > instance FromJSON Greet -- > instance ToJSON Greet -- > --- > instance ToSample Greet where --- > toSample = Just g +-- > instance ToSample Greet Greet where +-- > toSample _ = Just g -- > -- > where g = Greet "Hello, haskeller!" -- diff --git a/servant-docs/test/Servant/DocsSpec.hs b/servant-docs/test/Servant/DocsSpec.hs index 803823ba..8e6cb201 100644 --- a/servant-docs/test/Servant/DocsSpec.hs +++ b/servant-docs/test/Servant/DocsSpec.hs @@ -46,14 +46,14 @@ data Datatype1 = Datatype1 { dt1field1 :: String instance ToJSON Datatype1 -instance ToSample Datatype1 where - toSample = Just $ Datatype1 "field 1" 13 +instance ToSample Datatype1 Datatype1 where + toSample _ = Just $ Datatype1 "field 1" 13 -instance ToSample String where - toSample = Just "a string" +instance ToSample String String where + toSample _ = Just "a string" -instance ToSample Int where - toSample = Just 17 +instance ToSample Int Int where + toSample _ = Just 17 instance MimeRender PlainText Int where mimeRender _ = cs . show