This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {HKT as _} from "fp-ts/lib/HKT" | |
import {Equal, equal} from "./eq" | |
import {Functor, lift} from "fp-ts/lib/Functor" | |
import {Monad} from "fp-ts/lib/Monad" | |
import {Foldable} from "fp-ts/lib/Foldable" | |
import {constant} from "fp-ts/lib/function" | |
import {Traversable} from "fp-ts/lib/Traversable" | |
import {Applicative} from "fp-ts/lib/Applicative" | |
declare module "fp-ts/lib/HKT" { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as _Maybe from "./maybe" | |
import {maybe} from "./maybe" | |
import {Do} from "./syntax" | |
import Maybe = _Maybe.Maybe | |
type Person = { | |
name: string | |
age: number | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Monad} from "fp-ts/lib/Monad" | |
import {HKT as _, HKTAs as __, HKTS} from "fp-ts/lib/HKT" | |
import { | |
Function1 as F, | |
Function2, | |
Function3, | |
Function4, | |
Function5, | |
Function6, | |
Function7, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Leibniz<A, B> extends __2<Leibniz.µ, A, B> { | |
enum µ {} | |
<f> __<f, B> subst(__<f, A> p); | |
static <T> Leibniz<T, T> refl() { return HktId::id; } | |
default B coerce(A a) { | |
return _Leibniz.asId(subst((Id<A>) () -> a)).__(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cats | |
import cats.data.{StateT, WriterT} | |
import cats.implicits._ | |
/** | |
* TypeLevel is working on some alternative encodings of the Monad Transformer | |
* Library (MTL). The existing solution in cats was broken for a few reasons. | |
* One annoying issue made it imposisible to use for-comprehension with more | |
* than one Monad$FOO constraint owing to implicit resolution ambiguities. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toto | |
tata | |
tutu | |
azerty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class Coproduct<f, g, A> implements __3<Coproduct.µ, f, g, A> { | |
private final Either<__<f, A>, __<g, A>> run; | |
protected Coproduct(Either<__<f, A>, __<g, A>> run) {this.run = run;} | |
public final Either<__<f, A>, __<g, A>> run() { return run; } | |
public static <f, g, A> Coproduct<f, g, A> leftc(__<f, A> x) { return new Coproduct<f, g, A>(Left(x)) {}; } | |
public static <f, g, A> Coproduct<f, g, A> rightc(__<g, A> x) { return new Coproduct<f, g, A>(Right(x)) {}; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Data(flavour = Flavour.FJ) | |
public abstract class Free<f, A> implements __2<Free.µ, f, A> { | |
Free() {} | |
interface Cases<f, A, R> { | |
R Return(A a); | |
R Suspend(__<f, A> fa); | |
R Gosub(Sub<f, A, ?> sub); | |
} | |
abstract <R> R match(Cases<f, A, R> cases); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// given... | |
class Person { | |
final String name; | |
final Integer age; | |
final Date birth; | |
Person(String name, Integer age, Date birth) { | |
this.name = name; | |
this.age = age; | |
this.birth = birth; |