Skip to content

Instantly share code, notes, and snippets.

@sevanspowell
Last active July 2, 2019 07:27
Show Gist options
  • Save sevanspowell/ee6a2508d409a89e28cb493f7a8a4785 to your computer and use it in GitHub Desktop.
Save sevanspowell/ee6a2508d409a89e28cb493f7a8a4785 to your computer and use it in GitHub Desktop.
WrappingFail
data WrapperError = WrappingS3Error Jaws.S3Error
makeClassyPrisms ''WrapperError
instance Jaws.AsS3Error WrapperError where
_S3Error = _WrappingS3Error
data Lookup m a = Lookup (m a)
inner
:: ( AWS.MonadAWS m
, MonadError e m
, Jaws.AsS3Error e
, MonadResource m
)
=> Lookup m a
-> m S3.GetObjectResponse
inner _ = Jaws.getObjectResponse "bucket" "key"
wrapper
:: ( AWS.MonadAWS m
, MonadError e m
, AsWrapperError e
, MonadResource m
)
=> Lookup m a
-> m S3.GetObjectResponse
wrapper lookup = do
(e :: Either WrapperError S3.GetObjectResponse) <- runExceptT $ inner lookup
either (throwing _WrappingError) pure e
@sevanspowell
Copy link
Author

error:
• Occurs check: cannot construct the infinite type:
m ~ ExceptT S3Error m
Expected type: ExceptT S3Error m S3.GetObjectResponse
Actual type: m S3.GetObjectResponse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment