package smtml
Module Smtml.ValueSource
Concrete Values Module. This module defines types and utilities for working with concrete values, including integers, floats, strings, lists, and applications. It provides functions for type checking, comparison, mapping, and conversion to/from strings and JSON.
Value Types
type t = | True(*Boolean true.
*)| False(*Boolean false.
*)| Unit(*Unit value.
*)| Int of int(*Integer value.
*)| Real of float(*Real number value.
*)| Str of string(*String value.
*)| Num of Num.t(*Numeric value.
*)| Bitv of Bitvector.t(*Bitvector value.
*)| List of t list(*List of values.
*)| App : [> `Op of string ] * t list -> t(*Application of an operator to a list of values.
*)| Nothing(*Represents an undefined or missing value.
*)
The type t represents concrete values.
Comparison
compare v1 v2 provides a total ordering over values of type t. It returns a negative integer if v1 is less than v2, zero if they are equal, and a positive integer if v1 is greater than v2.
Mapping
map v f applies the function f to the value v. If v is a list, f is applied to each element.
Pretty Printing
Serialization
of_string ty s attempts to parse the string s as a value of type ty. Returns Ok v on success, or an error message if parsing fails.
to_json v converts the value v into a JSON representation.