Source

hack-and-slash / update.ml

open Core.Std

type t = string option

let escape_cr =
  unstage (String.Escaping.escape ~escapeworthy:['\n'] ~escape_char:'\\')

let of_string s = Some s

let empty = None

let of_error e =
  Some ("ERROR: " ^ Error.to_string_hum e)

let to_line t =
  Option.map ~f:(fun s -> escape_cr s ^ "\n") t