diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -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.
diff --git a/Setup.lhs b/Setup.lhs
new file mode 100644
--- /dev/null
+++ b/Setup.lhs
@@ -0,0 +1,4 @@
+#! /usr/bin/env runhaskell
+
+> import Distribution.Simple
+> main = defaultMain
diff --git a/rename-unsafe.sh b/rename-unsafe.sh
new file mode 100644
--- /dev/null
+++ b/rename-unsafe.sh
@@ -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 $*
diff --git a/src-new/System/Unsafe.hs b/src-new/System/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/src-new/System/Unsafe.hs
@@ -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
diff --git a/src-old/System/Unsafe.hs b/src-old/System/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/src-old/System/Unsafe.hs
@@ -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
diff --git a/unsafe.cabal b/unsafe.cabal
new file mode 100644
--- /dev/null
+++ b/unsafe.cabal
@@ -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
