Skip to content

Commit 982df63

Browse files
committed
DoNotUnbox* suffer from same problem
1 parent ac341f4 commit 982df63

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

vector/src/Data/Vector/Unboxed.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
-- @
6969
module Data.Vector.Unboxed (
7070
-- * Unboxed vectors
71-
Vector(V_UnboxAs, V_UnboxViaPrim, V_UnboxViaStorable), MVector(..), Unbox,
71+
Vector(V_UnboxAs, V_UnboxViaPrim, V_UnboxViaStorable,V_DoNotUnboxLazy,V_DoNotUnboxStrict,V_DoNotUnboxNormalForm),
72+
MVector(..), Unbox,
7273

7374
-- * Accessors
7475

vector/tests/Tests/Deriving.hs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ module Tests.Deriving () where
2525
import Control.DeepSeq
2626
import qualified Data.Vector.Generic as VG
2727
import qualified Data.Vector.Generic.Mutable as VGM
28+
import qualified Data.Vector as V
29+
import qualified Data.Vector.Strict as VV
2830
import qualified Data.Vector.Storable as VS
2931
import qualified Data.Vector.Primitive as VP
3032
import qualified Data.Vector.Unboxed as VU
@@ -129,6 +131,39 @@ instance NFData a => VU.Unbox (FooNormalForm a)
129131

130132

131133

134+
data BoxedLazy = BoxedLazy Int
135+
deriving (Eq, Ord, Show)
136+
137+
newtype instance VU.MVector s BoxedLazy = MV_BoxedLazy (V.MVector s BoxedLazy)
138+
newtype instance VU.Vector BoxedLazy = V_BoxedLazy (V.Vector BoxedLazy)
139+
deriving via (VU.DoNotUnboxLazy BoxedLazy) instance VGM.MVector VU.MVector BoxedLazy
140+
deriving via (VU.DoNotUnboxLazy BoxedLazy) instance VG.Vector VU.Vector BoxedLazy
141+
instance VU.Unbox BoxedLazy
142+
143+
144+
data BoxedStrict = BoxedStrict Int
145+
deriving (Eq, Ord, Show)
146+
147+
newtype instance VU.MVector s BoxedStrict = MV_BoxedStrict (VV.MVector s BoxedStrict)
148+
newtype instance VU.Vector BoxedStrict = V_BoxedStrict (VV.Vector BoxedStrict)
149+
deriving via (VU.DoNotUnboxStrict BoxedStrict) instance VGM.MVector VU.MVector BoxedStrict
150+
deriving via (VU.DoNotUnboxStrict BoxedStrict) instance VG.Vector VU.Vector BoxedStrict
151+
instance VU.Unbox BoxedStrict
152+
153+
154+
data BoxedNormalForm = BoxedNormalForm Int
155+
deriving (Eq, Ord, Show)
156+
157+
instance NFData BoxedNormalForm where
158+
rnf (BoxedNormalForm i) = rnf i
159+
160+
newtype instance VU.MVector s BoxedNormalForm = MV_BoxedNormalForm (VV.MVector s BoxedNormalForm)
161+
newtype instance VU.Vector BoxedNormalForm = V_BoxedNormalForm (VV.Vector BoxedNormalForm)
162+
deriving via (VU.DoNotUnboxNormalForm BoxedNormalForm) instance VGM.MVector VU.MVector BoxedNormalForm
163+
deriving via (VU.DoNotUnboxNormalForm BoxedNormalForm) instance VG.Vector VU.Vector BoxedNormalForm
164+
instance VU.Unbox BoxedNormalForm
165+
166+
132167
----------------------------------------------------------------
133168
-- Unboxed
134169

0 commit comments

Comments
 (0)