Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source type ascription #68

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion servant-multipart-api/servant-multipart-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ library

-- other dependencies
build-depends:
servant >=0.16 && <0.20
servant >=0.16 && <0.21

-- servant-0.19 dropped support for GHC-8.4 (latest GHCJS version),
-- due to QuantifiedConstraints
Expand Down
4 changes: 2 additions & 2 deletions servant-multipart-client/servant-multipart-client.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ library
build-depends:
servant-multipart-api == 0.12.*
, http-media >=0.7.1.3 && <0.9
, servant >=0.16 && <0.20
, servant-client-core >=0.16 && <0.20
, servant >=0.16 && <0.21
, servant-client-core >=0.16 && <0.21

-- servant-0.19 dropped support for GHC-8.4 (latest GHCJS version),
-- due to QuantifiedConstraints
Expand Down
7 changes: 5 additions & 2 deletions servant-multipart-client/src/Servant/Multipart/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ instance MultipartClient Tmp where
readHandle hdl = fromActionStep LBS.null (LBS.hGet hdl 4096)

instance MultipartClient Mem where
loadFile _ = source . pure
loadFile :: Proxy Mem -> MultipartResult Mem -> SourceIO LBS.ByteString
loadFile _ = (source @[]) . pure

-- | Generates a boundary to be used to separate parts of the multipart.
-- Requires 'IO' because it is randomized.
Expand Down Expand Up @@ -129,10 +130,12 @@ multipartToBody boundary mp = RequestBodySource $ files' <> source ["--", bounda
mempty' = SourceT ($ Stop)
crlf = "\r\n"
lencode = LBS.fromStrict . encodeUtf8

-- renderInput :: _ -> SourceIO LBS.ByteString
renderInput input = renderPart (lencode . iName $ input)
"text/plain"
""
(source . pure . lencode . iValue $ input)
((source @[]) . pure . lencode . iValue $ input)
inputs' = foldl' (\acc x -> acc `mappend'` renderInput x) mempty' (inputs mp)
renderFile :: FileData tag -> SourceIO LBS.ByteString
renderFile file = renderPart (lencode . fdInputName $ file)
Expand Down
4 changes: 2 additions & 2 deletions servant-multipart/servant-multipart.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ library
servant-multipart-api == 0.12.*
, lens >=4.17 && <5.3
, resourcet >=1.2.2 && <1.3
, servant >=0.16 && <0.20
, servant >=0.16 && <0.21
, servant-docs >=0.10 && <0.20
, servant-foreign >=0.15 && <0.20
, servant-server >=0.16 && <0.20
, servant-server >=0.16 && <0.21
, string-conversions >=0.4.0.1 && <0.5
, wai >=3.2.1.2 && <3.3
, wai-extra >=3.0.24.3 && <3.2
Expand Down
109 changes: 39 additions & 70 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,72 +1,41 @@
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/

# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
# resolver: ghcjs-0.1.0_ghc-7.10.2
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
resolver: lts-16.7

# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# - location:
# git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# extra-dep: true
# subdirs:
# - auto-update
# - wai
#
# A package marked 'extra-dep: true' will only be built if demanded by a
# non-dependency (i.e. a user package), and its test suites and benchmarks
# will not be run. This is useful for tweaking upstream packages.
resolver: snapshot.yaml
packages:
- .
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
- servant-multipart-client
- servant-multipart
- servant-multipart-api
extra-deps:
- servant-0.18
- servant-client-0.18
- servant-client-core-0.18
- servant-docs-0.11.6
- servant-foreign-0.15.2
- servant-server-0.18

# Override default flag values for local packages and extra-deps
flags: {}

# Extra package databases containing global packages
extra-package-dbs: []

# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=1.5"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor
#- git: https://github.com/mwotton/roboservant
# commit: 3deefd61396f33270a747643aea713f50315ce7c
#- git: https://github.com/jfischoff/postgres-options
#commit: 45bafb2092bc7a7b3c561608295294d562313dd3
- git: https://github.com/jfischoff/tmp-postgres
commit: 593e3ebcb7643afd6095f6269de3552d01c7ff40
- postgres-options-0.2.0.0@sha256:5e2d6408ed3943f9a056b58106186397b9aa1424c56f1f26668305ce8ea2838f,1604
- git: https://github.com/MonadicSystems/servant-htmx
commit: db30209295bd0446d316cae5880fb7a6b36a733e
- servant-server-0.20
- servant-0.20
- lucid-xstatic-0.1.1
- xstatic-0.2.0
- git: https://github.com/haskell-servant/servant-lucid
commit: 28faa2b57ab01b105c35f30908630900f55b5576
- servant-xstatic-0.1.0
- git: [email protected]:lambdamechanic/dutchelm
commit: c35d25e939aee2ea6e8a28daa0ca22dc1159d51c
- git: [email protected]:lambdamechanic/quickjs-hs
commit: 22048e08b91bab5eaf61255c22d195579813278f
# annoyingly, this appears to be behind the github.
- git: https://github.com/nh2/call-haskell-from-anything
commit: e7c4648bd38d3e61970b916f4760f77e744629b3
# - call-haskell-from-anything-1.1.0.0
- posix-escape-0.1
- git: https://github.com/lambdamechanic/hxt
commit: d063d93d050367dba7617fa5b937ed609c446671
subdir: hxt-xpath
- openai-hs-0.3.0.1
- openai-servant-0.3.0.1
- servant-client-0.20
- servant-client-core-0.20
- servant-docs-0.13
- servant-foreign-0.16
# - servant-multipart