@@ -110,6 +110,24 @@ import Streamly.Internal.System.IO (unsafeInlineIO, defaultChunkSize)
111#include "DocTestDataArray.hs"
111#include "DocTestDataArray.hs"
113+-------------------------------------------------------------------------------
115+-------------------------------------------------------------------------------
119+-- We need to be careful while using unsafePerformIO when array creation is
122+-- * We need to make sure the unsafe IO line does not float out of the binding.
123+-- * The order of the IO actions should be sane. For example, `touch` after `f`.
125+-- Assume the unsafe IO action floats up. If it makes sense given this
126+-- assumption, it's probably OK to use usafe IO.
128+-- A general approach should be never to use unsafe IO where Array creation is
129+-- involved or touch is involved.
113-------------------------------------------------------------------------------
131-------------------------------------------------------------------------------
114-- Array Data Type
132-- Array Data Type
115-------------------------------------------------------------------------------
133-------------------------------------------------------------------------------