标签:haskell class append app mes empty mono 笔记 cat
class Semigroup a where
(<>) :: a -> a -> a
sconcat :: NonEmpty a -> a
stimes :: Integral b => b -> a -> a
class Semigroup a => Monoid a where
mempty :: a
mappend :: a -> a -> a
mappend = (<>)
mconcat :: [a] -> a
mconcat = foldr mappend mempty
半群(Semigroup)是个类型类,它是幺半群(Monoid)的基类。
标签:haskell class append app mes empty mono 笔记 cat
原文地址:https://www.cnblogs.com/zwvista/p/8955460.html