Klemens Hemm wrote:
>
> the :++ infix definition causes the derived read parser to loop until control stack
>overflow in hugs may99.
>
> module Main where
>
> data T = T1 | T :++ T deriving (Eq,Show, Read)
>
> t :: T
> t = read "T1"
>
> main = print t
This is a known shortcoming of Hugs98 (and previous versions of Hugs).
The problem is that :++ is left associative (Haskell Report, 4.4.2)
and the type T appears recursively on the left hand side.
The parser (reader) is looping.
Adding the line
infix 9 :++
will allow the read to work, by giving :++ a non-associativity rather
than a left-associativity.
Hope the helps!
Andy Gill