module type Marker = sig type t val of_string : string -> t val pp : out_channel -> t -> unit end module Marker = struct type t = Point | Pixel | Circle | TriangleDown | TriangleUp | TriangleLeft | TriangleRight | Custom of string exception Invalid_marker_length let of_string s = if String.length s <> 1 then raise Invalid_marker_length else Custom(s) let pp channel n = (match n with | Point -> "." | Pixel -> "," | Circle -> "o" | TriangleDown -> "v" | TriangleUp -> "^" | TriangleLeft -> ">" | TriangleRight -> "<" | Custom(s) -> s) |> Printf.fprintf channel "%s" end