Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    G

    Gergő Érdi

    gergo.erdi.hu · Personal blog · on HN since 2011

    Gergő Érdi writes about Haskell, type systems, retro hardware, FPGAs, and compiling to unusual targets like the 6502.

    Visit blogRSSHN submissions
    Languages & CompilersRetro ComputingHardware & Electronics
    What HN says

    Commenters link his posts on free applicatives and Rust on the 6502, and his Clash book on building retro chips in Haskell.

    Stats for nerds
    22HN people shared it
    17linked in comments
    398story points
    May 2024last shared
    2012people per year2024

    Top posts on HN

    1. 1
      Rust on the MOS 6502: Beyond Fibonacci
      2 people · 165 points · first shared 2021 · 39 comments on HN
    2. 2
      Write Yourself a Haskell in Lisp
      1 person · 129 points · first shared 2013 · 13 comments on HN
    3. 3
      A Brainfuck CPU in FPGA
      1 person · 61 points · first shared 2013 · 16 comments on HN
    4. 4
      MetaFun: Compile Haskell-like code to C++ template metaprograms
      8 people · 11 points · first shared 2014 · Discussion on HN
    5. 5
      Developing iPhone applications in Haskell
      2 people · 10 points · first shared 2011 · Discussion on HN
    6. 6
      Compiling Brainfuck to the MMU Turing tarpit via a MOVDBZ machine
      2 people · 6 points · first shared 2013 · 1 comments on HN
    7. 7
      Rust on AVR: Beyond Blinking
      1 person · 3 points · first shared 2017 · Discussion on HN
    8. 8
      Cheap and Cheerful Microcode Compression
      1 person · 3 points · first shared 2022 · Discussion on HN
    9. 9
      Building an FPGA computer with Haskell using Lava
      1 person · 3 points · first shared 2014 · Discussion on HN
    10. 10
      A small benchmark for functional languages targeting web browsers
      1 person · 3 points · first shared 2022 · 1 comments on HN

    What HN people wrote when they linked it

    • gergoerdiAug 2017

      One drawback of the Hindley-Milner type system is that its typecheckers are necessarily non-compositional. The basic idea here is that this can result in "non-symmetrical" error messages[1]: given something like

      MkPair :: a -> b -> Pair a b
      not :: Bool -> Bool
      succ :: Int -> Int

      foo x = MkPair (succ x) (not x)

      the error message will either complain that `x` has type `Bool` but it should be `Int`, or it will complain that `x` has type `Int` but it should be `Bool` -- depending on what implementation you use! For example, in Haskell, Hugs 98 will emit the first error message, but GHC 7.10 will emit the second (see the full example in my slides[2]). And in some sense, neither is right (and certainly neither is as helpful for the programmer as it could be).

      So next time you're implementing vanilla HM, maybe consider a compositional type system[3] instead, which can give the following, much more informative error message:

      Cannot unify 'Int' with 'Bool' when unifying 'x':
      Cannot unify 'Int' with 'Bool' in the following context:

      MkPair (succ x) (not x)

      Bool -> Pair Int Bool Bool
      x :: Int Bool

      I have a simple implementation here[4], and am about to release a new version which works on `haskell-src-ext`'s AST to support more of Haskell 98 syntax (but still for vanilla HM only).

      [1] https://gergo.erdi.hu/blog/2010-10-23-the_case_for_compositional_type_checking/
      [2]…

    • mietekMay 2017

      Your sketch of a proof does not appear substantially different from the proof given in section 3.1 of the linked paper. Section 3.2 explains that this result does not apply to strongly normalising languages.

      See also the slides titled “So what about, e.g. Fω instead of ℕ ⇒ ℕ?” in Gergo Erdi’s talk on the subject of the linked paper:

      https://gergo.erdi.hu/talks/2015-11-fomega/FOmegaUnquote.pdf

      Note that your sketch is one particular variation of a folklore argument, best recalled by Conor McBride in 2003:

      https://mail.haskell.org/pipermail/haskell-cafe/2003-May/004343.html

      Here’s what Conor McBride has to say on the subject in 2015:

      https://www.reddit.com/r/haskell/comments/38wels/conor_mcbride_hasochistic_containers/cs11ppm/?context=3

      If you are interested in discussing this further, please feel free to contact me privately.

    • ladyanita22May 2024

      There's also this https://gergo.erdi.hu/blog/2021-09-18-rust_on_the_mos_6502__beyond_fibonacci/ for rust on the 6502.

      I wonder how's the performance vs. C (for both, C# and Rust).

      Edit: It's my understanding that the 6502 is extremely stack-limited, so a well-versed assembler would use the stack very little and allocate mostly on the heap. In C, you can replicate this with global variables, and I believe (and I would be very happy if someone related to the 6502 rust port could chime in here) on Rust you can do the same with `static mut` on Rust 2021 and `Unsafecell` on Rust 2024.

    • pbsdFeb 2015

      I have seen more than one such compiler, usually from Haskell-like dialects to C++ metafunctions (e.g., http://gergo.erdi.hu/projects/metafun/).

      In this case the metaprogramming seems unnecessary---even assuming that it makes any sense to run a snake game at compile time---since C++14's relaxed `constexpr` functions are a much more readable way to achieve the same thing. Metaprogramming is only required now when types need to be computed; most of everything else is more cleanly done with `constexpr`.

    • eruOct 2014

      > Maybe it's just me, but I've never found most functional code I've seen to be particularly declarative. I certainly like purity and immutability, but much of it still reads imperatively to me, just in a slightly more abstract style.

      How much have you seen? If you can understand Haskell, the ideas in http://gergo.erdi.hu/blog/2012-12-01-static_analysis_with_applicatives/ are pretty neat and directly exploit declarations.

    • cfallinFeb 2016

      Yup, it's definitely its own language! It made me so happy when I saw a Haskell-to-C++-template compiler [1] because of all the similarities in pure-FP style (pattern matching, iteration via recursion, etc).

      [1] https://gergo.erdi.hu/projects/metafun/

    Related

    Well-Typed Blogwell-typed.com60 people

    Falsify: Hypothesis-Inspired Shrinking for Haskell (2023)

    Well-Typed Blog
    Company · last shared 2026
    FP Complete Blogfpcomplete.com201 people

    Monads and GATs in Nightly Rust

    FP Complete Blog
    Company · last shared 2025
    A Neighborhood of Infinityblog.sigfpe.com185 people

    Why is nuclear fusion so hard?

    A Neighborhood of Infinity
    Personal · last shared 2026
    Manuel Chakravartycse.unsw.edu.au/~chak21 people

    Program Your GPU with Haskell

    Manuel Chakravarty
    Personal · last shared 2017
    Bryan O'Sullivanserpentine.com49 people

    Github is making me feel stupid(er)

    Bryan O'Sullivan
    Personal · last shared 2021
    Debasish Ghoshdebasishg.blogspot.com42 people

    Does category theory make you a better programmer?

    Debasish Ghosh
    Personal · last shared 2022
    Joachim Breitnerjoachim-breitner.de42 people

    Finding bugs in Haskell code by proving it

    Joachim Breitner
    Personal · last shared 2025
    Simon Marlowcommunity.haskell.org/~simonmar17 people

    Parallel and concurrent Haskell, Marlow [[PDF slide deck]]

    Simon Marlow
    Personal · last shared 2017