Foreign.ReadWrite
- Package
- purescript-foreign-readwrite
- Repository
- artemisSystem/purescript-foreign-readwrite
#ReadForeign Source
class ReadForeign a where
Members
readForeign :: forall m. Monad m => Foreign -> FT m a
Instances
ReadForeign Foreign
ReadForeign Void
ReadForeign Unit
ReadForeign String
ReadForeign Char
ReadForeign Boolean
ReadForeign Number
ReadForeign Int
(ReadForeign a) => ReadForeign (Additive a)
(ReadForeign a) => ReadForeign (Multiplicative a)
(ReadForeign a) => ReadForeign (Conj a)
(ReadForeign a) => ReadForeign (Disj a)
(ReadForeign (c a a)) => ReadForeign (Endo c a)
(ReadForeign a) => ReadForeign (First a)
(ReadForeign a) => ReadForeign (Last a)
(ReadForeign a) => ReadForeign (First a)
(ReadForeign a) => ReadForeign (Last a)
(ReadForeign a) => ReadForeign (Identity a)
(ReadForeign a) => ReadForeign (Array a)
(ReadForeign a) => ReadForeign (NonEmptyArray a)
(ReadForeign a) => ReadForeign (Object a)
(ReadForeign a) => ReadForeign (Maybe a)
(ReadForeign defaultType, Reflectable default defaultType) => ReadForeign (Default default defaultType)
(RowToList row rl, ReadForeignRecord rl row) => ReadForeign (Record row)
If any extra keys exist in the foreign object being read, it will result in an error. Preserves key order.
(RowToList row rl, ReadForeignRecord rl row) => ReadForeign (IncompleteRecord (Record row))
Does not error if extra keys exist in the foreign object being read. Preserves key order.
#WriteForeign Source
class WriteForeign a where
Members
writeForeign :: a -> Foreign
Instances
WriteForeign Foreign
WriteForeign Void
WriteForeign Unit
Writes
undefined
WriteForeign String
WriteForeign Char
WriteForeign Boolean
WriteForeign Number
WriteForeign Int
(WriteForeign a) => WriteForeign (Additive a)
(WriteForeign a) => WriteForeign (Multiplicative a)
(WriteForeign a) => WriteForeign (Conj a)
(WriteForeign a) => WriteForeign (Disj a)
(WriteForeign (c a a)) => WriteForeign (Endo c a)
(WriteForeign a) => WriteForeign (First a)
(WriteForeign a) => WriteForeign (Last a)
(WriteForeign a) => WriteForeign (First a)
(WriteForeign a) => WriteForeign (Last a)
(WriteForeign a) => WriteForeign (Identity a)
(WriteForeign a) => WriteForeign (Array a)
(WriteForeign a) => WriteForeign (NonEmptyArray a)
(WriteForeign a) => WriteForeign (Object a)
(WriteForeign a) => WriteForeign (Maybe a)
(WriteForeign defaultType, Eq defaultType, Reflectable default defaultType) => WriteForeign (Default default defaultType)
(RowToList row rl, WriteForeignRecord rl row) => WriteForeign (Record row)
Preserves key order.
#Default Source
newtype Default :: forall defaultType. defaultType -> Type -> Type
newtype Default default a
The ReadForeign
and WriteForeign
instances for Default
will
consider the type default
the default value and read/write it as
undefined
. So undefined
read into the type Default 0 Int
will be
the value Default 0
, and writing it back to foreign writes undefined
.
Constructors
Default a
Instances
Newtype (Default default a) _
Generic (Default default a) _
(Show a) => Show (Default default a)
(ReadForeign defaultType, Reflectable default defaultType) => ReadForeign (Default default defaultType)
(WriteForeign defaultType, Eq defaultType, Reflectable default defaultType) => WriteForeign (Default default defaultType)
#default Source
default :: forall default a. Reflectable default a => Default default a
The default value of a given type. For example, default :: Default 0 Int
has the value Default 0
#DefaultMonoid Source
type DefaultMonoid a = Default (MonoidProxy a) a
This uses Default
(with MonoidProxy
) to read/write mempty values when
encountering undefined
. See Default
for more info.
#IncompleteRecord Source
newtype IncompleteRecord r
Constructors
Instances
Newtype (IncompleteRecord r) _
Generic (IncompleteRecord r) _
(Show r) => Show (IncompleteRecord r)
(RowToList row rl, ReadForeignRecord rl row) => ReadForeign (IncompleteRecord (Record row))
Does not error if extra keys exist in the foreign object being read. Preserves key order.
#ReadForeignRecord Source
class ReadForeignRecord :: RowList Type -> Row Type -> Constraint
class ReadForeignRecord rl row | rl -> row where
Members
readForeignRecordImpl :: forall proxy m. Monad m => proxy rl -> Boolean -> Object Foreign -> FT m (Builder (Record ()) (Record row))
Instances
ReadForeignRecord Nil ()
(IsSymbol key, Cons key focus tail row, Lacks key tail, ReadForeignRecord rlTail tail, ReadForeign focus) => ReadForeignRecord (Cons key focus rlTail) row
#readForeignRecord Source
readForeignRecord :: forall proxy rl row m. Monad m => RowToList row rl => ReadForeignRecord rl row => proxy rl -> Boolean -> Foreign -> FT m (Record row)
#WriteForeignRecord Source
class WriteForeignRecord :: RowList Type -> Row Type -> Constraint
class WriteForeignRecord rl row | rl -> row where
Members
writeForeignRecordImpl :: forall proxy. proxy rl -> Record row -> Object Foreign
Instances
WriteForeignRecord Nil ()
(IsSymbol key, Cons key focus tail row, Lacks key tail, WriteForeignRecord rlTail tail, WriteForeign focus) => WriteForeignRecord (Cons key focus rlTail) row
#writeForeignRecord Source
writeForeignRecord :: forall proxy rl row. WriteForeignRecord rl row => proxy rl -> Record row -> Foreign
- Modules
- Foreign.
ReadWrite
Matches
undefined