Skip to content

Commit 6602ee4

Browse files
committed
Simplify at
1 parent bdc0c0d commit 6602ee4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Data/ArrayBuffer/Typed.purs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,7 @@ foreign import unsafeAtImpl :: forall a b. EffectFn2 (ArrayView a) Offset b
403403

404404
-- | Fetch element at index.
405405
at :: forall a t. TypedArray a t => ArrayView a -> Offset -> Effect (Maybe t)
406-
at a n = if a `hasIndex` n
407-
then Just <$> unsafePartial (unsafeAt a n)
408-
else pure Nothing
406+
at a n = toMaybe <$> runEffectFn2 unsafeAtImpl a n
409407

410408
infixl 3 at as !
411409

0 commit comments

Comments
 (0)