The .hs code :
data Person = Person { firstName :: String
, lastName :: String
, age :: Int
} deriving (Eq, Show, Read)
Compilation :
*Main> :load "/home/optimight/baby.hs"
[1 of 1] Compiling Main ( /home/optimight/baby.hs, interpreted )
Ok, modules loaded: Main.
While testing immediately after compilation:
*Main> read "Person {firstName = \"Michael\", lastName \"Diamond\", age = 43}" :: Person
*** Exception: Prelude.read: no parse
Please guide. Why this error is occurring and how to avoid such errors?
lastName \"Diamond\"
is missing an equals sign.
read "Person {firstName = \"Michael\", lastName = \"Diamond\", age = 43}" :: Person