Module
Simple.JSON
- Package
- purescript-simple-json
- Repository
- justinwoo/purescript-simple-json
#readJSON Source
readJSON :: forall a. ReadForeign a => String -> Either MultipleErrors a
Read a JSON string to a type a
while returning a MultipleErrors
if the
parsing failed.
#readJSON' Source
readJSON' :: forall a. ReadForeign a => String -> F a
Read a JSON string to a type a
using F a
. Useful with record types.
#writeJSON Source
writeJSON :: forall a. WriteForeign a => a -> String
Write a JSON string from a type a
.
#write Source
write :: forall a. WriteForeign a => a -> Foreign
#read Source
read :: forall a. ReadForeign a => Foreign -> Either MultipleErrors a
#ReadForeign Source
class ReadForeign a where
A class for reading foreign values to a type
Members
Instances
ReadForeign Foreign
ReadForeign Char
ReadForeign Number
ReadForeign Int
ReadForeign String
ReadForeign Boolean
(ReadForeign a) => ReadForeign (Array a)
(ReadForeign a) => ReadForeign (Maybe a)
(ReadForeign a) => ReadForeign (Nullable a)
(ReadForeign a) => ReadForeign (StrMap a)
(RowToList fields fieldList, ReadForeignFields fieldList () fields) => ReadForeign (Record fields)
(RowToList variants rl, ReadForeignVariant rl variants) => ReadForeign (Variant variants)
#ReadForeignFields Source
class ReadForeignFields (xs :: RowList) (from :: Row Type) (to :: Row Type) | xs -> from to where
A class for reading foreign values from properties
Members
Instances
(IsSymbol name, ReadForeign ty, ReadForeignFields tail from from', RowLacks name from', RowCons name ty from' to) => ReadForeignFields (Cons name ty tail) from to
ReadForeignFields Nil () ()
#ReadForeignVariant Source
class ReadForeignVariant (xs :: RowList) (row :: Row Type) | xs -> row where
Members
readVariantImpl :: RLProxy xs -> Foreign -> F (Variant row)
Instances
ReadForeignVariant Nil trash
(IsSymbol name, ReadForeign ty, RowCons name ty trash row, ReadForeignVariant tail row) => ReadForeignVariant (Cons name ty tail) row
#WriteForeign Source
class WriteForeign a where
A class for writing a value into JSON need to do this intelligently using Foreign probably, because of null and undefined whatever
Members
Instances
WriteForeign Foreign
WriteForeign String
WriteForeign Int
WriteForeign Char
WriteForeign Number
WriteForeign Boolean
(WriteForeign a) => WriteForeign (Array a)
(WriteForeign a) => WriteForeign (Maybe a)
(WriteForeign a) => WriteForeign (Nullable a)
(WriteForeign a) => WriteForeign (StrMap a)
(RowToList row rl, WriteForeignFields rl row () to) => WriteForeign (Record row)
(RowToList row rl, WriteForeignVariant rl row) => WriteForeign (Variant row)
#WriteForeignFields Source
class WriteForeignFields (rl :: RowList) row (from :: Row Type) (to :: Row Type) | rl -> row from to where
Members
writeImplFields :: forall g. g rl -> Record row -> Builder (Record from) (Record to)
Instances
(IsSymbol name, WriteForeign ty, WriteForeignFields tail row from from', RowCons name ty whatever row, RowLacks name from', RowCons name Foreign from' to) => WriteForeignFields (Cons name ty tail) row from to
WriteForeignFields Nil row () ()
#WriteForeignVariant Source
class WriteForeignVariant (rl :: RowList) (row :: Row Type) | rl -> row where
Members
writeVariantImpl :: forall g. g rl -> Variant row -> Foreign
Instances
WriteForeignVariant Nil ()
(IsSymbol name, WriteForeign ty, RowCons name ty subRow row, WriteForeignVariant tail subRow) => WriteForeignVariant (Cons name ty tail) row
- Modules
- Simple.
JSON