Hmm... one moment. The first example function they provide:
function handleResponse(response) {
return match (response) {
when ({ status: 200, data }) -> data
when ({ status: 401 }) -> throw new Error(’Unauthorized’)
when ({ status: 404 }) -> throw new Error(’Not Found’)
when ({ status: s if s >= 500 }) -> throw new Error(’Server Error’)
default -> throw new Error(’Unknown Error’)
};
}
Is less readable to me than the way I would write it without the match/when construct: function handleResponse(response) {
status = response.status;
data = response.data;
if (status === 200 && data) return data;
if (status === 401) throw new Error(’Unauthorized’);
if (status === 404) throw new Error(’Not Found’);
if (status >= 500) throw new Error(’Server Error’);
throw new Error(’Unknown Error’);
} replies(1):