servant-mock icon indicating copy to clipboard operation
servant-mock copied to clipboard

Fails to Build with GHC 9.2.5

Open arjunkathuria opened this issue 2 years ago • 1 comments

Hi @alpmestan

I'm trying to build this with a newer GHC ( 9.2.5 ) with stackage with resolver == lts-20.4 and it seems to fail.

The following errors show up

servant-mock/src/Servant/Mock.hs:121:10: error:
    • Could not deduce (base-4.16.4.0:Data.Typeable.Internal.Typeable
                          a)
        arising from the superclasses of an instance declaration
      from the context: (KnownSymbol s, FromHttpApiData a,
                         HasMock rest context, SBoolI (FoldLenient mods))
        bound by the instance declaration at src/Servant/Mock.hs:121:10-139
    • In the instance declaration for
        ‘HasMock (Capture' mods s a :> rest) context’
    |
121 | instance (KnownSymbol s, FromHttpApiData a, HasMock rest context, SBoolI (FoldLenient mods)) => HasMock (Capture' mods s a :> rest) context where
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

And

servant-mock/src/Servant/Mock.hs:124:10: error:
    • Could not deduce (base-4.16.4.0:Data.Typeable.Internal.Typeable
                          a)
        arising from the superclasses of an instance declaration
      from the context: (KnownSymbol s, FromHttpApiData a,
                         HasMock rest context)
        bound by the instance declaration at src/Servant/Mock.hs:124:10-109
    • In the instance declaration for
        ‘HasMock (CaptureAll s a :> rest) context’
    |
124 | instance (KnownSymbol s, FromHttpApiData a, HasMock rest context) => HasMock (CaptureAll s a :> rest) context where
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

arjunkathuria avatar Dec 23 '22 12:12 arjunkathuria

Hi,

I Added the missing Typeable a Constraints to the instances where necessary and that makes it build now.

It However, fails in testing with the following error :-

/servant-mock/test/Servant/MockSpec.hs:28:5: error:
    • No instance for (HasMock
                         (Fragment Int :> GET) '[NamedContext "foo" '[]])
        arising from a use of ‘mock’
    • In the expression:
        mock comprehensiveAPI (Proxy :: Proxy '[NamedContext "foo" '[]])
      In a pattern binding:
        _ = mock
              comprehensiveAPI (Proxy :: Proxy '[NamedContext "foo" '[]])
   |        
28 | _ = mock comprehensiveAPI (Proxy :: Proxy '[NamedContext "foo" '[]])
   |     ^^^^

arjunkathuria avatar Dec 27 '22 08:12 arjunkathuria