6 ms·
I have. Like many other concepts in Haskell, it takes a bit of time for intuition to kick in. For example you likely wouldn't understand Traversable or Applicat
by kccqzy 4y ago
I have. Like many other concepts in Haskell, it takes a bit of time for intuition to kick in. For example you likely wouldn't understand Traversable or Applicative when you first heard of it but it will become second nature in a few days.
The only rule I would have is to ban all the operators and force everyone to use actual words for names. For example (^.) is not allowed but `view` is.
- pmoriarty 4y ago> The only rule I would have is to ban all the operators and force everyone to use actual words for names. For example (^.) is not allowed but `view` is. Yeah, this is what I view as a enormous weakness of Haskell compared to Lisp/Scheme, where in the latter descriptive naming is a community norm. It makes for much more readable code... especially if I've been away from the language for a while.
- rssoconnor 4y agoDo you also consider v^.x hard to read when it is Pascal?
- HelloNurse 4y agoPascal has a much smaller number of much simpler operators than Haskell + fancy libraries, which puts a low ceiling on the incomprehensibility of Pascal expressions.
- aranchelk 4y agoPoint of clarification for readers who aren’t familiar with Haskell: Haskell doesn’t have operators in the classic sense, since they’re just an alternate syntax (infix) for regular functions; implemented in libraries. The Haskell ecosystem OTOH has a shitton of infix functions, as does Edward Kmett’s lens library. I don’t think there’s any reason to bother memorizing the ones that aren’t useful to you. You can always search them on Hoogle if you encounter one you don’t know. E.g. https://hoogle.haskell.org/?hoogle=%28%5E.%29&scope=set%3Astackage https://hoogle.haskell.org/?hoogle=%28%5E.%29&scope=set%3Ast... I use lenses frequently in a large application and have only ever used view, set, and over.
- bmacho 4y ago> Haskell doesn’t have operators in the classic sense, since they’re just an alternate syntax (infix) for regular functions Actually in Haskell there is a concept of 'functions' and 'operators'. The former are made up symbols, while the latter are made up mostly alphanumeric characters. Also they parse differently.
- kccqzy 4y agoNo it wasn't hard in Pascal. Pascal had way fewer operators (^ and . being different ones) than the lens library.
- ParetoOptimal 4y ago> The only rule I would have is to ban all the operators and force everyone to use actual words for names. For example (^.) is not allowed but `view` is. I sometimes find myself thinking the same, but then I remember "Notation as a tool of thought"[0] and become less sure. Also I remember some lens compositions being more awkwatd with words, though I can't recall an example. 0: https://www.jsoftware.com/papers/tot.htm https://www.jsoftware.com/papers/tot.htm
- trenchgun 4y agoBut Haskell does not have the squiggly sumbols…
- spopejoy 4y agoWe actually have this rule in our company style guide. We do allow '.=' and '.%' (MonadState ops) because they fit elegantly into 'do' contexts.