From 19dee18f713d32004e7746088ce3607229afb400 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 15 Sep 2019 17:19:56 +0300 Subject: [PATCH] Remove control-monad-omega dependency --- cabal.project | 4 ++++ servant-docs/CHANGELOG.md | 5 +++++ servant-docs/servant-docs.cabal | 5 ++--- servant-docs/src/Servant/Docs/Internal.hs | 17 +++++++++-------- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/cabal.project b/cabal.project index 52a926f7..30b65857 100644 --- a/cabal.project +++ b/cabal.project @@ -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:primitive allow-newer: openssl-streams-1.2.2.0:network + +-- MonadFail +-- https://github.com/nurpax/sqlite-simple/issues/74 +constraints: sqlite-simple < 0 diff --git a/servant-docs/CHANGELOG.md b/servant-docs/CHANGELOG.md index 5e56e234..5744be55 100644 --- a/servant-docs/CHANGELOG.md +++ b/servant-docs/CHANGELOG.md @@ -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 ------ diff --git a/servant-docs/servant-docs.cabal b/servant-docs/servant-docs.cabal index 899d3aeb..15b70890 100644 --- a/servant-docs/servant-docs.cabal +++ b/servant-docs/servant-docs.cabal @@ -1,7 +1,6 @@ cabal-version: >=1.10 name: servant-docs -version: 0.11.3 -x-revision: 1 +version: 0.11.4 synopsis: generate API docs for your servant webservice category: Servant, Web @@ -61,12 +60,12 @@ library , aeson-pretty >= 0.8.5 && < 0.9 , base-compat >= 0.10.5 && < 0.11 , 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.18 , 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 diff --git a/servant-docs/src/Servant/Docs/Internal.hs b/servant-docs/src/Servant/Docs/Internal.hs index 6452ea80..051a9dbc 100644 --- a/servant-docs/src/Servant/Docs/Internal.hs +++ b/servant-docs/src/Servant/Docs/Internal.hs @@ -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)