git.iko.soy/typeable/servant
on master help sign in
Remove control-monad-omega dependency
19dee18Oleg Grenrus
cabal.project+4
@@ -58,3 +58,7 @@ allow-newer: direct-sqlite-2.3.24:semigroups
58allow-newer: io-streams-1.5.1.0:network
58allow-newer: io-streams-1.5.1.0:network
59allow-newer: io-streams-1.5.1.0:primitive
59allow-newer: io-streams-1.5.1.0:primitive
60allow-newer: openssl-streams-1.2.2.0:network
60allow-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 @@
1[The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-docs/CHANGELOG.md)
1[The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-docs/CHANGELOG.md)
2[Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md)
2[Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md)
3
3
4+0.11.4
5+------
6+
7+- Drop dependency on `control-monad-omega` in favor of `Data.Universe.Helpers` from `universe-base`.
8+
40.11.3
90.11.3
5------
10------
6
11
servant-docs/servant-docs.cabal+2−3
@@ -1,7 +1,6 @@
1cabal-version: >=1.10
1cabal-version: >=1.10
2name: servant-docs
2name: servant-docs
3−version: 0.11.3
3+version: 0.11.4
4−x-revision: 1
5
4
6synopsis: generate API docs for your servant webservice
5synopsis: generate API docs for your servant webservice
7category: Servant, Web
6category: Servant, Web
@@ -61,12 +60,12 @@ library
61 , aeson-pretty >= 0.8.5 && < 0.9
60 , aeson-pretty >= 0.8.5 && < 0.9
62 , base-compat >= 0.10.5 && < 0.11
61 , base-compat >= 0.10.5 && < 0.11
63 , case-insensitive >= 1.2.0.11 && < 1.3
62 , case-insensitive >= 1.2.0.11 && < 1.3
64− , control-monad-omega >= 0.3.1 && < 0.4
65 , hashable >= 1.2.7.0 && < 1.4
63 , hashable >= 1.2.7.0 && < 1.4
66 , http-media >= 0.7.1.3 && < 0.9
64 , http-media >= 0.7.1.3 && < 0.9
67 , http-types >= 0.12.2 && < 0.13
65 , http-types >= 0.12.2 && < 0.13
68 , lens >= 4.17 && < 4.18
66 , lens >= 4.17 && < 4.18
69 , string-conversions >= 0.4.0.1 && < 0.5
67 , string-conversions >= 0.4.0.1 && < 0.5
68+ , universe-base >= 1.1.1 && < 1.2
70 , unordered-containers >= 0.2.9.0 && < 0.3
69 , unordered-containers >= 0.2.9.0 && < 0.3
71
70
72 hs-source-dirs: src
71 hs-source-dirs: src
servant-docs/src/Servant/Docs/Internal.hs+9−8
@@ -27,7 +27,6 @@ import Control.Arrow
27import Control.Lens
27import Control.Lens
28 (makeLenses, mapped, over, traversed, view, (%~), (&), (.~),
28 (makeLenses, mapped, over, traversed, view, (%~), (&), (.~),
29 (<>~), (^.), (|>))
29 (<>~), (^.), (|>))
30−import qualified Control.Monad.Omega as Omega
31import qualified Data.ByteString.Char8 as BSC
30import qualified Data.ByteString.Char8 as BSC
32import Data.ByteString.Lazy.Char8
31import Data.ByteString.Lazy.Char8
33 (ByteString)
32 (ByteString)
@@ -65,6 +64,8 @@ import Servant.API
65import Servant.API.ContentTypes
64import Servant.API.ContentTypes
66import Servant.API.TypeLevel
65import Servant.API.TypeLevel
67
66
67+import qualified Data.Universe.Helpers as U
68+
68import qualified Data.HashMap.Strict as HM
69import qualified Data.HashMap.Strict as HM
69import qualified Data.Text as T
70import qualified Data.Text as T
70import qualified Network.HTTP.Media as M
71import qualified Network.HTTP.Media as M
@@ -479,22 +480,22 @@ samples = map ("",)
479
480
480-- | Default sample Generic-based inputs/outputs.
481-- | Default sample Generic-based inputs/outputs.
481defaultSamples :: forall a. (Generic a, GToSample (Rep a)) => Proxy a -> [(Text, a)]
482defaultSamples :: 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))
483
484
484-- | @'ToSample'@ for Generics.
485-- | @'ToSample'@ for Generics.
485--
486--
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.
487class GToSample t where
488class GToSample t where
488− gtoSamples :: proxy t -> Omega.Omega (Text, t x)
489+ gtoSamples :: proxy t -> [(Text, t x)]
489
490
490instance GToSample U1 where
491instance GToSample U1 where
491− gtoSamples _ = Omega.each (singleSample U1)
492+ gtoSamples _ = singleSample U1
492
493
493instance GToSample V1 where
494instance GToSample V1 where
494 gtoSamples _ = empty
495 gtoSamples _ = empty
495
496
496instance (GToSample p, GToSample q) => GToSample (p :*: q) where
497instance (GToSample p, GToSample q) => GToSample (p :*: q) where
497− gtoSamples _ = render <$> ps <*> qs
498+ gtoSamples _ = U.cartesianProduct render ps qs
498 where
499 where
499 ps = gtoSamples (Proxy :: Proxy p)
500 ps = gtoSamples (Proxy :: Proxy p)
500 qs = gtoSamples (Proxy :: Proxy q)
501 qs = gtoSamples (Proxy :: Proxy q)
@@ -503,13 +504,13 @@ instance (GToSample p, GToSample q) => GToSample (p :*: q) where
503 | otherwise = (ta <> ", " <> tb, a :*: b)
504 | otherwise = (ta <> ", " <> tb, a :*: b)
504
505
505instance (GToSample p, GToSample q) => GToSample (p :+: q) where
506instance (GToSample p, GToSample q) => GToSample (p :+: q) where
506− gtoSamples _ = lefts <|> rights
507+ gtoSamples _ = lefts U.+++ rights
507 where
508 where
508 lefts = second L1 <$> gtoSamples (Proxy :: Proxy p)
509 lefts = second L1 <$> gtoSamples (Proxy :: Proxy p)
509 rights = second R1 <$> gtoSamples (Proxy :: Proxy q)
510 rights = second R1 <$> gtoSamples (Proxy :: Proxy q)
510
511
511instance ToSample a => GToSample (K1 i a) where
512instance 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)
513
514
514instance (GToSample f) => GToSample (M1 i a f) where
515instance (GToSample f) => GToSample (M1 i a f) where
515 gtoSamples _ = second M1 <$> gtoSamples (Proxy :: Proxy f)
516 gtoSamples _ = second M1 <$> gtoSamples (Proxy :: Proxy f)