View collapse.hs
data Tree a = Empty | Node a (Tree a) (Tree a)
deriving Show
type IntTree = Tree Int
collapse :: IntTree -> [Int]
collapse t =
case t of
Empty -> [-1]
Node a Empty r -> a : -1 : collapse r
View gist:cf74893716af6125ccb2112bed7608a6
data Tree a = Empty | Node a (Tree a) (Tree a)
deriving Show
type IntTree = Tree Int
collapse :: IntTree -> [Int]
collapse t =
case t of
Empty -> [-1]
Node a Empty r -> a : -1 : collapse r
#!/usr/bin/env python
import sys
import argparse
parser = argparse.ArgumentParser()
args = parser.parse_args()
View Term.kt
sealed class Term
data class Num(val n: Int) : Term()
data class Var(val name: String) : Term()
data class Mul(val l: Term, val r: Term) : Term()
data class Add(val l: Term, val r: Term) : Term()
fun simplify(term: Term): Term =
when (term) {
Mul(Num(0), x) -> Num(0),
Mul(Num(1), x) -> x,
View gist:ff8162eef03d9250f3779c03f071f4ea
Verifying my Blockstack ID is secured with the address 18Uquf8bAjtNmV3DeTccAWpZZrVzG6Ba6E
View litho.diff
commit 9957e3b5fae1cd14a7173811253dc11769729869
Author: Pascal Hartig <>
Date: Wed Oct 25 10:00:42 2017 +0100
Remove now redundant @JvmStatic
diff --git a/sample-kotlin/src/main/java/com/fblitho/lithoktsample/lithography/components/FavouriteButtonSpec.kt b/sample-kotlin/src/main/java/com/fblitho/lithoktsample/lithography/components/FavouriteButtonSpec.kt
index 7a1178d20..9822060da 100755
--- a/sample-kotlin/src/main/java/com/fblitho/lithoktsample/lithography/components/FavouriteButtonSpec.kt
+++ b/sample-kotlin/src/main/java/com/fblitho/lithoktsample/lithography/components/FavouriteButtonSpec.kt

I had a fun refactoring example in Haskell today I wanted to share. So, I've got a structure with a nested Maybe inside, which looked like this:

Maybe (Vector.Vector (Maybe (Direction, [Departure])))

I wanted to get that second-level Maybe folded into the first as it didn't provide any semantic meaning. So I start by writing the type definition:

public class TestClass {
public static void main(String... args) {
new Inner();
// Private class, package-level constructor.
private static class Inner {
Inner() {
System.out.println("Hello, world.");
View sling.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@id/root_view" android:layout_width="fill_parent" android:layout_height="fill_parent"
<com.facebook.slingshot.mypeople.PeopleView android:id="@id/people_shots_view" android:background="@color/black" android:visibility="visible" android:layout_width="fill_parent" android:layout_height="fill_parent" />
< android:id="@id/camera_shots_view" android:layout_width="fill_parent" android:layout_height="fill_parent" />
<com.facebook.slingshot.preview.PreviewShotsView android:id="@id/preview_shots_view" android:layout_width="fill_parent" android:layout_height="fill_parent" />
<com.facebook.slingshot.viewer.ViewerShotsView android:id="@id/viewer_shots_view" android:layout_width="fill_parent" android:layout_height="fill_parent" />
<com.facebook.slingshot.preview.PreviewShotsView android:id="@id/reaction_preview_shots_view" android:lay
View Core.hs
type CoreExpr = Expr Var
data Expr b -- "b" for the type of binders,
= Var Id
| Lit Literal
| App (Expr b) (Arg b)
| Lam b (Expr b)
| Let (Bind b) (Expr b)
| Case (Expr b) b Type [Alt b]
| Cast (Expr b) Coercion