purescript-deprecated / purescript-dom

Type definitions and standard effect for interacting with the DOM
41 stars 57 forks source link

Add `slice` for Blob #125

Closed safareli closed 7 years ago

safareli commented 7 years ago

https://developer.mozilla.org/en-US/docs/Web/API/Blob/slice

safareli commented 7 years ago

The slice takes Integer number but using Int will not be correct because its range is smaller, then what this function can handle. We should

if we define Data.Int.Long it should be like Int but instead of (n | 0) === n we should use Number.IsSafeInteger(n).

related https://github.com/purescript/purescript-integers/issues/28

safareli commented 7 years ago

Regarding Data.Int.Long there actually is Data.Int53 in purescript-int-53 which I think we should use.

garyb commented 7 years ago

Int53 would definitely be suitable for this, but we try to avoid depending on "private" libraries in -contrib libraries, as it gets awkward if they become unmaintained etc.

Maybe we can do something here with StartByte / EndByte style newtypes that have smart constructors to perform the necessary rounding and clamping from Number instead.