[Haskell] What's up with this Haskell runtime error message:

Garrett Mitchener garrett.mitchener at gmail.com
Wed Apr 5 14:32:02 EDT 2006

> GHC gives:     Fail: <<loop>>
>  Hugs gives:     [(ERROR - C stack overflow

This usually means that you programmed some kind of circular definition, as in

main =
  let x = x :: Int
  in print x

This is not the same as a self-referential data structure like an
infinite list, as in

let ones = 1:ones

which is perfectly okay.  The "loop" in the first example happens
because it starts to evaluate x, and determines that it has to know x
to do the evaluation, but the evalutation of x is already under way.

-- Garrett Mitchener

More information about the Haskell mailing list