I enabled the Safe extension, and now I have this warning:
<no location info>: warning: [GHC-98887]
-XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
However, I don't use that in the first place.
This is a known issue: see the GHC bug tracker.