Skip to content

Instantly share code, notes, and snippets.

edmundsmith /
Created Jul 7, 2019
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust


I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type:

ErnWong / VGA Data Pipeline V2.txt
Last active Jan 19, 2018
v86 VGA Implementation
View VGA Data Pipeline V2.txt
Same as V1 except we do complete redraws instead of using the color-use linked list. Simplifies the pipeline and code significantly.
Host Memory Write ________ Host Memory Read
| _|______ | ^
write | _|______ | | | read
logic | _|______ | |_| | logic
`-------->| | |_| ------------`
| Planes |_| ^ PLOT: Calculates 4 bit / 8 bit color data
|________| | from planes and plots them at the correct
256KiB | | pixel address. Full replots are rare, and
View Dockerfile
FROM i386/alpine:latest
RUN apk update && \
apk upgrade && \
apk add --no-cache linux-vanilla vim openrc && \
rc-update add devfs sysinit && \
rc-update add root boot && \
binji /
Last active Apr 18, 2022

Custom sections in the text format

This page describes a proposal for representing custom sections in the text format.


Currently it is impossible to round-trip a WebAssembly module between the binary and text formats without loss of information because there is no way to

Benjamin-Dobell / Diabolical
Last active Aug 29, 2018
Pfft, crashes are for chumps
View Diabolical
static jmp_buf jmpEnv;
enum {
kPrepareBinaryAddress = 0x44dd,
kMutexBinaryAddress = 0x9090
void signal_handler(int n, siginfo_t *info, void *context)
longjmp(jmpEnv, 1);
View cstheory.txt
1.1 Practical Programming - An Introduction to Computer Science Using Python 3
1.2 K&R C
1.3 The C++ Programming Language - Bjarne Stroustrup
1.4 Deitel's Java - How to Program
1.5.1 The Little Schemer
1.5.2 The Reasoned Schemer
1.5.3 The Seasoned Schemer
2.1 Computer Organization and Design - Patterson & Hennessy
3.1 Introduction to Algorithms - Cormen
3.2 Algorithms - Sedgewick
rauchg /
Last active Sep 1, 2022
paragonie-scott /
Last active Oct 2, 2022
An Open Letter to Developers Everywhere (About Cryptography)

@kangax's ES6 quiz, explained

@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).

Here we go with the explanations:

Question 1:
(function(x, f = () => x) {
paulirish /
Last active Oct 2, 2022
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent