Skip to content

Instantly share code, notes, and snippets.

(* service definition
message SeekRequest {
string subscription = 1;
oneof target {
google.protobuf.Timestamp time = 2;
string snapshot = 3;
}
}
message SeekResponse {
}
Fmt.(pf ppf "type %s = {@[<v>@,%a@;<1 -2>@]}" name (list ~sep:(any ";@ ") gen_record_field))
result:
type t = {
bar : BarEnum;
baz : BazMsg;
bum : BazMsg.Data;
foomap : (BarEnum * BazMsg)
}
@droyo
droyo / ast.ml
Created February 19, 2021 03:44
type t = term list
and term =
| Int of int
| Bool of bool
| Float of float
| Id of string
| Str of string
| Expr of t
(* pp_term calls pp *)
// Code generated by xsdgen. DO NOT EDIT.
package ws
// Must be at least 1 items long
type Email string
// Must be at least 1 items long
type ВерсПрог string
// Code generated by xsdgen. DO NOT EDIT.
package ws
import (
"bytes"
"encoding/xml"
)
type Anon1 string
@droyo
droyo / ddex.go
Created November 1, 2020 01:23
output for go-xml issue #123
// Code generated by xsdgen. DO NOT EDIT.
package ws
import (
"bytes"
"encoding/xml"
"time"
)
let decode = Angstrom.(
advance 2 >>= fun () -> (* skip length prefix *)
LE.any_uint16 >>= fun s_type ->
LE.any_int32 >>= fun s_dev ->
Qid.decode >>= fun s_qid ->
LE.any_int32 >>= fun s_mode ->
LE.any_int32 >>= fun s_atime ->
LE.any_int32 >>= fun s_mtime ->
LE.any_int64 >>= fun s_length ->
decode_string >>= fun s_name ->
// Adds, then removes an alias IP from a VM
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"time"
// Adds, then removes an alias IP from a VM
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"time"
# let inc p = let v = !p in incr p; v;;
val inc : int ref -> int = <fun>
# let x = ref 0;;
val x : int ref = {contents = 0}
# type t_read = {tag: int; fid: int; offset: int; count: int};;
type t_read = { tag : int; fid : int; offset : int; count : int }
# let r = {tag=(inc x); fid=(inc x); offset=(inc x); count=(inc x)};;
val r : t_read = {tag = 3; fid = 2; offset = 1; count = 0}
# let x = ref 0;;
val x : int ref = {contents = 0}