softwarefactory-project / dhall-ansible

Ansible definitions with Dhall
Apache License 2.0
66 stars 13 forks source link

build fails when lifting the limit on base < 15 #27

Open andrewufrank opened 1 week ago

andrewufrank commented 1 week ago

I wanted to try a conversion of ansible to dhall, but failed to install. could you update the package to run with current ghc? base < 15 is low and when I lifted it I got an error

Main.hs:160:40: error: [GHC-83865]
    • Couldn't match type: Data.Aeson.KeyMap.KeyMap Value
                     with: HashMap k0 Value
      Expected: HashMap k0 Value
        Actual: Object
    • In the first argument of ‘HM.elems’, namely ‘v’
      In the expression: HM.elems v
      In the expression:
        case HM.elems v of
          [v']
            -> case v' of
                 Object obj -> do ...
                 _ -> empty
          _ -> empty
    |
160 |   parseJSON (Object v) = case HM.elems v of
    |                                        ^

I would also appreciate I if you could give an example how to use it with a compiled and installed version of the code...

Thank you andrew

TristanCacqueray commented 1 week ago

Thank you for the bug report, the error is caused by the version 2 of the json library (aeson). This should be fixed by #28, I also fixed support for the latest ansible-doc. Here is what I ran to update the bindings:

# Update the binding:
ansible-collection-to-dhall$ cabal run ansible-collection-to-dhall -- --ansible_doc $(which ansible-doc) --builtin --output ../Ansible/
# Reformat and regen the packages:
dhall-ansible$ shake # or use `podman run -it --rm -v $(pwd):/data:Z quay.io/software-factory/shake-factory`