Skip to content

Instantly share code, notes, and snippets.

Andy Morris andy-morris

Block or report user

Report or block andy-morris

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
View code.rs
#[derive(Clone, Copy)]
struct Op(fn(u16, u16));
// lets you call foo() instead of foo.0() (where foo: Op)
impl std::ops::Deref for Op {
type Target = fn(u16, u16);
fn deref(&self) -> &fn(u16, u16) { &self.0 }
}
fn op_mov(one: u16, two: u16) {
View HSubst.idr
module HSubst
%default total
infixr 0 >>>
data Ty = O | (>>>) Ty Ty
%name Ty a, b, c
namespace Ctx
data Ctx = Nil | (::) Ty Ctx
View gist:4157b6513555415e3127
ident = tok.ident[&make_id];
id_expr = ident[&make_id_expr];
int_expr = tok.int_[&make_int_expr];
paren_expr %= '(' > expr > ')';
atomic_expr %= id_expr | paren_expr;
lam_expr = ("fn" > ident > "=>" > expr)[&make_lam_expr];
app_expr = (+atomic_expr)[&make_app_expr];
View keybase.md

Keybase proof

I hereby claim:

  • I am andy-morris on github.
  • I am anders_ (https://keybase.io/anders_) on keybase.
  • I have a public key whose fingerprint is F959 A1BE B2A4 90FB 717B 3A16 6F5E 66A3 C97A 20A9

To claim this, I am signing this object:

View blah.hs
import Graphics.Gloss
import Graphics.Gloss.Interface.Pure.Game
main = play w white 60 st0 draw ev advance
w = InWindow "a boring game." (640,480) (30,30)
data State = State {s, x, y, ds, dx, dy :: Float}
st0 = State 10 30 30 0 0 0
@andy-morris
andy-morris / cabal-stow.zsh
Created Mar 5, 2013
Cabal + stow = magic
View cabal-stow.zsh
#!/usr/bin/env zsh
cd $STOW_DIR
if [[ -a $1 ]]; then
echo "$1 already exists in stowland!"
exit 1
fi
mkdir $1
cd $1
@andy-morris
andy-morris / Data.Record.TL.hs
Created Sep 14, 2012
GHC’s DataKinds pretty printing leaves a bit to be desired
View Data.Record.TL.hs
-- WIP
{-# LANGUAGE DataKinds, GADTs, KindSignatures, TemplateHaskell,
ScopedTypeVariables, FlexibleContexts, FlexibleInstances,
UndecidableInstances, QuasiQuotes, RecordWildCards,
TypeOperators #-}
module Data.Record.TL (
type Label(..), l, label, labels,
type Record(..), type (:=), type Field(..), (&),
@andy-morris
andy-morris / gist:3338546
Created Aug 13, 2012
luite’s hackage mirror
View gist:3338546
remote-repo: hdiff.luite.com:http://hdiff.luite.com/packages/archive
@andy-morris
andy-morris / haskellmode-cabal-dev-ghc.zsh
Created Jun 22, 2012
Wrapper for ghc with haskellmode & cabal-dev
View haskellmode-cabal-dev-ghc.zsh
#!/usr/local/bin/zsh
if [[ -d ./cabal-dev ]]; then
ignoreflags=('-O.*' --make -debug -threaded -ticky '.*\.hs' -prof)
ignorere="/^(${(j'|')ignoreflags})\$/"
argflags=(-package-name -package-conf -odir -hidir -stubdir -package-id)
argre="/^(${(j'|')argflags})\$/"
output=`cabal-dev buildopts` || exit 1
@andy-morris
andy-morris / Foo.java
Created Dec 7, 2011
TIL java can break from arbitrary named blocks
View Foo.java
class Foo {
static void println(String s) { System.out.println(s); }
public static void main(String args[]) {
println("A");
foo: {
println("B");
if (true) break foo;
println("C");
}
You can’t perform that action at this time.