Skip to content

Instantly share code, notes, and snippets.

View joelburget's full-sized avatar

Joel Burget joelburget

View GitHub Profile

Sepi's version

Notice how a client operations are all !, then ?, then client.

type mathClient = +{
  max: !integer.!integer.?integer. mathClient,
  isZero: !integer.?boolean. mathClient,
  quit: end
}
import Control.Applicative
import Control.Monad (guard)
import Data.Maybe (isNothing)
-- expansion ideas:
-- * linear
-- * compilation (registers, etc)
-- * toggle HOAS / bidirectional knobs
-- * ABTs
-- * data types!
import Control.Applicative
import Control.Monad (guard)
import Data.Maybe (isNothing)
-- inspiration: https://github.com/AndrasKovacs/tcbe/blob/master/nosubst.md
-- expansion ideas:
-- * linear
-- * compilation (registers, etc)
-- * toggle HOAS / bidirectional knobs
@joelburget
joelburget / this.md
Created January 16, 2016 15:45
discussing this / self

Quick note about self / this:

Since the beginning, the this keyword in JS has been confusing. I recommend getting a good grasp of it, but I want to point out one specific case.

It's common to need access to this in a callback. JavaScript's scoping rules used to make it necessary to capture this explicitly:

var self = this;
(anonymous function) @ VM6003:1
evaluate @ (program):491
InjectedScript._evaluateOn @ VM5670:875
InjectedScript._evaluateAndWrap @ VM5670:808
InjectedScript.evaluateOnCallFrame @ VM5670:933
getData @ backend.js:2590
walkNode @ backend.js:2491
(anonymous function) @ backend.js:2494
walkNode @ backend.js:2493
(anonymous function) @ backend.js:2494

Generators

Let's look at an example:

function* teammate(name) {
  console.log(`Hi! I'm ${name} and I'm your teammate.`)
  const num = yield "I need a number!"
  const num2 = yield "I need another number!"
 console.log("Ok, here's my work.")
@joelburget
joelburget / gist:49f8906471fff1dcab6a
Created June 3, 2015 12:11
coping with changing programs

Setting the Stage

Starting from a dependently typed functional programming environment, I'll make a simplifying but nontrivial assumption - all program development is expressed as a series of changes. For example, if I start from some program f (x : X)(y : Y) = ?, then change the implementation to g (x : X)(y : Y) = ?, that change is known to the environment as "rename f to g", not "munge a character on line 1".

The entire course of program development, from the empty file, is changes like:

  • rename Bike to Bicycle
  • add a parameter to vehicles
  • define a new data type Airplane
@joelburget
joelburget / gist:fdb1ba91ddf9f11fd303
Created February 28, 2015 22:23
nix / gnutar error
joel@dublin react-haskell (master) $ nix-env -i gnutar
installing ‘gnutar-1.27.1’
these derivations will be built:
/nix/store/1n01k44qqqzffi17c5cjw5gb41j2mdaa-hook.drv
/nix/store/khrfnv769klndplrcs0xncsxxamfldq0-perl-5.20.1.drv
/nix/store/23h5p8wix8w1p3fl08p0k4nlscmv8agr-coreutils-8.23.drv
/nix/store/mvjsycfh9g3c2xa8v86f0bh9jpnszfql-mirrors-list.drv
/nix/store/asw4d872wncdfvw3d9sladp3k0x75m4w-openssl-1.0.1l.drv
/nix/store/lhcf41ckdgn37vl76b6pz4g93kw2xyac-zlib-1.2.8.drv
/nix/store/bq7zrs2j4ggmvvmriwjhb4krhm1hv4qg-libssh2-1.4.3.drv

Keybase proof

I hereby claim:

  • I am joelburget on github.
  • I am joelb (https://keybase.io/joelb) on keybase.
  • I have a public key whose fingerprint is D13C 898E FCCD 6148 3204 86B8 19F0 8797 075F 8C88

To claim this, I am signing this object:

var Button = React.createClass({
render: function() {
return this.transferPropsTo(<div style={{ border: "1px solid gray" }} className="button" />);
}
});
<Button style={{ background-color: "blue" }} className="blue-button" />
->