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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -