[web-devel] http2
Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)
kazu at iij.ad.jp
Tue Dec 17 07:59:01 UTC 2013
Hi,
First of all, I will export Network.HPACK (and Network.HTTP2) only
when the specs of HTTP/2.0 are fixed. Other modules are exported for
debugging/discussion purpose only at this moment. I'm explaining, for
instance, how to implement huffman encoding to other guys using this
unnecessary exported documents.
> A lot of the API uses the IO monad for no apparent reason. For example, the
> functions clearRefSets, removeRef, newEntry all seem to use IO
> unnecessarily, when they could be pure functions. That strikes me as bad
> style.
>From peformance point of view, an mutable array is necessary to
implement HPACK. Since this array is never shared and one-way update
only, I first tried to implement HPACK purely with Array (and STArray)
using unsafeFreeze and unsafeThaw. Unfortunately, this implementation
is unstable (i.e. compiled code with -O causes infinite loop) and I
gave up this approach. So, I decided to use IOArray.
Due to IOArray, some manipulation functions for Context is IO. I
decided to make all manipulation functions having IO at this moment
even if it is not necessary. This simplified the code of
Network.HPACK.To and Network.HPACK.From.
But I agree that Network.HPACK.Context should be cleaned up.
> I'm also a bit dubious about HeaderSet being a type alias for [Header],
> since you're not hiding it but have a very long alias for (:) later in the
> same module.
You are right. I will fix this.
> I don't like to see the print* functions scattered around in the public
> API, they look like debugging aids for your development purposes.
Please see above.
> I don't understand why HeaderSet is a type alias but ReferenceSet is a new
> type (and should be using newtype instead of data). The ReferenceSet
> functions look likely to be inefficient.
http-types defines:
type RequestHeaders = [Header]
type ResponseHeaders = [Header]
I would like to have the same type, but RequestHeaders and ResponseHeaders
is not good because this is used both in HTTP request and HTTP response.
I will use newtype for ReferenceSet. Thank you for pointing this out.
--Kazu
More information about the web-devel
mailing list