Permalink
Browse files

Add Some and None for constructing Optional (#3)

  • Loading branch information...
f-f authored and Gabriel439 committed May 30, 2018
1 parent e44284b commit c79c2bc3c46f129cc5b6d594ce298a381bcae92c
Showing with 30 additions and 0 deletions.
  1. +13 −0 Optional/None
  2. +13 −0 Optional/Some
  3. +4 −0 Optional/package.dhall
@@ -0,0 +1,13 @@
{-
Convenience function to construct empty Optional values.
Examples:
```
./None Natural = [] : Optional Natural
./None Text = [] : Optional Text
```
-}
let None = λ(a : Type) → [] : Optional a in None
@@ -0,0 +1,13 @@
{-
Convenience function to construct an Optional containing a value.
Examples:
```
./Some Natural 42 = [ 42 ] : Optional Natural
./Some Text "foo" = [ "foo" ] : Optional Text
```
-}
let Some = λ(a : Type) → λ(v : a) → [ v ] : Optional a in Some
@@ -24,4 +24,8 @@
./toList
, unzip =
./unzip
, None =
./None
, Some =
./Some
}

0 comments on commit c79c2bc

Please sign in to comment.