[Haskell-beginners] How to show a record
martin
martin.drautzburg at web.de
Sat Aug 16 08:45:08 UTC 2014
Hello all,
I have a record type like this
data Payload = Pl {
pType :: Char,
accepts :: String,
produces :: String,
workarea :: String} deriving (Eq)
an I want to write my own show function. I ended up with somethink like this
show pl = concatMap ( $ pl) [show . pType, show . accepts, show . produces, show . workarea]
That repetition of "show ." annoys me, but of course without it the elements of that list would have different types. Is
there a way around it and how does haskell itself manage to show records?
More information about the Beginners
mailing list