All local storage interactions are unsafe
samhh opened this issue · 2 comments
samhh commented
Per here, local storage can throw for many reasons, for example - something a project of mine has been bitten by before - the user having disabled it in their browser.
With this in mind, all of the APIs in this library are currently deceptively unsafe. Some options:
- Add documentation alluding to this unsafety
- Add new safe variants, and prefix the preexisting ones with
unsafe
- Rewrite everything to be safe - presumably using
E.tryCatch
under the hood and asking for an error handler from the user - e.g.number -> IO<Option<string>>
becomes(unknown -> E) -> number -> IO<Either<E, Option<string>>>
StefanoMagrassi commented
I think that a solution could be use IOEither
and release a new major version of the library