Closed clintonmead closed 1 year ago
The error message is quite unfriendly, but I think the issue is that you are probably doing something like
import Barbies(FunctorB(..))
and you need to import Rec
as well:
import Barbies(FunctorB(..), Rec(..))
The hint that this is missing comes from here:
The data constructor 'barbies-2.0.3.1:Data.Generics.GenericN.Rec' is not in scope.
Why it is needed? It is a newtype used to make the generic derivations work, and we rely on coerce
for the whole thing to work. However, this means that the newtype constructor needs to be in scope whenever you derive an instance (I guess it would be nice to have a COERCIBLE
pragma that drops this requirement for certain newtypes?)
I hope that solves the issue. If you can suggest a good place in the docs where we should mention this, that would be great (a PR would be even more great! :))
This sorted the issue. Thank you!
The following code:
Fails to build on GHC 9.2.2 for me, giving the error:
I think I'm following the docs close enough here and this trivial example should compile, but I'm not sure if this is a bug or just me doing something wrong.