servant icon indicating copy to clipboard operation
servant copied to clipboard

HasSwagger instance of UVerb depends on overlappable HasSwagger instance of Verb

Open akshaymankar opened this issue 4 years ago • 1 comments

This is HasSwagger UVerb ... defined here

 instance 
   {-# OVERLAPPABLE #-} 
   ( ToSchema a, 
     HasStatus a, 
     AllAccept cs, 
     SwaggerMethod method, 
     HasSwagger (UVerb method cs as) 
   ) => 
   HasSwagger (UVerb method cs (a ': as)) 
   where 
   toSwagger _ = 
     toSwagger (Proxy :: Proxy (Verb method (StatusOf a) cs a)) 
       `combineSwagger` toSwagger (Proxy :: Proxy (UVerb method cs as)) 

it depends on overlappable instance HasSwagger Verb .. by calling toSwagger (Proxy :: Proxy (Verb method (StatusOf a) cs a)). When this instance is actually overriden in a dependant module, the HasSwagger instance for UVerb doesn't pick that up as it is already compiled and linked with the now overlapped instance. This makes it confusing to write custom instances for a special type.

Moved from: https://github.com/haskell-servant/servant-swagger/issues/133

akshaymankar avatar Nov 22 '21 08:11 akshaymankar

Roughly in the same spirit of #1431, UVerb's overlapping instances are causing a bunch of issues.

alpmestan avatar Nov 23 '21 08:11 alpmestan