Skip to content

Commit

Permalink
Monoid instance for UniqSet
Browse files Browse the repository at this point in the history
  • Loading branch information
gergoerdi committed Jan 7, 2014
1 parent 4d70840 commit afefa7a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions compiler/utils/UniqSet.lhs
Expand Up @@ -36,6 +36,7 @@ module UniqSet (
import UniqFM
import Unique
import Data.Monoid
\end{code}

Expand Down Expand Up @@ -75,6 +76,19 @@ isEmptyUniqSet :: UniqSet a -> Bool
lookupUniqSet :: Uniquable a => UniqSet a -> a -> Maybe a
uniqSetToList :: UniqSet a -> [a]
\end{code}

%************************************************************************
%* *
\subsection{Monoid interface}
%* *
%************************************************************************

\begin{code}
instance Monoid (UniqSet a) where
mempty = emptyUniqSet
mappend = unionUniqSets
\end{code}

%************************************************************************
%* *
\subsection{Implementation using ``UniqFM''}
Expand Down

0 comments on commit afefa7a

Please sign in to comment.