blob: 3a0e7f68bf2e0a6d84851063952fc6197ebe4585 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
module Data.List.NonEmpty.Util where
import Data.List.NonEmpty (NonEmpty(..))
sconcatne :: Semigroup s => NonEmpty s -> s
sconcatne = \(x :| xs) -> go x xs
where go a [] = a
go a (x : xs) = go (a <> x) xs
foldMapne :: Semigroup s => (a -> s) -> NonEmpty a -> s
foldMapne f = sconcatne . fmap f
|