Skip to content

Instantly share code, notes, and snippets.

View ekmett's full-sized avatar
🤞

Edward Kmett ekmett

🤞
View GitHub Profile
@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)
@ekmett
ekmett / NegationByEvaluation.hs
Created April 13, 2021 03:37
negative information flow?
{-# language LambdaCase #-}
{-# language BlockArguments #-}
{-# language DataKinds #-}
{-# language PolyKinds #-}
{-# language LinearTypes #-}
{-# language StandaloneKindSignatures #-}
{-# language TypeOperators #-}
{-# language KindSignatures #-}
{-# language RankNTypes #-}
{-# language EmptyCase #-}
{- 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 February 6, 2021 12:22
Mandelbrot set (incrementally rendered with Adam7 interlacing)
{-# 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 February 2, 2021 08:41
"flat" circular substitution
{-# 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 August 4, 2021 18:27
a pragmatic mix of de bruijn indices and levels
{-# 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 October 31, 2020 14:59
windowed scanl -- by request, untested
-- 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 February 12, 2021 23:23
Diogenes debates Joe Biden

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 October 21, 2020 17:11
Socrates debates Donald Trump

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.