File: inline.ml

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 (35 lines) | stat: -rw-r--r-- 770 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
let _ = 
  Eq.eq<bool> true false


let _ =
  Show.show<(bool * string) list option> 
    (Some ([true, "yes";
            false, "no"]))

let _ =
  [Typeable.mk<int> 3;
   Typeable.mk<float> 3.0;
   Typeable.mk<int list> [1;2;3]]

type 'a seq = [`Nil | `Cons of 'a * 'a seq]
    deriving (Typeable)
    
type nil = [`Nil] 
    deriving (Typeable)
type intlist = ([nil| `Cons of int * 'a ] as 'a)
    deriving (Typeable)
    
let t1 = Lazy.force (Typeable.type_rep<intlist>)
let t2 = Lazy.force (Typeable.type_rep<int seq>)
let _ = Deriving_Typeable.TypeRep.eq t1 t2

let _ = 
  Typeable.throwing_cast<int seq> 
    (Typeable.mk<intlist> (`Cons (1, `Cons (2, `Cons (3, `Nil)))))

let _ =
    Eq.eq<bool> true (Eq.eq<int> 3 4)

let _ =
  print_endline "Tests succeeded!"