Created
November 18, 2015 22:27
-
-
Save Octachron/6bbfb9a744a908ef2777 to your computer and use it in GitHub Desktop.
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 Natl =struct | |
type z = Nil_z | |
type 'a succ = Nil_succ | |
end | |
open Natl | |
type _ t = | |
| Nil: <f:'a; t:'a; dim:z > t | |
| Cons: | |
'elt * <f:'ty; t:'ret; dim:'d > t -> <f: 'elt -> 'ty; t:'ret; dim:'d succ> t | |
let rec apply : type arg ret d . | |
arg -> < f :arg; t:ret; dim:d> t -> ret = fun f l-> | |
match l with | |
| Nil -> f | |
| Cons (a,Nil) -> f a | |
| Cons(a, ( Cons _ as l ) ) -> apply (f a ) l | |
module Infix = struct | |
let (@@) f l = apply f l | |
let (|>) l f = apply f l | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment