haskell - How to avoid unsafePerformIO in the Handler Monad? -
i have problems wrapping head around avoiding unsafeperformio in yesod handler. code in handler living in handler monad, how can execute io operation?
getprofiler :: handler html getprofiler = -- totmdbmovie's return-type io movie -- without unsafeperformio type of result io [movie] -- how io [movie] [movie]? -- ignore reccmovies - it's parameter. let result = unsafeperformio $ mapm totmdbmovie reccmovies defaultlayout $ settitle "profile" $(widgetfile "profile")
thank help!
if monad m
working in of monadio
class, can use liftio :: io -> m a
perform io actions inside.
as yesod, can perform io action in handler
actions, persistent's rundb
blocks.
Comments
Post a Comment