Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make shortest-path functions safer. #64

Merged
merged 1 commit into from
Apr 26, 2017
Merged

Make shortest-path functions safer. #64

merged 1 commit into from
Apr 26, 2017

Conversation

ntc2
Copy link
Contributor

@ntc2 ntc2 commented Apr 23, 2017

Namely:

  • return Nothing instead of failing with the dreaded *** Exception: Prelude.head: empty list (for spLength) or returning
    non-sense (for sp) when the source is not connected to the
    destination.

  • mention in the docs that negative edge weights will not produce the
    right answer.

  • add tests that check that Nothing and Just are returned when
    they should be for shortest-path operations.

I just used your great library for the first time but wasted time with Prelude.head: empty list from spLength. This patch will avoid that problem for future users.

Namely:

- return `Nothing` instead of failing with the dreaded `*** Exception:
  Prelude.head: empty list` (for `spLength`) or returning
  non-sense (for `sp`) when the source is not connected to the
  destination.

- mention in the docs that negative edge weights will not produce the
  right answer.

- add tests that check that `Nothing` and `Just` are returned when
  they should be for shortest-path operations.
@ivan-m
Copy link
Contributor

ivan-m commented Apr 26, 2017

Thanks!

@ivan-m ivan-m closed this Apr 26, 2017
@ivan-m ivan-m reopened this Apr 26, 2017
@ivan-m ivan-m merged commit 36da3fb into haskell:master Apr 26, 2017
@ntc2
Copy link
Contributor Author

ntc2 commented Apr 26, 2017

You're welcome; thanks for maintaining the library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants