Is there any place that explains the existence of the Newtype class, because it seems Newtype is more of an underlying part of the language than a user facing feature.
You’re right, the compiler has special type-checking support for newtypes, though there are extensions to the type (functions and optics for working with them) which are in the newtype
library.
- The PureScript documentation for newtypes
- The newtype section of the PureScript book
- Documentation for the
Data.Newtype
module - The section on newtypes from Jordan’s learning repository
The concept came originally from Haskell, so Haskell answers like this one on Stack Overflow generally cover the same ground.
2 Likes
Looking at Documentation for the Data.Newtype
module again was helpful. I have been toying with generics and it seems to be used a bit there which makes sense.