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

docs(option): getUnsafe does not raise an exception #131

Merged
merged 2 commits into from
Apr 15, 2023
Merged
Changes from all commits
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
8 changes: 4 additions & 4 deletions src/Core__Option.resi
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ Option.getExn(None) /* Raises an Error */
let getExn: option<'a> => 'a

/**
`getUnsafe(value)` returns `value`.
`getUnsafe(opt)` returns `value` if `opt` is `Some(value)`, otherwise `undefined`.

## Examples

```rescript
Option.getUnsafe(Some(3)) == 3
Option.getUnsafe(None) // Raises an error
Option.getUnsafe(None: option<int>) // Returns `undefined`, which is not a valid `int`
```

## Exceptions
## Notes

- This is an unsafe operation, it assumes `value` is neither `None` nor `Some(None(...)))`
- This is an unsafe operation. It assumes `value` is not `None`, and may cause undefined behaviour if it is.
*/
external getUnsafe: option<'a> => 'a = "%identity"

Expand Down