Merge pull request #1221 from haskell-servant/base-compat-0.11

base-compat-0.11
This commit is contained in:
Oleg Grenrus 2019-09-15 19:04:32 +03:00 committed by GitHub
commit 2c23e87119
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 177 additions and 197 deletions

51
.hlint.yaml Normal file
View file

@ -0,0 +1,51 @@
# Control which extensions/flags/modules/functions can be used
#
- extensions:
- default: false # all extension are banned by default
- name:
- CPP
- DataKinds
- DeriveDataTypeable
- DeriveFoldable
- DeriveFunctor
- DeriveGeneric
- DeriveTraversable
- FlexibleContexts
- FlexibleInstances
- FunctionalDependencies
- GADTs
- KindSignatures
- MultiParamTypeClasses
- OverloadedStrings
- PolyKinds
- RankNTypes
- ScopedTypeVariables
- TypeFamilies
- TypeOperators
- UndecidableInstances
- modules:
- {name: [Data.Set], as: Set}
- {name: Control.Arrow, within: []} # Certain modules are banned entirely
- functions:
- {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
# Turn on hints that are off by default
#
# Ban "module X(module X) where", to require a real export list
- warn: {name: Use explicit module export list}
# Ignore some builtin hints
- ignore: {name: Redundant do}
- ignore: {name: Parse error}
- ignore: {name: Use fmap}
- ignore: {name: "Use <$>"}
- ignore: {name: Use list comprehension}
- ignore: {name: Use lambda-case}
- ignore: {name: Eta reduce}
# Add custom hints for this project
#
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}

View file

