8000 Fix wrong NFData instance. · LumiGuide/haskell-opencv@31d5124 · GitHub
[go: up one dir, main page]

Skip to content

Commit 31d5124

Browse files
committed
Fix wrong NFData instance.
The code rnf _ = () is *always* wrong! Any request to evaluate to normal form must at least evaluate to weak head normal form. Even worse in this case, the `ForeignPtr` inside the type is often created by `unsafePerformIO`, and you'd _really_ expect that `rnf` enforces that.
1 parent dd51d7c commit 31d5124

File tree

1 file changed

+1
-1
lines changed
  • opencv/src/OpenCV/Internal/Core/Types

1 file changed

+1
-1
lines changed

opencv/src/OpenCV/Internal/Core/Types/Mat.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ instance FreezeThaw (Mat shape channels depth) where
203203
unsafeThaw = pure . Mut
204204

205205
instance NFData (Mat shape channels depth) where
206-
rnf _ = ()
206+
rnf (Mat !_fptr) = ()
207207

208208
{- | Tests whether a 'Mat' is deserving of its type level attributes
209209

0 commit comments

Comments
 (0)
0