[web-devel] Confusing double use of chooseRep in runHandler

Michael Snoyman michael at snoyman.com
Thu Jun 9 12:05:21 CEST 2011


On Wed, Jun 8, 2011 at 11:59 PM, Tyson Whitehead <twhitehead at gmail.com> wrote:
> I believe there may be an unneeded pass through chooseRep in at the end of
> runHandler in the HCContent branch of the content case construct
>
>  HCContent status a -> do
>    (ct, c) <- liftIO $ chooseRep a cts
>    return $ YARPlain status (headers []) ct c finalSession
>
> The chooseRep instance will just be id as a is already of type ChooseRep.
>
> While I doubt there would be any performance benefit, as I would hope it is
> optimized out, it did cause me some confusion while reading to code, so think
> it would be worth removing for clarity.  I've attached a patch for this.

You're absolutely correct, thanks for pointing this out. Patch applied.

Michael



More information about the web-devel mailing list