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
// CORE API | |
// -------------------------------------------------------------------- | |
/** | |
* Take an Application and paint it into the DOM at a given root node. | |
*/ | |
declare function render(tree: Application, root: Node): void; | |
/** |
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
'use strict'; | |
export interface Tuple<A, B> { | |
fst: A; | |
snd: B; | |
} | |
export module Tuple { | |
export function of<A, B>(a: A, b: B): Tuple<A, B> { | |
return {fst: a, snd: b}; |
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
{-# LANGUAGE DataKinds | |
, TypeFamilies | |
, TypeOperators | |
, GADTs | |
, KindSignatures #-} | |
data Nat = Z | S Nat | |
type family Plus n m :: Nat where | |
Plus Z m = m |
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
open Goji | |
let tracker_package = | |
register_package | |
~version:"1.0.7" | |
~doc:"Simple, push-based reactivity." | |
"tracker" | |
let tracker_component = | |
register_component |
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
module StringLike = struct | |
type t = string | |
let of_string : string -> t = fun s -> String.lowercase s | |
let to_string : t -> string = fun s -> s | |
let compare : t -> t -> int = String.compare | |
end | |
module Tag = struct |
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
module Opt = struct | |
module Core = struct | |
type 'a t = 'a option | |
let pure a = Some a | |
let map f = function | |
| None -> None | |
| Some a -> Some (f 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
module Sum = struct | |
type (+'a, +'b) sum = Inl of 'a | Inr of 'b | |
type (+'a, +'b) t = ('a, 'b) sum | |
let bimap f g = function | |
| Inl a -> Inl (f a) | |
| Inr b -> Inr (g b) | |
let lmap f = bimap f (fun x -> x) | |
let rmap f = bimap (fun x -> x) f |
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
{-# LANGUAGE RankNTypes, LiberalTypeSynonyms, DeriveFunctor, LambdaCase #-} | |
module Pp where | |
import Data.Monoid | |
class Profunctor p where | |
dimap :: (a -> b) -> (s -> t) -> p b s -> p a t | |
class Profunctor p => Strong p where |
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
module type Functor = sig | |
type 'a t | |
val map : ('a -> 'b) -> ('a t -> 'b t) | |
end | |
module Iso = struct | |
type ('a, 'b) t = { fwd : 'a -> 'b; bck : 'b -> 'a } | |
let fwd i = i.fwd | |
let bck i = i.bck |
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
module type Functor = sig | |
type 'a t | |
val map : ('a -> 'b) -> ('a t -> 'b t) | |
end | |
module Mu (F : Functor) : sig | |
type t = { mu : t F.t } | |
val cata : ('a F.t -> 'a) -> (t -> 'a) | |
end = struct |