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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -