Skip to content

Commit 85d3fd3

Browse files
author
Alex Sturtz
committed
Fixes purescript#18. Add Semigroup instance for NonEmpty.
1 parent 36ca3b2 commit 85d3fd3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Data/NonEmpty.purs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,8 @@ instance foldable1NonEmpty :: Foldable f => Foldable1 (NonEmpty f) where
110110

111111
instance unfoldable1NonEmpty :: Unfoldable f => Unfoldable1 (NonEmpty f) where
112112
unfoldr1 f b = uncurry (:|) $ unfoldr (map f) <$> f b
113+
114+
instance semigroupNonEmpty
115+
:: (Applicative f, Semigroup (f a))
116+
=> Semigroup (NonEmpty f a) where
117+
append (a1 :| f1) (a2 :| f2) = a1 :| (f1 <> pure a2 <> f2)

0 commit comments

Comments
 (0)