ocramz / aeson-schema

Haskell JSON schema validator and parser generator
MIT License
60 stars 17 forks source link

Tests still broken #18

Open Profpatsch opened 2 years ago

Profpatsch commented 2 years ago
test/Data/Aeson/Schema/Examples.hs:20:30: error:
    • No instance for (MonadFail (Either a0))
        arising from a use of ‘mkPattern’
    • In the expression: mkPattern (Data.Text.pack ".+String$")
      In a pattern binding:
        Right p = mkPattern (Data.Text.pack ".+String$")
      In the expression:
        let Right p_ai47 = mkPattern (Data.Text.pack ".+String$") in p_ai47
   |
20 |       let schema = [schemaQQ| {
   |                              ^^...

test/Data/Aeson/Schema/Examples.hs:20:30: error:
    • No instance for (MonadFail (Either a1))
        arising from a use of ‘mkPattern’
    • In the expression: mkPattern (Data.Text.pack ".+Number$")
      In a pattern binding:
        Right p = mkPattern (Data.Text.pack ".+Number$")
      In the expression:
        let Right p_ai48 = mkPattern (Data.Text.pack ".+Number$") in p_ai48
   |
20 |       let schema = [schemaQQ| {
   |                              ^^...

test/Data/Aeson/Schema/Examples.hs:40:41: error:
    • No instance for (MonadFail (Either a2))
        arising from a use of ‘mkPattern’
    • In the expression: mkPattern (Data.Text.pack ".+String$")
      In a pattern binding:
        Right p = mkPattern (Data.Text.pack ".+String$")
      In the expression:
        let Right p_apIO = mkPattern (Data.Text.pack ".+String$") in p_apIO
   |
40 |       let additionalNumbers = [schemaQQ| {
   |                                         ^^...

test/Data/Aeson/Schema/Examples.hs:55:46: error:
    • No instance for (MonadFail (Either a3))
        arising from a use of ‘mkPattern’
    • In the expression: mkPattern (Data.Text.pack ".+String$")
      In a pattern binding:
        Right p = mkPattern (Data.Text.pack ".+String$")
      In the expression:
        let Right p_apJp = mkPattern (Data.Text.pack ".+String$") in p_apJp
   |
55 |       let noAdditionalProperties = [schemaQQ| {
   |                                              ^^...

test/Data/Aeson/Schema/Examples.hs:154:30: error:
    • No instance for (MonadFail (Either a4))
        arising from a use of ‘mkPattern’
    • In the expression: mkPattern (Data.Text.pack "^[a-z]$")
      In a pattern binding:
        Right p = mkPattern (Data.Text.pack "^[a-z]$")
      In the expression:
        let Right p_apQs = mkPattern (Data.Text.pack "^[a-z]$") in p_apQs
    |
154 |       let schema = [schemaQQ| {
    |                              ^^...
Fuuzetsu commented 2 years ago

fwiw I think tests don't all pass even when they've been compiling but Inmaybbe misremembering...

ocramz commented 2 years ago

Since this error is only due to the tests using Either, and we cannot avoid the MonadFail constraint since it is due to makeRegexM, I suggest we switch to Nothing.

Fuuzetsu commented 2 years ago

We could also make newtype Error a = Error (Either String a) which we can write MonadFail for if we want to. Whatever works though.

ocramz commented 2 years ago

For posterity, this shows up when compiling against GHC 8.8.1 e.g. see these CI logs : https://github.com/ocramz/aeson-schema/runs/6031979441?check_suite_focus=true#step:4:1082