Hi.  I have a data type
        data Ok_Err s a = Ok s a
and a case expression
        case ok_err' of
          ~(Ok s' a) ->  ...
which involved in a loop (i.e. the ... contains a tail call back to the
function containing the case expression).

This takes a lot of space.  Specifically the space complexity seems
proportional to the number of loop iterations. Now if
I change the case expression to
        let ~(Ok s' a) = ok_err' in ...
then the space requirements become constant and small.

So what's going on?  The Haskell standard says that the dynamic sematics
is the same in both cases.

I don't want to use the let, because, really I'd like to exend the
data type to be a sum and the case expression to make a decision.  What
I really want is a state monad that supports emergency stops.  The case
expression is in the implementation of >>=.

BTW I am using NHC 1.3.

Cheers,
Theo Norvell


----------------------------
Dr. Theodore Norvell                                           [EMAIL PROTECTED]
Electrical and Computer Engineering                http://www.engr.mun.ca/~theo
Engineering and Applied Science                           Phone: (709) 737-8962
Memorial University of Newfoundland                         Fax: (709) 737-4042
St. John's, NF, Canada, A1B 3X5



Reply via email to