Skip to content

Instantly share code, notes, and snippets.

Avatar
🤞

Edward Kmett ekmett

🤞
View GitHub Profile
@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 #-}
View affine-logic-in-constraints.hs
{- cabal:
build-depends: base, constraints
-}
{-# language TypeFamilies, TypeFamilyDependencies, ConstraintKinds, ScopedTypeVariables, NoStarIsType, TypeOperators, TypeApplications, GADTs, AllowAmbiguousTypes, FunctionalDependencies, UndecidableSuperClasses, UndecidableInstances, FlexibleInstances, QuantifiedConstraints, BlockArguments, RankNTypes, FlexibleContexts, StandaloneKindSignatures, DefaultSignatures #-}
-- ⊷, ≕, =∘, =◯ These choices all look like something out of Star Trek, so let's boldly go...
import Data.Constraint hiding (top, bottom, Bottom)
import Data.Kind
import Data.Some
@ekmett
ekmett / Adam7Mandelbrot.hs
Created Feb 6, 2021
Mandelbrot set (incrementally rendered with Adam7 interlacing)
View Adam7Mandelbrot.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TypeFamilies #-}
import Codec.Compression.Zlib
import Control.Lens
import Control.DeepSeq
@ekmett
ekmett / FlatCircularSubstitution.hs
Last active Feb 2, 2021
"flat" circular substitution
View FlatCircularSubstitution.hs
{-# language DeriveTraversable #-}
{-# language BlockArguments #-}
{-# language LambdaCase #-}
{-# language PatternSynonyms #-}
{-# language ViewPatterns #-}
import Control.Monad (ap)
import Control.Monad.ST
import Control.Monad.Fix
import Data.Function (on)
@ekmett
ekmett / IndicesAndLevels.hs
Last active Apr 28, 2021
a pragmatic mix of de bruijn indices and levels
View IndicesAndLevels.hs
{-# language PolyKinds #-}
{-# language BlockArguments #-}
{-# language AllowAmbiguousTypes #-}
{-# language StrictData #-}
{-# language DerivingStrategies #-}
{-# language GeneralizedNewtypeDeriving #-}
{-# language TypeApplications #-}
{-# language BangPatterns #-}
{-# language NPlusKPatterns #-}
{-# language TypeFamilies #-}
@ekmett
ekmett / MonoidallyAnnotatedEphemeralQueue.hs
Last active Oct 31, 2020
windowed scanl -- by request, untested
View MonoidallyAnnotatedEphemeralQueue.hs
-- This is just a reference for how a "proper" monoidally-annotated queue would look.
{-# language PatternSynonyms #-}
{-# language ViewPatterns #-}
{-# language TypeFamilies #-}
{-# language FlexibleContexts #-}
class Monoid (M a) => Measured a where
type M a :: *
measure :: a -> M a
@ekmett
ekmett / GPT3-Diogenes-Debate.md
Last active Feb 12, 2021
Diogenes debates Joe Biden
View GPT3-Diogenes-Debate.md

In the last two weeks before the presidential election of the United States. Former Vice President Joe Biden agreed to debate the Greek scholar Diogenes, rather than his opponent President Donald Trump. Here is a transcript of the debate:

Chris Wallace: Hello, and welcome to tonight's debate. I am the moderator of tonight's debate and your host Chris Wallace. Tonight's format will allow each candidate 2 minutes to answer a wide range of questions of interest to the American people. In the interest of time we shall skip the opening statements. Diogenes has won the coin toss, and will go first.

Chris Wallace: Diogenes, what questions would you like to ask Vice President Joe Biden?

--end prompt--

Diogenes: (in ancient Greek) What do you mean by "what questions?" You are asking me to ask my opponent for an opening statement! This is not fair at all! I have never met him nor spoken with him in any way. He has no right to demand that I answer his questions or even speak to me at all. If he thinks I

@ekmett
ekmett / GPT3-Socrates-Debate.md
Last active Oct 21, 2020
Socrates debates Donald Trump
View GPT3-Socrates-Debate.md

In the last two weeks before the presidential election of the United States. President Donald Trump agreed to debate Socrates, rather than his opponent Joe Biden. Here is a transcript of the debate:

Chris Wallace: Hello, and welcome to tonight's debate. I am the moderator of tonight's debate and your host Chris Wallace. Tonight's format will allow each candidate 2 minutes to answer a wide range of questions of interest to the American people. In the interest of time we shall skip the opening statements. Socrates has won the coin toss, and will go first.

--end prompt--

Chris Wallace: Socrates, what questions would you like to ask President Trump?

Socrates: Well, Mr. Wallace, as I said in my opening statement, I think it's important that we talk about our differences because they are real and not just political rhetoric. But let me also say this. We have a lot more in common than we disagree on. And I want to talk about those things.