Skip to content

Instantly share code, notes, and snippets.

View ekmett's full-sized avatar
🤞

Edward Kmett ekmett

🤞
View GitHub Profile
@ekmett
ekmett / ssn_map.html
Created November 15, 2024 01:29
Map of states by SSN starting digits
<!DOCTYPE html>
<html>
<head>
<title>SSN Ranges by State</title>
<style>
#map {
height: 600px;
width: 100%;
}
</style>
@ekmett
ekmett / poetic-edda-kmett.txt
Created December 3, 2022 22:41
ChatGPT tells my tale.
Once upon a time,
In the land of code,
There lived a young programmer,
Named Edward Kmett.
He was skilled in many languages,
And excelled in their use,
But one day he stumbled upon,
The mighty Haskell's muse.
@ekmett
ekmett / lens.rs
Created July 24, 2022 20:26
lenses for rust don't have to be an inference nightmare
#![allow(non_camel_case_types)]
// type-inferrable lenses for rust can exist
// the bokeh of a lens is the stuff that is out of focus.
// this trait describes how given the lens as context, and a bokeh
// you can reassemble the result.
pub trait Bokeh<C,B> {
type T;
@ekmett
ekmett / Cursed.hs
Last active September 23, 2022 16:35
backtracking "effects" with constraint kinds generically
#!/usr/bin/env cabal
{- cabal:
build-depends: base, constraints, ghc-prim
-}
{-# language AllowAmbiguousTypes, ConstrainedClassMethods, ConstraintKinds,
DefaultSignatures, FlexibleInstances, ImplicitParams, RankNTypes,
ScopedTypeVariables, TypeApplications, TypeFamilies, UndecidableSuperClasses #-}
import Control.Applicative
import Control.Concurrent.MVar
aahed
aalii
aargh
aarti
abaca
abaci
aback
abacs
abaft
abaka
aback
abase
abate
abbey
abbot
abhor
abide
abled
abode
abort
@ekmett
ekmett / wordle.hs
Last active January 25, 2022 06:38
rough initial wordle guess calculator
{-# language BlockArguments, TupleSections #-}
import Data.Array
import Data.Foldable
import Data.Char
import Prelude as P
type Pattern = Int
-- each pattern is an equivalence class of words, basically a color pattern.
@ekmett
ekmett / bone-weary.txt
Created January 5, 2022 20:21
An old cooperatively generated short story chapter using GPT-3
You rolled out of bed and stretched your lazy bones and looked over at the clock. You're late to work.
Ever since western civilization figured out that necromancy was an easy path to a cheap labor force that didn't need to be fed, life, or rather unlife, has been going downhill. Fortunately, summoning rituals are too expensive, so the world isn't literally going to hell, yet.
You stumbled over to the bathroom shower, and shut the door. You don't have eyes any more, so there's no real point to turning on the lights. No real point to anything really. It's not like I have any other choice.
"Hey Suzy…" you hear from the bathroom door. "Are you in there?"
You groggily look around the room and look over at the door. There is no one in the bathroom.
@ekmett
ekmett / mihaescu.doc
Created July 28, 2021 06:00
Notes on Catenable Deques - Tarjan & Mihaescu
COS 528 Notes on Catenable Deques
Fall 03 in Pure LISP
HO1
Data structure devised by Radu Mihaesau and Robert Tarjan 8/2003. See also:
H. Kaplan and R.E. Tarjan, “Purely functional, real-time deques with catenation,” J. Assoc. Comput. Mach. 46 (1999), 577-603.
H. Kaplan, C. Okasaki and R.E. Tarjan, “Simple confluently persistent catenable lists,” SIAM J. Comput. 30 (2000), 965-977.
@ekmett
ekmett / ProxyT.hs
Created June 17, 2021 04:51
When functional dependencies don't
{-# Language FlexibleInstances #-}
{-# Language MultiParamTypeClasses #-}
{-# Language FlexibleContexts #-}
{-# Language UndecidableInstances #-}
{-# Language DeriveTraversable #-}
{-# Language NoStarIsType #-}
{-# Language StandaloneKindSignatures #-}
{-# Language RoleAnnotations #-}
-- | Dysfunctional dependencies