I have a module encoded and working, but I can’t enter two function signatures for it, because to enter them I have to enable the TypeFamilies extension for the module, and when I do, it will no longer build.
For one of them, I need TypeFamilies because it uses persisent / esqueleto functions .
The correct type would be, I believe:
getByIds :: (PersistEntityBackend a ~ SqlBackend) => EntityField a (Key a) -> [Key a] -> SqlPersistM [Entity a]
(ghc offers a more general signature)
Another uses hsqml .
ghc offers this signature, but I think it could be simplified:
prop :: forall tr b. (Marshal tr, Typeable b, MarshalMode tr ICanReturnTo () ~ Yes) => String -> (b -> tr) -> Member (GetObjType (ObjRef b))
The bottom line is that without TypeFamilies I cannot write these signatures. However, when I turn on TypeFamilies , the code will not be generated, and I do not understand why. The error looks like some polymorphic functions suddenly become monomorphic.
The error output is relatively long, you can find here .
I have TypeFamilies enabled in several other application modules without any problems, and this allows me to record signatures without problems using SqlBackend and ICanReturnTo .
Is there something wrong with this module that prevents it from building with TypeFamilies ? Or do I need to enable another extension to fix it? I did not expect to just enable this extension to break the compilation.