GeneralizedNewtypeDeriving fails for PersistFieldSql

不羁岁月 提交于 2019-12-05 10:28:17

This looks very similar to some of the examples (in particular the Vector one) in the GHC wiki Roles2 page of things that don't work with the current role system, alas.

Basically the problem is that in

class PersistField a => PersistFieldSql a where
    sqlType :: Monad m => m a -> SqlType

the monad m might be instantiated with a type constructor whose argument has nominal role, so that m Markdown and m MarkdownNewT aren't identically represented even if Markdown and MarkdownNewT themselves are - and the current role system has no way of restricting m to disallow such type constructors.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!