NorfairKing / autodocodec

self(auto)- documenting encoders and decoders
MIT License
121 stars 20 forks source link

aeson-2.2 incompatibity #42

Closed locallycompact closed 1 year ago

locallycompact commented 1 year ago
autodocodec> [5 of 9] Compiling Autodocodec.Aeson.Encode ( src/Autodocodec/Aeson/Encode.hs, dist/build/Autodocodec/Aeson/Encode.o, dist/build/Autodocodec/Aeson/Encode.dyn_o )
autodocodec> src/Autodocodec/Aeson/Encode.hs:40:25: error: [GHC-83865]
autodocodec>     • Couldn't match expected type ‘JSON.Value’
autodocodec>                   with actual type ‘f2 v -> JSON.Value’
autodocodec>     • Probable cause: ‘JSON.liftToJSON’ is applied to too few arguments
autodocodec>       In the expression:
autodocodec>         JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>       In a \case alternative:
autodocodec>           HashMapCodec c
autodocodec>             -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>       In the expression:
autodocodec>         \case
autodocodec>           NullCodec -> JSON.Null
autodocodec>           BoolCodec _ -> toJSON (a :: Bool)
autodocodec>           StringCodec _ -> toJSON (a :: Text)
autodocodec>           NumberCodec _ _ -> toJSON (a :: Scientific)
autodocodec>           ArrayOfCodec _ c -> toJSON (fmap (`go` c) (a :: Vector _))
autodocodec>           ObjectOfCodec _ oc -> JSON.Object (goObject a oc)
autodocodec>           HashMapCodec c
autodocodec>             -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>           MapCodec c
autodocodec>             -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>           ValueCodec -> (a :: JSON.Value)
autodocodec>           EqCodec value c -> go value c
autodocodec>           BimapCodec _ g c -> go (g a) c
autodocodec>           EitherCodec _ c1 c2
autodocodec>             -> case (a :: Either _ _) of
autodocodec>                  Left a1 -> go a1 c1
autodocodec>                  Right a2 -> go a2 c2
autodocodec>           CommentCodec _ c -> go a c
autodocodec>           ReferenceCodec _ c -> go a c
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Encode.hs:40:20)
autodocodec>    |
autodocodec> 40 |       HashMapCodec c -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:40:42: error: [GHC-83865]
autodocodec>     • Couldn't match type ‘JSON.Value’ with ‘Bool’
autodocodec>       Expected: v -> Bool
autodocodec>         Actual: v -> JSON.Value
autodocodec>     • In the first argument of ‘JSON.liftToJSON’, namely ‘(`go` c)’
autodocodec>       In the expression:
autodocodec>         JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>       In a \case alternative:
autodocodec>           HashMapCodec c
autodocodec>             -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>    |
autodocodec> 40 |       HashMapCodec c -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>    |                                          ^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:40:70: error: [GHC-83865]
autodocodec>     • Couldn't match expected type: [v] -> JSON.Value
autodocodec>                   with actual type: HashMap k v
autodocodec>     • In the third argument of ‘JSON.liftToJSON’, namely
autodocodec>         ‘(a :: HashMap _ _)’
autodocodec>       In the expression:
autodocodec>         JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>       In a \case alternative:
autodocodec>           HashMapCodec c
autodocodec>             -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Encode.hs:40:20)
autodocodec>    |
autodocodec> 40 |       HashMapCodec c -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>    |                                                                      ^^^^^^^^^^^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:41:21: error: [GHC-83865]
autodocodec>     • Couldn't match expected type ‘JSON.Value’
autodocodec>                   with actual type ‘f3 v -> JSON.Value’
autodocodec>     • Probable cause: ‘JSON.liftToJSON’ is applied to too few arguments
autodocodec>       In the expression:
autodocodec>         JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>       In a \case alternative:
autodocodec>           MapCodec c
autodocodec>             -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>       In the expression:
autodocodec>         \case
autodocodec>           NullCodec -> JSON.Null
autodocodec>           BoolCodec _ -> toJSON (a :: Bool)
autodocodec>           StringCodec _ -> toJSON (a :: Text)
autodocodec>           NumberCodec _ _ -> toJSON (a :: Scientific)
autodocodec>           ArrayOfCodec _ c -> toJSON (fmap (`go` c) (a :: Vector _))
autodocodec>           ObjectOfCodec _ oc -> JSON.Object (goObject a oc)
autodocodec>           HashMapCodec c
autodocodec>             -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>           MapCodec c
autodocodec>             -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>           ValueCodec -> (a :: JSON.Value)
autodocodec>           EqCodec value c -> go value c
autodocodec>           BimapCodec _ g c -> go (g a) c
autodocodec>           EitherCodec _ c1 c2
autodocodec>             -> case (a :: Either _ _) of
autodocodec>                  Left a1 -> go a1 c1
autodocodec>                  Right a2 -> go a2 c2
autodocodec>           CommentCodec _ c -> go a c
autodocodec>           ReferenceCodec _ c -> go a c
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Encode.hs:41:16)
autodocodec>    |
autodocodec> 41 |       MapCodec c -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:41:38: error: [GHC-83865]
autodocodec>     • Couldn't match type ‘JSON.Value’ with ‘Bool’
autodocodec>       Expected: v -> Bool
autodocodec>         Actual: v -> JSON.Value
autodocodec>     • In the first argument of ‘JSON.liftToJSON’, namely ‘(`go` c)’
autodocodec>       In the expression:
autodocodec>         JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>       In a \case alternative:
autodocodec>           MapCodec c
autodocodec>             -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>    |
autodocodec> 41 |       MapCodec c -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>    |                                      ^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:41:66: error: [GHC-83865]
autodocodec>     • Couldn't match expected type: [v] -> JSON.Value
autodocodec>                   with actual type: Map k v
autodocodec>     • In the third argument of ‘JSON.liftToJSON’, namely
autodocodec>         ‘(a :: Map _ _)’
autodocodec>       In the expression:
autodocodec>         JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>       In a \case alternative:
autodocodec>           MapCodec c
autodocodec>             -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Encode.hs:41:16)
autodocodec>    |
autodocodec> 41 |       MapCodec c -> JSON.liftToJSON (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>    |                                                                  ^^^^^^^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:89:25: error: [GHC-83865]
autodocodec>     • Couldn't match type: f0 v -> JSON.Encoding
autodocodec>                      with: JSON.Encoding' JSON.Value
autodocodec>       Expected: JSON.Encoding
autodocodec>         Actual: f0 v -> JSON.Encoding
autodocodec>     • Probable cause: ‘JSON.liftToEncoding’ is applied to too few arguments
autodocodec>       In the expression:
autodocodec>         JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>       In a \case alternative:
autodocodec>           HashMapCodec c
autodocodec>             -> JSON.liftToEncoding
autodocodec>                  (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>       In the expression:
autodocodec>         \case
autodocodec>           NullCodec -> JSON.null_
autodocodec>           BoolCodec _ -> JSON.bool (a :: Bool)
autodocodec>           StringCodec _ -> JSON.text (a :: Text)
autodocodec>           NumberCodec _ _ -> JSON.scientific (a :: Scientific)
autodocodec>           ArrayOfCodec _ c -> JSON.list (`go` c) (V.toList (a :: Vector _))
autodocodec>           ObjectOfCodec _ oc -> JSON.pairs (goObject a oc)
autodocodec>           HashMapCodec c
autodocodec>             -> JSON.liftToEncoding
autodocodec>                  (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>           MapCodec c
autodocodec>             -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>           ValueCodec -> JSON.value (a :: JSON.Value)
autodocodec>           EqCodec value c -> go value c
autodocodec>           BimapCodec _ g c -> go (g a) c
autodocodec>           EitherCodec _ c1 c2
autodocodec>             -> case (a :: Either _ _) of
autodocodec>                  Left a1 -> go a1 c1
autodocodec>                  Right a2 -> go a2 c2
autodocodec>           CommentCodec _ c -> go a c
autodocodec>           ReferenceCodec _ c -> go a c
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Encode.hs:89:20)
autodocodec>    |
autodocodec> 89 |       HashMapCodec c -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:89:46: error: [GHC-83865]
autodocodec>     • Couldn't match type ‘JSON.Encoding' JSON.Value’ with ‘Bool’
autodocodec>       Expected: v -> Bool
autodocodec>         Actual: v -> JSON.Encoding
autodocodec>     • In the first argument of ‘JSON.liftToEncoding’, namely ‘(`go` c)’
autodocodec>       In the expression:
autodocodec>         JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>       In a \case alternative:
autodocodec>           HashMapCodec c
autodocodec>             -> JSON.liftToEncoding
autodocodec>                  (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>    |
autodocodec> 89 |       HashMapCodec c -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>    |                                              ^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:89:74: error: [GHC-83865]
autodocodec>     • Couldn't match expected type: [v] -> JSON.Encoding
autodocodec>                   with actual type: HashMap k v
autodocodec>     • In the third argument of ‘JSON.liftToEncoding’, namely
autodocodec>         ‘(a :: HashMap _ _)’
autodocodec>       In the expression:
autodocodec>         JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>       In a \case alternative:
autodocodec>           HashMapCodec c
autodocodec>             -> JSON.liftToEncoding
autodocodec>                  (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Encode.hs:89:20)
autodocodec>    |
autodocodec> 89 |       HashMapCodec c -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>    |                                                                          ^^^^^^^^^^^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:90:21: error: [GHC-83865]
autodocodec>     • Couldn't match type: f1 v -> JSON.Encoding
autodocodec>                      with: JSON.Encoding' JSON.Value
autodocodec>       Expected: JSON.Encoding
autodocodec>         Actual: f1 v -> JSON.Encoding
autodocodec>     • Probable cause: ‘JSON.liftToEncoding’ is applied to too few arguments
autodocodec>       In the expression:
autodocodec>         JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>       In a \case alternative:
autodocodec>           MapCodec c
autodocodec>             -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>       In the expression:
autodocodec>         \case
autodocodec>           NullCodec -> JSON.null_
autodocodec>           BoolCodec _ -> JSON.bool (a :: Bool)
autodocodec>           StringCodec _ -> JSON.text (a :: Text)
autodocodec>           NumberCodec _ _ -> JSON.scientific (a :: Scientific)
autodocodec>           ArrayOfCodec _ c -> JSON.list (`go` c) (V.toList (a :: Vector _))
autodocodec>           ObjectOfCodec _ oc -> JSON.pairs (goObject a oc)
autodocodec>           HashMapCodec c
autodocodec>             -> JSON.liftToEncoding
autodocodec>                  (`go` c) (`go` listCodec c) (a :: HashMap _ _)
autodocodec>           MapCodec c
autodocodec>             -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>           ValueCodec -> JSON.value (a :: JSON.Value)
autodocodec>           EqCodec value c -> go value c
autodocodec>           BimapCodec _ g c -> go (g a) c
autodocodec>           EitherCodec _ c1 c2
autodocodec>             -> case (a :: Either _ _) of
autodocodec>                  Left a1 -> go a1 c1
autodocodec>                  Right a2 -> go a2 c2
autodocodec>           CommentCodec _ c -> go a c
autodocodec>           ReferenceCodec _ c -> go a c
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Encode.hs:90:16)
autodocodec>    |
autodocodec> 90 |       MapCodec c -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:90:42: error: [GHC-83865]
autodocodec>     • Couldn't match type ‘JSON.Encoding' JSON.Value’ with ‘Bool’
autodocodec>       Expected: v -> Bool
autodocodec>         Actual: v -> JSON.Encoding
autodocodec>     • In the first argument of ‘JSON.liftToEncoding’, namely ‘(`go` c)’
autodocodec>       In the expression:
autodocodec>         JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>       In a \case alternative:
autodocodec>           MapCodec c
autodocodec>             -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>    |
autodocodec> 90 |       MapCodec c -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>    |                                          ^^^^^^
autodocodec> src/Autodocodec/Aeson/Encode.hs:90:70: error: [GHC-83865]
autodocodec>     • Couldn't match expected type: [v] -> JSON.Encoding
autodocodec>                   with actual type: Map k v
autodocodec>     • In the third argument of ‘JSON.liftToEncoding’, namely
autodocodec>         ‘(a :: Map _ _)’
autodocodec>       In the expression:
autodocodec>         JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>       In a \case alternative:
autodocodec>           MapCodec c
autodocodec>             -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Encode.hs:90:16)
autodocodec>    |
autodocodec> 90 |       MapCodec c -> JSON.liftToEncoding (`go` c) (`go` listCodec c) (a :: Map _ _)
autodocodec>    |                                                                      ^^^^^^^^^^^^
autodocodec> [6 of 9] Compiling Autodocodec.Aeson.Decode ( src/Autodocodec/Aeson/Decode.hs, dist/build/Autodocodec/Aeson/Decode.o, dist/build/Autodocodec/Aeson/Decode.dyn_o )
autodocodec> src/Autodocodec/Aeson/Decode.hs:79:25: error: [GHC-83865]
autodocodec>     • Couldn't match expected type: Parser (HashMap w1 w2)
autodocodec>                   with actual type: Value -> Parser (f0 [v])
autodocodec>     • Probable cause: ‘liftParseJSON’ is applied to too few arguments
autodocodec>       In the expression:
autodocodec>           liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>             Parser (HashMap _ _)
autodocodec>       In a \case alternative:
autodocodec>           HashMapCodec c
autodocodec>             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>                  Parser (HashMap _ _)
autodocodec>       In the expression:
autodocodec>         \case
autodocodec>           NullCodec
autodocodec>             -> case (value :: Value) of
autodocodec>                  Null -> pure ()
autodocodec>                  _ -> typeMismatch "Null" value
autodocodec>           BoolCodec mname
autodocodec>             -> case mname of
autodocodec>                  Nothing -> parseJSON value
autodocodec>                  Just name -> withBool (T.unpack name) pure value
autodocodec>           StringCodec mname
autodocodec>             -> case mname of
autodocodec>                  Nothing -> parseJSON value
autodocodec>                  Just name -> withText (T.unpack name) pure value
autodocodec>           NumberCodec mname mBounds
autodocodec>             -> (\ f
autodocodec>                   -> case mname of
autodocodec>                        Nothing -> parseJSON value >>= f
autodocodec>                        Just name -> withScientific (T.unpack name) f value)
autodocodec>                  (\ s
autodocodec>                     -> case maybe Right checkNumberBounds mBounds s of
autodocodec>                          Left err -> fail err
autodocodec>                          Right s' -> pure s')
autodocodec>           ArrayOfCodec mname c
autodocodec>             -> (\ f
autodocodec>                   -> case mname of
autodocodec>                        Nothing -> parseJSON value >>= f
autodocodec>                        Just name -> withArray (T.unpack name) f value)
autodocodec>                  (\ vector
autodocodec>                     -> forM
autodocodec>                          (V.indexed (vector :: Vector Value))
autodocodec>                          (\ (ix, v) -> go v c JSON.<?> Index ix))
autodocodec>           ObjectOfCodec mname c
autodocodec>             -> (\ f
autodocodec>                   -> case mname of
autodocodec>                        Nothing -> parseJSON value >>= f
autodocodec>                        Just name -> withObject (T.unpack name) f value)
autodocodec>                  (\ object_ -> (`go` c) (object_ :: Object))
autodocodec>           HashMapCodec c
autodocodec>             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>                  Parser (HashMap _ _)
autodocodec>           MapCodec c
autodocodec>             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>                  Parser (Map _ _)
autodocodec>           ValueCodec -> pure (value :: Value)
autodocodec>           EqCodec expected c
autodocodec>             -> do actual <- go value c
autodocodec>                   if expected == actual then pure actual else fail $ unwords ...
autodocodec>           BimapCodec f _ c
autodocodec>             -> do old <- go value c
autodocodec>                   case f old of
autodocodec>                     Left err -> ...
autodocodec>                     Right new -> ...
autodocodec>           EitherCodec u c1 c2
autodocodec>             -> let
autodocodec>                  leftParser v = ...
autodocodec>                  ....
autodocodec>                in
autodocodec>                  case u of
autodocodec>                    PossiblyJointUnion -> ...
autodocodec>                    DisjointUnion -> ...
autodocodec>           DiscriminatedUnionCodec propertyName _ m
autodocodec>             -> do discriminatorValue <- (value :: Object)
autodocodec>                                           .: Compat.toKey propertyName
autodocodec>                   case HashMap.lookup discriminatorValue m of
autodocodec>                     Nothing -> ...
autodocodec>                     Just (_, c) -> ...
autodocodec>           CommentCodec _ c -> go value c
autodocodec>           ReferenceCodec _ c -> go value c
autodocodec>           RequiredKeyCodec k c _
autodocodec>             -> do valueAtKey <- (value :: Object) .: Compat.toKey k
autodocodec>                   go valueAtKey c JSON.<?> Key (Compat.toKey k)
autodocodec>           OptionalKeyCodec k c _
autodocodec>             -> do let ...
autodocodec>                   forM mValueAtKey $ \ valueAtKey -> ...
autodocodec>           OptionalKeyWithDefaultCodec k c defaultValue _
autodocodec>             -> do let ...
autodocodec>                   case mValueAtKey of
autodocodec>                     Nothing -> ...
autodocodec>                     Just valueAtKey -> ...
autodocodec>           OptionalKeyWithOmittedDefaultCodec k c defaultValue mDoc
autodocodec>             -> go value $ OptionalKeyWithDefaultCodec k c defaultValue mDoc
autodocodec>           PureCodec a -> pure a
autodocodec>           ApCodec ocf oca
autodocodec>             -> go (value :: Object) ocf <*> go (value :: Object) oca
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Decode.hs:79:20)
autodocodec>    |
autodocodec> 79 |       HashMapCodec c -> liftParseJSON (`go` c) (`go` listCodec c) value :: JSON.Parser (HashMap _ _)
autodocodec>    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
autodocodec> src/Autodocodec/Aeson/Decode.hs:79:40: error: [GHC-83865]
autodocodec>     • Couldn't match expected type: Maybe [v]
autodocodec>                   with actual type: Value -> Parser v
autodocodec>     • In the first argument of ‘liftParseJSON’, namely ‘(`go` c)’
autodocodec>       In the expression:
autodocodec>           liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>             Parser (HashMap _ _)
autodocodec>       In a \case alternative:
autodocodec>           HashMapCodec c
autodocodec>             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>                  Parser (HashMap _ _)
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Decode.hs:79:20)
autodocodec>    |
autodocodec> 79 |       HashMapCodec c -> liftParseJSON (`go` c) (`go` listCodec c) value :: JSON.Parser (HashMap _ _)
autodocodec>    |                                        ^^^^^^
autodocodec> src/Autodocodec/Aeson/Decode.hs:79:67: error: [GHC-83865]
autodocodec>     • Couldn't match type ‘Value’ with ‘Value -> Parser [[v]]’
autodocodec>       Expected: Value -> Parser [[v]]
autodocodec>         Actual: context1
autodocodec>     • In the third argument of ‘liftParseJSON’, namely ‘value’
autodocodec>       In the expression:
autodocodec>           liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>             Parser (HashMap _ _)
autodocodec>       In a \case alternative:
autodocodec>           HashMapCodec c
autodocodec>             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>                  Parser (HashMap _ _)
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Decode.hs:79:20)
autodocodec>    |
autodocodec> 79 |       HashMapCodec c -> liftParseJSON (`go` c) (`go` listCodec c) value :: JSON.Parser (HashMap _ _)
autodocodec>    |                                                                   ^^^^^
autodocodec> src/Autodocodec/Aeson/Decode.hs:80:21: error: [GHC-83865]
autodocodec>     • Couldn't match expected type: Parser (Map w1 w2)
autodocodec>                   with actual type: Value -> Parser (f1 [v])
autodocodec>     • Probable cause: ‘liftParseJSON’ is applied to too few arguments
autodocodec>       In the expression:
autodocodec>           liftParseJSON (`go` c) (`go` listCodec c) value :: Parser (Map _ _)
autodocodec>       In a \case alternative:
autodocodec>           MapCodec c
autodocodec>             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>                  Parser (Map _ _)
autodocodec>       In the expression:
autodocodec>         \case
autodocodec>           NullCodec
autodocodec>             -> case (value :: Value) of
autodocodec>                  Null -> pure ()
autodocodec>                  _ -> typeMismatch "Null" value
autodocodec>           BoolCodec mname
autodocodec>             -> case mname of
autodocodec>                  Nothing -> parseJSON value
autodocodec>                  Just name -> withBool (T.unpack name) pure value
autodocodec>           StringCodec mname
autodocodec>             -> case mname of
autodocodec>                  Nothing -> parseJSON value
autodocodec>                  Just name -> withText (T.unpack name) pure value
autodocodec>           NumberCodec mname mBounds
autodocodec>             -> (\ f
autodocodec>                   -> case mname of
autodocodec>                        Nothing -> parseJSON value >>= f
autodocodec>                        Just name -> withScientific (T.unpack name) f value)
autodocodec>                  (\ s
autodocodec>                     -> case maybe Right checkNumberBounds mBounds s of
autodocodec>                          Left err -> fail err
autodocodec>                          Right s' -> pure s')
autodocodec>           ArrayOfCodec mname c
autodocodec>             -> (\ f
autodocodec>                   -> case mname of
autodocodec>                        Nothing -> parseJSON value >>= f
autodocodec>                        Just name -> withArray (T.unpack name) f value)
autodocodec>                  (\ vector
autodocodec>                     -> forM
autodocodec>                          (V.indexed (vector :: Vector Value))
autodocodec>                          (\ (ix, v) -> go v c JSON.<?> Index ix))
autodocodec>           ObjectOfCodec mname c
autodocodec>             -> (\ f
autodocodec>                   -> case mname of
autodocodec>                        Nothing -> parseJSON value >>= f
autodocodec>                        Just name -> withObject (T.unpack name) f value)
autodocodec>                  (\ object_ -> (`go` c) (object_ :: Object))
autodocodec>           HashMapCodec c
autodocodec>             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>                  Parser (HashMap _ _)
autodocodec>           MapCodec c
autodocodec>             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>                  Parser (Map _ _)
autodocodec>           ValueCodec -> pure (value :: Value)
autodocodec>           EqCodec expected c
autodocodec>             -> do actual <- go value c
autodocodec>                   if expected == actual then pure actual else fail $ unwords ...
autodocodec>           BimapCodec f _ c
autodocodec>             -> do old <- go value c
autodocodec>                   case f old of
autodocodec>                     Left err -> ...
autodocodec>                     Right new -> ...
autodocodec>           EitherCodec u c1 c2
autodocodec>             -> let
autodocodec>                  leftParser v = ...
autodocodec>                  ....
autodocodec>                in
autodocodec>                  case u of
autodocodec>                    PossiblyJointUnion -> ...
autodocodec>                    DisjointUnion -> ...
autodocodec>           DiscriminatedUnionCodec propertyName _ m
autodocodec>             -> do discriminatorValue <- (value :: Object)
autodocodec>                                           .: Compat.toKey propertyName
autodocodec>                   case HashMap.lookup discriminatorValue m of
autodocodec>                     Nothing -> ...
autodocodec>                     Just (_, c) -> ...
autodocodec>           CommentCodec _ c -> go value c
autodocodec>           ReferenceCodec _ c -> go value c
autodocodec>           RequiredKeyCodec k c _
autodocodec>             -> do valueAtKey <- (value :: Object) .: Compat.toKey k
autodocodec>                   go valueAtKey c JSON.<?> Key (Compat.toKey k)
autodocodec>           OptionalKeyCodec k c _
autodocodec>             -> do let ...
autodocodec>                   forM mValueAtKey $ \ valueAtKey -> ...
autodocodec>           OptionalKeyWithDefaultCodec k c defaultValue _
autodocodec>             -> do let ...
autodocodec>                   case mValueAtKey of
autodocodec>                     Nothing -> ...
autodocodec>                     Just valueAtKey -> ...
autodocodec>           OptionalKeyWithOmittedDefaultCodec k c defaultValue mDoc
autodocodec>             -> go value $ OptionalKeyWithDefaultCodec k c defaultValue mDoc
autodocodec>           PureCodec a -> pure a
autodocodec>           ApCodec ocf oca
autodocodec>             -> go (value :: Object) ocf <*> go (value :: Object) oca
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Decode.hs:80:16)
autodocodec>    |
autodocodec> 80 |       MapCodec c -> liftParseJSON (`go` c) (`go` listCodec c) value :: JSON.Parser (Map _ _)
autodocodec>    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
autodocodec> src/Autodocodec/Aeson/Decode.hs:80:36: error: [GHC-83865]
autodocodec>     • Couldn't match expected type: Maybe [v]
autodocodec>                   with actual type: Value -> Parser v
autodocodec>     • In the first argument of ‘liftParseJSON’, namely ‘(`go` c)’
autodocodec>       In the expression:
autodocodec>           liftParseJSON (`go` c) (`go` listCodec c) value :: Parser (Map _ _)
autodocodec>       In a \case alternative:
autodocodec>           MapCodec c
autodocodec>             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>                  Parser (Map _ _)
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Decode.hs:80:16)
autodocodec>    |
autodocodec> 80 |       MapCodec c -> liftParseJSON (`go` c) (`go` listCodec c) value :: JSON.Parser (Map _ _)
autodocodec>    |                                    ^^^^^^
autodocodec> src/Autodocodec/Aeson/Decode.hs:80:63: error: [GHC-83865]
autodocodec>     • Couldn't match type ‘Value’ with ‘Value -> Parser [[v]]’
autodocodec>       Expected: Value -> Parser [[v]]
autodocodec>         Actual: context1
autodocodec>     • In the third argument of ‘liftParseJSON’, namely ‘value’
autodocodec>       In the expression:
autodocodec>           liftParseJSON (`go` c) (`go` listCodec c) value :: Parser (Map _ _)
autodocodec>       In a \case alternative:
autodocodec>           MapCodec c
autodocodec>             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
autodocodec>                  Parser (Map _ _)
autodocodec>     • Relevant bindings include
autodocodec>         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Decode.hs:80:16)
autodocodec>    |
autodocodec> 80 |       MapCodec c -> liftParseJSON (`go` c) (`go` listCodec c) value :: JSON.Parser (Map _ _)
autodocodec>    |                                                               ^^^^^
autodocodec> [9 of 9] Compiling Paths_autodocodec ( dist/build/autogen/Paths_autodocodec.hs, dist/build/Paths_autodocodec.o, dist/build/Paths_autodocodec.dyn_o )
error: builder for '/nix/store/842kg44cwi3x0riw4zvasjcpra2910an-autodocodec-0.2.0.3.drv' failed with exit code 1;
       last 10 log lines:
       >       In a \case alternative:
       >           MapCodec c
       >             -> liftParseJSON (`go` c) (`go` listCodec c) value ::
       >                  Parser (Map _ _)
       >     • Relevant bindings include
       >         c :: JSONCodec v (bound at src/Autodocodec/Aeson/Decode.hs:80:16)
       >    |
       > 80 |       MapCodec c -> liftParseJSON (`go` c) (`go` listCodec c) value :: JSON.Parser (Map _ _)
       >    |                                                               ^^^^^
       > [9 of 9] Compiling Paths_autodocodec ( dist/build/autogen/Paths_autodocodec.hs, dist/build/Paths_autodocodec.o, dist/build/Paths_autodocodec.dyn_o )

caught by https://gitlab.horizon-haskell.net/package-sets/horizon-core/-/jobs/426081

seanhess commented 1 year ago

@NorfairKing I'm running into this issue trying to use sydtest with GHC 9.6

NorfairKing commented 1 year ago

@seanhess PR welcome. I won't support a newer ghc until it's in the newest nixos- stable branch

NorfairKing commented 1 year ago

Fixed