Top all-time · #2768
Mark Karpov
Personal blog · markkarpov.com/postprogramming
Mark Karpov's personal blog at markkarpov.com covers programming. Since 2017, 27 different Hacker News readers have linked it 29 times, most often “Haskell vs. OCaml”. No feed was found, so read it on the site itself.
Mark Karpov's personal web site — writing on Haskell, functional programming, and software engineering.
Most-linked posts?
- Haskell vs. OCaml4 people · 4 mentions · first linked 2019-12-07
- Migrating text metrics to pure Haskell4 people · 4 mentions · first linked 2017-06-14
- Lisp and Haskell (2017)4 people · 4 mentions · first linked 2018-07-12
- Megaparsec Tutorial3 people · 3 mentions · first linked 2020-05-01
- Haskell GHC Generics Explained2 people · 2 mentions · first linked 2020-02-19
- Free monad considered harmful2 people · 2 mentions · first linked 2018-05-29
- Haskell: Smart constructors that cannot fail2 people · 2 mentions · first linked 2018-06-30
What Hacker News says?
Laziness on itself does not prevent one from properly evaluating resource utilisation. In fact, laziness helps in resource preservation. But what makes it less predictable is various optimisation techniques that come to aid the lazy environment: strictness analysis, rewrite rules, and stream fusion[1][2]. They may change significantly between compiler releases and affect the previously optimised codebase. [1] https:…
Comment linking /tutorial/ghc-optimization-and-fusion.html
on “PR to Merge Multicore OCaml”Submitted Lisp and Haskell (2017) as a story · 200 points
HN discussionNo idea how common it is. It's never been my main work language but I've been using it at work for prototyping/scripting/automation/analysis etc for at least ten years now. It looks like what I've done is most similar to https://www.parsonsmatt.org/2018/03/22/three_layer_haskell_c... And I think this was the post that proposed tagless-final over free-monads: https://markkarpov.com/post/free-monad-considered-harmful.…
Comment linking /post/free-monad-considered-harmful.html
on “OCaml as my primary language”Submitted Lisp and Haskell (2015) as a story · 107 points
HN discussionWell, these are mutable, but only in the ST or IO monad - which is a guarantee, but at the same time it is not quite the same thing. You cannot just accumulate state by mutating some stuff, then in a separate part of the program mutate it again. Which is intentional, of course, but quite opposite to the imperative mindset. About {#- Language Strict #-}, thank you - I was not aware of it. I think the first example in…
Comment linking /post/migrating-text-metrics.html
on “Rust as a gateway drug to Haskell”Submitted Megaparsec Tutorial as a story · 52 points
HN discussionThere was a recent post about "imperative Haskell": http://vaibhavsagar.com/blog/2017/05/29/imperative-haskell/ The code in this other post about implementing string distance metrics is also quite imperative: https://markkarpov.com/post/migrating-text-metrics.html
Comment linking /post/migrating-text-metrics.html
on “Rust as a gateway drug to Haskell”Submitted Category Theory Basics, Part I (2016) as a story · 24 points
HN discussionNot the OC and (mostly) not related to Haskell performance, but the following could be useful to you: State of Haskell Ecosystem: https://github.com/Gabriel439/post-rfc/blob/master/sotu.md#c... Guide to Haskell (2018): https://lexi-lambda.github.io/blog/2018/02/10/an-opinionated... Haskell learner milestones: https://stackoverflow.com/a/1016986 GHC optimizations (rather advanced, but interesting): https://stackoverf…
Comment linking /learn-haskell.html
on “Lessons learned from writing ShellCheck”Submitted Haskell: Smart constructors that cannot fail as a story · 7 points
HN discussionGHC does have special support for fusion and rewriting. See e.g. [1]. The laziness comes with the language, but turning it efficient requires a series of these rewrite rules expressed as GHC-specific metadata. [1] https://markkarpov.com/tutorial/ghc-optimization-and-fusion....
Comment linking /tutorial/ghc-optimization-and-fusion.html
on “A philosophical difference between Haskell and Lisp (2015)”Submitted Haskell GHC Generics Explained as a story · 4 points
HN discussion> like how to use FP to solve expression problem Some common approaches: - Tagless final style: https://okmij.org/ftp/tagless-final/ - Datatype-generic programming: https://markkarpov.com/tutorial/generics.html - Polymorphic records and variants: https://www.cl.cam.ac.uk/teaching/1415/L28/rows.pdf
Comment linking /tutorial/generics.html
on “Why Racket? Why Lisp? (2014)”Submitted Haskell vs. OCaml as a story · 4 points
HN discussionSome people just don't like parentheses. And they hate the Paamayim Nekudotayim (PHP PTSD?) And really like that the compiler helps them (types), so they are left with Scala. https://markkarpov.com/post/lisp-and-haskell.html
Comment linking /post/lisp-and-haskell.html
on “The Last Hope for Scala's Infinity War [video]”Submitted Tilia–A New Formatter for Haskell as a story · 3 points
HN discussionYou are not capable of writing a PhD chapter. You lack the basic scientific thinking or method required. I suggest you focus on your core competency - chuckling. Here is some basic reading material for you. Lets see if you can follow this https://hackage.haskell.org/package/async-2.2.2/docs/Control... do a1 <- async (getURL url1) a2 <- async (getURL url2) page1 <- wait a1 page2 <- wait a2 This implements async await…
Comment linking /tutorial/megaparsec.html
on “Do notation considered harmful”Submitted Haskell vs. OCaml as a story · 3 points
HN discussionThese days megaparsec might be a better way to get started as it has built on Parsec to improve the speed and documentation. https://markkarpov.com/tutorial/megaparsec.html https://hackage.haskell.org/package/megaparsec However it does rely on some GHC extensions, which makes things a bit more complicated for beginners, so for simplicity's sake it might be easier to start with Parsec and one of the old papers that g…
Comment linking /tutorial/megaparsec.html
on “Parsing with Haskell”Submitted Haskell vs. OCaml as a story · 3 points
HN discussionWhat means D < U in your notation? It's like, D is a subset of U? Anyway the problem with trying to make a function total by fiat like with the definition (D, R, f) is that for some functions (even computable functions), its domain may be an uncomputable set. That's because if we could decide if a given x in f(x) makes f return something or not, if f represents the output of a Turing machine we could use that to sol…
Comment linking /post/smart-constructors-that-cannot-fail.html
on “Partial functions and total functions”Submitted Lisp and Haskell (2017) as a story · 3 points
HN discussionWow I didn't realize Haskell beginners would learn to use Trifecta. Megaparsec is much more beginner friendly (and expert-friendly too). It has tutorials that guide you gently through the process of writing a parser. See https://markkarpov.com/megaparsec/parsing-simple-imperative-...
Comment linking /megaparsec/parsing-simple-imperative-language.html
on “Tintin – A soft documentation website generator for Haskell”Submitted Haskell vs. OCaml as a story · 3 points
HN discussionI like the article, but I don't agree with the conclusion. > When profiling, it is important to always run your code over an extended period of time, preferably seconds, in order to smooth out any irregularities that may occur. I agree. Moreover, for very small differences (1%-5%) I prefer that the benchmark is long enough that the difference is at least 200ms, or preferably 1 second. > When running extremely short…
Comment linking /post/migrating-text-metrics.html
on “When competing with C, fudge the benchmark”Submitted Haskell Exceptions Tutorial as a story · 3 points
HN discussionI don't like Exceptions in OCaml (or Haskell or C++ or JS/TS) either. But they aren't unsafe, except for bugs in the compiler/runtime (in OCaml, in C++ there are of course some footguns ;). Of course they add "bottom" to any function where an Exceptions can occur (and other things, see for example https://markkarpov.com/tutorial/Exceptions ) but for stuff like `0/0` there are 3 possibilities: use something like `May…
Comment linking /tutorial/Exceptions
on “OCaml: a Rust developer's first impressions”Submitted Migrating text metrics to pure Haskell as a story · 3 points
HN discussionSubmitted Free monad considered harmful as a story · 1 points
HN discussion