WIP: An inlined version of scaml empowered by ppx
to allow user to use SCaml without having to deal with standalone files. example:
module%scamltypes Sometypes = struct
open SCaml
type store = {
version: int;
balance: tz;
}
let x = { version = Int 3; balance = Tz 10. }
end
let ty_store :
< tztype : string;
convert : Sometypes.store -> string;
revert : string -> Sometypes.store option;
typerep : Sometypes.store Typerep_lib.Std_internal.Typerep.t;
convert' : Sometypes.store -> SCaml_compiler_lib.Michelson.Constant.t;
revert' : (int, string) Tezos_micheline.Micheline.node ->
SCaml_compiler_lib.Michelson.Constant.t option >
= [%scamltype: Sometypes.store]
let%test "tztype" =
ty_store#tztype = "pair :store (int %version) (mutez %balance)"
let%test "store_convert_x" =
ty_store#convert Sometypes.x = "Pair 3 10000000"
let%test "store_revert_x" =
ty_store#revert "Pair 3 10000000" = Some Sometypes.x
module%scamlcontract Somecontract = struct
open SCaml
open Sometypes
let [@entry] main p {version;balance} =
([], {version = version + p; balance})
end
let%test "contract_compiles" =
let tz : string = [%scamlcontract Somecontract] in
String.length tz > 0
Edited by Jun Furuse