purescript-contrib / purescript-bigints

Arbitrary length integers for PureScript
MIT License
26 stars 22 forks source link

Update to v0.15.0 #40

Closed sigma-andex closed 2 years ago

sigma-andex commented 2 years ago
sigma-andex commented 2 years ago

@sharkdp this test failed and only passes with the change made. I am not sure whether this correct.

sharkdp commented 2 years ago

@sharkdp this test failed and only passes with the change made. I am not sure whether this correct.

well, that is.. unexpected? Are there some upstream changes that would indicate a breaking change?

sigma-andex commented 2 years ago

@sharkdp this test failed and only passes with the change made. I am not sure whether this correct.

well, that is.. unexpected? Are there some upstream changes that would indicate a breaking change?

I haven't found anything... not sure what to think about this.

Apart from that, the 0.15 update is now complete

JordanMartinez commented 2 years ago

@sigma-andex Is this PR using spago@0.20.8 now?

Also, mind adding a ToString for BigInt, which can reflect type-level Ints to a BigInt? Something like this should work:

import Prim.Int (class ToString)
import Data.Reflectable (class Reflectable)

reflectBigInt :: forall i. ToString i sym => Reflectable sym String => Proxy i -> BigInt
reflectBigInt p = fromString $ reflectType p
sigma-andex commented 2 years ago
import Prim.Int (class ToString)
import Data.Reflectable (class Reflectable)

Not sure if this is possible, fromString returns a Maybe

JordanMartinez commented 2 years ago
import Prim.Int (class ToString)
import Data.Reflectable (class Reflectable)

Not sure if this is possible, fromString returns a Maybe

fromString has to return Maybe because it must work on all String types. However, if we can guarantee that the String type stores an integer, which it does in this case, then we don't need that Maybe.

So, we should actually just use fromBase here, but without the Maybe wrapper. In other words, exposing FFI to just this function and using that in the implementation.

JordanMartinez commented 2 years ago

This PR should now be ready to go.

sigma-andex commented 2 years ago

Thx @JordanMartinez

thomashoneyman commented 2 years ago

https://pursuit.purescript.org/packages/purescript-bigints/7.0.1