git.iko.soy/typeable/servant
on master help sign in
Fix ToSample issues
commit84211d4a0f8f378eebe69a6d66906b1ae2d78d03 authorJulian K. Arni <jkarni@gmail.com> dateSun 3 May 2015, 01:49 (11 years ago) parent50b0586
4 files changed+11−13
servant-docs/example/greet.hs−1 servant-docs/src/Servant/Docs.hs+3−3 servant-docs/src/Servant/Docs/Internal.hs+2−3 servant-docs/test/Servant/DocsSpec.hs+6−6
servant-docs/example/greet.hs−1
@@ -8,7 +8,6 @@
88import Control.Lens
99import Data.Aeson
1010import Data.Proxy
11−import Data.ByteString.Conversion
1211import Data.String.Conversions
1312import Data.Text (Text)
1413import GHC.Generics
servant-docs/src/Servant/Docs.hs+3−3
@@ -77,10 +77,10 @@
7777-- > "Get the greeting message selected language. Default is en."
7878-- > Normal
7979-- >
80−-- > instance ToSample Greet where
81−-- > toSample = Just $ Greet "Hello, haskeller!"
80+-- > instance ToSample Greet Greet where
81+-- > toSample _ = Just $ Greet "Hello, haskeller!"
8282-- >
83−-- > toSamples =
83+-- > toSamples _ =
8484-- > [ ("If you use ?capital=true", Greet "HELLO, HASKELLER")
8585-- > , ("If you use ?capital=false", Greet "Hello, haskeller")
8686-- > ]
servant-docs/src/Servant/Docs/Internal.hs+2−3
@@ -40,7 +40,6 @@ import GHC.Generics
4040import GHC.TypeLits
4141import Servant.API
4242import Servant.API.ContentTypes
43−import Servant.API.ResponseHeaders
4443import Servant.Utils.Links
4544
4645import qualified Data.HashMap.Strict as HM
@@ -373,8 +372,8 @@ class HasDocs layout where
373372-- > instance FromJSON Greet
374373-- > instance ToJSON Greet
375374-- >
376−-- > instance ToSample Greet where
377−-- > toSample = Just g
375+-- > instance ToSample Greet Greet where
376+-- > toSample _ = Just g
378377-- >
379378-- > where g = Greet "Hello, haskeller!"
380379--
servant-docs/test/Servant/DocsSpec.hs+6−6
@@ -46,14 +46,14 @@ data Datatype1 = Datatype1 { dt1field1 :: String
4646
4747instance ToJSON Datatype1
4848
49−instance ToSample Datatype1 where
50− toSample = Just $ Datatype1 "field 1" 13
49+instance ToSample Datatype1 Datatype1 where
50+ toSample _ = Just $ Datatype1 "field 1" 13
5151
52−instance ToSample String where
53− toSample = Just "a string"
52+instance ToSample String String where
53+ toSample _ = Just "a string"
5454
55−instance ToSample Int where
56− toSample = Just 17
55+instance ToSample Int Int where
56+ toSample _ = Just 17
5757
5858instance MimeRender PlainText Int where
5959 mimeRender _ = cs . show