unsafe-0.0/0000755000000000000000000000000012134734115011021 5ustar0000000000000000unsafe-0.0/LICENSE0000644000000000000000000000270312134734115012030 0ustar0000000000000000Copyright (c) Henning Thielemann 2013 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the author nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. unsafe-0.0/Setup.lhs0000644000000000000000000000011612134734115012627 0ustar0000000000000000#! /usr/bin/env runhaskell > import Distribution.Simple > main = defaultMain unsafe-0.0/unsafe.cabal0000644000000000000000000000347312134734115013275 0ustar0000000000000000Name: unsafe Version: 0.0 License: BSD3 License-File: LICENSE Author: Henning Thielemann Maintainer: Henning Thielemann Homepage: http://code.haskell.org/~thielema/unsafe/ Category: Control Synopsis: Unified interface to unsafe functions Description: SafeHaskell introduced the notion of safe and unsafe modules. In order to make as many as possible modules \"safe\", the well-known unsafe functions were moved to distinguished modules. This makes it hard to write packages that work with both old and new versions of GHC. This package provides a single module @System.Unsafe@ that exports the unsafe functions from the base package. It provides them in a style ready for qualification, that is, you should import them by . > import qualified System.Unsafe as Unsafe . The package also contains a script called @rename-unsafe.sh@. It replaces all occurrences of the original identifiers with the qualified identifiers from this package. You still have to adapt the import commands. It uses the @darcs-replace-rec@ script from the @darcs-scripts@ package. Tested-With: GHC==7.0.4, GHC==7.2.2, GHC==7.4.1 Cabal-Version: >=1.6 Build-Type: Simple Data-Files: rename-unsafe.sh Extra-Source-Files: src-old/System/Unsafe.hs src-new/System/Unsafe.hs Source-Repository this Tag: 0.0 Type: darcs Location: http://code.haskell.org/~thielema/unsafe/ Source-Repository head Type: darcs Location: http://code.haskell.org/~thielema/unsafe/ Library Build-Depends: base >= 4 && < 5 GHC-Options: -Wall If impl(ghc >= 7.2) Hs-Source-Dirs: src-new Else Hs-Source-Dirs: src-old Exposed-Modules: System.Unsafe unsafe-0.0/rename-unsafe.sh0000644000000000000000000000060012134734115014077 0ustar0000000000000000darcs-replace-rec unsafePerformIO Unsafe.performIO $* darcs-replace-rec unsafeInterleaveIO Unsafe.interleaveIO $* darcs-replace-rec unsafeInterleaveST Unsafe.interleaveST $* darcs-replace-rec unsafeIOToST Unsafe.ioToST $* darcs-replace-rec unsafeSTToIO Unsafe.stToIO $* darcs-replace-rec unsafeForeignPtrToPtr Unsafe.foreignPtrToPtr $* darcs-replace-rec unsafeCoerce Unsafe.coerce $* unsafe-0.0/src-new/0000755000000000000000000000000012134734115012377 5ustar0000000000000000unsafe-0.0/src-new/System/0000755000000000000000000000000012134734115013663 5ustar0000000000000000unsafe-0.0/src-new/System/Unsafe.hs0000644000000000000000000000151712134734115015444 0ustar0000000000000000module System.Unsafe where -- taken from share/doc/ghc/html/libraries/base-4.5.1.0/doc-index-U.html import System.IO.Unsafe (unsafePerformIO, unsafeInterleaveIO, ) import Control.Monad.ST.Unsafe (unsafeInterleaveST, unsafeIOToST, unsafeSTToIO, ) import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr, ) import Unsafe.Coerce (unsafeCoerce, ) import Control.Monad.ST (ST, ) import Foreign.ForeignPtr (ForeignPtr, ) import Foreign.Ptr (Ptr, ) performIO :: IO a -> a performIO = unsafePerformIO interleaveIO :: IO a -> IO a interleaveIO = unsafeInterleaveIO interleaveST :: ST s a -> ST s a interleaveST = unsafeInterleaveST ioToST :: IO a -> ST s a ioToST = unsafeIOToST stToIO :: ST s a -> IO a stToIO = unsafeSTToIO foreignPtrToPtr :: ForeignPtr a -> Ptr a foreignPtrToPtr = unsafeForeignPtrToPtr coerce :: a -> b coerce = unsafeCoerce unsafe-0.0/src-old/0000755000000000000000000000000012134734115012364 5ustar0000000000000000unsafe-0.0/src-old/System/0000755000000000000000000000000012134734115013650 5ustar0000000000000000unsafe-0.0/src-old/System/Unsafe.hs0000644000000000000000000000141112134734115015422 0ustar0000000000000000module System.Unsafe where -- taken from share/doc/ghc/html/libraries/base-4.5.1.0/doc-index-U.html import System.IO.Unsafe (unsafePerformIO, unsafeInterleaveIO, ) import Control.Monad.ST (ST, unsafeInterleaveST, unsafeIOToST, unsafeSTToIO, ) import Unsafe.Coerce (unsafeCoerce, ) import Foreign.ForeignPtr (ForeignPtr, unsafeForeignPtrToPtr, ) import Foreign.Ptr (Ptr, ) performIO :: IO a -> a performIO = unsafePerformIO interleaveIO :: IO a -> IO a interleaveIO = unsafeInterleaveIO interleaveST :: ST s a -> ST s a interleaveST = unsafeInterleaveST ioToST :: IO a -> ST s a ioToST = unsafeIOToST stToIO :: ST s a -> IO a stToIO = unsafeSTToIO foreignPtrToPtr :: ForeignPtr a -> Ptr a foreignPtrToPtr = unsafeForeignPtrToPtr coerce :: a -> b coerce = unsafeCoerce