Hi,

its a small detail, but the error mesgs for records have confused me
several times.

suppose that we have this datatype:
   data X = X {s :: String, s2 :: String}
      deriving Show

and a function f:
   f x@X{s} = x{s = s ++ "hi"}

which, when applied to X{s="one",s2="two"} we get:
   X{s="onehi",s2="two"}

but if we mess up the defn of "f":
   f x@X{s} = X{s = s ++ "hi"}

then we gets:
   Main> f X{s="one",s2="two"}
   X{s="onehi",s2="
   Program error: {undefined}


it would be nicer if hugs returned the error mesg:
   Main> f X{s="one",s2="two"}
   X{s="onehi",s2="
   Program error: field/name "s2" = undefined


byron

Reply via email to