Unsafe functions

From HaskellWiki
Revision as of 12:52, 26 August 2007 by Mrd (talk | contribs) (spelling)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

There are a number of unsafe functions in the libraries.

  • unsafePerformIO :: IO a -> a
  • unsafeInterleaveIO :: IO a -> IO a
  • unsafeInterleaveST :: ST s a -> ST s a
  • unsafeIOToST :: IO a -> ST s a
  • unsafeIOToSTM :: IO a -> STM a
  • unsafeFreeze, unsafeThaw
  • unsafeCoerce# :: a -> b
  • seq :: a -> b -> b

Unsafe functions can break type safety (unsafeCoerce#, unsafePerformIO), interfere with lazy IO (unsafeInterleaveIO), or break parametricity (seq). Their use (except in the case of seq) would require some kind of assurance on the part of the programmer that what they're doing is safe.

This article is a stub. You can help by expanding it.