[Haskell-cafe] style question: Writer monad or unsafeIOToST?

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Aug 24 13:17:43 EDT 2006

Hello Gregory,

Thursday, August 24, 2006, 7:29:47 PM, you wrote:

> it seems that unsafeIOToST is safe in this case, in the sense that

why you are stuck to ST monad? isn't it better to use just IO monad?

and about total style - again, you can use my lib or write this
yourself so that all you reference operations will work independent on
Monad used and you can freely experiment with different monads without
rewriting whole code:

class Ref m r | m->r where

instance Ref IO IORef
  writeRef r x = writeIORef r $! x

instance (Ref m r) => Ref (WriterT m) r where
  writeRef = lift . writeRef

and so on...

ps to Brian: it is why i was so interested in your idea. writing
monad-independent code, including code that can be applied to any
monad lifted from ST or IO, looks for me very promising idea, somewhat
that will be widely used in future

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list