Skip to content

Instantly share code, notes, and snippets.

@okram
Created April 20, 2020 06:34
Show Gist options
  • Save okram/f23902ce429df92677b27faa984cfc61 to your computer and use it in GitHub Desktop.
Save okram/f23902ce429df92677b27faa984cfc61 to your computer and use it in GitHub Desktop.
// -< [split]
// >- [merge]
// [x|y] co-product
// variants are "choose"-branching structures
mmlang> 10-<[bool|int]
==>[|10]
mmlang> true-<[bool|int]
==>[true|]
// unions don't preserve branch source
mmlang> 10-<[bool|int]>-
==>10
mmlang> true-<[bool|int]>-
==>true
@okram
Copy link
Author

okram commented Apr 20, 2020

mmlang> 1-<[bool|str|int]
==>[||1]
mmlang> 1-<[bool|int|int]
==>[|1|]
mmlang> 1-<[bool|int[is>100]|int]
==>[||1]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment