プログラミング言語SML#解説 4.0.0版
27 SML#システムライブラリ

27.8 Dynamic

インタフェイス

structure Dynamic =
  struct
    datatype term =
        ARRAY of ty * boxed
      | ARRAY_PRINT of term array
      | BOOL of bool
      | BOXED of boxed
      | BOUNDVAR
      | BUILTIN
      | CHAR of char
      | CODEPTR of word64
      | DATATYPE of string * term option * ty
      | DYNAMIC of ty * boxed
      | EXN of {exnName: string, hasArg: bool}
      | EXNTAG
      | FUN of {closure: boxed, ty: ty}
      | IENVMAP of (int * term) list
      | INT32 of int
      | INT16 of int16
      | INT64 of int64
      | INT8 of int8
      | INTERNAL
      | INTINF of intInf
      | LIST of term list
      | NULL
      | NULL_WITHTy of ty
      | OPAQUE
      | OPTION of term option * ty
      | PTR of word64
      | REAL64 of real
      | REAL32 of real32
      | RECORDLABEL of RecordLabel.label
      | RECORDLABELMAP of (RecordLabel.label * term) list
      | RECORD of term RecordLabel.Map.map
      | REF of ty * boxed
      | REF_PRINT of term
      | SENVMAP of (string * term) list
      | STRING of string
      | VOID
      | VOID_WITHTy of ty
      | UNIT
      | UNPRINTABLE
      | VECTOR of ty * boxed
      | VECTOR_PRINT of term vector
      | WORD32 of word
      | WORD16 of word16
      | WORD64 of word64
      | WORD8 of word8
    datatype ty =
        ARRAYty of ty
      | BOOLty
      | BOTTOMty
      | BOXEDty
      | BOUNDVARty of BoundTypeVarID.id
      | CHARty
      | CODEPTRty
      | CONSTRUCTty
          of {args: ty list,
              conSet: ty option SEnv.map,
              id: ReifiedTy.typId,
              layout: ReifiedTy.layout,
              longsymbol: {loc: Loc.pos * Loc.pos, string: string} list,
              size: int}
      | DATATYPEty
          of {args: ty list,
              id: ReifiedTy.typId,
              layout: ReifiedTy.layout,
              longsymbol: {loc: Loc.pos * Loc.pos, string: string} list,
              size: int}
      | DUMMYty of {boxed: bool, size: word}
      | DYNAMICty of ty
      | ERRORty
      | EXNTAGty
      | EXNty
      | FUNMty of ty list * ty
      | IENVMAPty of ty
      | INT16ty
      | INT64ty
      | INT8ty
      | INTERNALty
      | INTINFty
      | INT32ty
      | LISTty of ty
      | OPAQUEty
          of {args: ty list,
              id: ReifiedTy.typId,
              longsymbol: {loc: Loc.pos * Loc.pos, string: string} list,
              size: int}
      | OPTIONty of ty
      | POLYty
          of {body: ty,
              boundenv: BoundTypeVarID.id BoundTypeVarID.Map.map}
      | PTRty of ty
      | REAL32ty
      | REAL64ty
      | RECORDLABELty
      | RECORDLABELMAPty of ty
      | RECORDty of ty RecordLabel.Map.map
      | REFty of ty
      | SENVMAPty of ty
      | STRINGty
      | TYVARty
      | UNITty
      | VECTORty of ty
      | VOIDty
      | WORD16ty
      | WORD64ty
      | WORD8ty
      | WORD32ty
    type ’a dyn (= boxed)
    type void (= unit)
    type dynamic = void dyn
    exception RuntimeTypeError
    val dynamic = fn : [’a#reify. ’a -> void dyn]
    val dynamicToString = fn : void dyn -> string
    val dynamicToTerm = fn : void dyn -> term
    val dynamicToTy = fn : void dyn -> ty
    val dynamicToTyString = fn : void dyn -> string
    val format = fn : [’a#reify. ’a -> string]
    val fromJson = fn : string -> void dyn
    val fromJsonFile = fn : string -> void dyn
    val join = fn : void dyn * void dyn -> void dyn
    val pp = fn : [’a#reify. ’a -> unit]
    val termToDynamic = fn : term -> void dyn
    val termToString = fn : term -> string
    val termToTy = fn : term -> ty
    val toJson = fn : [’a. ’a dyn -> string]
    val tyToString = fn : ty -> string
    val valueToJson = fn : [’a#reify. ’a -> string]
    val view = fn : [’a#reify. ’a dyn -> ’a]
    ...
  end