on master help sign in
Remove control-monad-omega dependency
commit19dee18f713d32004e7746088ce3607229afb400 authorOleg Grenrus <oleg.grenrus@iki.fi> dateSun 15 Sep 2019, 17:19 (7 years ago) parent56773a7
4 files changed+20−11
cabal.project+4 servant-docs/CHANGELOG.md+5 servant-docs/servant-docs.cabal+2−3 servant-docs/src/Servant/Docs/Internal.hs+9−8
cabal.project+4
@@ -58,3 +58,7 @@ allow-newer: direct-sqlite-2.3.24:semigroups
5858allow-newer: io-streams-1.5.1.0:network
5959allow-newer: io-streams-1.5.1.0:primitive
6060allow-newer: openssl-streams-1.2.2.0:network
61+
62+-- MonadFail
63+-- https://github.com/nurpax/sqlite-simple/issues/74
64+constraints: sqlite-simple < 0
servant-docs/CHANGELOG.md+5
@@ -1,6 +1,11 @@
11[The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-docs/CHANGELOG.md)
22[Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md)
33
4+0.11.4
5+------
6+
7+- Drop dependency on `control-monad-omega` in favor of `Data.Universe.Helpers` from `universe-base`.
8+
490.11.3
510------
611
servant-docs/servant-docs.cabal+2−3
@@ -1,7 +1,6 @@
11cabal-version: >=1.10
22name: servant-docs
3−version: 0.11.3
4−x-revision: 1
3+version: 0.11.4
54
65synopsis: generate API docs for your servant webservice
76category: Servant, Web
@@ -61,12 +60,12 @@ library
6160 , aeson-pretty >= 0.8.5 && < 0.9
6261 , base-compat >= 0.10.5 && < 0.11
6362 , case-insensitive >= 1.2.0.11 && < 1.3
64− , control-monad-omega >= 0.3.1 && < 0.4
6563 , hashable >= 1.2.7.0 && < 1.4
6664 , http-media >= 0.7.1.3 && < 0.9
6765 , http-types >= 0.12.2 && < 0.13
6866 , lens >= 4.17 && < 4.18
6967 , string-conversions >= 0.4.0.1 && < 0.5
68+ , universe-base >= 1.1.1 && < 1.2
7069 , unordered-containers >= 0.2.9.0 && < 0.3
7170
7271 hs-source-dirs: src
servant-docs/src/Servant/Docs/Internal.hs+9−8
@@ -27,7 +27,6 @@ import Control.Arrow
2727import Control.Lens
2828 (makeLenses, mapped, over, traversed, view, (%~), (&), (.~),
2929 (<>~), (^.), (|>))
30−import qualified Control.Monad.Omega as Omega
3130import qualified Data.ByteString.Char8 as BSC
3231import Data.ByteString.Lazy.Char8
3332 (ByteString)
@@ -65,6 +64,8 @@ import Servant.API
6564import Servant.API.ContentTypes
6665import Servant.API.TypeLevel
6766
67+import qualified Data.Universe.Helpers as U
68+
6869import qualified Data.HashMap.Strict as HM
6970import qualified Data.Text as T
7071import qualified Network.HTTP.Media as M
@@ -479,22 +480,22 @@ samples = map ("",)
479480
480481-- | Default sample Generic-based inputs/outputs.
481482defaultSamples :: forall a. (Generic a, GToSample (Rep a)) => Proxy a -> [(Text, a)]
482−defaultSamples _ = Omega.runOmega $ second to <$> gtoSamples (Proxy :: Proxy (Rep a))
483+defaultSamples _ = second to <$> gtoSamples (Proxy :: Proxy (Rep a))
483484
484485-- | @'ToSample'@ for Generics.
485486--
486−-- The use of @'Omega'@ allows for more productive sample generation.
487+-- Note: we use combinators from "Universe.Data.Helpers" for more productive sample generation.
487488class GToSample t where
488− gtoSamples :: proxy t -> Omega.Omega (Text, t x)
489+ gtoSamples :: proxy t -> [(Text, t x)]
489490
490491instance GToSample U1 where
491− gtoSamples _ = Omega.each (singleSample U1)
492+ gtoSamples _ = singleSample U1
492493
493494instance GToSample V1 where
494495 gtoSamples _ = empty
495496
496497instance (GToSample p, GToSample q) => GToSample (p :*: q) where
497− gtoSamples _ = render <$> ps <*> qs
498+ gtoSamples _ = U.cartesianProduct render ps qs
498499 where
499500 ps = gtoSamples (Proxy :: Proxy p)
500501 qs = gtoSamples (Proxy :: Proxy q)
@@ -503,13 +504,13 @@ instance (GToSample p, GToSample q) => GToSample (p :*: q) where
503504 | otherwise = (ta <> ", " <> tb, a :*: b)
504505
505506instance (GToSample p, GToSample q) => GToSample (p :+: q) where
506− gtoSamples _ = lefts <|> rights
507+ gtoSamples _ = lefts U.+++ rights
507508 where
508509 lefts = second L1 <$> gtoSamples (Proxy :: Proxy p)
509510 rights = second R1 <$> gtoSamples (Proxy :: Proxy q)
510511
511512instance ToSample a => GToSample (K1 i a) where
512− gtoSamples _ = second K1 <$> Omega.each (toSamples (Proxy :: Proxy a))
513+ gtoSamples _ = second K1 <$> toSamples (Proxy :: Proxy a)
513514
514515instance (GToSample f) => GToSample (M1 i a f) where
515516 gtoSamples _ = second M1 <$> gtoSamples (Proxy :: Proxy f)