【发布时间】:2017-11-16 16:25:13
【问题描述】:
我正在寻找执行以下操作的 Elm 函数:
if e then
Just a
else
Nothing
例如,我正在寻找可以像这样使用的运算符(=>) : Bool -> a -> Maybe a(二进制函数也可以)
(x == 42) => "yes"
如果是x == 42,则返回Just "yes",否则返回Nothing。
显然,我可以使用if-then-else 来完成同样的事情,但我很好奇这样的功能是否已经存在。
【问题讨论】:
标签: elm