#3446: Library enhancement request: Data.Maybe.justIf
-----------------------------+----------------------------------------------
Reporter: nomeata | Owner:
Type: feature request | Status: new
Priority: normal | Component: libraries/base
Version: 6.10.4 | Severity: normal
Keywords: | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
-----------------------------+----------------------------------------------
Hi,
I found myself often writing the idiom "if a then Just v else Nothing". It
can be nicely abbreviated by the function:
{{{
justIf :: a -> Bool -> Just a
justIf x True = Just x
justIf x False = Nothing
}}}
Which would allow me to write the nicely write- and readable {{{v `justIf`
a}}}.
Asking on #haskell, I got positive feedback about this addition:
{{{
<endojelly> nomeata, I'm all for it. my last project was *full* of that
idiom
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3446>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs