fork download
  1. module Result =
  2. struct
  3. type ('a, 'b) t = Ok of 'a | Error of 'b
  4. end
  5.  
  6. open Result
  7.  
  8. type 'a t = { contents : int list }
  9.  
  10. include
  11. (struct
  12. let no_siblings_of_t t =
  13. match t.contents with
  14. | [_] -> Ok (t : [< `No_siblings | `Has_siblings] t :> [`No_siblings] t)
  15. | _ -> Error `Has_siblings
  16. end : sig
  17. val no_siblings_of_t : [< `No_siblings | `Has_siblings] t -> ([ `No_siblings ] t, [> `Has_siblings ]) Result.t
  18. end)
  19.  
Success #stdin #stdout 0.02s 2736KB
stdin
Standard input is empty
stdout
Standard output is empty