I am new to Haskell and I want to be able to a newtype so I can tell what is what, but I also have to read it from a string. I have
newtype SpecialId Int
deriving (Eq, Ord, Show)
I want to be able to read "5" :: SpecialId
if I derive Read in the newtype it doesn't work it only works on read "SpecialId 5" :: SpecialId
. I have tried
instance Read SpecialId where
readsPrec _ s = read s
But this gives me
SpecialId *** Exception: Prelude.read: no parse