(Alt m) `mappend` (Alt n) = Alt (m <|> n)mempty = Alt emptyI found myself needing this type in my current overhaul of Data.Foldable, but it seems to be generally useful:
newtype Alt f a = Alt { getAlt :: f a } deriving
(Eq,Ord,Show,Read,Typeable,Data,Generic,Num,Real,
Floating, Fractional, RealFrac, RealFloat, Integral, Enum,
Bounded,Ix,Functor,Foldable,Traversable,Applicative,
Alternative,Monad,MonadPlus,MonadFix, IsString, IsList)-- The laundry list of derived instances is as recommended by Edward Kmett, who would probably want more added if someone can think of more. Some of them would, of course, need to be derived in other modules. The key instance is this:instance Alternative t => Monoid (Alt t a) where
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://www.haskell.org/mailman/listinfo/libraries