Skip to content

Instantly share code, notes, and snippets.

@Janiczek
Janiczek / elm-build-cache.mjs
Last active February 4, 2022 00:39
Build ~/.elm cache manually without checking SHA1 hashes
#!/usr/bin/env node
// the .mjs extension is important
// run this inside the directory containing the `elm.json` file
// (if it's not executable, run `chmod +x elm-build-cache.mjs`)
// with VERBOSE=1 env var it will show you results of the exec commands
import fs from 'fs/promises';
import {exec} from 'child_process';
@supermario
supermario / readme.md
Last active March 21, 2022 15:07
Elm code splitting and the impact of dead-code-elimination

The question of code-splitting in Elm comes up fairly routinely.

The apparent low-hanging-fruit of code-splitting with Elm's pure/immutable philosophy has led me to explore this a few times with my compiler work on Lamdera.

Here are some of the challenges I've found:

The impact of Elm's current live-code-inclusion (LCI?)

It's a little trickier than it looks because Elm's DCE is actually not DCE (dead code elimination) at all, it's LCI (live code inclusion).

@evancz
evancz / data-interchange.md
Last active July 16, 2025 00:25
Why do I have to write JSON decoders in Elm?

A vision for data interchange in Elm

How do you send information between clients and servers? What format should that information be in? What happens when the server changes the format, but the client has not been updated yet? What happens when the server changes the format, but the database cannot be updated?

These are difficult questions. It is not just about picking a format, but rather picking a format that can evolve as your application evolves.

Literature Review

By now there are many approaches to communicating between client and server. These approaches tend to be known within specific companies and language communities, but the techniques do not cross borders. I will outline JSON, ProtoBuf, and GraphQL here so we can learn from them all.

Lightning Talk proposal for ReactiveConf 2017 http://www.reactiveconf.com #ReactiveConf

Porting Prezi to Elm in 99 lines of code

Elm is a statically-typed functional programming language. Its compiler produces safe JavaScript which is guaranteed to be free of runtime exceptions. Moreover Elm is packed with a bunch of powerful abstractions which let us build visual and reactive Web applications in a few lines of code.

As an example, I show the implementation of a simple framework for building Prezi-like presentations. It's just 99 lines of code!

@puffnfresh
puffnfresh / covariant.ts
Created October 1, 2012 17:06
Covariant arrays. Blurgh.
// Compiles fine even though the code is broken.
// This is because arrays are covariant and mutable.
//
// TypeScript team: Please fix either of those things. Preferably mutability :)
class Animal {}
class Snake extends Animal {
slither() {
alert("Slithering!")