packages feed

dhall-1.7.0: Prelude/Optional/fold

{-
`fold` is the primitive function for consuming `Optional` values

Examples:

```
./fold Integer ([2] : Optional Integer) Integer (λ(x : Integer) → x) 0 = 2

./fold Integer ([]  : Optional Integer) Integer (λ(x : Integer) → x) 0 = 0
```
-}
    let fold
        :   ∀(a : Type)
          → Optional a
          → ∀(optional : Type)
          → ∀(just : a → optional)
          → ∀(nothing : optional)
          → optional
        = Optional/fold

in  fold