@@ -55,6 +55,8 @@ import Data.Maybe (Maybe(..), fromMaybe, fromMaybe', maybe)
5555import Data.Newtype (class Newtype, unwrap, wrap)
5656import Data.Nullable (Nullable, toMaybe, toNullable)
5757import Data.Number as Number
58+import Data.Set (Set)
59+import Data.Set as Set
5860import Data.String.NonEmpty.Internal (NonEmptyString)
5961import Data.String.NonEmpty.Internal as NonEmptyString
6062import Data.Symbol (class IsSymbol, reflectSymbol)
@@ -575,6 +577,13 @@ else instance (ReadForeign a) ⇒ ReadForeign (Map BigInt a) where
575577else instance (Newtype nt key, ReadForeign (Map key value)) ⇒ ReadForeign (Map nt value) where
576578 readImpl = (readImpl ∷ (_ → _ (Map key value))) >>> map (unsafeCoerce ∷ (Map key value → Map nt value))
577579
580+-- Set instances
581+instance (WriteForeign a) ⇒ WriteForeign (Set a) where
582+ writeImpl set = writeImpl (Set.toUnfoldable set :: Array a)
583+
584+instance (Ord a, ReadForeign a) ⇒ ReadForeign (Set a) where
585+ readImpl f = Set.fromFoldable <$> (readImpl f :: F (Array a))
586+
578587-- Date instances
579588instance WriteForeign JSDate where
580589 writeImpl = JSDate.toISOString >>> unsafePerformEffect >>> writeImpl