package ppx_hardcaml

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

Source file ppx_hardcaml_runtime.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
32
33
open Base

module Array = struct
  include Array

  let for_ length ~f =
    for i = 0 to length - 1 do
      f i
    done
  ;;
end

module Int = Int
module Interface = Hardcaml.Interface
module List = List

let concat = String.concat

let option_map2_exn a b ~f =
  match a, b with
  | None, None -> None
  | Some a, Some b -> Some (f a b)
  | _, _ ->
    raise_s [%message "Option.map2 expects either both to be Some, or both to be None!"]
;;

let option_iter2_exn a b ~f =
  match a, b with
  | None, None -> ()
  | Some a, Some b -> f a b
  | _, _ ->
    raise_s [%message "Option.map2 expects either both to be Some, or both to be None!"]
;;
OCaml

Innovation. Community. Security.