@@ -7,15 +7,12 @@ import Data.Eq (class Eq1)
77import Data.Foldable (class Foldable )
88import Data.FoldableWithIndex (class FoldableWithIndex )
99import Data.FunctorWithIndex (class FunctorWithIndex )
10- import Data.Maybe (Maybe , fromJust , isNothing )
1110import Data.Ord (class Ord1 )
1211import Data.Semigroup.Foldable (class Foldable1 , foldMap1Default )
1312import Data.Semigroup.Traversable (class Traversable1 , sequence1Default )
1413import Data.Traversable (class Traversable )
1514import Data.TraversableWithIndex (class TraversableWithIndex )
16- import Data.Tuple (Tuple , fst , snd )
1715import Data.Unfoldable1 (class Unfoldable1 )
18- import Partial.Unsafe (unsafePartial )
1916
2017newtype NonEmptyArray a = NonEmptyArray (Array a )
2118
@@ -40,9 +37,7 @@ instance foldable1NonEmptyArray :: Foldable1 NonEmptyArray where
4037 foldMap1 = foldMap1Default
4138 fold1 = fold1Impl (<>)
4239
43- instance unfoldable1NonEmptyArray :: Unfoldable1 NonEmptyArray where
44- unfoldr1 = unfoldr1Impl isNothing (unsafePartial fromJust) fst snd
45-
40+ derive newtype instance unfoldable1NonEmptyArray :: Unfoldable1 NonEmptyArray
4641derive newtype instance traversableNonEmptyArray :: Traversable NonEmptyArray
4742derive newtype instance traversableWithIndexNonEmptyArray :: TraversableWithIndex Int NonEmptyArray
4843
@@ -63,16 +58,6 @@ derive newtype instance altNonEmptyArray :: Alt NonEmptyArray
6358-- we use FFI here to avoid the unncessary copy created by `tail`
6459foreign import fold1Impl :: forall a . (a -> a -> a ) -> NonEmptyArray a -> a
6560
66- foreign import unfoldr1Impl
67- :: forall a b
68- . (forall x . Maybe x -> Boolean )
69- -> (forall x . Maybe x -> x )
70- -> (forall x y . Tuple x y -> x )
71- -> (forall x y . Tuple x y -> y )
72- -> (b -> Tuple a (Maybe b ))
73- -> b
74- -> NonEmptyArray a
75-
7661foreign import traverse1Impl
7762 :: forall m a b
7863 . (forall a' b' . (m (a' -> b' ) -> m a' -> m b' ))
0 commit comments