packages feed

dhall-1.24.0: dhall-lang/Prelude/Optional/toList

{-
Convert an `Optional` value into the equivalent `List`

Examples:

```
./toList Natural (Some 1) = [ 1 ]

./toList Natural (None Natural) = [] : List Natural
```
-}
let toList
    : ∀(a : Type) → Optional a → List a
    =   λ(a : Type)
      → λ(o : Optional a)
      → Optional/fold a o (List a) (λ(x : a) → [ x ] : List a) ([] : List a)

in  toList