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:
parent
8f22cb26f8
commit
6399cb3c58
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user