~jojo/Carth

c18ff977c6e198a4222590236d1c8d0e2ab8ab8a — JoJo 1 year, 6 months ago 86dd9f1
Update std with undefined & panic functionality
2 files changed, 16 insertions(+), 0 deletions(-)

M examples/std.carth
M foreign-core/src/lib.rs
M examples/std.carth => examples/std.carth +8 -0
@@ 3,6 3,14 @@
(define snd
  (fun-match (case (Pair _ b) b)))

(define: (undefined x)
    (forall (a) (Fun Unit a))
  (undefined x))

(extern -panic (Fun Str Unit))
(define (panic msg)
  (seq (-panic msg) (undefined unit)))

(type (Maybe a)
  None
  (Some a))

M foreign-core/src/lib.rs => foreign-core/src/lib.rs +8 -0
@@ 132,3 132,11 @@ def_carth_closure! {
    i64, Str; n =>
        Str::new(n.to_string())
}

def_carth_closure! {
    "-panic", PANIC, panic;
    Str, (); s => {
        eprintln!("*** Panic: {}", from_carth_str(&s));
        std::process::abort()
    }
}