[Haskell-cafe] benchmarking pure code
Paul Brauner
paul.brauner at loria.fr
Wed Mar 31 05:06:52 EDT 2010
Hello,
actually I don't know if I can. I totally wouldn't mind but this is
mainly my co-author work and I don't know if he would (I suppose not but
since he is sleeping right now I can't check). However let's assume it's
a deBruijn representation for instance, I can tell you the scheme I
used:
data Term = Lam Term | App Term Term | Var Int
instance NFData where
rnf (Lam t) = rnf t
rnf (App t1 t2) = rnf t1 `seq` rnf t2
rnf (Var x) = rnf x
the actual datatype doesn't have fancy stuff like higher-order
types for constructors, it's really similar. The only difference
is that it is a GADT, but this souldn't change anything right?
Did I make some mistake in instancing NFData ?
Regards,
Paul
On Wed, Mar 31, 2010 at 09:32:29AM +0200, Bas van Dijk wrote:
> On Wed, Mar 31, 2010 at 9:17 AM, Paul Brauner <paul.brauner at loria.fr> wrote:
> > Does anyone have an idea why calling rnf before the bench
> > doesn't seem to "cache" the result as calling show does?
> > (my instances of NFData follow the scheme described in strictbench
> > documentation).
>
> Is it possible you could show us your term type and your NFData instance?
>
> regards,
>
> Bas
More information about the Haskell-Cafe
mailing list