@ -40,8 +40,6 @@ matrix:
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-3.0"]}}
- compiler: ghc-8.0.2
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-3.0"]}}
allow_failures:
- compiler: ghc-8.8.1
before_install:
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
- WITHCOMPILER="-w $HC"
@ -80,7 +78,6 @@ install:
- TEST=--enable-tests
- BENCH=--enable-benchmarks
- HEADHACKAGE=false
- if [ $HCNUMVER -ge 80800 ] ; then HEADHACKAGE=true ; fi
- rm -f $CABALHOME/config
- |
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
@ -98,17 +95,6 @@ install:
echo " prefix: $CABALHOME" >> $CABALHOME/config
echo "repository hackage.haskell.org" >> $CABALHOME/config
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
- |
if $HEADHACKAGE; then
echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config
echo "repository head.hackage.ghc.haskell.org" >> $CABALHOME/config
echo " url: https://ghc.gitlab.haskell.org/head.hackage/" >> $CABALHOME/config
echo " secure: True" >> $CABALHOME/config
echo " root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d" >> $CABALHOME/config
echo " 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329" >> $CABALHOME/config
echo " f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89" >> $CABALHOME/config
echo " key-threshold: 3" >> $CABALHOME/config
fi
- GHCJOBS=-j2
- |
echo "program-default-options" >> $CABALHOME/config
@ -145,33 +131,31 @@ install:
echo "constraints: foundation >=0.0.14" >> cabal.project
echo "constraints: memory <0.14.12 || >0.14.12" >> cabal.project
echo "constraints: sqlite-simple < 0" >> cabal.project
echo "allow-newer: servant-multipart:http-media" >> cabal.project
echo "allow-newer: servant-multipart:lens" >> cabal.project
echo "allow-newer: servant-js:base" >> cabal.project
echo "allow-newer: servant-js:lens" >> cabal.project
echo "allow-newer: servant-quickcheck:base" >> cabal.project
echo "allow-newer: servant-quickcheck:hspec" >> cabal.project
echo "allow-newer: servant-quickcheck:http-client" >> cabal.project
echo "allow-newer: servant-quickcheck:http-media" >> cabal.project
echo "allow-newer: servant-quickcheck:QuickCheck" >> cabal.project
echo "allow-newer: servant-quickcheck:servant" >> cabal.project
echo "allow-newer: servant-quickcheck:servant-client" >> cabal.project
echo "allow-newer: servant-quickcheck:servant-server" >> cabal.project
echo "allow-newer: servant-quickcheck:time" >> cabal.project
echo "allow-newer: servant-quickcheck:warp" >> cabal.project
echo "allow-newer: servant-multipart-0.11.4:http-media" >> cabal.project
echo "allow-newer: servant-multipart-0.11.4:lens" >> cabal.project
echo "allow-newer: servant-js-0.9.4:base" >> cabal.project
echo "allow-newer: servant-js-0.9.4:base-compat" >> cabal.project
echo "allow-newer: servant-js-0.9.4:lens" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:base" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:base-compat-batteries" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:hspec" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:http-client" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:http-media" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:QuickCheck" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:servant" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:servant-client" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:servant-server" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:time" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:warp" >> cabal.project
echo "allow-newer: aeson-pretty-0.8.7:base-compat" >> cabal.project
echo "allow-newer: vault-0.3.1.2:hashable" >> cabal.project
echo "allow-newer: psqueues-0.2.7.1:hashable" >> cabal.project
echo "allow-newer: sqlite-simple-0.4.16.0:semigroups" >> cabal.project
echo "allow-newer: direct-sqlite-2.3.24:semigroups" >> cabal.project
echo "allow-newer: io-streams-1.5.1.0:network" >> cabal.project
echo "allow-newer: io-streams:primitive" >> cabal.project
echo "allow-newer: io-streams-1.5.1.0:primitive" >> cabal.project
echo "allow-newer: openssl-streams-1.2.2.0:network" >> cabal.project
echo "optimization: False" >> cabal.project
echo "" >> cabal.project
echo "source-repository-package" >> cabal.project
echo " type: git" >> cabal.project
echo " location: https://github.com/luqui/control-monad-omega.git" >> cabal.project
echo " tag: 76c71e8917eec275ba423959f00a34583b5c7215" >> cabal.project
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(cookbook-basic-auth|cookbook-basic-streaming|cookbook-curl-mock|cookbook-db-postgres-pool|cookbook-file-upload|cookbook-generic|cookbook-structuring-apis|cookbook-testing|cookbook-using-custom-monad|cookbook-using-free-client|servant|servant-client|servant-client-core|servant-conduit|servant-docs|servant-foreign|servant-http-streams|servant-machines|servant-pipes|servant-server|tutorial)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true
- cat cabal.project.local || true
@ -202,11 +186,8 @@ install:
script:
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# Packaging...
- echo 'Packaging...' && echo -en 'travis_fold:start:sdist\\r'
- ${CABAL} v2-sdist all | color_cabal_output
- echo -en 'travis_fold:end:sdist\\r'
# Unpacking...
- echo 'Unpacking...' && echo -en 'travis_fold:start:unpack\\r'
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
- cd ${DISTDIR} || false
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
@ -261,58 +242,51 @@ script:
echo "constraints: foundation >=0.0.14" >> cabal.project
echo "constraints: memory <0.14.12 || >0.14.12" >> cabal.project
echo "constraints: sqlite-simple < 0" >> cabal.project
echo "allow-newer: servant-multipart:http-media" >> cabal.project
echo "allow-newer: servant-multipart:lens" >> cabal.project
echo "allow-newer: servant-js:base" >> cabal.project
echo "allow-newer: servant-js:lens" >> cabal.project
echo "allow-newer: servant-quickcheck:base" >> cabal.project
echo "allow-newer: servant-quickcheck:hspec" >> cabal.project
echo "allow-newer: servant-quickcheck:http-client" >> cabal.project
echo "allow-newer: servant-quickcheck:http-media" >> cabal.project
echo "allow-newer: servant-quickcheck:QuickCheck" >> cabal.project
echo "allow-newer: servant-quickcheck:servant" >> cabal.project
echo "allow-newer: servant-quickcheck:servant-client" >> cabal.project
echo "allow-newer: servant-quickcheck:servant-server" >> cabal.project
echo "allow-newer: servant-quickcheck:time" >> cabal.project
echo "allow-newer: servant-quickcheck:warp" >> cabal.project
echo "allow-newer: servant-multipart-0.11.4:http-media" >> cabal.project
echo "allow-newer: servant-multipart-0.11.4:lens" >> cabal.project
echo "allow-newer: servant-js-0.9.4:base" >> cabal.project
echo "allow-newer: servant-js-0.9.4:base-compat" >> cabal.project
echo "allow-newer: servant-js-0.9.4:lens" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:base" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:base-compat-batteries" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:hspec" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:http-client" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:http-media" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:QuickCheck" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:servant" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:servant-client" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:servant-server" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:time" >> cabal.project
echo "allow-newer: servant-quickcheck-0.0.7.4:warp" >> cabal.project
echo "allow-newer: aeson-pretty-0.8.7:base-compat" >> cabal.project
echo "allow-newer: vault-0.3.1.2:hashable" >> cabal.project
echo "allow-newer: psqueues-0.2.7.1:hashable" >> cabal.project
echo "allow-newer: sqlite-simple-0.4.16.0:semigroups" >> cabal.project
echo "allow-newer: direct-sqlite-2.3.24:semigroups" >> cabal.project
echo "allow-newer: io-streams-1.5.1.0:network" >> cabal.project
echo "allow-newer: io-streams:primitive" >> cabal.project
echo "allow-newer: io-streams-1.5.1.0:primitive" >> cabal.project
echo "allow-newer: openssl-streams-1.2.2.0:network" >> cabal.project
echo "optimization: False" >> cabal.project
echo "" >> cabal.project
echo "source-repository-package" >> cabal.project
echo " type: git" >> cabal.project
echo " location: https://github.com/luqui/control-monad-omega.git" >> cabal.project
echo " tag: 76c71e8917eec275ba423959f00a34583b5c7215" >> cabal.project
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(cookbook-basic-auth|cookbook-basic-streaming|cookbook-curl-mock|cookbook-db-postgres-pool|cookbook-file-upload|cookbook-generic|cookbook-structuring-apis|cookbook-testing|cookbook-using-custom-monad|cookbook-using-free-client|servant|servant-client|servant-client-core|servant-conduit|servant-docs|servant-foreign|servant-http-streams|servant-machines|servant-pipes|servant-server|tutorial)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true
- cat cabal.project.local || true
- echo -en 'travis_fold:end:unpack\\r'
# Building with tests and benchmarks...
- echo 'Building with tests and benchmarks...' && echo -en 'travis_fold:start:build-everything\\r'
# build & run tests, build benchmarks
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
- echo -en 'travis_fold:end:build-everything\\r'
# Testing...
- ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
# haddock...
- echo 'haddock...' && echo -en 'travis_fold:start:haddock\\r'
- ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output
- echo -en 'travis_fold:end:haddock\\r'
# Constraint sets
- rm -rf cabal.project.local
# Constraint set http-media-0.8
- echo 'Constraint set http-media-0.8' && echo -en 'travis_fold:start:constraint-sets-http-media-0.8\\r'
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='http-media ==0.8.*' all | color_cabal_output
- echo -en 'travis_fold:end:constraint-sets-http-media-0.8\\r'
# Constraint set http-media-0.7
- echo 'Constraint set http-media-0.7' && echo -en 'travis_fold:start:constraint-sets-http-media-0.7\\r'
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='http-media ==0.7.*' all | color_cabal_output
- echo -en 'travis_fold:end:constraint-sets-http-media-0.7\\r'
- if [ $HCNUMVER -lt 80800 ] ; then ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='http-media ==0.7.*' all | color_cabal_output ; fi
# Constraint set base-compat-0.10
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.10.*' all | color_cabal_output
# Constraint set base-compat-0.11
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='base-compat ==0.11.*' all | color_cabal_output
# REGENDATA ["--config=cabal.haskell-ci","--output=.travis.yml","cabal.project"]
# EOF

