HNHacker News
TopNewBestAskShowJobs

shirogane86x

106 karma · joined March 30, 2020

submissionscomments
shirogane86x··on Comparison of Haskell and Julia List Comprehensions
That's actually how list comprehensions work in F#: that would become:

  [for xs in xss do for x in xs -> x]
(where -> is a shorthand for do yield) in practice (after 3 years of professional F#), when writing functional code i'd actually rather have the result first rather than last. I got used to reading code right to left with Haskell so that's what feels most natural to me
shirogane86x··on Neovim 0.5 is overpowering
to be honest, idiomatic code in haskell-land tends to be written right-to-left and not left-to-right, so you'd usually write it with the ($) and (.) operators. I personally have gotten used to reading it right to left more, as have probably most people who use haskell extensively. And I think it's only fair that haskell chose a 1 character operator: composing functions and applying them to arguments is the main way to make programs, so it's good that you have to type the least amount characters possible to do it, compared to something like F# where all the function composition and application operator take two characters (|>, <|, >>, <<)
shirogane86x··on Rf: an experimental refactoring tool for Go
Relevant: https://haskellwingman.dev/ . it's actually possible to use it if you have the haskell language server installed, as a code action (at least i think it is, haven't personally tried it yet tho)
shirogane86x··on How JavaScript works: 3 types of polymorphism
As far as i remember there's functions that take explicit typeclass dictionaries (that you can compose via contramap). So I guess they sort of do typeclasses, but without implicits, which is pretty painful IME. Example: https://gcanti.github.io/fp-ts/modules/Functor.ts.html#map
shirogane86x··on Java for Everything (2014)
just as a heads up, as someone who's worked as an F# dev for the last three years: it's HM, but compared to the other languages mentioned (Haskell, OCaml, SML), it still tends to feel C#-y when doing fairly complex things. Also some things don't quite feel right: indentation is sometimes finnicky, type inference only really works left-to-right (might only be a problem for me, I do a lot of Haskell in my free time so right to left feels more natural), still has all the baggage from other .NET languages, which helps interop, but also means that when you try to bend the type system a bit you end up with method overloading. Even for simple things like optional or named parameters (which can only be done on uncurried instance and static methods, but not on functions). Type providers feel great until you have enough that they break your editor and they slow compilation down massively. editor tooling also feels pretty immature (it didn't work well at all on my machine, but YMMV). I think if you want to use an HM language, go with OCaml/Haskell, don't bother with F#, unless you specifically need the ecosystem. OCaml/Haskell's ecosystems are smaller compared to .NET, but you can still get by a lot of the time, and IMHO you get a more polished language + an ecosystem that was designed for it, as opposed to getting a language that at points feels dodgy + a big ecosystem that (for the most part) wasn't at all designed for the language you're using.

TL;DR: F# is only worth it if you need to take advantage of the .NET ecosystem, otherwise just go with SML/Haskell/OCaml

shirogane86x··on Haskell web framework IHP aims to make web development type-safe and easy
seems very likely that it's Fira Code
shirogane86x··on Go’s Major Versioning Sucks – From a Fanboy
nix-style local builds (although the name is kinda bad) don't really have anything to do with nix, they're only the (admittedly bad) name for the new v2-* style commands (that now, at least as of cabal-3.0.0.0 and higher, are the default)
shirogane86x··on What killed Haskell, could kill Rust, too
the default is pvp [1] and I think most packages use that and not SemVer? or, at least, I can't remember off the top of my head of specifically pinning a package with SemVer.

[1] https://pvp.haskell.org/

shirogane86x··on What killed Haskell, could kill Rust, too
I personally haven't had the same experience as you (I personally find the Haskell community quite pleasant, especially in the functional-programming slack server), but I'll try and answer (probably in an incomplete way) your question about updates.

Haskell can, in fact, update variables. Mostly through 2 mechanisms:

- ST (a computation containing local, mutable state, that cannot escape its scope) [1]

- IORef (mutable, thread-safe variables that only work in IO). [2]

The other (and usually more common way) of doing "mutable" state in Haskell is through State, which technically doesn't update the variable in-place, but simply modifies the variable and passes a copy to the rest of the computation (although, as far as I'm aware, a lot of the time this step gets optimized away).

That said, if your main field of expertise is simulation programs where performance and space efficiency are very important, then Haskell is probably not a great fit (cause not only is it based on a GC, it's also lazy, which can sometimes mess with the performance of your code, not speed-wise but memory usage-wise). Hopefully this could be mitigated in some way in the coming years when Linear types become viable for efficient resource usage (Linear types ideally could grant us some sort of Rust-like resource management)

[1] https://hackage.haskell.org/package/base-4.14.0.0/docs/Contr...

[2] https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-...

shirogane86x··on Ask HN: Is there a declarative animation language?
Haskell has reanimate (https://reanimate.github.io/), although I don't personally have much experience with it. But it does have an online playground to try out stuff in the browser
shirogane86x··on How to write PureScript react components to replace JavaScript
I mean, there are people who do, using GHCJS and something like Miso or Reflex.
shirogane86x··on Show HN: IHP, a batteries-included web framework built on Haskell and Nix
How do you think IHP would interact with something like concur-replica(https://github.com/pkamenarsky/concur-replica)?
shirogane86x··on I can't keep up with idiomatic Rust
Actually, in Haskell, given that Maybe is Foldable, you can technically implement the maybe function as

maybe' def f value = foldr (const . f) def value

Although in pratcice almost noone uses Maybe's foldable instance (and it also doesn't scale to other datatypes, like Either, nearly as well, because of the multiple type parameters).

← PreviousPage 4 of 4