Skip to content

Instantly share code, notes, and snippets.

Edward Kmett ekmett

Block or report user

Report or block ekmett

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ekmett
ekmett / checkpoint.hs
Created Jul 20, 2019
checkpointing with 'ad'
View checkpoint.hs
{-# language RankNTypes #-}
{-# language FlexibleContexts #-}
{-# language ScopedTypeVariables #-}
import Numeric.AD.Internal.Identity
import Numeric.AD.Internal.Reverse
import Numeric.AD.Internal.Or
import Numeric.AD.Mode
import Numeric.AD.Mode.Reverse (grad)
import Data.Reflection (Reifies)
import Data.Foldable (toList)
@ekmett
ekmett / Allen.hs
Last active Mar 13, 2019
Falling sum
View Allen.hs
-- emit o numbers in an arithmetic series stepping by -r such that the sum
-- of the output numbers is n
-- assumes o > 0
allen :: Double -> Double -> Int -> [Double]
allen n r o = take o [base,base-r..] where
z = fromIntegral o
base = n/z + (z-1)*r/2
Examples:
@ekmett
ekmett / Renaming.hs
Created Feb 6, 2019
Towards nominal renaming sets
View Renaming.hs
{-# language DeriveGeneric #-}
{-# language LambdaCase #-}
{-# language DeriveAnyClass #-}
{-# language StrictData #-}
{-# language TypeOperators #-}
{-# language MultiParamTypeClasses #-}
{-# language FlexibleInstances #-}
{-# language UndecidableInstances #-}
---------------------------------------------------------------------------------
@ekmett
ekmett / keybase.md
Created Jan 25, 2019
Keybase authentication
View keybase.md

Keybase proof

I hereby claim:

  • I am ekmett on github.
  • I am kmett (https://keybase.io/kmett) on keybase.
  • I have a public key ASAwD1T0KltJvc10LhqShIfup48UL87zWURZ7q7ugTfrRQo

To claim this, I am signing this object:

@ekmett
ekmett / init.vim
Created Dec 13, 2018
Current vim config
View init.vim
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
set hidden
let g:airline_solarized_bg='dark'
let g:airline_powerline_fonts = 1
let g:airline_theme='luna'
let g:airline_skip_empty_sections = 1
let g:airline_section_a = '' "disable mode
@ekmett
ekmett / Distributive.hs
Created Nov 28, 2018
Work-in-Progress distributive functors a la Aaron Vargo
View Distributive.hs
{-# language PolyKinds #-}
{-# language RankNTypes #-}
{-# language TypeOperators #-}
{-# language DefaultSignatures #-}
{-# language TypeFamilies #-}
{-# language FlexibleContexts #-}
{-# language GeneralizedNewtypeDeriving #-}
{-# language DeriveGeneric #-}
{-# language DeriveTraversable #-}
{-# language DeriveAnyClass #-}
@ekmett
ekmett / Maxel.hs
Created Nov 28, 2018
Never even compiled, but this is how I'd think of Maxels.
View Maxel.hs
module Maxel where
import Control.Monad
import Data.Discrimination.Grouping
import Data.Map as Map
import Data.Tuple (swap)
-- M a b is a generalization of a b-valued multiset and a maxel
-- M (Fin n) b acts as an MSet(n)
-- M (x,y) b acts as a 'traditional' maxel
@ekmett
ekmett / GenericReflection.hs
Created Aug 20, 2018
Generic Reflection (v0)
View GenericReflection.hs
{-# language GADTs #-}
{-# language PolyKinds #-}
{-# language DataKinds #-}
{-# language ConstraintKinds #-}
{-# language KindSignatures #-}
{-# language TypeOperators #-}
{-# language FlexibleInstances #-}
{-# language MultiParamTypeClasses #-}
{-# language TypeApplications #-}
{-# language ScopedTypeVariables #-}
@ekmett
ekmett / CEK.hs
Created Jul 22, 2018
A more strongly typed CEK machine
View CEK.hs
{-# Language StrictData #-}
{-# Language GADTs #-}
{-# Language DeriveTraversable #-}
{-# Language LambdaCase #-}
module CEK where
import Control.Monad (ap)
import Data.Maybe
import Data.Void
@ekmett
ekmett / CEK.hs
Created Jul 22, 2018
Simple CEK Machine
View CEK.hs
{-# language StrictData #-}
module CEK where
-- C -- Control
-- E -- Environment
-- (S) -- Store
-- K -- Continuation
data Exp
= Var String
You can’t perform that action at this time.