summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/IO
diff options
context:
space:
mode:
authorTom Sydney Kerckhove <syd@cs-syd.eu>2021-03-09 09:24:05 +0100
committerHécate Moonlight <kleidukos@crypto-keupone.eu>2021-10-15 06:51:18 +0000
commit7a8171bc9db792b19a2ee4dda9e019de5e24ebe0 (patch)
tree711cd55fa9ca0dc33160b3074dccda9a73dbbbc0 /libraries/base/GHC/IO
parent481e6b546cdbcb646086cd66f22f588c47e66151 (diff)
downloadhaskell-7a8171bc9db792b19a2ee4dda9e019de5e24ebe0.tar.gz
Insert warnings in the documentation of dangerous functions
Diffstat (limited to 'libraries/base/GHC/IO')
-rw-r--r--libraries/base/GHC/IO/Unsafe.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/base/GHC/IO/Unsafe.hs b/libraries/base/GHC/IO/Unsafe.hs
index 5284dcf887..e6c43e920c 100644
--- a/libraries/base/GHC/IO/Unsafe.hs
+++ b/libraries/base/GHC/IO/Unsafe.hs
@@ -117,6 +117,10 @@ monadic use of references. There is no easy way to make it impossible
once you use 'unsafePerformIO'. Indeed, it is
possible to write @coerce :: a -> b@ with the
help of 'unsafePerformIO'. So be careful!
+
+WARNING: If you're looking for "a way to get a 'String' from an 'IO String'",
+then 'unsafePerformIO' is not the way to go. Learn about do-notation and the
+@<-@ syntax element before you proceed.
-}
unsafePerformIO :: IO a -> a
unsafePerformIO m = unsafeDupablePerformIO (noDuplicate >> m)