json-alt-1.0.0: json-alt.cabal
-- Build information for the package.
name: json-alt
version: 1.0.0
synopsis: Union 'alternative' or Either that has untagged JSON encoding.
description: 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>
homepage: https://github.com/mgajda/json-autotype
license: BSD3
license-file: LICENSE
stability: stable
author: Michal J. Gajda
maintainer: simons@cryp.to
mjgajda@gmail.com
copyright: Copyright by Michal J. Gajda '2014-'2018
category: Data, Tools
build-type: Simple
extra-source-files: README.md changelog.md
cabal-version: >=1.10
bug-reports: https://github.com/mgajda/json-autotype/issues
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
source-repository head
type: git
location: https://github.com/mgajda/json-autotype.git
library
exposed-modules: Data.Aeson.AutoType.Alternative
other-extensions: TemplateHaskell,
ScopedTypeVariables,
OverloadedStrings,
FlexibleInstances,
MultiParamTypeClasses,
DeriveDataTypeable,
DeriveGeneric,
RecordWildCards
build-depends: base >=4.3 && <5,
aeson >=1.2.1 && <1.5
default-language: Haskell2010