4 ms·
Immediately confronted by 9 compiler extension directives, major turnoff to this interested newbie. Is this considered normal and acceptable?
by asplake 6y ago
Immediately confronted by 9 compiler extension directives, major turnoff to this interested newbie. Is this considered normal and acceptable?
- aszen 6y agoI 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.
- tome 6y agoWhy 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)".
- lallysingh 6y agoYes. 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.
- kccqzy 6y agoAre 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.
- iso8859-1 6y agoWith 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_idea_of_xghc2021_excite_you/ https://www.reddit.com/r/haskell/comments/je1t82/does_the_id...
- Iceland_jack 6y agoIt 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/deriving_via.html?highlight=derivingvia#extension-DerivingVia https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/deri... [2] https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/linear_types.html?highlight=lineartypes#extension-LinearTypes https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/line... [3] https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/lambda_case.html?highlight=lambdacase#extension-LambdaCase https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/lamb... [4] https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/block_arguments.html?highlight=xblockarguments#extension-BlockArguments https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/bloc... [5] https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/multiway_if.html?highlight=multiwayif#extension-MultiWayIf https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/mult... [6] https://twitter.com/haskellhutt https://twitter.com/haskellhutt [7] https://twitter.com/jer_gib https://twitter.com/jer_gib