I created a newtype
for Maybe Int
:
Prelude> newtype MaybeTuple = MaybeTuple { getMaybe :: Maybe Int}
Prelude> let m = MaybeTuple (Just 5)
Prelude> getMaybe m
Just 5
But how can I create a generic newtype
of Maybe a
?
Add the a
as a type parameter:
newtype MaybeTuple a = MaybeTuple { getMaybe :: Maybe a }