Skip to content

Instantly share code, notes, and snippets.

@DanielleSucher
Created July 21, 2016 01:59
Show Gist options
  • Save DanielleSucher/3710db84af7e7d0ad71450fd63930671 to your computer and use it in GitHub Desktop.
Save DanielleSucher/3710db84af7e7d0ad71450fd63930671 to your computer and use it in GitHub Desktop.
just some ocamling around with fieldslib
open Core.Std
module A : sig
type t = {
foo : string;
bar : int
} [@@deriving fields]
end = struct
type t = {
foo : string;
bar : int
} [@@deriving fields]
end
let () =
(printf "%s\n" (Field.name A.Fields.foo));
(printf "%s\n" (Field.name A.Fields.bar))
(* which can then be built with `ocamlfind ocamlc -linkpkg -thread -package core -package ppx_deriving -package ppx_fields_conv test.ml -o test.byte` *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment