[Haskell-cafe] Missing common function for Maybe types
Marc Busqué
marc at lamarciana.com
Tue Jul 31 11:52:34 UTC 2018
On Tue, 31 Jul 2018, Imants Cekusins wrote:
> Salut Marc,
> Are you looking for Alternative by any chance:
> http://hackage.haskell.org/package/base-4.11.1.0/docs/Control-Applicative.html#t:Alternative
>
>
> Prelude> :m Control.Applicative
> Prelude Control.Applicative> Just 1 <|> Just 2::Maybe Int
> Just 1
> Prelude Control.Applicative> Nothing <|> Just 2::Maybe Int
> Just 2
Thanks for your answer Imants. That seems would be the perfect fit in
the case that both Maybe were parametrized by the same type, but it is
not the case. For that reason I thought I needed an `Either` in the
result.
Marc Busqué
http://waiting-for-dev.github.io/about/
More information about the Haskell-Cafe
mailing list