[GHC] #13976: Defined but not used warning on records used by servant-client

GHC ghc-devs at haskell.org
Fri Jul 14 16:07:03 UTC 2017


#13976: Defined but not used warning on records used by servant-client
-------------------------------------+-------------------------------------
           Reporter:  matthewleon    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 When generating an HTTP client through the servant-client lib
 (https://hackage.haskell.org/package/servant-client), if the various API
 record accessors go unused elsewhere, -Wunused-top-binds will generate
 warnings of the style "Defined but not used: `{accessor}`.

 I believe this is somewhat misleading, as the accessors are indeed "used"
 in the process of generating the client.

 Some sample code that will generate a warning for the `release` accessor:

 {{{
 type API = "release" :> Capture "mbid" Mbid :> Get '[JSON] Listing

 type Mbid = UUID

 data Listing = Listing
   { release :: Text
   } deriving (Show, Generic)

 instance FromJSON Listing

 coverArtArchiveAPI :: Proxy API
 coverArtArchiveAPI  = Proxy

 getListing :: Mbid -> ClientM Listing
 getListing = client coverArtArchiveAPI
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13976>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list