Skip to content

Instantly share code, notes, and snippets.

Avatar
🤞

Edward Kmett ekmett

🤞
View GitHub Profile
@ekmett
ekmett / lens.rs
Created Jul 24, 2022
lenses for rust don't have to be an inference nightmare
View lens.rs
#![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 Sep 23, 2022
backtracking "effects" with constraint kinds generically
View Cursed.hs
#!/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
View guesses.txt
aahed
aalii
aargh
aarti
abaca
abaci
aback
abacs
abaft
abaka
View actuals.txt
aback
abase
abate
abbey
abbot
abhor
abide
abled
abode
abort
@ekmett
ekmett / wordle.hs
Last active Jan 25, 2022
rough initial wordle guess calculator
View wordle.hs
{-# 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 Jan 5, 2022
An old cooperatively generated short story chapter using GPT-3
View bone-weary.txt
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 Jul 28, 2021
Notes on Catenable Deques - Tarjan & Mihaescu
View mihaescu.doc
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 Jun 17, 2021
When functional dependencies don't
View ProxyT.hs
{-# 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
the topic mentioned that were were active on irc.libera.chat but that we were planning on keeping the lights on on freenode
View haskell.log
•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)
@ekmett
ekmett / NegationByEvaluation.hs
Created Apr 13, 2021
negative information flow?
View NegationByEvaluation.hs
{-# language LambdaCase #-}
{-# language BlockArguments #-}
{-# language DataKinds #-}
{-# language PolyKinds #-}
{-# language LinearTypes #-}
{-# language StandaloneKindSignatures #-}
{-# language TypeOperators #-}
{-# language KindSignatures #-}
{-# language RankNTypes #-}
{-# language EmptyCase #-}