brendanhay / amazonka

A comprehensive Amazon Web Services SDK for Haskell.
https://amazonka.brendanhay.nz
Other
598 stars 227 forks source link

Unable to derive Typeable of AWSRequest #913

Closed rickeyski closed 1 year ago

rickeyski commented 1 year ago

Hi All,

I have an issue trying to upgrade some code. I am stuck trying to figure out why the wrappers around send and await are failing to compile.

I am using Stackage lts-20.24, GHC 9.2.7, and Amazonka main rev 83fef97319628d24395805c1f13fb010c821a751

I have created a minimal reproducer of my issue in this gist.

The below is the stack trace.

 src/S3.hs:41:35: error:
    • Could not deduce (base-4.16.4.0:Data.Typeable.Internal.Typeable r)
        arising from a use of ‘send’
      from the context: AWSRequest r
        bound by the type signature for:
                   genericSend :: forall r.
                                  AWSRequest r =>
                                  Env -> r -> IO (AWSResponse r)
        at src/S3.hs:40:1-61
    • In the second argument of ‘(.)’, namely ‘send env’
      In the expression: runResourceT . send env
      In an equation for ‘genericSend’:
          genericSend env = runResourceT . send env
   |
41 | genericSend env =  runResourceT . send env
   |                                   ^^^^

Thanks in advance, Rickey

rickeyski commented 1 year ago

Additionally, the reproducer generates the same error using the nix development shell for .#ghc92

endgame commented 1 year ago

Thanks for the report and the reproducer. Can you try adding (Typeable r) to your constraints at line 40?

rickeyski commented 1 year ago

Thanks! That did it. The working type signature is

genericSend :: (AWSRequest r, Typeable r, Typeable (AWSResponse r)) => Region -> r -> IO (AWSResponse r)