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

I think the thing is, if you want to write at a Clojure-level-abstraction, Haskell won’t stop you doing that and I get the impression that it’s actually the way a lot of Haskell programmers operate. (Chas Emerick has recently been advocating this approach and I get the impression it’s actually the style of GHC itself.)

We don’t all have to be at EK, BM or GGs level.




> I think the thing is, if you want to write at a Clojure-level-abstraction, Haskell won’t stop you doing that

Unless Haskell drastically fixed its record syntax recently, this is definitely not the case.


Haskell record syntax with lenses is workable:

  import Control.Lens

  data MyRecord = MyRecord { _a :: Int, _b :: MyRecord }
  makeLenses ''MyRecord
Then you can use it nested like:

  over (b . b . a) (+5) myRecord


Clojure people use the untyped equivalent of row types, i.e. being able to arbitrarily add and remove fields to and from a record. That would be nice to have in Haskell (though personally it's nowhere near a dealbreaker for me).


Haskell has reasonable implementations of row types as well.


A bold claim!


There are various library-level implementations. Here's the first one that turned up on Google:

https://raw.githubusercontent.com/target/row-types/master/ex...


Yeah, Clojure’s “labels are values” map stuff is pretty nice.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: