Generalized newtype deriving error
App Development3 posts261 views1 likesLast activity Mar 2022
GY
gyorgybalazsiOP
Mar 2022I need a generalized newtype declaration, and I’m trying to apply for this the appropriate language option, still get an error:

Unexpected type ‘{getAge : Int}’
In the newtype declaration for ‘Age’
A newtype declaration should have form
newtype Age a = ...parser
What am I missing?
RE
Remy
Mar 2022I think you want to write
newtype Age = Age {getAge: Int}
deriving (Eq, Ord, Show, Enum)
GY
gyorgybalazsi
Mar 2022Of course, thanks!