Skip to content

Instantly share code, notes, and snippets.

🐪

Vladimir Keleshev keleshev

Block or report user

Report or block keleshev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View tagless-serialization.ml
open Printf
module type SERIALIZER = sig
type t
val variant_simple : string -> int -> t
val variant_tuple : string -> int -> t list -> t
val variant_record : string -> int -> (string * t) list -> t
val string : string -> t
View static_duck_typing.ml
#! /usr/bin/env ocaml
type some_interface = <
foo : unit -> unit
>
let do_stuff (p : some_interface) =
p#foo ()
View case.ml
#! /usr/bin/env ocaml
(* From http://keleshev.com/point-free-case-analysis *)
open Printf
let id x = x
let const x _ = x
(*
View divide-and-conquer.ml
(* https://www.infoq.com/presentations/Thinking-Parallel-Programming *)
open Printf
let (=>) left right = printf "%c" (if left = right then '.' else 'F')
let print_list list = printf "[%s]" (String.concat "; " list)
let sprint_list list = sprintf "[%s]" (String.concat "; " list)
module Cat = struct
View char_string_slice.ml
open Printf
let (=>) left right = printf "%c" (if left = right then '.' else 'F')
module CharString = struct
type t = Empty | Char of char * t
let rec fold ~empty ~char = function
| Empty -> empty
View blog-topics.md
  • vi mode bash
  • point-free pattern matching
  • ocaml on windows/ubuntu
  • unisofn/free/extensible monads
  • learn to love reason
  • StdLabels, MoreLabels to ease porting to Base
View slit-tulip.ml
(* type 'a succ *)
module Slit = struct
type zero
type 'a succ = X
type (_, _) t =
View cat.ml
open Printf
let (=>) left right = printf "%c" (if left = right then '.' else 'F')
let print_list list = printf "[%s]" (String.concat "; " list)
let sprint_list list = sprintf "[%s]" (String.concat "; " list)
View fold.ml
let (=>) left right = print_char (if left = right then '.' else 'F')
open Printf
let id x = x
let const x = fun _ -> x
let sum = List.fold_left (+) 0
let (>>) f g x = g (f x)
let () =
View fusion.ml
open Printf
module Syntax = struct
type t =
| Unit
| Boolean of bool
| Number of int
| Name of string
| Divide of t * t
You can’t perform that action at this time.