Hacker News new | past | comments | ask | show | jobs | submit login

Immediately confronted by 9 compiler extension directives, major turnoff to this interested newbie. Is this considered normal and acceptable?



I think this is considered normal for real world Haskell usage.

Most libraries and even frameworks like ihp that try to be favor ease of use rely on these language extensions. You can ofcourse place these directives once in the cabal file, but there's no getting around to learning what they do.


With GHC2021, you may soon be able to simply put that instead, and it will imply enabling all those individually.

https://www.reddit.com/r/haskell/comments/je1t82/does_the_id...


It comes with the territory for a fast moving language with new extensions like -XDerivingVia[1] -XLinearTypes[2], more often than not backed by a publication where its interaction with other features is considered. Some extensions are purely syntactic and are quickly understood -XLambdaCase[3] -XBlockArguments[4] -XMultiWayIf[5]. The compiler will suggest missing extensions. There is enough to hs98 for a lifetime of study (see work of Graham Hutton[6] and Jeremy Gibbons[7])

[1] https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/deri...

[2] https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/line...

[3] https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/lamb...

[4] https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/bloc...

[5] https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/mult...

[6] https://twitter.com/haskellhutt

[7] https://twitter.com/jer_gib


Why a turnoff? "Extension" just means "language feature that is thoroughly well-specified, well-tested and widely used but hasn't made it into the language standard (partly because there hasn't been one for ten years)".


Yes. They're normal here, and you can consider them about as significant as an import statement, some context when reading the code, but nothing crazy.

The extensions are very well vetted, and new versions of the language standard can be summed up as "enable extensions a, b, c by default." Plus library changes, of course.


Are you looking at production code or pedagogical examples? For the former, it's totally normally to use compiler-specific features. If you are scared off by that, you'd be better served reading a book that introduces things little by little.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: