@@ -69,7 +69,7 @@ import Foreign.Index (readProp)
6969import Foreign.Object (Object)
7070import Foreign.Object as Object
7171import JS.BigInt (BigInt)
72−import JS.BigInt (fromInt, fromNumber, fromString) as BigInt
72+import JS.BigInt (fromInt, fromNumber, fromString, toString) as BigInt
7373import Partial.Unsafe (unsafeCrashWith)
7474import Prim.Row as Row
7575import Prim.RowList (class RowToList, Cons, Nil, RowList)
@@ -549,6 +549,8 @@ instance (WriteForeign a) ⇒ WriteForeign (Map String a) where
549549 writeImpl = foldrWithIndex Object.insert Object.empty >>> writeImpl
550550else instance (WriteForeign a) ⇒ WriteForeign (Map Int a) where
551551 writeImpl = foldrWithIndex (show >>> Object.insert) Object.empty >>> writeImpl
552+else instance (WriteForeign a) ⇒ WriteForeign (Map BigInt a) where
553+ writeImpl = foldrWithIndex (BigInt.toString >>> Object.insert) Object.empty >>> writeImpl
552554else instance (Newtype nt key, WriteForeign (Map key value)) ⇒ WriteForeign (Map nt value) where
553555 writeImpl = (unsafeCoerce ∷ (_ → Map key value)) >>> writeImpl
554556
@@ -556,6 +558,8 @@ instance (ReadForeign a) ⇒ ReadForeign (Map String a) where
556558 readImpl = (readImpl ∷ (_ → _ (Object a))) >>> map (foldrWithIndex Map.insert Map.empty)
557559else instance (ReadForeign a) ⇒ ReadForeign (Map Int a) where
558560 readImpl = (readImpl ∷ (_ → _ (Object a))) >>> map (foldrWithIndex (unsafeStringToInt >>> Map.insert) Map.empty)
561+else instance (ReadForeign a) ⇒ ReadForeign (Map BigInt a) where
562+ readImpl = (readImpl ∷ (_ → _ (Object a))) >>> map (foldrWithIndex (unsafeStringToBigInt >>> Map.insert) Map.empty)
559563else instance (Newtype nt key, ReadForeign (Map key value)) ⇒ ReadForeign (Map nt value) where
560564 readImpl = (readImpl ∷ (_ → _ (Map key value))) >>> map (unsafeCoerce ∷ (Map key value → Map nt value))
561565
@@ -619,6 +623,10 @@ unsafeStringToInt ∷ String → Int
619623unsafeStringToInt = Int.fromString >>>
620624 (fromMaybe' \_ → unsafeCrashWith "impossible")
621625
626+unsafeStringToBigInt ∷ String → BigInt
627+unsafeStringToBigInt = BigInt.fromString >>>
628+ (fromMaybe' \_ → unsafeCrashWith "impossible")
629+
622630sequenceCombining ∷
623631 ∀ f a.
624632 Monoid (f a) ⇒