Hacker News new | past | comments | ask | show | jobs | submit login

> …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.



Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: