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

I think the article mixes up "type" and "newtype". "newtype Email = String" doesn't make sense.


"type" wouldn't work in this context, as it is literally just an alias, so the compiler cannot use to determine what instance to use. In contrast, newtype actually creates a new type, that acts as a wrapper around the old type. I believe what the author meant to say was "newtype Email = Email String".




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

Search: