With singletons-3.0 and singletons-th-3.0, if I try to generate a singled data type with TypeRep as one of the fields, with genSingletons, for instance:
data MvType s where
MvHsT :: TypeRep -> MvType s
MvBaseT :: s -> MvType s
MvFunT :: MvType s -> MvType s -> MvType s
MvPredT :: MvType s
$(genSingletons [''MvType])
I get the following exception in GHC:
src/Meriv/Types.hs:27:2: error:
• Couldn't match type ‘Demote
base-4.15.0.0:Data.Typeable.Internal.SomeTypeRep’
with ‘base-4.15.0.0:Data.Typeable.Internal.SomeTypeRep’
Expected: TypeRep
Actual: Demote base-4.15.0.0:Data.Typeable.Internal.SomeTypeRep
• When checking that the pattern signature:
Demote base-4.15.0.0:Data.Typeable.Internal.SomeTypeRep
fits the type of its context: TypeRep
In the pattern:
b_a7uB :: Demote base-4.15.0.0:Data.Typeable.Internal.SomeTypeRep
In the pattern:
MvHsT (b_a7uB :: Demote base-4.15.0.0:Data.Typeable.Internal.SomeTypeRep)
|
I know that there are issues with TypeRep promotion, as documented here, however, I was not able to find any documentation explaining how to use Data.Singletons.Base.TypeRepTYPE to create a singled version of a data type containing TypeRep.
Note: a related issue looks like it had a workaround added in 3.0 so genSingletons works correctly with data types with Nats, so I am wondering if it is possible to add a workaround for TypeRep as well.
With singletons-3.0 and singletons-th-3.0, if I try to generate a singled data type with
TypeRepas one of the fields, withgenSingletons, for instance:I get the following exception in GHC:
I know that there are issues with
TypeReppromotion, as documented here, however, I was not able to find any documentation explaining how to useData.Singletons.Base.TypeRepTYPEto create a singled version of a data type containingTypeRep.Note: a related issue looks like it had a workaround added in 3.0 so
genSingletonsworks correctly with data types withNats, so I am wondering if it is possible to add a workaround forTypeRepas well.