Skip to content

overlapping instances for [Char] #351

Closed
@phadej

Description

@phadej

While trying to compile bower-json-0.7.0.0 with current bos/master: I get an error:

    bower-json/src/Web/Bower/PackageMeta/Internal.hs:318:26:
        Overlapping instances for Aeson.ToJSON [a]
          arising from a use of ‘.=’
        Matching instances:
          instance [overlappable] Aeson.ToJSON a => Aeson.ToJSON [a]
            -- Defined in ‘aeson-0.11.0.0:Data.Aeson.Types.Instances’
          instance Aeson.ToJSON [Char]
            -- Defined in ‘aeson-0.11.0.0:Data.Aeson.Types.Instances’

Used stack.yaml:

resolver: lts-5.1
packages:
- '.'
- location:
    git: git@github.com:bos/aeson.git
    commit: fdb867286b6b4fd5afc703718b0a30dadc300db2
extra-deps:
- fail-4.9.0.0

It compiles fine with aeson versions in LTS-4.2 and LTS-5.1 though. I have no idea what happened lately in master.


Anyway, my proposal is to remove overlapping FromJSON and ToJSON instances, by the same trick as with Read and Show, i.e. introducing parseJSONList and listToJSON functions. They would have default implementations, so this is not breaking change. With #349 fixed, there won't be other overlapping instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions