Movatterモバイル変換


[0]ホーム

URL:


{-# LANGUAGE Unsafe #-}{-# LANGUAGE NoImplicitPrelude #-}------------------------------------------------------------------------------- |-- Module      :  System.IO.Unsafe-- Copyright   :  (c) The University of Glasgow 2001-- License     :  BSD-style (see the file libraries/base/LICENSE)---- Maintainer  :  libraries@haskell.org-- Stability   :  provisional-- Portability :  portable---- \"Unsafe\" IO operations.-------------------------------------------------------------------------------moduleSystem.IO.Unsafe(-- * Unsafe 'System.IO.IO' operationsunsafePerformIO,unsafeDupablePerformIO,unsafeInterleaveIO,unsafeFixIO,)whereimportGHC.BaseimportGHC.IOimportGHC.IORefimportGHC.ExceptionimportControl.Exception-- | A slightly faster version of `System.IO.fixIO` that may not be-- safe to use with multiple threads.  The unsafety arises when used-- like this:---- >  unsafeFixIO $ \r -> do-- >     forkIO (print r)-- >     return (...)---- In this case, the child thread will receive a @NonTermination@-- exception instead of waiting for the value of @r@ to be computed.---- @since 4.5.0.0unsafeFixIO::(a->IOa)->IOaunsafeFixIOk=doref<-newIORef(throwNonTermination)ans<-unsafeDupableInterleaveIO(readIORefref)result<-kanswriteIORefrefresultreturnresult

[8]ページ先頭

©2009-2025 Movatter.jp