In ruby ?
is allowed at the end of identifier which allows things like
if do_something? do_something
which allow to differientiate function returing a bool from function doing something.
In Haskell, obviously the type signature tells you the difference between those two function, but is there a name convention or naming pattern to name bool or options ?
In my case, I want to generate (or not) some labels depending of the value of an options (passed as argument).
the obvious code would be
generate options = do
when (generateLabels? options) generateLabels
but as generateLabels?
is not valid name, how can I call it ?
If you glance at the functions that return Bool, you'll notice that the convention is to use a predicate that when used in code reads like a sentence. For example:
isDenormalized :: RealFloat a => a -> Bool
isSigned :: Bits a => a -> Bool
isAlphaNum :: Char -> Bool
In your function I'd suggest that you rename generateLables?
to something like needsLabels
as @bheklilr pointed out in order to make your code more readable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With