Hacker News new | ask | show | jobs
by evincarofautumn 2986 days ago
> …it is common to say 'data type X is a monad'. This statement is completely nonsensical…

I think the reason for this is that in Haskell we model algebraic structures using typeclasses, which are dispatched by type. So we say “X is a monoid, with mempty and mappend defined as follows”:

    instance Monoid X where
      mempty = …
      mappend = …
Instead of “X, emptyX, and appendX form a monoid”:

    instance Monoid X emptyX appendX
    emptyX = …
    appendX = …
This leads to what I call the “newtype hack” for distinguishing different monoids (resp. monads, &c.) on the same underlying type.