json-alt: Union 'alternative' or Either that has untagged JSON encoding.
Parsing JSON with Aeson often requires decoding fields that have more than one Haskell type.
So we have: ``` data a :|: b = AltLeft a | AltLeft b printIt = print . (fromJSON :: ByteString -> Int :|: Bool) main = do printIt "1" -- AltLeft 1 printIt "true" -- AltRight True printIt "null" -- errors! ``` To generate types for larger JSON documents, you might use `json-autotype`.
This is separate package so that users do not have to keep `json-autotype` as runtime dependency.
See https://github.com/mgajda/json-autotype
[Skip to Readme]
Downloads
- json-alt-1.0.0.tar.gz [browse] (Cabal source package)
 - Package description (as included in the package)
 
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
| Versions [RSS] | 1.0.0 | 
|---|---|
| Change log | changelog.md | 
| Dependencies | aeson (>=1.2.1 && <1.5), base (>=4.3 && <5) [details] | 
| Tested with | ghc ==7.6.1, ghc ==7.6.2, ghc ==7.6.3, ghc ==7.8.1, ghc ==7.8.2, ghc ==7.8.3, ghc ==7.8.4, ghc ==7.10.1, ghc ==7.10.2, ghc ==7.10.3, ghc ==8.0.1, ghc ==8.0.2, ghc ==8.2.2, ghc ==8.4.1, ghc ==8.4.2, ghc ==8.4.3, ghc ==8.4.4, ghc ==8.6.2, ghc ==8.6.1 | 
| License | BSD-3-Clause | 
| Copyright | Copyright by Michal J. Gajda '2014-'2018 | 
| Author | Michal J. Gajda | 
| Maintainer | simons@cryp.to mjgajda@gmail.com | 
| Category | Data, Tools | 
| Home page | https://github.com/mgajda/json-autotype | 
| Bug tracker | https://github.com/mgajda/json-autotype/issues | 
| Source repo | head: git clone https://github.com/mgajda/json-autotype.git | 
| Uploaded | by MichalGajda at 2018-11-28T13:45:17Z | 
| Distributions | NixOS:1.0.0 | 
| Reverse Dependencies | 4 direct, 4 indirect [details] | 
| Downloads | 1251 total (3 in the last 30 days) | 
| Rating | (no votes yet) [estimated by Bayesian average] | 
| Your Rating | |
| Status | Docs uploaded by user Build status unknown [no reports yet]  |