rightfold / purescript-bytestrings

Immutable packed byte sequences.
https://pursuit.purescript.org/packages/purescript-bytestrings
BSD 3-Clause "New" or "Revised" License
9 stars 8 forks source link

fromString may throw an exception #8

Closed rightfold closed 7 years ago

rightfold commented 7 years ago

See https://github.com/purescript-node/purescript-node-buffer/issues/23.

I would like to fix this by doing both of these:

  1. Inhibit any exceptions and return Maybe.
  2. Add an additional function for each safe encoding (e.g. UTF-8, UTF-16 LE), that has no Maybe return type. In fact, toUTF8 already exists. We can add toUTF16LE and so on for the safe encodings.

toString is probably also affected.