Skip to content

Instantly share code, notes, and snippets.

View puffnfresh's full-sized avatar

Brian McKenna puffnfresh

View GitHub Profile
@debasishg
debasishg / gist:729080
Created December 5, 2010 13:32
ascii artwork for arrows
// joining of 2 arrows
(>>>) :: arr a b -> arr b c -> arr a c
(>>>)
a -- (f) --> b -- (g) --> c
// works on pairs
// f: a -> b
// g: a -> c
@tlrobinson
tlrobinson / LICENSE.txt
Created October 2, 2011 08:56
Extremely simple lexer, parser, compiler, and interpreter for a prefix notation calculator.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Tom Robinson <http://tlrobinson.net/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@paulmillr
paulmillr / active.md
Last active May 15, 2024 02:25
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 1000)
@cassiemeharry
cassiemeharry / lens-types.md
Created August 24, 2012 23:43
Thoughts on Roy Lenses

Lens Types

Looking into the Haskell/JS hybrid Roy, and one of the proposed features are lenses. They are basically sugar over attribute getters and setters, and look like this:

set .x 3 {x: 1, y: 2} == {x: 3, y: 2}
get .name {title: "Mr.", name: "Bob"} == "Bob"

This is much like Python's getattr and setattr, except that these are static (no

@brehaut
brehaut / ref.roy
Created August 29, 2012 01:55
mutable refs in Roy
// the first hack needed to support mutable refs in Roy is allowing in place edits
// to JS arrays
let aSet (arr:[#a]) (idx:Number) (v:#a) :[#a] =
Array.prototype.splice.call arr idx 1 v
arr
// wrapper type is currently a structural type rather than an ADT because I couldn't
// get ADTs to have an Array as a field
type Ref = {_val: [#a]}
(def-alias Monad
(TFn [[m :kind (TFn [[x :variance :covariant]] Any)]]
'{:m-bind (All [x y]
[(m x) [x -> (m y)] -> (m y)])
:m-result (All [x]
[x -> (m x)])
:m-zero Undefined
:m-plus Undefined}))
(ann maybe-m (Monad
@tonymorris
tonymorris / TypeClass.hs
Last active September 15, 2020 13:17
Type-class hierarchy
Moved to https://github.com/tonymorris/type-class
@jonsterling
jonsterling / Coinduction.hs
Created October 13, 2012 22:46
Idea for codata syntax in Haskell
-- Inspired by http://www2.tcs.ifi.lmu.de/~abel/popl13.pdf
[codata|
codata Stream a where
head :: Stream a -> a
tail :: Stream a -> Stream a
|]
fib :: Stream Nat
[copattern|
@copumpkin
copumpkin / Telescope.agda
Last active August 22, 2021 04:12
Telescopes?
module Telescope where
open import Function
open import Data.Unit
open import Data.Product
open import Data.Nat
open import Data.Vec
infixr 6 _∷_
@t0yv0
t0yv0 / subtyping.v
Last active February 28, 2021 01:47
Demonstrating TypeScript 0.8 type system to be unsound. The subtyping relationship is defined in a way that admits the following code that results in TypeError exception being thrown.
Require Import Utf8.
Inductive subtype (a b : Set) : Set :=
| ST : (a -> b) -> subtype a b.
Infix ":>" := subtype (at level 50).
Definition st {x y} f := ST x y f.
Definition unpack {a b : Set} (st : a :> b) :=