unison/unison-src/tests/a-tale-of-two-optionals.uu
2018-09-24 13:36:13 -04:00

22 lines
520 B
Plaintext

type Optional a = None | Some a
Optional.isEmpty : Optional a -> Boolean
Optional.isEmpty o = case o of
Optional.None -> true
Optional.Some _ -> false
increment x = x + 1
(|>) : forall a b . a -> (a -> b) -> b
a |> f = f a
Stream.from-int -3
|> Stream.take 10
|> Stream.fold-left +0 (Int.+)
|> Optional.Some
-- as of 3935b366383fe8184f96cfe714c31ca04234cf27,
-- complains about the Optional on line 1 being different
-- from the Optional on line 3.
-- Surprisingly, it typechecks if I comment out line 1.