2 ms·
Monads, Transformers etc can make Haskell code hard to follow. But the culture of overusing unpronounceable/unmemorable operators is what makes Haskell really h
by yencabulator 6y ago
Monads, Transformers etc can make Haskell code hard to follow. But the culture of overusing unpronounceable/unmemorable operators is what makes Haskell really hard to read.
>@>
<$>
<*>
<|>
<=<
<+>
<$>
-->
<&&>
<||>
|||
.|.
None of the above are made up, all are from real code.
- whateveracct 6y agoOf code is using <$>, <*>, And <|>, it's probably easier to read & understand at a glance than the the best, most read-optimized Go equivalent. If you know what those symbols mean (aka the interfaces they belong to.) If you don't have that knowledge and are instead complaining about the fact that they have symbols period, I suggest you quit spouting answers when you should be asking questions.
- Macha 6y agoWhy is <$> for example easier to read, type, understand, Google, or any dimension really over "fmap"?
- whateveracct 6y agoApplicative style for one data Person = Person { age :: Int , name :: Text , height :: Int } Person <$> parseAge <*> parseName <*> parseHeight Applicative style is one of the easiest constructs to read relative to the power of what it typically does. Most other times when you use <$>, you're using it instead of something like this: fmap f $ x y z Which is simplified by f <$> x y z Google is a non-issue. Hoogle exists and works great (and can even index all symbols importable by your project)
- siraben 6y agoSome of these are explanable from mathematical conventions. In abstract algebra it's common to surround an operator in a circle to denote a "generic" or "lifted" operator. So <$> denotes a "lifted application", i.e. ($) :: (a → b) → a → b (<$>) :: Functor f => (a → b) → f a → f b