haskell-servant / servant-multipart

Support for file uploads in multipart/form-data for servant
https://hackage.haskell.org/package/servant-multipart
40 stars 37 forks source link

Compilation error for servant-multipart-client-0.12.1 against servant-0.16.1 #56

Open flhorizon opened 3 years ago

flhorizon commented 3 years ago

Hello, I work on a project currently depending on servant-0.16.1.

It seems the SourceT type is lacking a Semigroup instance on which servant-multipart-client-0.12.1 relies on.

If my understanding is correct, servant-multipart-client 0.12.1 is effectively incompatible with servant 0.16.

Details:

ghc-8.6.5
$ stack exec ghc-pkg list | grep servant
    servant-0.16.0.1
    servant-client-0.16
    servant-client-core-0.16
    servant-multipart-0.11.4
    servant-multipart-api-0.12.1
    servant-server-0.16
servant-multipart-client > Configuring servant-multipart-client-0.12.1...
servant-multipart-client > build
servant-multipart-client > Preprocessing library for servant-multipart-client-0.12.1..
servant-multipart-client > Building library for servant-multipart-client-0.12.1..
servant-multipart-client > [1 of 1] Compiling Servant.Multipart.Client
servant-multipart-client >
servant-multipart-client > /tmp/stack2910/servant-multipart-client-0.12.1/src/Servant/Multipart/Client.hs:116:51: error:
servant-multipart-client >     • Could not deduce (Semigroup (SourceT IO LBS.ByteString))
servant-multipart-client >         arising from a use of ‘<>’
servant-multipart-client >       from the context: MultipartClient tag
servant-multipart-client >         bound by the type signature for:
servant-multipart-client >                    multipartToBody :: forall tag.
servant-multipart-client >                                       MultipartClient tag =>
servant-multipart-client >                                       LBS.ByteString -> MultipartData tag -> RequestBody
servant-multipart-client >         at src/Servant/Multipart/Client.hs:(111,1)-(115,30)
servant-multipart-client >     • In the second argument of ‘($)’, namely
servant-multipart-client >         ‘files' <> source ["--", boundary, "--"]’
servant-multipart-client >       In the expression:
servant-multipart-client >         RequestBodySource $ files' <> source ["--", boundary, "--"]
servant-multipart-client >       In an equation for ‘multipartToBody’:
servant-multipart-client >           multipartToBody boundary mp
servant-multipart-client >             = RequestBodySource $ files' <> source ["--", boundary, "--"]
servant-multipart-client >             where
servant-multipart-client >                 (SourceT l) `mappend'` (SourceT r) = SourceT $ \ k -> l $ ...
servant-multipart-client >                 appendStep Stop r = r
servant-multipart-client >                 appendStep (Error err) _ = Error err
servant-multipart-client >                 appendStep (Skip s) r = appendStep s r
servant-multipart-client >                 appendStep (Yield x s) r = Yield x (appendStep s r)
servant-multipart-client >                 appendStep (Effect ms) r = Effect $ (flip appendStep r <$> ms)
servant-multipart-client >                 mempty' = SourceT ($ Stop)
servant-multipart-client >                 crlf = "\r\n"
servant-multipart-client >                 ....
servant-multipart-client >     |
servant-multipart-client > 116 | multipartToBody boundary mp = RequestBodySource $ files' <> source ["--", boundary, "--"]
servant-multipart-client >     |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^