Skip to content

Instantly share code, notes, and snippets.

View ekmett's full-sized avatar
🤞

Edward Kmett ekmett

🤞
View GitHub Profile
@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
@ekmett
ekmett / haskell.log
Created May 26, 2021 03:49
the topic mentioned that were were active on irc.libera.chat but that we were planning on keeping the lights on on freenode
•freenodecom set the topic: This channel has moved to ##haskell. The topic is in violation of freenode policy: https://freenode.net/policies
8:02:53 PM <•freenodecom> This channel has been reopened with respect to the communities and new users. The topic is in violation of freenode policy: https://freenode.net/policies
8:02:53 PM •freenodecom was opped (+o) by OperServ
8:02:53 PM ChanServ un-banned *!*@141.98.255.* (-b)
8:02:53 PM ChanServ un-banned *!467ca176@gateway/web/cgi-irc/kiwiirc.com/ip.70.124.161.118 (-b)
8:02:53 PM ChanServ un-banned Monica*!*@* (-b)
8:02:53 PM ChanServ un-banned glgirl2!*@* (-b)
8:02:53 PM Channel mode set to +c by ChanServ
8:02:53 PM ChanServ un-banned *!*@*/web/cgi-irc/kiwiirc.com/ip.51.158.166.131 (-b)
8:02:53 PM ChanServ un-banned $a:solvr (-b)