basvandijk / scientific

Arbitrary-precision floating-point numbers represented using scientific notation
BSD 3-Clause "New" or "Revised" License
73 stars 40 forks source link

Add Safe Haskell support #71

Closed mlugg closed 3 years ago

mlugg commented 3 years ago

Add Safe Haskell extensions to each file, and move unsafeFromRational from Data.Scientific to Data.Scientific.Unsafe. This arose from attempts to add Safe Haskell support to Megaparsec (see mrkkrp/megaparsec#425).

phadej commented 3 years ago

The unsafeFromRational doesn't violate module boundaries nor allows for unsafeCoerce, thus it is "safe" as in "Safe Haskell". Non termination is not prevented by Safe Haskell.

phadej commented 3 years ago

I added annotations in https://github.com/basvandijk/scientific/pull/77, thanks for the prompt!