Send Beginners mailing list submissions to beginners@haskell.org 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 beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. how to modify show for a list of certain types (Manfred Lotz) 2. Re: how to modify show for a list of certain types (Daniel Fischer) 3. haskell on the jvm? (Mike Meyer) 4. Re: Question about functors (or maybe not...) (Patrick LeBoutillier) 5. Re: Haskell Platform and GHC 7.0.3 (Magnus Therning) 6. Re: haskell on the jvm? (Krzysztof Skrz?tnicki) ---------------------------------------------------------------------- Message: 1 Date: Sat, 2 Apr 2011 15:32:07 +0200 From: Manfred Lotz <manfred.l...@arcor.de> Subject: [Haskell-beginners] how to modify show for a list of certain types To: beginners@haskell.org Message-ID: <20110402153207.23f2c...@arcor.com> Content-Type: text/plain; charset=US-ASCII Hi there, I have a list of say type Record which I write to a file and read back from the file if required. The list's content is a single line in the file it doesn't matter how many records the list contains. I would like to modify show for type Record in a way that show does work like the normal show but additionally adds a newline at the end of the string. I'm a bit lost how to do that. Any idea? -- Manfred ------------------------------ Message: 2 Date: Sat, 2 Apr 2011 15:51:33 +0200 From: Daniel Fischer <daniel.is.fisc...@googlemail.com> Subject: Re: [Haskell-beginners] how to modify show for a list of certain types To: beginners@haskell.org Cc: Manfred Lotz <manfred.l...@arcor.de> Message-ID: <201104021551.34557.daniel.is.fisc...@googlemail.com> Content-Type: Text/Plain; charset="iso-8859-1" On Saturday 02 April 2011 15:32:07, Manfred Lotz wrote: > Hi there, > I have a list of say type Record which I write to a file and > read back from the file if required. > > The list's content is a single line in the file it doesn't matter how > many records the list contains. > > I would like to modify show for type Record in a way that show does > work like the normal show but additionally adds a newline at the end of > the string. > > I'm a bit lost how to do that. Any idea? There's a showList function in the Show class, you can use that to define non-standard list displays (as it's done for [Char] = String). You cannot then derive the Show instance, which may be a minor inconvenience or a major pain. In the latter case, you could define a newtype, newtype RecordList = RL [Record] instance Show RecordList where show (RL xs) = unlines (map show xs) and use that to display when you want things on separate lines. Or you could modify the function used to writing the file, instead of hPutStrLn fileHandle (show recordList) mapM_ (hPrint fileHandle) recordList ------------------------------ Message: 3 Date: Sat, 2 Apr 2011 09:59:22 -0400 From: Mike Meyer <m...@mired.org> Subject: [Haskell-beginners] haskell on the jvm? To: beginners@haskell.org Message-ID: <20110402095922.29242...@bhuda.mired.org> Content-Type: text/plain; charset=US-ASCII Google didn't turn up anything, so... Is there any way to compile haskell to JVM bytecodes? Dalvik, even? A gcc front end, maybe? Thanks, <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Software developer/SCM consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org ------------------------------ Message: 4 Date: Sat, 2 Apr 2011 10:57:28 -0400 From: Patrick LeBoutillier <patrick.leboutill...@gmail.com> Subject: Re: [Haskell-beginners] Question about functors (or maybe not...) To: Felipe Almeida Lessa <felipe.le...@gmail.com> Cc: beginners <beginners@haskell.org> Message-ID: <banlktiny+kjbr4hm+hfmowg8n7sn0x3...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Felipe, > You can write your own plain old functions: > > mapChord :: (Note -> Note) -> Chord -> Chord > mapChord f (Chord q n) = Chord q (f n) > > mapScale :: (Note -> Note) -> Scale -> Scale > mapScale f (Scale q n) = Scale q (f n) > > You can also create your own type class, if that's convenient for you > > class NoteMap a where > ?noteMap :: (Note -> Note) -> a -> a > > instance NoteMap Chord where noteMap = mapChord > instance NoteMap Scale where noteMap = mapScale Initially I didn't realize how powerful this approach could be, but once you have noteMap then most of the functions for altering Notes can then be used on the other types, *without* having to make them (the functions I mean) be part of the typeclass definition. This seems obvious but I hadn't really noticed it until now... Thanks a lot, Patrick > HTH, =) > > -- > Felipe. > -- ===================== Patrick LeBoutillier Rosem?re, Qu?bec, Canada ------------------------------ Message: 5 Date: Sat, 2 Apr 2011 20:28:53 +0100 From: Magnus Therning <mag...@therning.org> Subject: Re: [Haskell-beginners] Haskell Platform and GHC 7.0.3 To: beginners@haskell.org Message-ID: <20110402192853.GA5227@ohann> Content-Type: text/plain; charset="us-ascii" On Fri, Apr 01, 2011 at 01:35:45PM -0500, Forrest Cahoon wrote: > On Fri, Apr 1, 2011 at 10:33 AM, Alba Marchisio > <alba.marchi...@gmail.com> wrote: > > Sorry I'm new and probably this post is out of topic, but my question is: > > when a Haskell Platform integrated with GHC 7.0.3? > > Thanks > > Alba. > > The current 2011.2.0.0 version linked from > http://hackage.haskell.org/platform/ does. It took them a while to > update that link, but it's there now. No, it lists GHC 7.0.2. I don't think we'll see 7.0.3 in HP for at least a few months (2011.4.0.0). /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://www.haskell.org/pipermail/beginners/attachments/20110402/7ac24969/attachment-0001.pgp> ------------------------------ Message: 6 Date: Sat, 2 Apr 2011 23:31:28 +0200 From: Krzysztof Skrz?tnicki <gte...@gmail.com> Subject: Re: [Haskell-beginners] haskell on the jvm? To: Mike Meyer <m...@mired.org> Cc: beginners@haskell.org Message-ID: <BANLkTi=ozexcgwpmksocce+6j85bl6z...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" There is JHC: http://repetae.net/computer/jhc/ <http://repetae.net/computer/jhc/>It compiles Haskell into standard compliant C code which can be easily compiled with GCC. Be aware though not all libraries are going to work with it. In particular there are many language extensions which aren't implemented and some libraries may depend upon them. Best regards, Krzysztof Skrz?tnicki On Sat, Apr 2, 2011 at 15:59, Mike Meyer <m...@mired.org> wrote: > Google didn't turn up anything, so... > > Is there any way to compile haskell to JVM bytecodes? Dalvik, even? A > gcc front end, maybe? > > Thanks, > <mike > -- > Mike Meyer <m...@mired.org> > http://www.mired.org/consulting.html > Independent Software developer/SCM consultant, email for more information. > > O< ascii ribbon campaign - stop html mail - www.asciiribbon.org > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110402/28c8ada8/attachment-0001.htm> ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 34, Issue 4 ****************************************