Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: How to show a record (martin)
2. Re: How to show a record (Karolis Velicka)
----------------------------------------------------------------------
Message: 1
Date: Sun, 17 Aug 2014 11:40:27 +0200
From: martin <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>,
[email protected]
Subject: Re: [Haskell-beginners] How to show a record
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
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).
Am 08/16/2014 12:39 PM, schrieb Roman Czyborra:
> 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 <[email protected]
> <mailto:[email protected]>> 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 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
> [email protected] <mailto:[email protected]>
> http://www.haskell.org/mailman/listinfo/beginners
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
------------------------------
Message: 2
Date: Sun, 17 Aug 2014 12:08:57 +0100
From: Karolis Velicka <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How to show a record
Message-ID:
<canxl2l7svnezqfx9z-b7sywf+bzh1bk8xukuvnzugj-1tky...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
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" <[email protected]> wrote:
> 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).
>
>
>
>
> Am 08/16/2014 12:39 PM, schrieb Roman Czyborra:
> > 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 <[email protected]
> <mailto:[email protected]>> 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
> 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
> > [email protected] <mailto:[email protected]>
> > http://www.haskell.org/mailman/listinfo/beginners
> >
> >
> >
> >
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/beginners
> >
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140817/80705e0c/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 74, Issue 13
*****************************************