HUGS error: Unresolved overloading
Laszlo Nemeth
laszlo@ropas.kaist.ac.kr
Mon, 21 May 2001 15:34:35 +0900 (KST)
Hi Mark,
> isSorted xs = and (zipWith (<=) xs (tail xs))
> In other words: "When is a list xs sorted? If each element in xs is
> less than or equal to its successor in the list (i.e., the corresponding
> element in tail xs)."
That's right ... under cbn! At the same time David's version with
explicit recursion is fine both in Hugs and in a strict language.
I recently started using Caml for day to day work and I get bitten
because of the 'lazy mindset' at least once a week. I am not in
disagreement with you over the style, but explicit recursion in this
case avoids the problem.
Cheers,
Laszlo
PS. Why not go all the way
and . uncurry (zipWith (<=)) . id >< tail . dup
with appropriate definitions for dup and >< (prod)?