module Sound.MIDI.Monoid where

import Data.Foldable (foldMap, )
import Data.Monoid (Monoid, mappend, )
import Data.Semigroup (Semigroup, sconcat, )
import Data.List.NonEmpty (NonEmpty, )



infixr 5 +#+

(+#+) :: Monoid m => m -> m -> m
+#+ :: forall m. Monoid m => m -> m -> m
(+#+) = forall m. Monoid m => m -> m -> m
mappend


genAppend :: (Monoid m) =>
   (m -> a) -> (a -> m) -> a -> a -> a
genAppend :: forall m a. Monoid m => (m -> a) -> (a -> m) -> a -> a -> a
genAppend m -> a
cons a -> m
decons a
x a
y =
   m -> a
cons forall a b. (a -> b) -> a -> b
$ forall m. Monoid m => m -> m -> m
mappend (a -> m
decons a
x) (a -> m
decons a
y)

genConcat :: (Monoid m) =>
   (m -> a) -> (a -> m) -> [a] -> a
genConcat :: forall m a. Monoid m => (m -> a) -> (a -> m) -> [a] -> a
genConcat m -> a
cons a -> m
decons =
   m -> a
cons forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap a -> m
decons

nonEmptyConcat :: (Semigroup m) =>
   (m -> a) -> (a -> m) -> NonEmpty a -> a
nonEmptyConcat :: forall m a. Semigroup m => (m -> a) -> (a -> m) -> NonEmpty a -> a
nonEmptyConcat m -> a
cons a -> m
decons =
   m -> a
cons forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Semigroup a => NonEmpty a -> a
sconcat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> m
decons