How to extract value from monadic action

前端 未结 8 2320

Is there a built-in function with signature :: (Monad m) => m a -> a ?

Hoogle tells that there is no such function.

Can you explain why?<

8条回答
  •  情歌与酒
    2020-11-27 05:47

    Well, technicaly there is unsafePerformIO for the IO monad.

    But, as the name itself suggests, this function is evil and you should only use it if you really know what you are doing (and if you have to ask wether you know or not then you don't)

提交回复
热议问题