On Sun, 04 Jun 2000, Koen Claessen wrote:
> You cannot ask a question like this without explaining why
> you are interested in this subject! :-) Just out of
> curiosity... (I think that it is has to do with a recursive
> do-translation, am I right? 

Yes, we're working on a new semantics for do, where you'll be able 
to bind variables recursively. For instance:
 
                 do xs <- Just (1:xs)
                    return (take 5 xs)
 
will evaluate to: Just [1,1,1,1,1] 

Such recursive bindings are quite useful for a class of problems (and for
a class of monads.)

It turns out that if we allow polymorphic let-bindings, the translation gets
far more complicated. So we're trying to figure out whether restricting
let-generators to be monomorphic is OK.

My apologies for not making this clear in the first posting..

-Levent.

PS. Some more detail for the truly interested: In the recursive-do, one
can stil have polymorphic let-bindings: use the usual <let ... in> form, i.e.

  do ...1...              -->  f is not visible 
     ...2...              -->  in the first two lines
     let f = .... 
         in do ...3...      -+
               ...4...       |>  f will be polymorphic here
               ...5...      -+  

But, of course, f will not be visible before it's definition (i.e. the first
two lines of the do.) But a let-generator will be visible everywhere:

  do ....                  -+
     ....                   |
     let f = ...            |>   f is visible everywhere (but is monomorphic)
     ....                   |
     ....                  -+
    
but it will not be polymorphic.

We'll appreciate any comments on this design.. Thanks again,

Reply via email to