View file

@ -1,4 +1,3 @@
folds: all-but-test
branches: master release-0.16
jobs-selection: any
@ -19,6 +18,11 @@ constraint-set http-media-0.8
constraints: http-media ==0.8.*
constraint-set http-media-0.7
ghc: <8.8
constraints: http-media ==0.7.*
head-hackage: >= 8.8
constraint-set base-compat-0.10
constraints: base-compat ==0.10.*
constraint-set base-compat-0.11
constraints: base-compat ==0.11.*

View file

@ -41,12 +41,13 @@ constraints:
memory <0.14.12 || >0.14.12
allow-newer:
servant-multipart:http-media,
servant-multipart:lens
servant-multipart-0.11.4:http-media,
servant-multipart-0.11.4:lens
allow-newer:
servant-js:base,
servant-js:lens
servant-js-0.9.4:base,
servant-js-0.9.4:base-compat,
servant-js-0.9.4:lens
allow-newer:
-- servant-pagination:servant, servant-pagination:servant-server,
@ -56,36 +57,28 @@ allow-newer:
-- servant-quickcheck
allow-newer:
servant-quickcheck:base,
servant-quickcheck:hspec,
servant-quickcheck:http-client,
servant-quickcheck:http-media,
servant-quickcheck:QuickCheck,
servant-quickcheck:servant,
servant-quickcheck:servant-client,
servant-quickcheck:servant-server,
servant-quickcheck:time,
servant-quickcheck:warp
servant-quickcheck-0.0.7.4:base,
servant-quickcheck-0.0.7.4:base-compat-batteries,
servant-quickcheck-0.0.7.4:hspec,
servant-quickcheck-0.0.7.4:http-client,
servant-quickcheck-0.0.7.4:http-media,
servant-quickcheck-0.0.7.4:QuickCheck,
servant-quickcheck-0.0.7.4:servant,
servant-quickcheck-0.0.7.4:servant-client,
servant-quickcheck-0.0.7.4:servant-server,
servant-quickcheck-0.0.7.4:time,
servant-quickcheck-0.0.7.4:warp
-- constraints: semigroups ^>=0.19
-- constraints: hashable ^>=1.3
-- constraints: network ^>=3.1
-- constraints: machines ^>=0.7
-- constraints: http-media ^>=0.8
allow-newer: aeson-pretty-0.8.7:base-compat
allow-newer: vault-0.3.1.2:hashable
allow-newer: psqueues-0.2.7.1:hashable
allow-newer: sqlite-simple-0.4.16.0:semigroups
allow-newer: direct-sqlite-2.3.24:semigroups
allow-newer: io-streams-1.5.1.0:network
allow-newer: io-streams:primitive
allow-newer: io-streams-1.5.1.0:primitive
allow-newer: openssl-streams-1.2.2.0:network
source-repository-package
type: git
location: https://github.com/luqui/control-monad-omega.git
tag: 76c71e8917eec275ba423959f00a34583b5c7215
-- MonadFail
-- https://github.com/nurpax/sqlite-simple/issues/74
constraints: sqlite-simple < 0

