Remove control-monad-omega dependency

This commit is contained in:
Oleg Grenrus 2019-09-15 17:19:56 +03:00
parent 589c65fb99
commit e8e1efb67e
4 changed files with 16 additions and 16 deletions

View file

@ -86,11 +86,6 @@ allow-newer: io-streams-1.5.1.0:network
allow-newer: io-streams:primitive
allow-newer: openssl-streams-1.2.2.0:network
source-repository-package
type: git
location: https://github.com/luqui/control-monad-omega.git
tag: 76c71e8917eec275ba423959f00a34583b5c7215
-- MonadFail
-- https://github.com/nurpax/sqlite-simple/issues/74
constraints: sqlite-simple < 0

View file

@ -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)
[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
------

View file

@ -1,7 +1,6 @@
cabal-version: >=1.10
name: servant-docs
version: 0.11.3
x-revision: 3
version: 0.11.4
synopsis: generate API docs for your servant webservice
category: Servant, Web
@ -62,12 +61,12 @@ library
, aeson-pretty >= 0.8.5 && < 0.9
, base-compat >= 0.10.5 && < 0.12
, case-insensitive >= 1.2.0.11 && < 1.3
, control-monad-omega >= 0.3.1 && < 0.4
, hashable >= 1.2.7.0 && < 1.4
, http-media >= 0.7.1.3 && < 0.9
, http-types >= 0.12.2 && < 0.13
, lens >= 4.17 && < 4.19
, string-conversions >= 0.4.0.1 && < 0.5
, universe-base >= 1.1.1 && < 1.2
, unordered-containers >= 0.2.9.0 && < 0.3
hs-source-dirs: src

View file

@ -27,7 +27,6 @@ import Control.Arrow
import Control.Lens
(makeLenses, mapped, over, traversed, view, (%~), (&), (.~),
(<>~), (^.), (|>))
import qualified Control.Monad.Omega as Omega
import qualified Data.ByteString.Char8 as BSC
import Data.ByteString.Lazy.Char8
(ByteString)
@ -65,6 +64,8 @@ import Servant.API
import Servant.API.ContentTypes
import Servant.API.TypeLevel
import qualified Data.Universe.Helpers as U
import qualified Data.HashMap.Strict as HM
import qualified Data.Text as T
import qualified Network.HTTP.Media as M
@ -479,22 +480,22 @@ samples = map ("",)
-- | Default sample Generic-based inputs/outputs.
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.
--
-- 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
gtoSamples :: proxy t -> Omega.Omega (Text, t x)
gtoSamples :: proxy t -> [(Text, t x)]
instance GToSample U1 where
gtoSamples _ = Omega.each (singleSample U1)
gtoSamples _ = singleSample U1
instance GToSample V1 where
gtoSamples _ = empty
instance (GToSample p, GToSample q) => GToSample (p :*: q) where
gtoSamples _ = render <$> ps <*> qs
gtoSamples _ = U.cartesianProduct render ps qs
where
ps = gtoSamples (Proxy :: Proxy p)
qs = gtoSamples (Proxy :: Proxy q)
@ -503,13 +504,13 @@ instance (GToSample p, GToSample q) => GToSample (p :*: q) where
| otherwise = (ta <> ", " <> tb, a :*: b)
instance (GToSample p, GToSample q) => GToSample (p :+: q) where
gtoSamples _ = lefts <|> rights
gtoSamples _ = lefts U.+++ rights
where
lefts = second L1 <$> gtoSamples (Proxy :: Proxy p)
rights = second R1 <$> gtoSamples (Proxy :: Proxy q)
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
gtoSamples _ = second M1 <$> gtoSamples (Proxy :: Proxy f)