I am new to Haskell and I want to be able to have a new type so that I can understand what it is, but I also need to read it from a line. I have
newtype SpecialId Int
deriving (Eq, Ord, Show)
I want to be able to read "5" :: SpecialId
, if I get Read in newtype, it does not work, it only works on read "SpecialId 5" :: SpecialId
. I tried
instance Read SpecialId where
readsPrec _ s = read s
But it gives me
SpecialId *** Exception: Prelude.read: no parse
source
share