rust¶
In [ ]:
//// test
open testing
rust¶
any_base¶
In [ ]:
type any_base = any
any¶
In [ ]:
nominal any =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"core::any::Any\")>]\ntype core_any_Any = class end\n#else\ntype core_any_Any = obj\n#endif\n"
$'' : $'core_any_Any'
)
try¶
In [ ]:
nominal try t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"_\")>]\n#endif\ntype core_ops_Try<'T> = class end"
$'' : $'core_ops_Try<`t>'
)
cow¶
In [ ]:
nominal cow t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"std::borrow::Cow<$0>\")>]\n#endif\ntype std_borrow_Cow<'T> = class end"
$'' : $'std_borrow_Cow<`t>'
)
ref_cell¶
In [ ]:
nominal ref_cell t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"std::cell::RefCell<$0>\")>]\n#endif\ntype std_cell_RefCell<'T> = class end"
$'' : $'std_cell_RefCell<`t>'
)
cell_ref¶
In [ ]:
nominal cell_ref t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"std::cell::Ref<$0>\")>]\n#endif\ntype std_cell_Ref<'T> = class end"
$'' : $'std_cell_Ref<`t>'
)
rc¶
In [ ]:
nominal rc t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"std::rc::Rc<$0>\")>]\n#endif\ntype std_rc_Rc<'T> = class end"
$'' : $'std_rc_Rc<`t>'
)
lifetime_ref¶
In [ ]:
nominal lifetime_ref (t : * -> *) u =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"$0\")>]\n#endif\ntype LifetimeRef<'T> = class end"
$'' : $'LifetimeRef<`(t u)>'
)
lifetime_join¶
In [ ]:
nominal lifetime_join t u =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"$0 + $1\")>]\n#endif\ntype LifetimeJoin<'T, 'U> = class end"
$'' : $'LifetimeJoin<`t, `u>'
)
lifetime¶
In [ ]:
nominal lifetime t u =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"$0 $1\")>]\n#endif\ntype Lifetime<'T, 'U> = class end"
$'' : $'Lifetime<`t, `u>'
)
static_lifetime¶
In [ ]:
nominal static_lifetime =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"'static\")>]\n#endif\ntype StaticLifetime = class end"
$'' : $'StaticLifetime'
)
ref¶
In [ ]:
nominal ref t =
`(
backend_switch `(()) `({}) {
Fsharp =
(fun () =>
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"&$0\")>]\ntype Ref<'T> = class end\n#else\ntype Ref<'T> = 'T\n#endif\n"
) : () -> ()
}
$'' : $'Ref<`t>'
)
static_ref¶
In [ ]:
nominal static_ref t = ref (lifetime static_lifetime t)
weak_rc¶
In [ ]:
nominal weak_rc t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"std::rc::Weak<$0>\")>]\n#endif\ntype std_rc_Weak<'T> = class end"
$'' : $'std_rc_Weak<`t>'
)
box¶
In [ ]:
nominal box t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"Box<$0>\")>]\n#endif\ntype Box<'T> = class end"
$'' : $'Box<`t>'
)
mut_cell¶
In [ ]:
nominal mut_cell t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"MutCell<$0>\")>]\n#endif\ntype MutCell<'T> = class end"
$'' : $'MutCell<`t>'
)
pin¶
In [ ]:
nominal pin t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"std::pin::Pin<$0>\")>]\n#endif\ntype std_pin_Pin<'T> = class end"
$'' : $'std_pin_Pin<`t>'
)
dyn'¶
In [ ]:
nominal dyn' t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"dyn $0\")>]\n#endif\ntype Dyn<'T> = class end"
$'' : $'Dyn<`t>'
)
fn'¶
In [ ]:
nominal fn' t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"Fn() -> $0\")>]\n#endif\ntype Fn<'T> = class end"
$'' : $'Fn<`t>'
)
action_fn¶
In [ ]:
nominal action_fn t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"Fn($0)\")>]\n#endif\ntype ActionFn<'T> = class end"
$'' : $'ActionFn<`t>'
)
action_fn2¶
In [ ]:
nominal action_fn2 t u =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"Fn($0, $1)\")>]\n#endif\ntype ActionFn2<'T, 'U> = class end"
$'' : $'ActionFn2<`t, `u>'
)
fn_once¶
In [ ]:
nominal fn_once t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"FnOnce() -> $0\")>]\n#endif\ntype FnOnce<'T> = class end"
$'' : $'FnOnce<`t>'
)
fn_unit¶
In [ ]:
nominal fn_unit =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"Fn()\")>]\n#endif\ntype FnUnit = class end"
$'' : $'FnUnit'
)
func0¶
In [ ]:
nominal func0 t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"Func0<$0>\")>]\n#endif\ntype Func0<'T> = class end"
$'' : $'Func0<`t>'
)
func1¶
In [ ]:
nominal func1 t u =
`(
typecase t with
| () => `func0 `u
| _ =>
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"Func1<$0, $1>\")>]\n#endif\ntype Func0<'T, 'U> = class end"
$'' : $'Func0<`t, `u>'
)
impl¶
In [ ]:
nominal impl t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"impl $0\")>]\n#endif\ntype Impl<'T> = class end"
$'' : $'Impl<`t>'
)
mut'¶
In [ ]:
nominal mut' t =
`(
backend_switch `(()) `({}) {
Fsharp =
(fun () =>
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"mut $0\")>]\n#endif\ntype Mut<'T> = class end"
) : () -> ()
}
$'' : $'Mut<`t>'
)
send¶
In [ ]:
nominal send t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"Send\")>]\n#endif\ntype Send<'T> = class end"
$'' : lifetime_join t $'Send<`t>'
)
emit_expr¶
In [ ]:
inl emit_expr forall a t. (args : a) (code : string) : t =
$'Fable.Core.RustInterop.emitRustExpr !args !code '
(~!\)¶
In [ ]:
inl (~!\) forall t. (code : string) : t =
emit_expr () code
(~!\\)¶
In [ ]:
inl (~!\\) forall t u. ((args : t), (code : string)) : u =
emit_expr args code
ptr¶
In [ ]:
nominal ptr t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"*const $0\")>]\n#endif\ntype Ptr<'T> = class end"
$'' : $'Ptr<`t>'
)
ptr_read¶
In [ ]:
inl ptr_read forall t. (x : ptr t) : t =
!\\(x, $'"std::ptr::read($0)"')
u128¶
In [ ]:
nominal u128 =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"u128\")>]\n#endif\ntype u128 = class end"
$'' : $'u128'
)
In [ ]:
inl u128 forall t. (x : t) : u128 =
!\\(x, $'"$0 as u128"')
f64¶
In [ ]:
inl f64 forall t. (x : t) : f64 =
!\\(x, $'"$0 as f64"')
unwrap_0¶
In [ ]:
inl unwrap_0 forall (t : * -> *) u. (x : t u) : u =
!\\(x, $'"$0.0"')
unwrap_0_ref¶
In [ ]:
inl unwrap_0_ref forall (t : * -> *) u. (x : ref (t u)) : ref u =
!\\(x, $'"&$0.0"')
len¶
In [ ]:
inl len forall t u {uint; int}. (x : t) : u =
!\($'$"!x.len()"')
len'¶
In [ ]:
inl len' forall t u {uint; int}. (x : t) : u =
!\\(x, $'$"$0.len()"')
emit¶
In [ ]:
inl emit forall t. (x : t) : t =
!\\(x, $'"$0"')
emit'¶
In [ ]:
inl emit' forall t. (x : t) : t =
!\\(x, $'"let !x = $0"')
x
clone¶
In [ ]:
inl clone forall t. (x : t) : t =
!\\(x, $'"$0.clone()"')
dbg¶
In [ ]:
inl dbg forall t. (x : t) : t =
!\\(x, $'"dbg\!($0)"')
new_box¶
In [ ]:
inl new_box forall t. (x : t) : box t =
!\\(x, $'"Box::new($0)"')
new_rc¶
In [ ]:
inl new_rc forall t. (x : t) : rc t =
!\\(x, $'"std::rc::Rc::new($0)"')
rc_clone¶
In [ ]:
inl rc_clone forall t. (x : rc t) : rc t =
!\\(x, $'"std::rc::Rc::clone(&$0)"')
rc_unwrap_or_clone¶
In [ ]:
inl rc_unwrap_or_clone forall t. (x : rc t) : t =
!\\(x, $'"std::rc::Rc::unwrap_or_clone($0)"')
rc_downgrade¶
In [ ]:
inl rc_downgrade forall t. (x : rc t) : weak_rc t =
!\\(x, $'"std::rc::Rc::downgrade(&$0)"')
new_ref_cell¶
In [ ]:
inl new_ref_cell forall t. (x : t) : ref_cell t =
!\($'"std::cell::RefCell::new(!x)"')
ref_cell_borrow¶
In [ ]:
inl ref_cell_borrow forall t. (x : rc (ref_cell t)) : cell_ref t =
!\\(x, $'"std::cell::RefCell::borrow(&std::rc::Rc::clone(&$0))"')
ref_cell_borrow_mut¶
In [ ]:
inl ref_cell_borrow_mut forall t. (x : rc (ref_cell t)) : mut' t =
!\\(x, $'"std::cell::RefCell::borrow_mut(&std::rc::Rc::clone(&$0))"')
ref_leak¶
In [ ]:
inl ref_leak forall t. (x : cell_ref t) : ref t =
!\\(x, $'"std::cell::Ref::leak($0)"')
to_mut¶
In [ ]:
inl to_mut forall t. (x : t) : () =
(!\($'"true; // 1"') : bool) |> ignore
!\($'"let mut !x = !x"') : ()
// (!\($'"true; !x"') : bool) |> ignore
// !\($'"!x"')
// inl result = !\($'"!x"') : mut' t
// !\($'"!result"')
// inl result = !\($'"*/ // a"') : mut' t
// inl result = !\($'"!x"') : mut' t
// result |> fun x => $'!x |> unbox // b'
ref_map¶
In [ ]:
inl ref_map forall t u. (fn : t -> u) (x : ref t) : ref u =
!\($'"!fn(!x)"')
ref_eval¶
In [ ]:
inl ref_eval forall t u. (fn : t -> u) (ref : ref t) : u =
!\\(fn, $'"$0(!ref.clone())"')
cow_as_ref¶
In [ ]:
inl cow_as_ref forall t. (s : cow t) : ref t =
!\\(s, $'"$0.as_ref()"')
from_mut¶
In [ ]:
inl from_mut forall t. (x : mut' t) : t =
!\\(x, $'"$0"')
box_fn¶
In [ ]:
inl box_fn forall t. (x : () -> ()) : box t =
inl x = join x
!\($'"Box::new(move || !x())"')
box_pin¶
In [ ]:
inl box_pin forall t. (x : t) : pin (box t) =
!\\(x, $'"Box::pin($0)"')
to_ref¶
In [ ]:
inl to_ref forall t. (x : t) : ref t =
!\\(x, $'"&$0"')
to_ref_mut¶
In [ ]:
inl to_ref_mut forall t. (x : t) : ref (mut' t) =
x |> to_mut
!\\(x, $'"&mut $0"')
deref¶
In [ ]:
inl deref forall t. (ref : ref t) : t =
!\\(ref, $'"*$0"')
clone_deref¶
In [ ]:
inl clone_deref forall t. (ref : ref t) : t =
!\\(ref, $'"$0.clone()"')
from_ref¶
In [ ]:
inl from_ref forall t. (ref : ref t) : t =
!\($'"!ref"')
from_ref_mut¶
In [ ]:
inl from_ref_mut forall t. (ref : ref (mut' t)) : t =
!\($'"!ref"')
reref¶
In [ ]:
inl reref forall t (u : * -> *). (x : ref (u t)) : ref t =
!\($'$"&*!x"')
into¶
In [ ]:
inl into forall t u. (x : t) : u =
!\($'"!x.into()"')
ops_deref¶
In [ ]:
inl ops_deref forall t. (ref : t) : t =
!\\(ref, $'"core::ops::Deref::deref(&$0)"')
func0_eval¶
In [ ]:
inl func0_eval forall t. (x : func0 t) : t =
!\\(x, $'"$0()"')
func0_move¶
In [ ]:
inl func0_move forall t. (fn : func0 t) : t =
inl fn = join fn
!\($'"(move || !fn())()"')
move¶
In [ ]:
inl move forall t. (fn : () -> t) : func0 t =
!\\(fn, $'"Func0::new(move || $0())"')
to_static_ref_unbox¶
In [ ]:
inl to_static_ref_unbox forall t. (x : ref t) : static_ref t =
x |> unbox
from_static_ref_unbox¶
In [ ]:
inl from_static_ref_unbox forall t. (x : static_ref t) : ref t =
x |> unbox
box_leak¶
In [ ]:
inl box_leak forall t. (x : box t) : static_ref (mut' t) =
!\\(x, $'"Box::leak($0)"')
drop¶
In [ ]:
inl drop forall t. (x : t) : () =
(!\\(x, $'"true; drop($0)"') : bool) |> ignore
break¶
In [ ]:
inl break () : () =
(!\($'"true; break"') : bool) |> ignore
fix_closure'¶
In [ ]:
inl fix_closure' forall t. (depth : u8 * u8) (x : t) : string =
inl rec loop text (acc : string) n : string =
if n <= 0
then acc
else loop text (acc +. text) (n - 1)
inl a = depth |> fst |> loop "}" ""
inl b = depth |> snd |> loop "{" ""
inl x' : infer = $'!x '
run_target_args (fun () => x') function
| Rust _ => fun x' => !\\(x', $'$"true; let !x' = $0"') : bool
| _ => fun x' => $'true'
|> ignore
$'$"true; !x' " + !a + "); " + !b + " // rust.fix_closure\'"'
In [ ]:
//// test
//// print_code
fix_closure' (3, 2) 0i32
|> _assert_eq "true; v8 }}}); {{ // rust.fix_closure'"
let rec method1 (v0 : bool) : bool = v0 and closure0 (v0 : string) () : unit = let v1 : (string -> unit) = System.Console.WriteLine v1 v0 and method0 () : unit = let v0 : string = "" let v1 : string = "}" let v2 : string = v0 + v1 let v3 : string = v2 + v1 let v4 : string = v3 + v1 let v5 : string = "{" let v6 : string = v0 + v5 let v7 : string = v6 + v5 let v8 : _ = 0 let v9 : unit = () #if FABLE_COMPILER || WASM || CONTRACT #if FABLE_COMPILER_RUST && !WASM && !CONTRACT let v10 : string = $"true; let v8 = $0" let v11 : bool = Fable.Core.RustInterop.emitRustExpr v8 v10 let _v9 = v11 #endif #if FABLE_COMPILER_RUST && WASM let v12 : string = $"true; let v8 = $0" let v13 : bool = Fable.Core.RustInterop.emitRustExpr v8 v12 let _v9 = v13 #endif #if FABLE_COMPILER_RUST && CONTRACT let v14 : string = $"true; let v8 = $0" let v15 : bool = Fable.Core.RustInterop.emitRustExpr v8 v14 let _v9 = v15 #endif #if FABLE_COMPILER_TYPESCRIPT let v16 : bool = true let _v9 = v16 #endif #if FABLE_COMPILER_PYTHON let v17 : bool = true let _v9 = v17 #endif #if !FABLE_COMPILER_RUST && !FABLE_COMPILER_TYPESCRIPT && !FABLE_COMPILER_PYTHON let v18 : bool = true let _v9 = v18 #endif #else let v19 : bool = true let _v9 = v19 #endif let v20 : bool = _v9 let v23 : string = $"true; v8 " + v4 + "); " + v7 + " // rust.fix_closure'" let v24 : bool = v23 = "true; v8 }}}); {{ // rust.fix_closure'" let v26 : bool = if v24 then true else method1(v24) let v27 : string = "__assert_eq" let v28 : string = "true; v8 }}}); {{ // rust.fix_closure'" let v29 : string = $"{v27} / actual: %A{v23} / expected: %A{v28}" let v32 : unit = () let v33 : (unit -> unit) = closure0(v29) let v34 : unit = (fun () -> v33 (); v32) () let v36 : bool = v26 = false if v36 then failwith<unit> v29 method0() __assert_eq / actual: "true; v8 }}}); {{ // rust.fix_closure'" / expected: "true; v8 }}}); {{ // rust.fix_closure'"
In [ ]:
//// test
//// print_code
fix_closure' (0, 0) ()
|> _assert_eq "true; v0 ); // rust.fix_closure'"
let rec method1 (v0 : bool) : bool = v0 and closure0 (v0 : string) () : unit = let v1 : (string -> unit) = System.Console.WriteLine v1 v0 and method0 () : unit = let v0 : _ = () let v1 : unit = () #if FABLE_COMPILER || WASM || CONTRACT #if FABLE_COMPILER_RUST && !WASM && !CONTRACT let v2 : string = $"true; let v0 = $0" let v3 : bool = Fable.Core.RustInterop.emitRustExpr v0 v2 let _v1 = v3 #endif #if FABLE_COMPILER_RUST && WASM let v4 : string = $"true; let v0 = $0" let v5 : bool = Fable.Core.RustInterop.emitRustExpr v0 v4 let _v1 = v5 #endif #if FABLE_COMPILER_RUST && CONTRACT let v6 : string = $"true; let v0 = $0" let v7 : bool = Fable.Core.RustInterop.emitRustExpr v0 v6 let _v1 = v7 #endif #if FABLE_COMPILER_TYPESCRIPT let v8 : bool = true let _v1 = v8 #endif #if FABLE_COMPILER_PYTHON let v9 : bool = true let _v1 = v9 #endif #if !FABLE_COMPILER_RUST && !FABLE_COMPILER_TYPESCRIPT && !FABLE_COMPILER_PYTHON let v10 : bool = true let _v1 = v10 #endif #else let v11 : bool = true let _v1 = v11 #endif let v12 : bool = _v1 let v15 : string = "" let v16 : string = $"true; v0 " + v15 + "); " + v15 + " // rust.fix_closure'" let v17 : bool = v16 = "true; v0 ); // rust.fix_closure'" let v19 : bool = if v17 then true else method1(v17) let v20 : string = "__assert_eq" let v21 : string = "true; v0 ); // rust.fix_closure'" let v22 : string = $"{v20} / actual: %A{v16} / expected: %A{v21}" let v25 : unit = () let v26 : (unit -> unit) = closure0(v22) let v27 : unit = (fun () -> v26 (); v25) () let v29 : bool = v19 = false if v29 then failwith<unit> v22 method0() __assert_eq / actual: "true; v0 ); // rust.fix_closure'" / expected: "true; v0 ); // rust.fix_closure'"
fix_closure¶
In [ ]:
inl fix_closure depth x =
inl code = fix_closure' depth x
(!\code : bool) |> ignore
loop¶
In [ ]:
inl loop (depth : i32) (fn : () -> ()) : () =
(!\($'"true; loop { // rust.loop"') : bool) |> ignore
fn ()
listm.init depth id
|> listm.iter fun n =>
(!\($'"true; } // rust.loop"') : bool) |> ignore
(!\($'"true; } // rust.loop"') : bool) |> ignore
listm.init depth id
|> listm.iter fun n =>
(!\($'"true; { // rust.loop"') : bool) |> ignore
capture¶
In [ ]:
inl capture forall t. (fn : () -> t) : t =
(!\($'"true; let _capture = (|| { //"') : bool) |> ignore
(!\\(fn (), $'"true; $0 })()"') : bool) |> ignore
!\($'"_capture"')
capture_move¶
In [ ]:
inl capture_move forall t. (fn : () -> t) : t =
(!\($'"true; let _capture_move = (move || { //"') : bool) |> ignore
(!\\(fn (), $'"true; $0 })()"') : bool) |> ignore
!\($'"_capture_move"')
type_emit¶
In [ ]:
nominal type_emit t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"*/ $0 /*\")>]\n#endif\ntype TypeEmit<'T> = class end"
$'' : $'TypeEmit<`t>'
)
partial_eq_wrapper¶
In [ ]:
nominal partial_eq_wrapper t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"PartialEqWrapper<$0>\")>]\n#endif\ntype PartialEqWrapper<'T> = class end"
$'' : $'PartialEqWrapper<`t>'
)
new_partial_eq_wrapper¶
In [ ]:
inl new_partial_eq_wrapper forall t.
(eq_fn : ref (partial_eq_wrapper t) -> ref (partial_eq_wrapper t) -> bool)
(x : t)
: partial_eq_wrapper t
=
inl struct () =
!\($'"} //"') : ()
!\($'"#[derive( //"') : ()
!\($'" Debug, //"') : ()
!\($'" Clone, //"') : ()
!\($'")] //"') : ()
!\($'"pub struct PartialEqWrapper<T>(T); /*"') : ()
!\($'"*/ impl PartialEq for PartialEqWrapper< /*"') : ()
(null () : type_emit t) |> ignore
!\($'"*/ > { //"') : ()
!\($'"fn eq(&self, other: &Self) -> bool { //"') : ()
inl self : ref (partial_eq_wrapper t) = !\($'$"self"')
inl other : ref (partial_eq_wrapper t) = !\($'$"other"')
self
|> eq_fn other
|> fun x => !\($'$"!x //"')
!\($'"} } } fn _main() { { { //"') : ()
$'let _!struct = true' : ()
!\\(x, $'"PartialEqWrapper($0)"')
clone_wrapper¶
In [ ]:
nominal clone_wrapper t =
`(
global "#if FABLE_COMPILER\n[<Fable.Core.Erase; Fable.Core.Emit(\"CloneWrapper<$0>\")>]\n#endif\ntype CloneWrapper<'T> = class end"
$'' : $'CloneWrapper<`t>'
)
new_clone_wrapper¶
In [ ]:
inl new_clone_wrapper forall t.
(clone_fn : ref (clone_wrapper t) -> ref (clone_wrapper t))
(x : t)
: clone_wrapper t
=
inl struct () =
!\($'"} //"') : ()
!\($'"#[derive( //"') : ()
!\($'" Debug, //"') : ()
!\($'")] //"') : ()
!\($'"pub struct CloneWrapper<T>(T); /*"') : ()
!\($'"*/ impl Clone for CloneWrapper< /*"') : ()
(null () : type_emit t) |> ignore
!\($'"*/ > { //"') : ()
!\($'"fn clone(&self) -> Self { //"') : ()
inl self : ref (clone_wrapper t) = !\($'$"self"')
self
|> clone_fn
|> fun x => !\($'$"!x.clone() //"')
!\($'"} } } fn _main() { { { //"') : ()
$'let _!struct = true' : ()
!\\(x, $'"CloneWrapper($0)"')
concat¶
In [ ]:
inl concat forall (t : * -> *) u. (x : t (t u)) : t u =
!\($'$"!x.concat()"')