Skip to content

Explain why Ref functions return Effect (Ref s) rather than Ref s #30

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix explanation: the Effect action creates a new ref on each call
  • Loading branch information
JordanMartinez committed Oct 12, 2020
commit bff52e3d76cc829b7df196ec5b65f3ed888b610c
5 changes: 3 additions & 2 deletions src/Effect/Ref.purs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
-- | In the above code, `first` would be the same as `second` if it upheld
-- | referential transparency. However, `first` holds the same reference twice
-- | whereas `second` holds two different references. Thus, it invalidates
-- | referential transparency. By making `Ref.new` return an `Effect`, a
-- | new separate reference is created each time.
-- | referential transparency. By making `Ref.new` return an `Effect`, we
-- | return an _action_. Each time this action is called, it will create a new
-- | separate reference that is initialized to the given value.
-- |
-- | In regards to the second, consider the below example:
-- | ```
Expand Down