[EMAIL PROTECTED] wrote:
Say I have the following function, ... :
f n () = (n, f (n + 1))
...
I have two questions:
1. How can I tell from the Haskell 98 Revised Report that this
function isn't allowed? The discussions of typing in the Report
generally defer to the
Jeremy Shaw wrote:
There is a thread on comp.lang.functional that talks about why haskell
does not support recursive types:
http://groups.google.com/groups?q=ocaml+rectypeshl=enlr=lang_enie=UTF-8oe=UTF-8safe=offselm=8giqpt%24oee%241%40rivesaltes.inria.frrnum=1
(searching for 'ocaml
Ken Shan wrote:
I think the rule you're looking for is the following: Don't equate a
type variable with something that contains that type variable. This
is known as the occurs check. This rule prohibits equi-recursive
types like b above, but not iso-recursive types like
data List a =
Greetings.
Say I have the following function, adapted from Pierce, Types and
Programming languages:
f n () = (n, f (n + 1))
Now, this function fails to typecheck in ghc 6.0.1 because the
subexpression f (n + 1) has the infinite type t = () - (t1, t)
And so I assume (perhaps wrongly?) that f
Malcom Wallace wrote:
Since you aren't interested in absolute timings, just the algorithmic
complexity, then you could try using a less smart compiler (e.g. nhc98)
which will not automatically optimise away the repeated calls.
Thanks very much, I will try this.
I'm seriously interested in using
Ketil Z. Malde wrote:
Using GHC 6.0 on Mac OS X (10.2.6), I'm trying to do some timing
tests of something that doesn't take very long. So, I want to call
a function repeatedly (1000s of times).
No chance you could call it with different parameters each time?
I will try this--thanks very much for
Greetings.
Using GHC 6.0 on Mac OS X (10.2.6), I'm trying to do some timing
tests of something that doesn't take very long. So, I want to call
a function repeatedly (1000s of times). It appears, however, that
the compiler is figuring out that there's no need to call the
function more than once