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

Proposing new syntax for zero-cost unwrapping options/results

$
0
0

I’ve always thought some kind of ergonomic enhancement to map / flatmap is needed for results to make them more useful, and happy to see this proposal.

Are there rules to when they can be used? For example can you unwrap an option and result in the same function -

let foo = async () => {
  let? Some({c}) = m->Dict.get(id1)
  let? Ok(obj) = Decode.decode(c, decoder)
  Ok(obj)
}

Viewing all articles
Browse latest Browse all 2592

Trending Articles