File: deriving_Typeable.mli

package info (click to toggle)
ocaml-deriving-ocsigen 0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 628 kB
  • ctags: 1,159
  • sloc: ml: 6,334; makefile: 63; sh: 18
file content (51 lines) | stat: -rw-r--r-- 1,648 bytes parent folder | download | duplicates (3)
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
module TypeRep :
sig
  type t
  type delayed = t Lazy.t
  val compare : t -> t -> int
  val eq : t -> t -> bool
  val mkFresh : string -> delayed list -> t
  val mkTuple : delayed list -> t
  val mkPolyv : (string * delayed option) list -> delayed list -> t
end

exception CastFailure of string

type dynamic
val tagOf : dynamic -> TypeRep.t

module type Typeable =
sig
  type a
  val type_rep : TypeRep.t Lazy.t
  val has_type : dynamic -> bool
  val cast : dynamic -> a option
  val throwing_cast : dynamic -> a
  val make_dynamic : a -> dynamic
  val mk : a -> dynamic
end

module Defaults (T : (sig
                        type a
                        val type_rep : TypeRep.t Lazy.t
                      end))
  : Typeable with type a = T.a

module Typeable_list   (A : Typeable) : Typeable with type a = A.a list
module Typeable_option (A : Typeable) : Typeable with type a = A.a option
module Typeable_ref    (A : Typeable) : Typeable with type a = A.a ref

(*module Primitive_typeable (T : sig type t end): Typeable with type a = T.t *)

module Typeable_unit   : Typeable with type a = unit
module Typeable_int    : Typeable with type a = int
module Typeable_float  : Typeable with type a = float
module Typeable_bool   : Typeable with type a = bool
module Typeable_string : Typeable with type a = string
module Typeable_char   : Typeable with type a = char
module Typeable_int32     : Typeable with type a = int32
module Typeable_int64     : Typeable with type a = int64
module Typeable_nativeint : Typeable with type a = nativeint

(**/**)
module Primitive_typeable (T : sig type t val magic : string end) : Typeable with type a = T.t