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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
(* Copyright Jeremy Yallop 2007.
This file is free software, distributed under the MIT license.
See the file COPYING for details.
*)
(** Primitive instanecs for bounded **)
module Deriving_Bounded = struct
module type Bounded = sig
type a
val min_bound : a
val max_bound : a
end
module Bounded_integer(B : sig type t
val max_int : t
val min_int : t
end) : Bounded with type a = B.t =
struct
type a = B.t
let min_bound = B.min_int
let max_bound = B.max_int
end
module Bounded_int32 = Bounded_integer(Int32)
module Bounded_int64 = Bounded_integer(Int64)
module Bounded_nativeint = Bounded_integer(Nativeint)
module Bounded_int = struct
type a = int
let min_bound = Pervasives.min_int
let max_bound = Pervasives.max_int
end
module Bounded_bool = struct
type a = bool
let min_bound = false
let max_bound = true
end
module Bounded_char = struct
type a = char
let min_bound = Char.chr 0
let max_bound = Char.chr 0xff (* Is this guaranteed? *)
end
module Bounded_unit = struct
type a = unit
let min_bound = ()
let max_bound = ()
end
end
include Deriving_Bounded
type open_flag = Pervasives.open_flag =
| Open_rdonly
| Open_wronly
| Open_append
| Open_creat
| Open_trunc
| Open_excl
| Open_binary
| Open_text
| Open_nonblock
deriving (Bounded)
type fpclass = Pervasives.fpclass =
| FP_normal
| FP_subnormal
| FP_zero
| FP_infinite
| FP_nan
deriving (Bounded)
|