[Haskell-cafe] Decompressing and http-enumerator

Erik de Castro Lopo mle+hs at mega-nerd.com
Tue Aug 30 06:48:35 CEST 2011


Michael Snoyman wrote:

> > I think we should invert the logic of this (to avoid
> > double negatives) so we have:
> >
> >     type ContentType = ByteString
> >     decompress :: ContentType -> Bool
> >
> >     browserDecompress = (/== "application/x-tar")
> >     defaultDecompress = const True
> 
> No objections from me.
> 
> > Was the idea that this decompress field then gets added to
> > the Request record?
> 
> Yes.
> 
> > If so, would simpleHttp be modified to be:
> >
> >   simpleHttp :: String -> (ContentType -> Bool) -> m L.ByteString
> >
> > and exporting both browserDecompress and defaultDecompress so
> > they can be used as two sane defaults for the second parameter?
> 
> I don't want to go this route actually. I think simpleHttp should have
> the exact same type signature it has route now (thus living up to the
> name "simple"). It likely makes sense to use browserDecompress as the
> default for simpleHttp, and defaultDecompress as the default for
> parseUrl. Though I don't really have a strong opinion on this either.
> In either case, I'm thinking we should rename defaultDecompress to
> alwaysDecompress (my mistake to start off with), to properly indicate
> what it does.

Ok, I'll prepare a patch along these lines and submit a github pull
request.

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/



More information about the Haskell-Cafe mailing list