I get the following error from ghc for my servant library:
No instance for (GetEndpoint
(Verb 'GET 200 '[JSON] Position)
(Verb 'GET 200 '[JSON] Position)
'True)
arising from a use of `callServer3'
but I have an instance in scope, which looks like that:
instance GetEndpoint (Verb n s ct a) (Verb n s ct a) 'True where
getEndpoint _ _ _ _ server = server
which looks exactly like the one ghc can not find. I am a bit confused right now.
Full code can be found here:
Any clues? Thanks a lot for any hints!
The given instance has default kind '*' for n s ct and a. Either use poly kinds as for n or the right concrete kinds:
(Verb (n :: k1) (s :: Nat) (ct :: [*]) a)
The correct instance would look like this:
instance GetEndpoint (Verb (n :: k1) (s :: Nat) (ct :: [*]) a) (Verb n s ct a) 'True where
getEndpoint _ _ _ _ server = server
If you don't want to enable PolyKinds (it introduced a bunch of other errors), you can use the more restricted StdMethod
for n:
instance GetEndpoint (Verb (n :: StdMethod) (s :: Nat) (ct :: [*]) a) (Verb n s ct a) 'True where
getEndpoint _ _ _ _ server = server
Full code (compiling and even working as expected), can be found here.
Thanks again Carsten for this really quick help!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With