Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(potentially?) broken DO notation #1076

Open
stylewarning opened this issue Mar 26, 2024 · 1 comment
Open

(potentially?) broken DO notation #1076

stylewarning opened this issue Mar 26, 2024 · 1 comment

Comments

@stylewarning
Copy link
Member

         > Since cs:open? executes when the line (let is-open-b = (cs:open? stream)) executes, is-open-b is calculated before the stream is closed, even though it looks like the stream was already closed on the previous line.

This seems like a bug in our implementation of do to me, though the Haskellers might disagree. It seems to me that

(do
  some-monad
  (let foo = some-pure-computation)
  another-monad)

should expand to something like

(>>= some-monad (fn (_) (let foo = some-pure-computation) another-monad))

whereas at present it expands into

(>>= some-monad
     (coalton::const (coalton::bind foo some-pure-computation another-monad)))

which eagerly evaluates the bind form (imo incorrectly).

Originally posted by @gefjon in #765 (comment)

@stylewarning
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant