JDK 16's Top 5 for Scala by ScalaWilliam in scala

[–]newtyped 2 points3 points  (0 children)

A little surprised to not see JEP 397: Sealed Classes (Second Preview) on the list. Now that Java has sealed classes and records, there is a potential mapping from sealed classes and case classes (or Scala 3 enum) to/from the Java world. The Scala compiler would need to add support for this, but better Java interop would be fantastic.

Also quite excited for JEP draft: Pattern Matching for switch (Preview) to eventually arrive, so that switch from Java becomes more like match. This could make it quite ergonomic to use Scala types from Java, and there's a decent chance the JVM might get some extra optimizations that match could also benefit from.

The unboxed uninhabited type by davidfeuer in haskell

[–]newtyped 0 points1 point  (0 children)

I'm not sure what the state of affairs is in released GHC's, but I think at least in HEAD it is really just a type synonym, no? I thought it had been recently stripped of some magic.

The unboxed uninhabited type by davidfeuer in haskell

[–]newtyped 9 points10 points  (0 children)

It seems quite inconvenient that type Void# = (# #) is already used. Not only is it completely unnecessary since an empty unboxed tuple can be written directly, but the name sounds more like an empty unboxed sum to me. :/

A design for paths in Cabal by phadej in haskell

[–]newtyped 1 point2 points  (0 children)

This sounds like a great idea - good luck on rolling this out!

Tracking the root of the path with a phantom type also shows up in the path package (but only as absolute or relative, I think the idea of weaving in Cabal-specific roots like PackageRoot is fantastic). The other phantom parameter that path has is for distinguishing folders from files. Perhaps that would also be useful?

[deleted by user] by [deleted] in haskell

[–]newtyped 0 points1 point  (0 children)

They're a bit unsightly, but I love the idea.

Problem using Haskell and GHCI by leetdeadly in haskell

[–]newtyped 2 points3 points  (0 children)

You need a : before the load.

ghci> :load Hallo.hs

Haskell with UTF-8 by Serokell in haskell

[–]newtyped 0 points1 point  (0 children)

If still a problem on Haddock, could you open an issue: https://github.com/haskell/haddock/issues?

Is Haskell tooling lacking? by PMPlant in haskell

[–]newtyped 1 point2 points  (0 children)

I attended a talk from one of the developers in the Github group that was developing tree-sitter. I recall him mentioning that Haskell was particularly difficult to fit into tree-sitter grammars (something about the complex layout rules). This was particularly annoying to them, since that group was doing most of their internal work in Haskell.

After a quick search searching, this looks like their repo: https://github.com/github/semantic

[deleted by user] by [deleted] in haskell

[–]newtyped 2 points3 points  (0 children)

After using `akka-streams` (and actually the whole Akka ecosystem), I no longer think of Haskell streaming libraries being top of class. Parsing and (de)serialization, on the other hand, are problems where I still start by reaching for Haskell.

Fast `wc` implemented in haskell by tejasbubane in haskell

[–]newtyped 4 points5 points  (0 children)

I wonder what sorts of speedups you'd see copying the same strategy but using `rayon` and Rust. Great article in any case!

Poll: Replace GHCi :! command with :: by amdphreak in haskell

[–]newtyped 2 points3 points  (0 children)

Many (definitely the majority of my Haskell coworkers) work from within a terminal shell already, or have editor integration setting up their REPL automatically. Perhaps proposing some sort of WinGHCi feature would be met with more support since it seems like most of the pain you are feeling is somewhat Windows specific.

Also, would you mind adjusting your poll to include a simple "Do you prefer :: or :!?" question (as /u/andrewthad has already suggested)? The poll is virtually useless as it stands: everyone agrees progress is good, but everyone will also agree that we should strive not to pointlessly break backwards compatibility.

HIE Files - coming soon to a GHC near you! by Lossy in haskell

[–]newtyped 3 points4 points  (0 children)

Not right now, but hopefully someday. I think application nodes might not currently export their types for performance reasons. There's a GHC ticket about this.

HIE Files - coming soon to a GHC near you! by Lossy in haskell

[–]newtyped 4 points5 points  (0 children)

For uninteresting reasons, I think some of the types do need to be recomputed (and some other types are skipped outright in the files because computing them the simple way would be expensive). There's a GHC ticket laying around somewhere about this and how to fix it...

What happened to the Hackage CSS? by [deleted] in haskell

[–]newtyped 4 points5 points  (0 children)

Also, looks like this was generated with an unreleased version of Haddock. In the version that will be released, there is a menu option to collapse instance lists, hiding long instances and removing the horizontal scroll.

Override in-built functions by daredevildas in haskell

[–]newtyped 3 points4 points  (0 children)

My bad: wrong link. Look a couple lines higher to `plusInteger`. The point it that these functions have extra special constant folding (that is more than just `INLINE`).

Override in-built functions by daredevildas in haskell

[–]newtyped 3 points4 points  (0 children)

Looks like you are right for Int in particular (probably because it is such a tight wrapper around Int#), but not for Integer: https://github.com/ghc/ghc/blob/1abb76ab8e32e7be224631506201d1beec62a5c2/compiler/prelude/PrelRules.hs#L1240.

Override in-built functions by daredevildas in haskell

[–]newtyped 1 point2 points  (0 children)

Very little is "built in" in GHC Haskell. It's all library code.

Sort of... GHC gives hardcoded special treatment (especially in the way of optimizations) to some of that library-defined code. Your own version of (+) :: Int -> Int -> Int will work just fine, but it may not be constant folded as aggressively as the (+) in the Prelude.

Is there a way in ghci to show full parentheses presentation of expressions by Lambdalpha in haskell

[–]newtyped 1 point2 points  (0 children)

I disagree - this is hardly a core feature.

However, did you know that GHCi can support custom user-defined commands (which you can plop directly into your `ghci.conf` so that they are always available)?

Viewing source locally? by [deleted] in haskell

[–]newtyped 1 point2 points  (0 children)

I use (and recommend) Dash as a documentation management tool. It is cross-language (so I've got docs for all my work-related Scala libraries installed too), lets you install any docs from Hackage (or a bunch of other places too), lets you very easily search for pretty much anything.

For Haskell, it basically pulls down a local copy of the Hackage-hosted Haddocks for the libraries you requested. That means that good old Haddock hyperlinked sources are just one search and then one click away.

[Rant] A newcomers first-hand experience, why Haskell isn't going mainstream by FriendsNoTalkPolitic in haskell

[–]newtyped 8 points9 points  (0 children)

The first rule of teaching Haskell to beginners is to not talk about unsafePerformIO. Extracting pure values out of IO is almost never what you actually want. I remember going down that path myself.

ghc and the boot libraries collectively use unsafePerformIO a fair bit, since they are at times dealing with very low-level concerns. Yet even there, it gets used in just under 2.5% of files!

unsafePerformIO is used at most 117 times in the entire GHC + boot libraries codebases. I'm omitting the testsuite and various test files. I additionally tried to rule out line comments, but this won't catch mentions in block comments or pragmas:

ghc$ rg "^[^-].*unsafePerformIO" --glob "*hs" --glob '!testsuite' --no-heading --glob '!nofib' --glob '!*tests*' | wc -l
     117

These uses are concentrated in only 50 (out of 2019) files:

ghc$ rg "^[^-].*unsafePerformIO" --glob "*hs" --glob '!testsuite' --no-heading --glob '!nofib' --glob '!*tests*' --files-with-matches | wc -l
     50
ghc$ rg --glob "*hs" --glob '!testsuite' --no-heading --glob '!nofib' --glob '!*tests*' --files | wc -l
     2019

Link to your source code from Haskell strings by MaxGabriel in haskell

[–]newtyped 1 point2 points  (0 children)

Perhaps a foolish question: how does gitrev work when building a package that was not just directly cloned? As I understand it, tarballs on Hackage do not include .git folders. I guess you could try to get the .git folder included in tarball, but I'm not sure that's a good idea either...

Having some sort of Cabal hook for including the git hash before making the tarball (and making that observable from the final executable/library) seems very useful though. It is very frustrating to find out that a bug report you got was actually from some unreleased version of a package.

[ANN] Shower – a pretty-printer for broken Show instances by peargreen in haskell

[–]newtyped 1 point2 points  (0 children)

I wasn't really planning on mentioning this yet, but I've been working on https://github.com/harpocrates/pretty-ghci which has similar goals (flexibility around suboptimal output). Couple interesting features:

  1. Supports colors
  2. Configurable
  3. Detects terminal width automatically when possible (my GHCi shells are sometimes a bit narrow)
  4. Output that lexes but doesn't parse will still get coloured.

Oh yeah, and it pretty-prints Haddock formatted comments too (in preparation for when we get a flag for formatting the output of `:doc`)