git.iko.soy/typeable/servant
on master help sign in
Remove control-monad-omega dependency
commite8e1efb67e1d1e7ea85a36d8ca0bf74a63c95573 authorOleg Grenrus <oleg.grenrus@iki.fi> dateSun 15 Sep 2019, 17:19 (7 years ago) parent589c65f
4 files changed+16−16
cabal.project−5 servant-docs/CHANGELOG.md+5 servant-docs/servant-docs.cabal+2−3 servant-docs/src/Servant/Docs/Internal.hs+9−8
cabal.project−5
@@ -86,11 +86,6 @@ allow-newer: io-streams-1.5.1.0:network
8686allow-newer: io-streams:primitive
8787allow-newer: openssl-streams-1.2.2.0:network
8888
89−source-repository-package
90− type: git
91− location: https://github.com/luqui/control-monad-omega.git
92− tag: 76c71e8917eec275ba423959f00a34583b5c7215
93−
9489-- MonadFail
9590-- https://github.com/nurpax/sqlite-simple/issues/74
9691constraints: 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: 3
3+version: 0.11.4
54
65synopsis: generate API docs for your servant webservice
76category: Servant, Web
@@ -62,12 +61,12 @@ library
6261 , aeson-pretty >= 0.8.5 && < 0.9
6362 , base-compat >= 0.10.5 && < 0.12
6463 , case-insensitive >= 1.2.0.11 && < 1.3
65− , control-monad-omega >= 0.3.1 && < 0.4
6664 , hashable >= 1.2.7.0 && < 1.4
6765 , http-media >= 0.7.1.3 && < 0.9
6866 , http-types >= 0.12.2 && < 0.13
6967 , lens >= 4.17 && < 4.19
7068 , string-conversions >= 0.4.0.1 && < 0.5
69+ , universe-base >= 1.1.1 && < 1.2
7170 , unordered-containers >= 0.2.9.0 && < 0.3
7271
7372 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)