
In that case, can you elaborate please? I don't see how this is different
to making the record itself an instance if Show.
Best wishes,
Karolis Velicka
On 17 Aug 2014 10:44, "martin"
Right, but this is merely a coincidence.
What I wanted is a way to show a value of a record, where all fields are instances of Show.
Haskell itself is able to do this (and it even figures out the accessors, which I am not even asking for).
Your particular types do not require your annoying repetition beyond [ show . pType, accepts, produces, workarea] with 1st show = (:[])
On Sat, Aug 16, 2014 at 10:45 AM, martin
mailto:martin.drautzburg@web.de> wrote: 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
Am 08/16/2014 12:39 PM, schrieb Roman Czyborra: 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?
_______________________________________________ Beginners mailing list Beginners@haskell.org mailto:Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners