在 Yesod 处理程序中使用 Data.Binary.decodeFile
我尝试编译以下内容:
postRQuery :: Handler RepHtml
postRQuery = do
properties <- liftIO $ decodeFile "store" :: IO (Map String ())
defaultLayout [whamlet|Posted!|]
但出现以下编译器错误:
Couldn't match expected type `GGHandler
Bayith
Bayith
(Data.Enumerator.Iteratee
Data.ByteString.Internal.ByteString IO)
t0'
with actual type `IO (Map String ())'
In a stmt of a 'do' expression:
properties <- liftIO $ decodeFile "store" :: IO (Map String ())
关于如何在 Yesod 处理程序中使用 Data.Binary.decodeFile 的任何想法?
I tried to compile the following:
postRQuery :: Handler RepHtml
postRQuery = do
properties <- liftIO $ decodeFile "store" :: IO (Map String ())
defaultLayout [whamlet|Posted!|]
but I got the following compiler error:
Couldn't match expected type `GGHandler
Bayith
Bayith
(Data.Enumerator.Iteratee
Data.ByteString.Internal.ByteString IO)
t0'
with actual type `IO (Map String ())'
In a stmt of a 'do' expression:
properties <- liftIO $ decodeFile "store" :: IO (Map String ())
Any ideas on how I use Data.Binary.decodeFile in a Yesod handler?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里的问题是优先级。
::
的优先级低于$
,因此这会解析为您的意思是
The problem here is precedence.
::
has lower precedence than$
, so this parses aswhile what you meant was
如果你使用 ScopedTypeVariables,你应该这样做,你可以这样做:
但是,看起来你只是存储键,为什么不使用
Data.Set.Set
而不是 Mapif you use ScopedTypeVariables, and you should, you can do this:
But, it seems like you're just storing Keys, why dont you use
Data.Set.Set
instead of Map