@@ -10,15 +10,15 @@ import Data.ArrayBuffer.Typed as TA
10
10
import Data.ArrayBuffer.Typed.Gen (WithOffset (..), genFloat32 , genFloat64 , genInt16 , genInt32 , genInt8 , genTypedArray , genUint16 , genUint32 , genUint8 , genWithOffset )
11
11
import Data.ArrayBuffer.Types (ArrayView , Float32Array , Float64Array , Int16Array , Int32Array , Int8Array , Uint16Array , Uint8Array , Uint8ClampedArray , Uint32Array )
12
12
import Data.ArrayBuffer.ValueMapping (class BytesPerValue )
13
- import Data.Maybe (Maybe (..), fromMaybe )
13
+ import Data.Maybe (Maybe (..), fromMaybe , isJust )
14
+ import Data.Traversable (traverse )
14
15
import Data.Typelevel.Num (class Nat , D0 , D1 , D2 , D5 , d0 , d1 , toInt' )
15
16
import Data.Vec (head , index ) as Vec
16
17
import Effect (Effect )
17
18
import Effect.Console (log )
18
19
import Effect.Ref (Ref )
19
20
import Effect.Ref as Ref
20
21
import Effect.Unsafe (unsafePerformEffect )
21
- import Partial.Unsafe (unsafePartial )
22
22
import Test.QuickCheck (class Testable , Result (..), quickCheckGen , (/==), (<?>), (===))
23
23
import Test.QuickCheck.Combinators ((==>), (|=|))
24
24
import Test.QuickCheck.Gen (Gen )
@@ -298,12 +298,9 @@ withOffsetElemTests count = overAll1 count withOffsetElem
298
298
where
299
299
withOffsetElem :: forall a b t . TestableArrayF a b D5 t Result
300
300
withOffsetElem (WithOffset os xs) = do
301
- let valid :: TA.Offset -> Boolean
302
- valid o = unsafePerformEffect do
303
- e <- unsafePartial $ TA .unsafeAt xs o
304
- b <- TA .elem e Nothing xs
305
- pure b
306
- pure $ Array .all valid os <?> " All doesn't have an elem of itself"
301
+ let fetch o = TA .at xs o
302
+ exs <- traverse fetch os
303
+ pure $ Array .all isJust exs <?> " All doesn't have an elem of itself"
307
304
308
305
309
306
-- | Should work with any arbitrary predicate, but we can't generate them
0 commit comments