| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Saison.Decoding.Examples
Description
Various examples of using saison.
SomeValue
SomeValue is a dummy object.
Decoding it from a JSON value always succeeds,
but we don't preserve any information about that value.
If we decode a list [, we can then SomeValue]count values in it.
This is an extreme example where saison approach shines.
instanceFromTokensSomeValuewherefromTokens= \toks ->SomeValue<$skipValuetoks
Constructors
| SomeValue |
Instances
| Eq SomeValue Source # | |
| Ord SomeValue Source # | |
| Show SomeValue Source # | |
| NFData SomeValue Source # | |
Defined in Saison.Decoding.Examples | |
| FromJSON SomeValue Source # | |
Defined in Saison.Decoding.Examples | |
| ToJSON SomeValue Source # | |
Defined in Saison.Decoding.Examples Methods toEncoding :: SomeValue -> Encoding toJSONList :: [SomeValue] -> Value toEncodingList :: [SomeValue] -> Encoding | |
| FromTokens SomeValue Source # | |
Laureates
is a wrapper around a list of elements.Laureates a
The laureate.json database is a json of form
{
"laureates": [
...
]
}
This type parses the outer layer.
Constructors
| Laureates | |
Fields
| |
Instances
| Eq a => Eq (Laureates a) Source # | |
| Show a => Show (Laureates a) Source # | |
| NFData a => NFData (Laureates a) Source # | |
Defined in Saison.Decoding.Examples | |
| FromJSON a => FromJSON (Laureates a) Source # | |
Defined in Saison.Decoding.Examples | |
| FromTokens a => FromTokens (Laureates a) Source # | This instance differs from
|
Almost complete information about a laureate. We skip "prizes" information.
Look at the implementaton of FromJSON and FromTokens instances,
they don't look that much different.
Constructors
| Laureate | |
Fields | |