Skip to content

Instantly share code, notes, and snippets.

View dinosaure's full-sized avatar

Calascibetta Romain dinosaure

View GitHub Profile
@dinosaure
dinosaure / pc.ml
Last active June 21, 2016 13:12
parser combinator and ringbuffer in ocaml
module Buffer = Rb.Bytes
module Make (E : sig type err end) =
struct
type s = Complete | Incomplete
let pp fmt = function
| Complete -> Format.fprintf fmt "Complete"
| Incomplete -> Format.fprintf fmt "Incomplete"
module type BLIT =
sig
type t
val blit : t -> int -> t -> int -> int -> unit
val blit_string : string -> int -> t -> int -> int -> unit
end
open Bigarray
@dinosaure
dinosaure / _tags
Created February 16, 2017 14:52
Zlib in OCaml
true: safe_string, bin_annot, debug
<*/*>: warn(@32@20@25@26@34@33@37@39)
<dpipe.{ml,mli,byte,native}>: use_unix, use_bigarray, linkdep(bs.o), linkdep(adler32.o)
@dinosaure
dinosaure / main.ml
Created October 18, 2017 19:38
Peano, List, Proof
module List =
struct
include List
let empty = []
let cons x r = x :: r
end
type z = Z
type +'a s = S
@dinosaure
dinosaure / main.ml
Created November 15, 2017 09:28
ADT to GADT
module Eq =
struct
type (_, _) refl = Refl : ('a, 'a) refl
let symm
: type m n. (m, n) refl -> (n, m) refl
= fun Refl -> Refl
let trans
: type m n p. (m, n) refl -> (n, p) refl -> (m, p) refl
@dinosaure
dinosaure / main.ml
Created November 19, 2017 06:03
dédi' à pierre
let () = Printexc.record_backtrace true
type ('l, 'r) either =
| L of 'l
| R of 'r
type ('a, 'b) cpl = T of 'a * 'b
module Eq =
struct
(* (c) Romain Calascibetta *)
[@@@warning "-42"]
[@@@warning "-44"]
[@@@warning "-45"]
type ('l, 'r) either =
| L of 'l
| R of 'r
#!/usr/bin/env ocaml
#use "topfind";;
#thread;;
#require "unix";;
#require "git-unix";;
#require "mtime";;
#require "mtime.clock.os";;
#require "fmt.tty";;
module type SA =
sig
type v
type t = { value: v }
end
module type SB =
sig
type v
type vec =
{ off : int option
; len : int option }
type 'a state = 'a Lavoisier.state
type encoder = Lavoisier.encoder
type bigstring = Lavoisier.bigstring
type 'a t =
{ run : 'r. (encoder -> 'r state) -> encoder -> 'a -> 'r state }