haskell - How do I write a function which behaves differently depending on which monad is at the base of the transformer stack -


(at point more of puzzle i'd know how solve solution expect use in practice)

i'm trying write function rundebug following specification: argument has type io (); return type (monad m) => m (); depending on m, behaves in 1 of 2 different ways; if monadio m, rundebug = liftio, , otherwise rundebug = const (return ()).

the approaches i've tried relied on type class like

class monaddebug m   rundebug :: io () -> m () 

i've tried using monadbase, , i've tried using monadio overlapping instances, of them have run issues ambiguity.

i think works writing instances each transformer, i've been hoping avoid that.

write instances of monaddebug each transformer , each base monad interested in supporting.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -