A partial fork of the cgi package exposing the Multipart module.
silkapp / multipart Goto Github PK
View Code? Open in Web Editor NEWA partial fork of the cgi package exposing the multipart module
License: Other
A partial fork of the cgi package exposing the multipart module
License: Other
A partial fork of the cgi package exposing the Multipart module.
I wonder where the bytestring >= 0.10.8.0
constraint comes from. This lower bound cannot be satisfied by ghc-7.10.3
. No big deal, of course, the compiler is very old ... I'm just curious whether that constraint is really necessary. See https://travis-ci.org/peti/multipart/builds/594576304 for the complete build log that shows the problem.
The package builds fine with bytestring-0.11.3.1 (shipped with GHC 9.2) as I have tested, but it's upper bound forbids it. It'd be nice if this could be alleviated via a hackage revision!
It's been while since I tried, but I'm pretty sure multipart
still builds with bytestring < 0.13
It appears that parseM
is lacking a MonadFail
constraint. See https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail for more details. Unfortunately, that issue is preventing cgi
from compiling successfully.
Building library for multipart-0.1.3..
[1 of 2] Compiling Network.Multipart.Header ( Network/Multipart/Header.hs, dist/build/Network/Multipart/Header.o )
Network/Multipart/Header.hs:241:15: error:
• Could not deduce (MonadFail m) arising from a use of ‘fail’
from the context: Monad m
bound by the type signature for:
parseM :: forall (m :: * -> *) a.
Monad m =>
Parser a -> SourceName -> String -> m a
at Network/Multipart/Header.hs:238:1-60
Possible fix:
add (MonadFail m) to the context of
the type signature for:
parseM :: forall (m :: * -> *) a.
Monad m =>
Parser a -> SourceName -> String -> m a
• In the expression: fail (show e)
In a case alternative: Left e -> fail (show e)
In the expression:
case parse p n inp of
Left e -> fail (show e)
Right x -> return x
|
241 | Left e -> fail (show e)
| ^^^^^^^^^^^^^
Network/Multipart/Header.hs:245:20: error:
• Could not deduce (MonadFail m) arising from a use of ‘fail’
from the context: (Monad m, Eq a, Show a)
bound by the type signature for:
lookupM :: forall (m :: * -> *) a b.
(Monad m, Eq a, Show a) =>
a -> [(a, b)] -> m b
at Network/Multipart/Header.hs:244:1-57
Possible fix:
add (MonadFail m) to the context of
the type signature for:
lookupM :: forall (m :: * -> *) a b.
(Monad m, Eq a, Show a) =>
a -> [(a, b)] -> m b
• In the first argument of ‘maybe’, namely
‘(fail ("No such field: " ++ show n))’
In the first argument of ‘(.)’, namely
‘maybe (fail ("No such field: " ++ show n)) return’
In the expression:
maybe (fail ("No such field: " ++ show n)) return . lookup n
|
245 | lookupM n = maybe (fail ("No such field: " ++ show n)) return . lookup n
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
~~~
GIven the following program
import Network.Multipart
import Data.ByteString.Lazy.UTF8 as BLU
main = let boundary = "---------------------------9051914041544843365972754266" in
putStr $ show $ parseMultipartBody boundary $ BLU.fromString "-----------------------------9051914041544843365972754266\n\
\Content-Disposition: form-data; name=\"text\"\n\
\\n\
\text default\n\
\-----------------------------9051914041544843365972754266\n\
\Content-Disposition: form-data; name=\"file1\"; filename=\"a.txt\"\n\
\Content-Type: text/plain\n\
\\n\
\Content of a.txt.\n\
\-----------------------------9051914041544843365972754266--"
the output with v0.1.3 is
MultiPart []
Changing multipart to v0.1.2 changes the output to
MultiPart [BodyPart [(HeaderName "Content-Disposition","form-data; name=\"text\"")] "text default",BodyPart [(HeaderName "Content-Disposition","form-data; name=\"file1\"; filename=\"a.txt\""),(HeaderName "Content-Type","text/plain")] "Content of a.txt."]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.