我在config/models
中具有以下模型:
Post json
title Text
intro Text
posted UTCTime default=now()
published Bool default=true
content Markdown Maybe
cvId CvItemId Maybe
projectId ProjectId Maybe
我有Yesod.Text.Markdown,它清楚地定义了src/Models.hs
中安装并导入的PersistField。在此文件中,使用以下代码生成模型:
share [mkPersist sqlSettings, mkMigrate "migrateAll"]
$(persistFileWith lowerCaseSettings "config/models")
在尝试构建时,出现以下错误:
src/Model.hs:20:7: error:
• Not in scope: type constructor or class ‘Markdown’
• In the untyped splice:
$(persistFileWith lowerCaseSettings "config/models")
|
20 | $(persistFileWith lowerCaseSettings "config/models")
|
我如何进行这项工作?我可以避免使用TemplateHaskell使其工作,但我想坚持使用这种格式,因为它更加优雅。