package dune

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

Source file nothing.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
type t = (int, string) Type_eq.t

(* The purpose of [dummy] is to get the definition of [unreachable_code]
   that OCaml 4.02 would accept without having to write "assert false".

   The problem is that 4.02 doesn't have refutation branches, so we turn the
   "nullary" pattern-match into an equivalent one with one branch. *)
type ('a, 'b, 'c) dummy =
  | No of 'c
  | Eq : ('a, 'a, 'c) dummy

let _f x = No x

let to_dummy : type a b . (a, b) Type_eq.t -> (a, b, 'c) dummy =
  fun Type_eq.T -> Eq

let unreachable_code (t : t) =
  match to_dummy t with
  | No c -> c
OCaml

Innovation. Community. Security.