[Haskell] Top-level <-

George Russell ger at informatik.uni-bremen.de
Thu Nov 25 04:07:20 EST 2004

John Meacham wrote:
 > Now, my mdo proposal as written would have "hello" outputed exactly once
 > at module start up time no matter what, whether x is demanded or not. it
 > is equivalant to a program transformation that collects all the top
 > level initializers and declarations, puts them all in a mdo block and
 > runs it with the semantics explained in the fixIO paper. (with a
 > deterministic, but partially undefined order)

What happens if you write the following?

    y <- f
    x <- ....
    let f = something depending on x

Will it know to evaluate x before y, or is this not allowed?

What about if the assignments to y and x occur in different modules?  Will the
RTS have to analyse the dependencies to work out which order to run the assignments

More information about the Haskell mailing list