File: int-inf1.sml

package info (click to toggle)
mlton 20100608-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 34,980 kB
  • ctags: 69,089
  • sloc: ansic: 18,421; lisp: 2,879; makefile: 1,570; sh: 1,325; pascal: 256; asm: 97
file content (78 lines) | stat: -rw-r--r-- 1,916 bytes parent folder | download | duplicates (5)
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
67
68
69
70
71
72
73
74
75
76
77
78
(* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
 *    Jagannathan, and Stephen Weeks.
 * Copyright (C) 1997-2000 NEC Research Institute.
 *
 * MLton is released under a BSD-style license.
 * See the file MLton-LICENSE for details.
 *)

signature INT_INF1 =
   sig
      include INT_INF0

      val fromInt: Int.int -> int
      val fromLarge: LargeInt.int -> int
      val toInt: int -> Int.int
      val toLarge: int -> LargeInt.int
   end

structure Primitive = struct

open Primitive

structure IntInf : INT_INF1 =
   struct
      structure I = Primitive.IntInf

      local
         structure S =
            Int_ChooseInt
            (type 'a t = 'a -> int
             val fInt8 = I.fromInt8
             val fInt16 = I.fromInt16
             val fInt32 = I.fromInt32
             val fInt64 = I.fromInt64
             val fIntInf = I.fromIntInf)
      in
         val fromInt = S.f
      end
      local
         structure S =
            LargeInt_ChooseInt
            (type 'a t = 'a -> int
             val fInt8 = I.fromInt8
             val fInt16 = I.fromInt16
             val fInt32 = I.fromInt32
             val fInt64 = I.fromInt64
             val fIntInf = I.fromIntInf)
      in
         val fromLarge = S.f
      end
      local
         structure S =
            Int_ChooseInt
            (type 'a t = int -> 'a
             val fInt8 = I.toInt8
             val fInt16 = I.toInt16
             val fInt32 = I.toInt32
             val fInt64 = I.toInt64
             val fIntInf = I.toIntInf)
      in
         val toInt = S.f
      end
      local
         structure S =
            LargeInt_ChooseInt
            (type 'a t = int -> 'a
             val fInt8 = I.toInt8
             val fInt16 = I.toInt16
             val fInt32 = I.toInt32
             val fInt64 = I.toInt64
             val fIntInf = I.toIntInf)
      in
         val toLarge = S.f
      end

   end

end