Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Syntax for unwrapping Option inside function

$
0
0

Pattern matching is possible today.

type t =
  | A(int)
  | B(int)

...
let A(x) | B(x) = A(1)

The problem is that there is no way to handle unmatched patterns without early return semantics.

For example in Rust, ? is an abbreviation for this:

let Ok(a) = result else {
  return result.into()
}

Viewing all articles
Browse latest Browse all 2592

Trending Articles