haskell / haskell/math-functions

How to handle errors

Open
#22 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Haskell
Stars
45
Forks
32
PR merge metrics
No merged PRs in 30d

Description

There are basically two way to deal with invalid input. First is to throw exception on invalid input and second is to return NaN. Both methods have advantages and disadvantages. Currently we use first method.

Throwing exception could be good for controlling NaN spread. Error is raised early and hopefully close to place of origin.Indeed finding out where NaN did appear could be time consuming process.

On the other hand returing NaN gives caller chance to deal with error. This is especially important is code is passed as calllback to C function (e.g. minimization routine). In this case exception means immediate program termination.

So only sensible choice is to give user choice. It's hoever unclear how to do so unobtrusively.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.