I hereby claim:
- I am markus1189 on github.
- I am markus1189 (https://keybase.io/markus1189) on keybase.
- I have a public key ASBPUi8X0YfGs5fiDuxchE5N7am75W2C1qrb0U6lu-mUFgo
To claim this, I am signing this object:
{ pkgs ? import <nixpkgs> {} }: with pkgs; | |
stdenv.mkDerivation rec { | |
name = "zoom-${version}"; | |
version = "2.0.115900.1201"; | |
src = fetchurl { | |
url = "https://zoom.us/client/${version}/zoom_x86_64.tar.xz"; | |
sha256 = "1ssd1mdmbxdf5b2drv23ag8hznlj29b1qaldsn3gpn94mzvh6nrl"; | |
}; |
I hereby claim:
To claim this, I am signing this object:
#! /usr/bin/env nix-shell | |
#! nix-shell -i 'runhaskell --ghc-arg=-threaded' | |
#! nix-shell -p 'ghc.withPackages (p: with p; [ turtle text hnix ])' | |
#! nix-shell -p coursier nix | |
#! nix-shell --pure | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TupleSections #-} | |
import qualified Control.Foldl as Foldl |
trait Monoid[A] { | |
def zero: A | |
def op(lhs: A, rhs: A): A | |
} | |
def listMonoid[A]: Monoid[List[A]] = new Monoid[List[A]] { | |
override def zero: List[A] = List() | |
override def op(lhs: List[A], rhs: List[A]): List[A] = |
// for ammonite | |
// import $ivy.`com.chuusai::shapeless:2.3.2` | |
import shapeless._ | |
import shapeless.labelled._ | |
import shapeless.ops.hlist._ | |
import shapeless.ops.record._ | |
case class IceCream(flavour: String, price: Int) |
# Nix file for DoorKickers | |
# | |
# - make sure 'DoorKickers.tar.gz' is in the same dir | |
# - run: | |
# $ nix-build -E 'with import <nixpkgs> { }; callPackage_i686 ./default.nix { }' | |
{lib, openal, glibc, libGL, libX11, libogg, xorg, makeWrapper, stdenv }: | |
stdenv.mkDerivation { | |
name = "DoorKickers"; | |
src = ./DoorKickers.tar.gz; |
{ pkgs ? import <nixpkgs> {}}: | |
with pkgs; | |
let | |
writePureScriptBin = { name, deps ? [], interp ? stdenv.shell }: text: | |
writeScriptBin name '' | |
#!${interp} | |
export PATH=${lib.makeBinPath deps} |
// source: https://gist.github.com/markus1189/760d1078b462c282ab44 | |
/* Example of using phantom types to make a type safe builder. | |
* A House requires: | |
* - a roof which can be either flat or normal | |
* - a base, after one set this can never be removed again and neither added again | |
* - side walls, can be removed/added if (not) present | |
* - a door, can be removed/added if (not) present | |
* | |
* the `build` method can only be called if the builder is in a valid | |
* state and will create the correct result type, e.g. a flat house or |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DataKinds #-} | |
module LightSwitch where | |
data Power = On | Off | |
type family Toggle (a :: Power) where | |
Toggle On = Off | |
Toggle Off = On |
sealed abstract class Power | |
final abstract class On extends Power | |
final abstract class Off extends Power | |
class LightSwitch[State <: Power] private { | |
def on(implicit ev: State =:= Off) = LightSwitch.on | |
def off(implicit ev: State =:= On) = LightSwitch.off | |
def toggleP[S<:Power](implicit t: ToggleP[State,S]): LightSwitch[S] = new LightSwitch[S] | |
def toggleM[S<:Power](implicit t: ToggleM.Aux[State,S]): LightSwitch[S] = | |
new LightSwitch[S] |