Skip to content

Commit 53425f1

Browse files
committed
NonEmptyList: newtype derive Foldable1
1 parent ab3189f commit 53425f1

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
],
2222
"dependencies": {
2323
"purescript-lazy": "^3.0.0",
24-
"purescript-nonempty": "^4.0.0",
24+
"purescript-nonempty": "^4.2.0",
2525
"purescript-tailrec": "^3.3.0",
2626
"purescript-unfoldable": "^3.0.0",
2727
"purescript-partial": "^1.0.0",

src/Data/List/Types.purs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,7 @@ derive newtype instance foldableNonEmptyList :: Foldable NonEmptyList
204204

205205
derive newtype instance traversableNonEmptyList :: Traversable NonEmptyList
206206

207-
instance foldable1NonEmptyList :: Foldable1 NonEmptyList where
208-
fold1 (NonEmptyList (a :| as)) =
209-
foldl append a as
210-
foldMap1 f (NonEmptyList (a :| as)) =
211-
foldl (\acc -> append acc <<< f) (f a) as
207+
derive newtype instance foldable1NonEmptyList :: Foldable1 NonEmptyList
212208

213209
instance traversable1NonEmptyList :: Traversable1 NonEmptyList where
214210
traverse1 f (NonEmptyList (a :| as)) =

0 commit comments

Comments
 (0)