(module result (export ok_i32 err_i32 is_ok_i32 is_err_i32 unwrap_ok_i32 unwrap_err_i32 unwrap_or_i32 ok_or_none_i32 ok_u32 err_u32 is_ok_u32 is_err_u32 unwrap_ok_u32 unwrap_err_u32 unwrap_or_u32 ok_or_none_u32 ok_i64 err_i64 is_ok_i64 is_err_i64 unwrap_ok_i64 unwrap_err_i64 unwrap_or_i64 ok_or_none_i64 ok_u64 err_u64 is_ok_u64 is_err_u64 unwrap_ok_u64 unwrap_err_u64 unwrap_or_u64 ok_or_none_u64 ok_string err_string is_ok_string is_err_string unwrap_ok_string unwrap_err_string unwrap_or_string ok_or_none_string ok_f64 err_f64 is_ok_f64 is_err_f64 unwrap_ok_f64 unwrap_err_f64 unwrap_or_f64 ok_or_none_f64 ok_bool err_bool is_ok_bool is_err_bool unwrap_ok_bool unwrap_err_bool unwrap_or_bool ok_or_none_bool))

(fn ok_i32 ((value i32)) -> (result i32 i32)
  (ok i32 i32 value))

(fn err_i32 ((code i32)) -> (result i32 i32)
  (err i32 i32 code))

(fn is_ok_i32 ((value (result i32 i32))) -> bool
  (std.result.is_ok value))

(fn is_err_i32 ((value (result i32 i32))) -> bool
  (std.result.is_err value))

(fn unwrap_ok_i32 ((value (result i32 i32))) -> i32
  (std.result.unwrap_ok value))

(fn unwrap_err_i32 ((value (result i32 i32))) -> i32
  (std.result.unwrap_err value))

(fn unwrap_or_i32 ((value (result i32 i32)) (fallback i32)) -> i32
  (if (std.result.is_ok value)
    (std.result.unwrap_ok value)
    fallback))

(fn ok_or_none_i32 ((value (result i32 i32))) -> (option i32)
  (if (std.result.is_ok value)
    (some i32 (std.result.unwrap_ok value))
    (none i32)))

(fn ok_u32 ((value u32)) -> (result u32 i32)
  (ok u32 i32 value))

(fn err_u32 ((code i32)) -> (result u32 i32)
  (err u32 i32 code))

(fn is_ok_u32 ((value (result u32 i32))) -> bool
  (std.result.is_ok value))

(fn is_err_u32 ((value (result u32 i32))) -> bool
  (std.result.is_err value))

(fn unwrap_ok_u32 ((value (result u32 i32))) -> u32
  (std.result.unwrap_ok value))

(fn unwrap_err_u32 ((value (result u32 i32))) -> i32
  (std.result.unwrap_err value))

(fn unwrap_or_u32 ((value (result u32 i32)) (fallback u32)) -> u32
  (if (std.result.is_ok value)
    (std.result.unwrap_ok value)
    fallback))

(fn ok_or_none_u32 ((value (result u32 i32))) -> (option u32)
  (if (std.result.is_ok value)
    (some u32 (std.result.unwrap_ok value))
    (none u32)))

(fn ok_i64 ((value i64)) -> (result i64 i32)
  (ok i64 i32 value))

(fn err_i64 ((code i32)) -> (result i64 i32)
  (err i64 i32 code))

(fn is_ok_i64 ((value (result i64 i32))) -> bool
  (std.result.is_ok value))

(fn is_err_i64 ((value (result i64 i32))) -> bool
  (std.result.is_err value))

(fn unwrap_ok_i64 ((value (result i64 i32))) -> i64
  (std.result.unwrap_ok value))

(fn unwrap_err_i64 ((value (result i64 i32))) -> i32
  (std.result.unwrap_err value))

(fn unwrap_or_i64 ((value (result i64 i32)) (fallback i64)) -> i64
  (if (std.result.is_ok value)
    (std.result.unwrap_ok value)
    fallback))

(fn ok_or_none_i64 ((value (result i64 i32))) -> (option i64)
  (if (std.result.is_ok value)
    (some i64 (std.result.unwrap_ok value))
    (none i64)))

(fn ok_u64 ((value u64)) -> (result u64 i32)
  (ok u64 i32 value))

(fn err_u64 ((code i32)) -> (result u64 i32)
  (err u64 i32 code))

(fn is_ok_u64 ((value (result u64 i32))) -> bool
  (std.result.is_ok value))

(fn is_err_u64 ((value (result u64 i32))) -> bool
  (std.result.is_err value))

(fn unwrap_ok_u64 ((value (result u64 i32))) -> u64
  (std.result.unwrap_ok value))

(fn unwrap_err_u64 ((value (result u64 i32))) -> i32
  (std.result.unwrap_err value))

(fn unwrap_or_u64 ((value (result u64 i32)) (fallback u64)) -> u64
  (if (std.result.is_ok value)
    (std.result.unwrap_ok value)
    fallback))

(fn ok_or_none_u64 ((value (result u64 i32))) -> (option u64)
  (if (std.result.is_ok value)
    (some u64 (std.result.unwrap_ok value))
    (none u64)))

(fn ok_string ((value string)) -> (result string i32)
  (ok string i32 value))

(fn err_string ((code i32)) -> (result string i32)
  (err string i32 code))

(fn is_ok_string ((value (result string i32))) -> bool
  (std.result.is_ok value))

(fn is_err_string ((value (result string i32))) -> bool
  (std.result.is_err value))

(fn unwrap_ok_string ((value (result string i32))) -> string
  (std.result.unwrap_ok value))

(fn unwrap_err_string ((value (result string i32))) -> i32
  (std.result.unwrap_err value))

(fn unwrap_or_string ((value (result string i32)) (fallback string)) -> string
  (match value
    ((ok payload)
      payload)
    ((err code)
      fallback)))

(fn ok_or_none_string ((value (result string i32))) -> (option string)
  (if (std.result.is_ok value)
    (some string (std.result.unwrap_ok value))
    (none string)))

(fn ok_f64 ((value f64)) -> (result f64 i32)
  (ok f64 i32 value))

(fn err_f64 ((code i32)) -> (result f64 i32)
  (err f64 i32 code))

(fn is_ok_f64 ((value (result f64 i32))) -> bool
  (std.result.is_ok value))

(fn is_err_f64 ((value (result f64 i32))) -> bool
  (std.result.is_err value))

(fn unwrap_ok_f64 ((value (result f64 i32))) -> f64
  (std.result.unwrap_ok value))

(fn unwrap_err_f64 ((value (result f64 i32))) -> i32
  (std.result.unwrap_err value))

(fn unwrap_or_f64 ((value (result f64 i32)) (fallback f64)) -> f64
  (if (std.result.is_ok value)
    (std.result.unwrap_ok value)
    fallback))

(fn ok_or_none_f64 ((value (result f64 i32))) -> (option f64)
  (if (std.result.is_ok value)
    (some f64 (std.result.unwrap_ok value))
    (none f64)))

(fn ok_bool ((value bool)) -> (result bool i32)
  (ok bool i32 value))

(fn err_bool ((code i32)) -> (result bool i32)
  (err bool i32 code))

(fn is_ok_bool ((value (result bool i32))) -> bool
  (std.result.is_ok value))

(fn is_err_bool ((value (result bool i32))) -> bool
  (std.result.is_err value))

(fn unwrap_ok_bool ((value (result bool i32))) -> bool
  (std.result.unwrap_ok value))

(fn unwrap_err_bool ((value (result bool i32))) -> i32
  (std.result.unwrap_err value))

(fn unwrap_or_bool ((value (result bool i32)) (fallback bool)) -> bool
  (if (std.result.is_ok value)
    (std.result.unwrap_ok value)
    fallback))

(fn ok_or_none_bool ((value (result bool i32))) -> (option bool)
  (if (std.result.is_ok value)
    (some bool (std.result.unwrap_ok value))
    (none bool)))
