unsafe (empty) → 0.0
raw patch · 6 files changed
+162/−0 lines, 6 filesdep +basesetup-changed
Dependencies added: base
Files
- LICENSE +27/−0
- Setup.lhs +4/−0
- rename-unsafe.sh +7/−0
- src-new/System/Unsafe.hs +33/−0
- src-old/System/Unsafe.hs +31/−0
- unsafe.cabal +60/−0
+ LICENSE view
@@ -0,0 +1,27 @@+Copyright (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.
+ Setup.lhs view
@@ -0,0 +1,4 @@+#! /usr/bin/env runhaskell++> import Distribution.Simple+> main = defaultMain
+ rename-unsafe.sh view
@@ -0,0 +1,7 @@+darcs-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 $*
+ src-new/System/Unsafe.hs view
@@ -0,0 +1,33 @@+module 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
+ src-old/System/Unsafe.hs view
@@ -0,0 +1,31 @@+module 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
+ unsafe.cabal view
@@ -0,0 +1,60 @@+Name: unsafe+Version: 0.0+License: BSD3+License-File: LICENSE+Author: Henning Thielemann <haskell@henning-thielemann.de>+Maintainer: Henning Thielemann <haskell@henning-thielemann.de>+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