Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /smlnj-lib/trunk/JSON/json-util.sml
ViewVC logotype

Diff of /smlnj-lib/trunk/JSON/json-util.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4326, Wed Apr 12 16:17:30 2017 UTC revision 4327, Wed Apr 12 17:00:43 2017 UTC
# Line 30  Line 30 
30    
31    (* conversion functions for atomic values.  These raise the corresponding    (* conversion functions for atomic values.  These raise the corresponding
32     * "NotXXX" exceptions when their argument has the wrong shape.  Also note     * "NotXXX" exceptions when their argument has the wrong shape.  Also note
33     * that asNumber will accept both integers and floats.     * that asNumber will accept both integers and floats and asInt may raise
34       * Overflow if the number is too large.
35     *)     *)
36      val asBool : JSON.value -> bool      val asBool : JSON.value -> bool
37      val asInt : JSON.value -> IntInf.int      val asInt : JSON.value -> Int.int
38        val asIntInf : JSON.value -> IntInf.int
39      val asNumber : JSON.value -> Real.real      val asNumber : JSON.value -> Real.real
40      val asString : JSON.value -> string      val asString : JSON.value -> string
41    
# Line 75  Line 77 
77      fun asBool (J.BOOL b) = b      fun asBool (J.BOOL b) = b
78        | asBool v = raise NotBool v        | asBool v = raise NotBool v
79    
80      fun asInt (J.INT n) = n      fun asInt (J.INT n) = Int.fromLarge n
81        | asInt v = raise NotInt v        | asInt v = raise NotInt v
82    
83        fun asIntInf (J.INT n) = n
84          | asIntInf v = raise NotInt v
85    
86      fun asNumber (J.INT n) = Real.fromLargeInt n      fun asNumber (J.INT n) = Real.fromLargeInt n
87        | asNumber (J.FLOAT f) = f        | asNumber (J.FLOAT f) = f
88        | asNumber v = raise NotNumber v        | asNumber v = raise NotNumber v

Legend:
Removed from v.4326  
changed lines
  Added in v.4327

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0