Skip to content

Commit 19dee18

Browse files
committed
Remove control-monad-omega dependency
1 parent 56773a7 commit 19dee18

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

cabal.project

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,7 @@ allow-newer: direct-sqlite-2.3.24:semigroups
5858
allow-newer: io-streams-1.5.1.0:network
5959
allow-newer: io-streams-1.5.1.0:primitive
6060
allow-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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
49
0.11.3
510
------
611

servant-docs/servant-docs.cabal

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cabal-version: >=1.10
22
name: servant-docs
3-
version: 0.11.3
4-
x-revision: 1
3+
version: 0.11.4
54

65
synopsis: generate API docs for your servant webservice
76
category: 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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import Control.Arrow
2727
import Control.Lens
2828
(makeLenses, mapped, over, traversed, view, (%~), (&), (.~),
2929
(<>~), (^.), (|>))
30-
import qualified Control.Monad.Omega as Omega
3130
import qualified Data.ByteString.Char8 as BSC
3231
import Data.ByteString.Lazy.Char8
3332
(ByteString)
@@ -65,6 +64,8 @@ import Servant.API
6564
import Servant.API.ContentTypes
6665
import Servant.API.TypeLevel
6766

67+
import qualified Data.Universe.Helpers as U
68+
6869
import qualified Data.HashMap.Strict as HM
6970
import qualified Data.Text as T
7071
import qualified Network.HTTP.Media as M
@@ -479,22 +480,22 @@ samples = map ("",)
479480

480481
-- | Default sample Generic-based inputs/outputs.
481482
defaultSamples :: 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.
487488
class GToSample t where
488-
gtoSamples :: proxy t -> Omega.Omega (Text, t x)
489+
gtoSamples :: proxy t -> [(Text, t x)]
489490

490491
instance GToSample U1 where
491-
gtoSamples _ = Omega.each (singleSample U1)
492+
gtoSamples _ = singleSample U1
492493

493494
instance GToSample V1 where
494495
gtoSamples _ = empty
495496

496497
instance (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

505506
instance (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

511512
instance 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

514515
instance (GToSample f) => GToSample (M1 i a f) where
515516
gtoSamples _ = second M1 <$> gtoSamples (Proxy :: Proxy f)

0 commit comments

Comments
 (0)