I am new to Haskell and do not know which is idiomatic - using operators in prefix form or infix form. From what I've noticed so far, functions with special characters for names such as <$>, <*>, >>= etc are used in infix form but functions whose names are made up of alphabets are used in prefix form. My guess is that this is inspired from mathematics, although I am not sure.
I've looked up Blow your mind, Category:Idioms and also searched up stackoverflow, but to no avail.
Edit
Clarifying, when is it idiomatic to infixify a function and prefixify an operator?
You can call any function any way you want.
fmap foo barfoo `fmap` bar(<$>) foo barfoo <$> barAs for what's idiomatic when calling them, that's a bit of a soft question, but here's some guidelines:
fmapand<$>), then use whichever one lets you use fewer parentheses.(`foo` bar)is more common thanflip foo bar.needle `elem` haystackis much more common thanelem needle haystack. Other common ones includedivandmod. I'm not aware of any of the opposite cases, though, where an operator would commonly be used as a prefix.As for whether you should make your new function an operator or not, the answer is almost always no. Named functions are generally much easier to understand. The exceptions in this case are if it'll be something you're chaining a lot of in a single expression (like Servant's
:<|>and:>), and operators that are common and well-known in the problem domain.