1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 23:11:50 +03:00

Define an App semigroup.

This commit is contained in:
Rob Rix 2018-03-21 17:07:49 -04:00
parent 8f22cb26f8
commit 6399cb3c58

View File

@ -1,6 +1,7 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Data.Semigroup.App module Data.Semigroup.App
( AppMerge(..) ( AppMerge(..)
, App(..)
) where ) where
import Control.Applicative import Control.Applicative
@ -16,3 +17,7 @@ instance (Applicative f, Semigroup a) => Semigroup (AppMerge f a) where
instance (Applicative f, Monoid a, Semigroup a) => Monoid (AppMerge f a) where instance (Applicative f, Monoid a, Semigroup a) => Monoid (AppMerge f a) where
mempty = AppMerge (pure mempty) mempty = AppMerge (pure mempty)
mappend = (<>) mappend = (<>)
newtype App f a = App { runApp :: f a }
deriving (Alternative, Applicative, Bounded, Enum, Eq, Foldable, Functor, Monad, Ord, Show, Traversable)