Stream: contributing

Topic: Option proposal


view this post on Zulip Ghislain (Oct 13 2022 at 13:29):

Hi,
During the AoC, I found myself needing the rusty Option<T>. Could it be something interesting to be added to builtins?

Here's my current interface:

Option some : [Some some, None]

isSome : Option some -> Bool

isNone : Option some -> Bool

contains : Option a, a -> Bool

withDefault : Option a, a -> a

map : Option a, (a -> b) -> Option b

mapNone : Option a, a -> Option a

try : Option a, (a -> Option b) -> Option b

onNone : Option a, Option a -> Option a

view this post on Zulip Folkert de Vries (Oct 13 2022 at 13:32):

we are well-aware of this type :smile:. but so far, it's been nicer to use Result with some custon well-named reason why the value is absent

view this post on Zulip Zeljko Nesic (Oct 13 2022 at 20:04):

Folkert de Vries said:

we are well-aware of this type :smile:.

Maybe ... :wink:

view this post on Zulip Anton (Oct 14 2022 at 07:06):

We also answer this in detail in the FAQ.

view this post on Zulip Ghislain (Oct 14 2022 at 22:17):

:100: Thanks @Anton, sorry, it totally slipped my mind! I often make the mistake to read full docs before trying things and so do not understand every aspects of what I read that it doesn't stay well in memory. I should read again the FAQ / doc now I have a better knowledge of the language!

view this post on Zulip Anton (Oct 15 2022 at 05:59):

No need to apologize :)


Last updated: Jul 06 2025 at 12:14 UTC