fix: serializable url

This commit is contained in:
orion 2023-12-23 19:30:49 -06:00
parent 939f6d1dcd
commit 1f4995a2d1
Signed by: orion
GPG Key ID: 6D4165AE4C928719
3 changed files with 639 additions and 5775 deletions

6405
spago.lock

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@ package:
- maybe
- node-event-emitter
- node-streams
- node-url
- nullable
- ordered-collections
- prelude
@ -27,5 +28,4 @@ package:
workspace:
extra_packages: {}
package_set:
url: https://raw.githubusercontent.com/purescript/package-sets/psc-0.15.10-20230930/packages.json
hash: sha256-nTsd44o7/hrTdk0c6dh0wyBqhFFDJJIeKdQU6L1zv/A=
registry: 47.7.1

View File

@ -15,6 +15,7 @@ import Foreign (Foreign, readArray, readBoolean, readInt, readNullOrUndefined, r
import Foreign.Index (readProp)
import Foreign.Object (Object)
import JS.BigInt (BigInt)
import Node.URL (URL)
import Prim.Row as Row
import Prim.RowList (class RowToList, Cons, Nil, RowList)
import Record (get)
@ -36,6 +37,10 @@ instance Serializable String where
serialize = unsafeToForeign
deserialize = lmap show <<< runExcept <<< readString
instance Serializable URL where
serialize = unsafeToForeign
deserialize = lmap show <<< runExcept <<< unsafeReadTagged "URL"
instance Serializable Int where
serialize = unsafeToForeign
deserialize = lmap show <<< runExcept <<< readInt