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 free.ml
let (=>) left right = print_char (if left = right then '.' else 'F')
module Env = struct
include Set.Make (String)
let to_list t = fold List.cons t []
end
View trmc.ml
let rec map f = function
| [] -> []
| x :: xs -> f x :: map f xs
View undo.ml
let hd list = List.nth_opt list 0
let (>>) f g x = g (f x)
let unoption = function
| None -> assert false
| Some a -> a
module Zipper = struct
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 =
You can’t perform that action at this time.