I ran HLint on a little project and it suggested me to use &&&.
Example :
>>> cat st.hs
f = (+) 10
g = (+) 1
main = print $ (\x -> (f x, g x)) 5
>>> hlint st.hs
st.hs:4:17: Warning: Use &&&
Found:
\ x -> (f x, g x)
Why not:
f Control.Arrow.&&& g
1 suggestion
I understand the \x -> (f x, g x)
is a pattern and appreciate the suggestion. However Control.Arrow.&&&
doesn't take normal functions but arrow, so I can't just use &&&
as suggested.
So what is the recommended way in that situation ?
&&&
operator on function ?(arr f) &&& (arr g)
but I even don't know how evaluate it ?Arrow is a type class, of which (->)
is an instance (see here under "Instances", and here for the implementation). This means that you can directly use arrow operators such as (&&&)
with functions.
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