package streamable

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file sexp_clause.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
open! Base
open! Import

let maybe_match type_ (_ : Ctx.t) =
  let%bind core_type = Type_.match_core_type type_ in
  let%map module_ =
    match core_type.ptyp_desc with
    | Ptyp_constr (longident_loc, []) ->
      (match
         Helpers.longident_is_like_t
           longident_loc.txt
           ~primitive_name:None
           ~first_module_name:"Sexp"
       with
       | false -> None
       | true -> Helpers.if_module_dot_t_then_module core_type)
    | _ -> None
  in
  ({ children = []
   ; apply_functor =
       (fun ctx (_ : module_expr list) ->
         Helpers.apply_streamable_dot
           (* NOTE: There is no [Of_sexpable_rpc] since, by definition, there must be
               both [of_sexp] and [sexp_of]. As a result, explicitly ask for the functor
               without the "_rpc" suffix. *)
           { ctx with rpc = false }
           ~functor_name:[%string "Of_sexpable"]
           ~arguments:[ pmod_ident ~loc:ctx.loc module_ ])
   }
    : Clause.Match.t)
;;
OCaml

Innovation. Community. Security.