Remove control-monad-omega dependency
This commit is contained in:
parent
56773a7649
commit
19dee18f71
4 changed files with 20 additions and 11 deletions
|
@ -58,3 +58,7 @@ allow-newer: direct-sqlite-2.3.24:semigroups
|
||||||
allow-newer: io-streams-1.5.1.0:network
|
allow-newer: io-streams-1.5.1.0:network
|
||||||
allow-newer: io-streams-1.5.1.0:primitive
|
allow-newer: io-streams-1.5.1.0:primitive
|
||||||
allow-newer: openssl-streams-1.2.2.0:network
|
allow-newer: openssl-streams-1.2.2.0:network
|
||||||
|
|
||||||
|
-- MonadFail
|
||||||
|
-- https://github.com/nurpax/sqlite-simple/issues/74
|
||||||
|
constraints: sqlite-simple < 0
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
[The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-docs/CHANGELOG.md)
|
[The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-docs/CHANGELOG.md)
|
||||||
[Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md)
|
[Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md)
|
||||||
|
|
||||||
|
0.11.4
|
||||||
|
------
|
||||||
|
|
||||||
|
- Drop dependency on `control-monad-omega` in favor of `Data.Universe.Helpers` from `universe-base`.
|
||||||
|
|
||||||
0.11.3
|
0.11.3
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
cabal-version: >=1.10
|
cabal-version: >=1.10
|
||||||
name: servant-docs
|
name: servant-docs
|
||||||
version: 0.11.3
|
version: 0.11.4
|
||||||
x-revision: 1
|
|
||||||
|
|
||||||
synopsis: generate API docs for your servant webservice
|
synopsis: generate API docs for your servant webservice
|
||||||
category: Servant, Web
|
category: Servant, Web
|
||||||
|
@ -61,12 +60,12 @@ library
|
||||||
, aeson-pretty >= 0.8.5 && < 0.9
|
, aeson-pretty >= 0.8.5 && < 0.9
|
||||||
, base-compat >= 0.10.5 && < 0.11
|
, base-compat >= 0.10.5 && < 0.11
|
||||||
, case-insensitive >= 1.2.0.11 && < 1.3
|
, case-insensitive >= 1.2.0.11 && < 1.3
|
||||||
, control-monad-omega >= 0.3.1 && < 0.4
|
|
||||||
, hashable >= 1.2.7.0 && < 1.4
|
, hashable >= 1.2.7.0 && < 1.4
|
||||||
, http-media >= 0.7.1.3 && < 0.9
|
, http-media >= 0.7.1.3 && < 0.9
|
||||||
, http-types >= 0.12.2 && < 0.13
|
, http-types >= 0.12.2 && < 0.13
|
||||||
, lens >= 4.17 && < 4.18
|
, lens >= 4.17 && < 4.18
|
||||||
, string-conversions >= 0.4.0.1 && < 0.5
|
, string-conversions >= 0.4.0.1 && < 0.5
|
||||||
|
, universe-base >= 1.1.1 && < 1.2
|
||||||
, unordered-containers >= 0.2.9.0 && < 0.3
|
, unordered-containers >= 0.2.9.0 && < 0.3
|
||||||
|
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
|
|
|
@ -27,7 +27,6 @@ import Control.Arrow
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
(makeLenses, mapped, over, traversed, view, (%~), (&), (.~),
|
(makeLenses, mapped, over, traversed, view, (%~), (&), (.~),
|
||||||
(<>~), (^.), (|>))
|
(<>~), (^.), (|>))
|
||||||
import qualified Control.Monad.Omega as Omega
|
|
||||||
import qualified Data.ByteString.Char8 as BSC
|
import qualified Data.ByteString.Char8 as BSC
|
||||||
import Data.ByteString.Lazy.Char8
|
import Data.ByteString.Lazy.Char8
|
||||||
(ByteString)
|
(ByteString)
|
||||||
|
@ -65,6 +64,8 @@ import Servant.API
|
||||||
import Servant.API.ContentTypes
|
import Servant.API.ContentTypes
|
||||||
import Servant.API.TypeLevel
|
import Servant.API.TypeLevel
|
||||||
|
|
||||||
|
import qualified Data.Universe.Helpers as U
|
||||||
|
|
||||||
import qualified Data.HashMap.Strict as HM
|
import qualified Data.HashMap.Strict as HM
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Network.HTTP.Media as M
|
import qualified Network.HTTP.Media as M
|
||||||
|
@ -479,22 +480,22 @@ samples = map ("",)
|
||||||
|
|
||||||
-- | Default sample Generic-based inputs/outputs.
|
-- | Default sample Generic-based inputs/outputs.
|
||||||
defaultSamples :: forall a. (Generic a, GToSample (Rep a)) => Proxy a -> [(Text, a)]
|
defaultSamples :: forall a. (Generic a, GToSample (Rep a)) => Proxy a -> [(Text, a)]
|
||||||
defaultSamples _ = Omega.runOmega $ second to <$> gtoSamples (Proxy :: Proxy (Rep a))
|
defaultSamples _ = second to <$> gtoSamples (Proxy :: Proxy (Rep a))
|
||||||
|
|
||||||
-- | @'ToSample'@ for Generics.
|
-- | @'ToSample'@ for Generics.
|
||||||
--
|
--
|
||||||
-- The use of @'Omega'@ allows for more productive sample generation.
|
-- Note: we use combinators from "Universe.Data.Helpers" for more productive sample generation.
|
||||||
class GToSample t where
|
class GToSample t where
|
||||||
gtoSamples :: proxy t -> Omega.Omega (Text, t x)
|
gtoSamples :: proxy t -> [(Text, t x)]
|
||||||
|
|
||||||
instance GToSample U1 where
|
instance GToSample U1 where
|
||||||
gtoSamples _ = Omega.each (singleSample U1)
|
gtoSamples _ = singleSample U1
|
||||||
|
|
||||||
instance GToSample V1 where
|
instance GToSample V1 where
|
||||||
gtoSamples _ = empty
|
gtoSamples _ = empty
|
||||||
|
|
||||||
instance (GToSample p, GToSample q) => GToSample (p :*: q) where
|
instance (GToSample p, GToSample q) => GToSample (p :*: q) where
|
||||||
gtoSamples _ = render <$> ps <*> qs
|
gtoSamples _ = U.cartesianProduct render ps qs
|
||||||
where
|
where
|
||||||
ps = gtoSamples (Proxy :: Proxy p)
|
ps = gtoSamples (Proxy :: Proxy p)
|
||||||
qs = gtoSamples (Proxy :: Proxy q)
|
qs = gtoSamples (Proxy :: Proxy q)
|
||||||
|
@ -503,13 +504,13 @@ instance (GToSample p, GToSample q) => GToSample (p :*: q) where
|
||||||
| otherwise = (ta <> ", " <> tb, a :*: b)
|
| otherwise = (ta <> ", " <> tb, a :*: b)
|
||||||
|
|
||||||
instance (GToSample p, GToSample q) => GToSample (p :+: q) where
|
instance (GToSample p, GToSample q) => GToSample (p :+: q) where
|
||||||
gtoSamples _ = lefts <|> rights
|
gtoSamples _ = lefts U.+++ rights
|
||||||
where
|
where
|
||||||
lefts = second L1 <$> gtoSamples (Proxy :: Proxy p)
|
lefts = second L1 <$> gtoSamples (Proxy :: Proxy p)
|
||||||
rights = second R1 <$> gtoSamples (Proxy :: Proxy q)
|
rights = second R1 <$> gtoSamples (Proxy :: Proxy q)
|
||||||
|
|
||||||
instance ToSample a => GToSample (K1 i a) where
|
instance ToSample a => GToSample (K1 i a) where
|
||||||
gtoSamples _ = second K1 <$> Omega.each (toSamples (Proxy :: Proxy a))
|
gtoSamples _ = second K1 <$> toSamples (Proxy :: Proxy a)
|
||||||
|
|
||||||
instance (GToSample f) => GToSample (M1 i a f) where
|
instance (GToSample f) => GToSample (M1 i a f) where
|
||||||
gtoSamples _ = second M1 <$> gtoSamples (Proxy :: Proxy f)
|
gtoSamples _ = second M1 <$> gtoSamples (Proxy :: Proxy f)
|
||||||
|
|
Loading…
Add table
Reference in a new issue