Skip to content

Instantly share code, notes, and snippets.

View brainrake's full-sized avatar
λ ék .

Márton Boros brainrake

λ ék .
  • Budapest, Hungary
View GitHub Profile
@brainrake
brainrake / Optional.idr
Last active December 2, 2018 08:33
Optional function arguments in Idris
interface Optional a t where
optional : t -> Maybe a
Optional a (Maybe a) where
optional x = x
Optional a a where
optional x = Just x
Optional a () where
@brainrake
brainrake / Overloading.idr
Last active November 30, 2018 16:56
idris type-directed overloading
f : String -> String
f x = x ++ "!"
namespace maybe
f : Maybe String -> String
f (Just x) = x ++ "!"
f Nothing = "_"
test1 : String

Keybase proof

I hereby claim:

  • I am brainrape on github.
  • I am brainrape (https://keybase.io/brainrape) on keybase.
  • I have a public key ASDb9JEd0zAfwt34CvSxt69KoXMFYW3rUeiRII1kXHAK9Ao

To claim this, I am signing this object:

updateNpmDeps = pkgs.writeScriptBin "update-frontend-deps" ''
#!${pkgs.stdenv.shell}
set -e
echo; echo "Pinning node dependencies from ./package.json ..."; echo
${pkgs.nix}/bin/nix-instantiate --strict --json --eval --expr '
(import <nixpkgs> {}).lib.mapAttrsToList
(name : value : { "${"\${name}"}" = value; })
(builtins.fromJSON (builtins.readFile ./package.json)).dependencies
' > node-modules.json
${pkgs.nodePackages.node2nix}/bin/node2nix \
@brainrake
brainrake / install-nix.sh
Last active October 14, 2017 20:28
Install Nix without sudo
#!/bin/sh
# Create the /nix directory, and change its ownership
sudo mkdir -p -m 0755 /nix
sudo chown $USER /nix
# Now install normally. It will not use sudo or ask for password.
curl https://nixos.org/nix/install | sh
# Or download, unpack, and run `./install` manually
@brainrake
brainrake / session.txt
Created June 27, 2017 10:25
structural editor interactive session
<"ul" space>
ul _[]_ []
^ List (Attribute msg)
<space>
ul [] _[]_
^ List (Html msg)
<">">
{pkgs ? import <nixpkgs> {}, ...}:
pkgs.stdenv.mkDerivation {
name = "a-slower-speed-of-light";
src = pkgs.fetchurl {
url = http://web.mit.edu/gambit/summer12/speedoflight/beta/A_Slower_Speed_of_Light.tgz;
sha256 = "095kbvpjwzllm0p0c92100vsk40fdrxp2ak3wvdbmk3vzfvbxb6v";
};
installPhase = with pkgs; ''
@brainrake
brainrake / a.hs
Created January 31, 2017 11:39
head of empty list in haskell
main = print $ show $ head []
@brainrake
brainrake / Machine.elm
Last active January 31, 2017 10:58
simple type-level state machine in elm. invalid tra
module Machine exposing (..)
type DoorState = Opened | Closed
type ClosedDoor = ClosedDoor DoorState
type OpenedDoor = OpenedDoor DoorState