

//
// Source
//

record SourceFile = referenceType(
    path: String,
    data: String,
);

readSource(path) =
    SourceFile(path, readAll(File(path)));



//
// ClayError
//

variant ClayError;

instance Exception (ClayError);

[T | VariantMember?(ClayError, T)]
overload Exception(forward x:T) = Exception(ClayError(x));



//
// displayError
//

define displayError;

overload displayError(e) {
    println(e);
}
overload displayError(e:Exception) {
    displayError(*e);
}
overload displayError(e:ClayError) {
    displayError(*e);
}
