Reputation: 363
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!
Upvotes: 5
Views: 80
Reputation: 363
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!
Upvotes: 5