View file

@ -1,65 +0,0 @@
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
# This file contains a template configuration file, which is typically
# placed as .hlint.yaml in the root of your project
# Specify additional command line arguments
#
# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
# Control which extensions/flags/modules/functions can be used
#
# - extensions:
# - default: false # all extension are banned by default
# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
#
# - flags:
# - {name: -w, within: []} # -w is allowed nowhere
#
# - modules:
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
#
# - functions:
# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
# Add custom hints for this project
#
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
# Turn on hints that are off by default
#
# Ban "module X(module X) where", to require a real export list
# - warn: {name: Use explicit module export list}
#
# Replace a $ b $ c with a . b $ c
# - group: {name: dollar, enabled: true}
#
# Generalise map to fmap, ++ to <>
# - group: {name: generalise, enabled: true}
# Ignore some builtin hints
- ignore: {name: Redundant do}
- ignore: {name: Parse error}
- ignore: {name: Use fmap}
- ignore: {name: Use list comprehension}
- ignore: {name: Use lambda-case}
- ignore: {name: Eta reduce}
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
# Define some custom infix operators
# - fixity: infixr 3 ~^#^~
# To generate a suitable file for HLint do:
# $ hlint --default > .hlint.yaml

View file

@ -1,6 +1,11 @@
[The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-client/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.16.0.1
--------
- Allow `base-compat-0.11`
0.16
----

View file

@ -1,7 +1,6 @@
cabal-version: >=1.10
name: servant-client
version: 0.16
x-revision: 3
version: 0.16.0.1
synopsis: Automatic derivation of querying functions for servant
category: Servant, Web

View file

@ -16,10 +16,11 @@ import Prelude.Compat
import Control.Concurrent.MVar
(modifyMVar, newMVar)
import qualified Data.ByteString as BS
import Control.Concurrent.STM.TVar
import Control.Exception
(SomeException (..), catch)
import Control.Monad
(unless)
import Control.Monad.Base
(MonadBase (..))
import Control.Monad.Catch
@ -27,15 +28,18 @@ import Control.Monad.Catch
import Control.Monad.Error.Class
(MonadError (..))
import Control.Monad.IO.Class
(liftIO)
(MonadIO (..))
import Control.Monad.Reader
(MonadReader, ReaderT, ask, runReaderT)
import Control.Monad.STM
(STM, atomically)
import Control.Monad.Trans.Control
(MonadBaseControl (..))
import Control.Monad.Trans.Except
(ExceptT, runExceptT)
import Data.Bifunctor
(bimap)
import qualified Data.ByteString as BS
import Data.ByteString.Builder
(toLazyByteString)
import qualified Data.ByteString.Lazy as BSL
@ -64,8 +68,8 @@ import Network.HTTP.Types
(hContentType, renderQuery, statusCode)
import Servant.Client.Core
import qualified Servant.Types.SourceT as S
import qualified Network.HTTP.Client as Client
import qualified Servant.Types.SourceT as S
-- | The environment in which a request is run.
data ClientEnv

View file

@ -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
------

View file

@ -1,7 +1,6 @@
cabal-version: >=1.10
name: servant-docs
version: 0.11.3
x-revision: 3
version: 0.11.4
synopsis: generate API docs for your servant webservice
category: Servant, Web
@ -62,12 +61,12 @@ library
, aeson-pretty >= 0.8.5 && < 0.9
, base-compat >= 0.10.5 && < 0.12
, 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.19
, 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

View file

@ -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)

View file

@ -1,6 +1,11 @@
[The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-http-streams/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.16.0.1
--------
- Allow `base-compat-0.11`
0.16
----

View file

@ -18,6 +18,8 @@ import Control.DeepSeq
(NFData, force)
import Control.Exception
(IOException, SomeException (..), catch, evaluate, throwIO)
import Control.Monad
(unless)
import Control.Monad.Base
(MonadBase (..))
import Control.Monad.Codensity
@ -25,9 +27,13 @@ import Control.Monad.Codensity
import Control.Monad.Error.Class
(MonadError (..))
import Control.Monad.IO.Class
(liftIO)
(MonadIO (..))
import Control.Monad.Reader
(MonadReader, ReaderT, ask, runReaderT)
import Control.Monad.Trans.Class
(lift)
import Control.Monad.Trans.Except
(ExceptT, runExceptT)
import Data.Bifunctor
(bimap, first)
import Data.ByteString.Builder

View file

@ -1,6 +1,5 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PolyKinds #-}
module Servant.API.Experimental.Auth where