this is not meant to be combative! i really like haskell, and i've been liking it more and more the more i use it more, more. don't feel obligated to answer these at all! i just wanted to put them all in one place. these are in order of when i put them and very, uh, unrefined
- are there any language extensions i should always use?
- are there any language extensions i should never use?
- speaking of language extensions, is any implementation other than GHC worth using?
- arrows are very cool! i printed out the original paper and read it a while ago, but i'm still very shaky on them. i'll read this. they seem pretty hard to use! are they worth it?
- i do love that ->s are arrows, which makes stuff like (&&&) beautifully general
- is proc notation worthwhile?
- are any alternate preludes worth the effort? the idea of using decades of hindsight seems nice
- was it worth changing(?) Monad to require Applicative, which requires Functor?
- wiki page that seems relevant to 2am me: https://wiki.haskell.org/Functor-Applicative-Monad_Proposal
- the word you're looking for is superclass, dude. it's not like this is new terminology, why did i blank on this
- dependent haskell. i read some of the writing on that on serokell's blog. how's that going?
- is there a more lightweight (in terms of project structure) alternative to cabal? is cabal even the thing for dependencies? i should try nix for this hm
- my vscode setup for haskell is so brittle! sometimes two or three instances will start up and i have to restart vscode. this isn't a question, sorry, i just really need to fix this, lol. i'll probably try to get emacs up to par
- speaking of dependencies, is the (thankfully) built-in Parsec good enough, or should i learn {mega,atto,giga???}parsec/something else? (i think i'll try megaparsec out for errors' sake)
- speaking of preludes like five questions ago, should i be using Text pretty much all the time?
remarkably, i am out of questions for the moment, so i guess i'll publish this now
karkat's birthday update:
there are two great sets of answers by
- @prophet: https://cohost.org/mehbark/post/6369370-i-keep-wanting-to-as#comment-47bac0a5-9aff-4a0a-b0b6-dfcf04e8951c
- and @fullmoon: https://cohost.org/fullmoon/post/6393545-anyone-reading-this
- i'm using ghcid with haskell-mode thanks to this post. you're not going to believe this, but this actually uses less memory than vscode. (this isn't a real knock against vscode or the haskell vscode extension, my vscode config is a superfund site)
if you've read this far, read both of these! if you haven't read this far, what?
i'm still going to barf questions (and answers if and when i find them) here:
- (<$) is quite useful. i've mainly seen it when parsing enums. the docs say
The default definition is fmap . const, but this may be overridden with a more efficient version.
but it's hard to think of (or find) instances where a more efficient version is possible. - i did find a [specialized definition](https://hackage.haskell.org/package/base-4.20.0.1/docs/src/Data.Functor.Product.html#line-82) for Product! but i have no idea if it's actually more efficient lol
Jun 17 00:24 00:29 update:
- i was annoyed by ghc (-Wall)'s constant warnings about shadowing variable bindings, so i looked up how to turn it off, which led me to this reddit thread. the comments convinced me to fix my code instead of configuring ghc (i have done recursion when i didn't mean to multiple times). do you think haskell would be better if recursive bindings had to be explicit? idk! i can live with letrec and i have written dozens of bytes of ocaml, but it feels nice to be concise
(anyone reading this should feel free to ask my account this sort of stuff)
are there any language extensions i should always use?
I'm not sure I can provide a definitive answer to this question, but here are some extensions that (A) I enable quite frequently in my code and (B) have basically no downside as far as I'm concerned:
BlockArgumentsDerivingStrategies/DeriveGeneric/DeriveAnyClass/GeneralizedNewtypeDerivingNamedFieldPunsTypeApplications
are there any language extensions i should never use?
The only one that comes to mind for me IncoherentInstances. This is almost always a mistake to enable and there's usually a better alternative.
speaking of language extensions, is any implementation other than GHC worth using?
no
arrows are very cool! i printed out the original paper and read it a while ago, but i'm still very shaky on them. i'll read this. they seem pretty hard to use! are they worth it?
no. most cases where people want Arrow they'd be better served by Category + Applicative
is proc notation worthwhile?
no. again, Category + Applicative is typically better and do notation + ApplicativeDo is typically a better solution than proc notation
are any alternate preludes worth the effort? the idea of using decades of hindsight seems nice
maybe relude, but i personally don't use alternative preludes. i don't feel like they add a lot of value. i prefer to explicitly import all the functionality i need from the original packages even if it means a lot of imports
was it worth changing(?) Monad to require Applicative, which requires Functor?
yes. this leads to simpler constraints on a LOT of functions. it also makes stuff like ApplicativeDo much safer to enable
dependent haskell. i read some of the writing on that on serokell's blog. how's that going?
no idea. i think it will never materialize
is there a more lightweight (in terms of project structure) alternative to cabal? is cabal even the thing for dependencies? i should try nix for this hm
no. just bite the bullet and use plain old cabal. don't mess around with other stuff until you're very comfortable using cabal. trust me on this one
my vscode setup for haskell is so brittle! sometimes two or three instances will start up and i have to restart vscode. this isn't a question, sorry, i just really need to fix this, lol. i'll probably try to get emacs up to par
i use ghcid for my haskell coding
speaking of dependencies, is the (thankfully) built-in Parsec good enough, or should i learn {mega,atto,giga???}parsec/something else? (i think i'll try megaparsec out for errors' sake)
use megaparsec if you need LL parsing (which is typically what you want) and use Earley if you need LR parsing (which is typically only what you want if you're implementing a programming language)
speaking of preludes like five questions ago, should i be using Text pretty much all the time?
yes. basically never use String except in cases where you have to and make sure all of your public function types use Text instead of String