[Haskell-cafe] Type constraint with RankNTypes gradually slows down function?

Brandon Allbery allbery.b at gmail.com
Mon Jun 15 22:42:03 UTC 2015

On Mon, Jun 15, 2015 at 6:38 PM, Ben Gunton <ben.gunton at gmail.com> wrote:

> When I write a function with the type constraint "embedded" in the
> function's type declaration, instead of at the beginning, the function
> takes longer each time it is run. The simplest example I could write is
> this: http://lpaste.net/134563
> . "run1" is near instantaneous the first time, but gets marginally slower
> after each iteration... after thousands of iterations it takes about a
> millisecond to run (and keeps getting worse). "run2" is always near
> instantaneous. What is happening in "run1" that makes it slow down?

Something about having to make a typeclass dictionary for each iteration?

brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150615/c4a11b2e/attachment.html>

More information about the Haskell-Cafe mailing list