Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Haskellers just call them Monoid and happily include anything that's associative+identity. When talking to people not yet familiar with Haskell or abstract algebra, it's commonly a good idea to simplify the notion and call Monoid the same as concatenation. That's all.

    newtype Sum = Sum { getSum :: Int }
    instance Monoid Sum where
      mempty = Sum 0
      mappend (Sum a) (Sum b) = Sum (a + b)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: