haskell / haskell/vector

Clarify the drawbacks of unsafe functions

Open
#305 4 comments 4 reactions 0 assignees View on GitHub
documentation help-wanted
Dominant language
Haskell
Stars
400
Forks
145
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm opening this issue regarding the documentation of the following functions:
![Screenshot from 2020-05-08 20-50-20](https://user-images.githubusercontent.com/15848443/81438748-8bbb6b80-916d-11ea-8ed1-5ab4ec6f2645.png)

---
Nowhere in the module documentation or in those functions it is said clearly the fact that:
* Given an empty vector, `head` will raise a runtime error;
* `unsafe` functions do not lead to RTS exceptions (like they may do in other container-like APIs), but will **segfault** the program. Beginners and more generally people who did not experience this behaviour first-hand are in no way warned of the implications of using `unsafe` functions (who are then closer than Rust’s `unsafe` than the commonly accepted definition of safety in the Haskell ecosystem).

I personally think it is dangerous to leave such gaps in the documentation and wanted to discuss this with the maintainers before opening a PR to rectify this.

cc @cartazio

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.