• anton@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    5
    ·
    9 days ago

    You can already :

    res_res??;
    

    I think it’s more for cases where you don’t want to return, like

    let new_res = old_res.map(func).flatten();
    
    • lad@programming.dev
      link
      fedilink
      English
      arrow-up
      5
      ·
      9 days ago

      This, it’s not a thing that happens often, but there were a couple of times when flatten would’ve been handy

      This was also usually a result of a chain of and_then that could do with some flattening. This could’ve been rewritten as a separate function to make use of ?, but it seems to be a bigger trouble than use