I am trying to detect Markdown newtype and using GeneralizedNewtypeDeriving to automatically detect new instances:
import Text.Markdown import Yesod.Text.Markdown import Database.Persist.Sql newtype MarkdownNewT = MarkdownNewT { getMarkdown :: Markdown } deriving (Eq, IsString, Monoid, PersistField, PersistFieldSql)
This does not work for PersistFieldSql with the following message:
Could not coerce from 'm Markdown' to 'm MarkdownNewT' because 'm Markdown' and 'm MarkdownNewT' are different types. arising from the coercion of the method 'sqlType' from type 'forall (m :: * -> *). Monad m => m Markdown -> SqlType' to type 'forall (m :: * -> *). Monad m => m MarkdownNewT -> SqlType'
Is this due to the new roles GHC 7.8.2 features? In this particular case, I donβt know what to do, since Markdown itself is a new type of text ...
Or is it related to forall on sqlType ? What is the cause of this error when all other instances are successfully received automatically?
thanks
source share