I've just started using the with sexp
syntax extension (described here and here) on my custom types. However, I've noticed that when I do, I get the following warning about my type:
Warning 4: this pattern-matching is fragile. It will remain exhaustive when constructors are added to type Sexplib.Type.t.
I'm assuming this is because the sexp converters that are generated by the with sexp
syntax only handle the type constructors defined for Sexp (Sexp.List
and Sexp.Atom
).
I generally try to fix any warnings in my compilation; is there a way to make the compiler happy here (short of having it suppress the warning entirely for all cases)?
EDIT: for markdown formatting.
Update: Providing example code from hit.ml
.
open Core.Std
open Option.Monad_infix
open Battey.Kernel
type hit = (sentence * int) with sexp
Generates this warning:
File "hit.ml", line 6, characters 5-27:
Warning 4: this pattern-matching is fragile.
It will remain exhaustive when constructors are added to type Sexplib.Type.t.
Other info: I'm using version 4.02.3 of ocamlc (as installed via opam
) on a macbook (Yosemite) and am using version 113.00.00 of core
and core_kernel
. I'm also using -w A
for my cflags.
Apologies for the delay in updating; the holidays kept me away from my laptop/internet connection.
Thanks for the feedback!