Module Sarek_ppx_lib.Sarek_error

type error =
  1. | Unbound_variable of string * Sarek_ast.loc
  2. | Unbound_constructor of string * Sarek_ast.loc
  3. | Unbound_field of string * Sarek_ast.loc
  4. | Unbound_type of string * Sarek_ast.loc
  5. | Type_mismatch of {
    1. expected : Sarek_types.typ;
    2. got : Sarek_types.typ;
    3. loc : Sarek_ast.loc;
    }
  6. | Cannot_unify of Sarek_types.typ * Sarek_types.typ * Sarek_ast.loc
  7. | Not_a_function of Sarek_types.typ * Sarek_ast.loc
  8. | Wrong_arity of {
    1. expected : int;
    2. got : int;
    3. loc : Sarek_ast.loc;
    }
  9. | Not_a_vector of Sarek_types.typ * Sarek_ast.loc
  10. | Not_an_array of Sarek_types.typ * Sarek_ast.loc
  11. | Not_a_record of Sarek_types.typ * Sarek_ast.loc
  12. | Field_not_found of string * Sarek_types.typ * Sarek_ast.loc
  13. | Immutable_variable of string * Sarek_ast.loc
  14. | Recursive_type of Sarek_types.typ * Sarek_ast.loc
  15. | Unsupported_expression of string * Sarek_ast.loc
  16. | Parse_error of string * Sarek_ast.loc
  17. | Invalid_kernel of string * Sarek_ast.loc
  18. | Duplicate_field of string * Sarek_ast.loc
  19. | Missing_type_annotation of string * Sarek_ast.loc
  20. | Invalid_intrinsic of string * Sarek_ast.loc
  21. | Barrier_in_diverged_flow of Sarek_ast.loc
  22. | Warp_collective_in_diverged_flow of string * Sarek_ast.loc
  23. | Reserved_keyword of string * Sarek_ast.loc
  24. | Unsupported_type_in_registration of string * Sarek_ast.loc
  25. | Unsupported_constructor_form of Sarek_ast.loc
  26. | Unsupported_registration_form of Sarek_ast.loc
  27. | Unsupported_tuple_in_variant of Sarek_ast.loc
  28. | Unsupported_function_in_variant of Sarek_ast.loc
  29. | Unknown_variant_type of string * Sarek_ast.loc
  30. | Expression_needs_statement_context of string * Sarek_ast.loc
  31. | Invalid_lvalue of Sarek_ast.loc

Error types

val error_loc : error -> Sarek_ast.loc

Get the location from an error

val pp_error : Stdlib.Format.formatter -> error -> unit

Pretty print an error

val error_to_string : error -> string

Convert error to string

val pp_error_with_loc : Stdlib.Format.formatter -> error -> unit

Print error with location

type 'a result = ('a, error list) Stdlib.Result.t

Result type for error accumulation

val (let*) : ('a, 'b) Stdlib.result -> ('a -> ('c, 'b) Stdlib.result) -> ('c, 'b) Stdlib.result

Monadic operations for error handling

val ok : 'a -> ('a, 'b) Stdlib.result
val error : 'a -> ('b, 'a list) Stdlib.result
val errors : 'a -> ('b, 'a) Stdlib.result
val map_result : ('a -> 'b) -> ('a, 'c) Stdlib.result -> ('b, 'c) Stdlib.result
val combine_results : ('a, 'b list) Stdlib.result list -> ('a list, 'b list) Stdlib.result
val report_error : error -> 'a

Report error to ppxlib

val report_errors : error list -> unit

Report multiple errors

exception Sarek_error of error

Raise error as OCaml exception for use in PPX

val raise_error : error -> 'a