Return type polymorphism in Haskell
In this brief post I want to discuss a fairly unusual feature of Haskell - functions that can be parameterized by their return type.
One of the most wonderful aspects of math is how deep we can get by studying seemingly trivial questions. Consider the roots of unity, where "unity" simply means the number 1.
Visit eli.thegreenplace.net → RSS feedOn Hacker News Apr 2008 – Oct 2026
Software Engineering 51Programming Languages 23Systems & Performance 17Math & Algorithms 9Web & Frontend 3Life, Learning & Writing 3
In this brief post I want to discuss a fairly unusual feature of Haskell - functions that can be parameterized by their return type.
This post is a basic introduction to running HTTPS servers and clients in Go using TLS. It assumes some familiarity with public-key crypto. Feel free to check out my earlier posts about RSA and the Diffie-Hellman Key Exchange ; TLS uses the elliptic-curve version of Diffie-Hellman. I won't be covering how the protocol…
The futex (short for "Fast userspace mutex") mechanism was proposed by Linux contributors from IBM in 2002 [1] ; it was integrated into the kernel in late 2003. The main idea is to enable a more efficient way for userspace code to synchronize multiple threads, with minimal kernel involvement.
How is tail recursion different from regular recursion? What do continuations have to do with this, what is CPS, and how do trampolines help? This article provides an introduction, with code samples in Python and Clojure.
Longer answer: it depends on what you mean by "equivalent". Pointer arithmetic and array indexing are equivalent. In other aspects, pointers and arrays are different.
I'm happy to announce the general availability of watgo - the W eb A ssembly T oolkit for G o. This project is similar to wabt (C++) or wasm-tools (Rust), but in pure, zero-dependency Go.
[The Python version described in this article is 3.x, more specifically - the 3.3 alpha release of CPython.]
It's been a while since I've last rewritten my favorite lexical analyzer :-) That post is the last in a series implementing a lexer for the TableGen language in a variety of programming languages, using multiple techniques. The last lexer written, in Go, was very fast indeed - processing 1 MiB of source in about 20…
Machine learning models are rapidly becoming more capable; how can we make use of these powerful new tools in our Go applications?
The craft of programming is almost universally concerned with different types of data and operations/algorithms that act on this data [1] . Therefore, it's hardly surprising that designing abstractions for data types and operations has been on the mind of software engineers and programming-language designers since…
This is a post about multiplying polynomials, convolution sums and the connection between them.
I've noticed more than once that some programmers are confused about the direction in which the stack grows on x86, and what "top of the stack" and "bottom of the stack" mean. It appears that this confusion is caused by a basic mismatch in the way people are used to thinking about stacks, and in the way the stack on…
This is Part 3 in a series of posts describing the Raft distributed consensus algorithm and its complete implementation in Go. Here is a list of posts in the series:
This is Part 2 in a series of posts describing the Raft distributed consensus algorithm and its complete implementation in Go. Here is a list of posts in the series:
The terms lvalue and rvalue are not something one runs into often in C/C++ programming, but when one does, it's usually not immediately clear what they mean. The most common place to run into these terms are in compiler error & warning messages. For example, compiling the following with gcc :
This article is an attempt to better understand how the front-end of Python works. Just reading documentation and source code may be a bit boring, so I'm taking a hands-on approach here: I'm going to add an until statement to Python.
I've completed the SICP reading project, which I began on June 19th, 2007 . In hindsight, it seems like a very long time (almost a year!), during which this was my main hacking project at home. So, in this conclusion I want to examine my progress, and compare the result with my initial goals.
In this post I want to explore the costs of threads on modern Linux machines, both in terms of time and space. The background context is designing high-load concurrent servers, where using threads is one of the common schemes .
I've written previously about the problem recursive descent parsers have with expressions, especially when the language has multiple levels of operator precedence.
Context free grammars (CFGs) are a valuable theoretical tool on which the modern compilation theory relies for parsing the code of programming languages. For example, the most popular tool used for parsing – YACC , generates parsers for CFGs. What most people don’t know 1 is that the vast majority of programming…
Recently, while idly browsing through the source code of Python, I came upon an interesting comment in the bytecode VM implementation ( Python/ceval.c ) about using the computed gotos extension of GCC [1] . Driven by curiosity, I decided to code a simple example to evaluate the difference between using a computed goto…