Pair.java
package com.acme.math;

import static church.lang.operators.Streams.$$encode;

@SuppressWarnings("unchecked")
public class Pair<T> {
    public final T el1;
    public final T el2;

    public Pair(T el1, T el2) {
        this.el1 = el1;
        this.el2 = el2;
    }

    public static <T> Pair<T> pair(T el1, T el2) {
        return new Pair<>(el1, el2);
    }

    public static <T, U> $$encode<T, Pair<U>> $encode($$encode<T, String> $L0, $$encode<T, U> $L1) {
        return (stream, $0) -> $L0.$encode($L1.$encode($L0.$encode($L1.$encode($L0.$encode(stream, "("), $0.el1), " "), $0.el2), ")");
    }

    public static <T> T first(Pair<T> $0) {
        return $0.el1;
    }

    public static <T> T second(Pair<T> $0) {
        return $0.el2;
    }

}