Fix ToSample issues
This commit is contained in:
parent
50b05860b7
commit
84211d4a0f
4 changed files with 11 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
-- > ]
|
||||
|
|
|
@ -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!"
|
||||
--
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue