haskell / haskell/primitive

write up policies for 'Prim' typeclass

Open
#180 3 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Haskell
Stars
123
Forks
60
PR merge metrics
No merged PRs in 30d

Description

I think we should include a write-up about what makes sense in a `Prim` instance. Some specific points I've thought of are what makes a valid `Prim` instance (laws), what makes sense to have a `Prim` instance, why certain things are excluded, etc.

For example, I just discussed with @andrewthad about why `Bool` doesn't have a `Prim` instance. Aside from space inefficiency, let's say we map `True` to 1 and `False` to 0, then writing a byte to a `ByteArray#` means that only 1 and 0 are valid, and we cannot interpret any byte other than 0 or 1 as a `Bool`. This makes sense for anything which cannot be talked about in bytes (i.e. its size is not at least 1 byte).

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.