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. Re: Where do you put your tests? (Michael Orlitzky) 2. Re: Where do you put your tests? (Magnus Therning) 3. Re: Where do you put your tests? (Brent Yorgey) 4. Re: Where do you put your tests? (Michael Orlitzky) 5. simple sound playback (Gnu/Linux) (Christopher Howard) 6. Re: Where do you put your tests? (Magnus Therning) ---------------------------------------------------------------------- Message: 1 Date: Sat, 21 Jul 2012 13:50:46 -0400 From: Michael Orlitzky <mich...@orlitzky.com> Subject: Re: [Haskell-beginners] Where do you put your tests? To: beginners@haskell.org Message-ID: <500aebf6.3020...@orlitzky.com> Content-Type: text/plain; charset=ISO-8859-1 On 07/19/2012 09:27 AM, damodar kulkarni wrote: > > Good because library dependencies are reduced, but bad because tests > are somewhat "disconnected" from the functions they are testing. > > > AFAIK, it's a good engineering practice to separate the tests from the > code they are supposed to test. Code management issues will be there, > but those can be taken care with the help of cabal like tool. > That way, a person who wants to test will use the test-files and the one > who doesn't want will be spared the trouble of separating tests from the > intended function code. > This is the solution I'd prefer, but I quickly ran into a problem: if I want to test internal (non-exported) functions, the tests need to be in the same module as the code. Is there a way around this? (For now, I just put the code in the same file and depend on the test libs.) ------------------------------ Message: 2 Date: Sat, 21 Jul 2012 20:04:35 +0200 From: Magnus Therning <mag...@therning.org> Subject: Re: [Haskell-beginners] Where do you put your tests? To: Michael Orlitzky <mich...@orlitzky.com> Cc: beginners@haskell.org Message-ID: <CAAExw5sQ0DiH19T-R=ZxLfXauz9jdSnz+XFsmR=oseg7qjb...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 On Sat, Jul 21, 2012 at 7:50 PM, Michael Orlitzky <mich...@orlitzky.com> wrote: > On 07/19/2012 09:27 AM, damodar kulkarni wrote: >> >> Good because library dependencies are reduced, but bad because tests >> are somewhat "disconnected" from the functions they are testing. >> >> >> AFAIK, it's a good engineering practice to separate the tests from the >> code they are supposed to test. Code management issues will be there, >> but those can be taken care with the help of cabal like tool. >> That way, a person who wants to test will use the test-files and the one >> who doesn't want will be spared the trouble of separating tests from the >> intended function code. >> > > This is the solution I'd prefer, but I quickly ran into a problem: if I > want to test internal (non-exported) functions, the tests need to be in > the same module as the code. > > Is there a way around this? > > (For now, I just put the code in the same file and depend on the test libs.) A common issue. I, and some others I've seen, have a FooInternal module exporting *everything* for the tests, and a Foo module exporting only the public API. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus ------------------------------ Message: 3 Date: Sat, 21 Jul 2012 14:12:21 -0400 From: Brent Yorgey <byor...@seas.upenn.edu> Subject: Re: [Haskell-beginners] Where do you put your tests? To: beginners@haskell.org Message-ID: <20120721181220.ga18...@seas.upenn.edu> Content-Type: text/plain; charset=us-ascii On Sat, Jul 21, 2012 at 08:04:35PM +0200, Magnus Therning wrote: > On Sat, Jul 21, 2012 at 7:50 PM, Michael Orlitzky <mich...@orlitzky.com> > wrote: > > On 07/19/2012 09:27 AM, damodar kulkarni wrote: > >> > >> Good because library dependencies are reduced, but bad because tests > >> are somewhat "disconnected" from the functions they are testing. > >> > >> > >> AFAIK, it's a good engineering practice to separate the tests from the > >> code they are supposed to test. Code management issues will be there, > >> but those can be taken care with the help of cabal like tool. > >> That way, a person who wants to test will use the test-files and the one > >> who doesn't want will be spared the trouble of separating tests from the > >> intended function code. > >> > > > > This is the solution I'd prefer, but I quickly ran into a problem: if I > > want to test internal (non-exported) functions, the tests need to be in > > the same module as the code. > > > > Is there a way around this? > > > > (For now, I just put the code in the same file and depend on the test libs.) > > A common issue. I, and some others I've seen, have a FooInternal > module exporting *everything* for the tests, and a Foo module > exporting only the public API. I do this too. (For an example, see http://hackage.haskell.org/package/split ). It has another benefit beyond testing: I tend to export both modules from the package, and make it clear that beginning users should start by looking at the module with the public API; but for power users who want more control or access and don't mind the possibility of shooting themselves in the foot, the "export everything" module is also available. -Brent ------------------------------ Message: 4 Date: Sat, 21 Jul 2012 14:53:41 -0400 From: Michael Orlitzky <mich...@orlitzky.com> Subject: Re: [Haskell-beginners] Where do you put your tests? To: Magnus Therning <mag...@therning.org> Cc: beginners@haskell.org Message-ID: <500afab5.1030...@orlitzky.com> Content-Type: text/plain; charset=UTF-8 On 07/21/2012 02:04 PM, Magnus Therning wrote: > On Sat, Jul 21, 2012 at 7:50 PM, Michael Orlitzky <mich...@orlitzky.com> > wrote: >> On 07/19/2012 09:27 AM, damodar kulkarni wrote: >>> >>> Good because library dependencies are reduced, but bad because tests >>> are somewhat "disconnected" from the functions they are testing. >>> >>> >>> AFAIK, it's a good engineering practice to separate the tests from the >>> code they are supposed to test. Code management issues will be there, >>> but those can be taken care with the help of cabal like tool. >>> That way, a person who wants to test will use the test-files and the one >>> who doesn't want will be spared the trouble of separating tests from the >>> intended function code. >>> >> >> This is the solution I'd prefer, but I quickly ran into a problem: if I >> want to test internal (non-exported) functions, the tests need to be in >> the same module as the code. >> >> Is there a way around this? >> >> (For now, I just put the code in the same file and depend on the test libs.) > > A common issue. I, and some others I've seen, have a FooInternal > module exporting *everything* for the tests, and a Foo module > exporting only the public API. > I think I could get rid of the test lib dependencies this way, but doesn't the export-everything approach prevent GHC from making certain optimizations? GHC can be quite a bit more aggressive with pieces of code if it knows they are not exported. (I think I may have had evidence of this at one point, but who knows now.) [1] http://www.haskell.org/ghc/docs/latest/html/users_guide/faster.html ------------------------------ Message: 5 Date: Sat, 21 Jul 2012 19:48:50 -0800 From: Christopher Howard <christopher.how...@frigidcode.com> Subject: [Haskell-beginners] simple sound playback (Gnu/Linux) To: Haskell Beginners <beginners@haskell.org> Message-ID: <500b7822.6030...@frigidcode.com> Content-Type: text/plain; charset="iso-8859-1" Hi. I've been playing around with gloss and its game modeling module. However, I am wondering what package to use to get simple sound playback. (For example, playing an explosion sound when a bomb lands.) There seem to be lots of modules in the sound category at hackage but I'm not sure what would be appropriate and simplest to use. (Only Gnu/Linux compatibility matters, if that helps.) -- frigidcode.com indicium.us -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 554 bytes Desc: OpenPGP digital signature URL: <http://www.haskell.org/pipermail/beginners/attachments/20120721/fcde49fc/attachment-0001.pgp> ------------------------------ Message: 6 Date: Sun, 22 Jul 2012 09:42:35 +0200 From: Magnus Therning <mag...@therning.org> Subject: Re: [Haskell-beginners] Where do you put your tests? To: Michael Orlitzky <mich...@orlitzky.com> Cc: beginners@haskell.org Message-ID: <20120722074235.GC1240@ohann> Content-Type: text/plain; charset="us-ascii" On Sat, Jul 21, 2012 at 02:53:41PM -0400, Michael Orlitzky wrote: >On 07/21/2012 02:04 PM, Magnus Therning wrote: >> On Sat, Jul 21, 2012 at 7:50 PM, Michael Orlitzky <mich...@orlitzky.com> >> wrote: >>> On 07/19/2012 09:27 AM, damodar kulkarni wrote: >>>> >>>> Good because library dependencies are reduced, but bad >>>> because tests are somewhat "disconnected" from the functions >>>> they are testing. >>>> >>>> >>>> AFAIK, it's a good engineering practice to separate the tests >>>> from the code they are supposed to test. Code management issues >>>> will be there, but those can be taken care with the help of cabal >>>> like tool. That way, a person who wants to test will use the >>>> test-files and the one who doesn't want will be spared the >>>> trouble of separating tests from the intended function code. >>>> >>> >>> This is the solution I'd prefer, but I quickly ran into a problem: >>> if I want to test internal (non-exported) functions, the tests >>> need to be in the same module as the code. >>> >>> Is there a way around this? >>> >>> (For now, I just put the code in the same file and depend on the >>> test libs.) >> >> A common issue. I, and some others I've seen, have a FooInternal >> module exporting *everything* for the tests, and a Foo module >> exporting only the public API. >> > > I think I could get rid of the test lib dependencies this way, but > doesn't the export-everything approach prevent GHC from making > certain optimizations? > > GHC can be quite a bit more aggressive with pieces of code if it > knows they are not exported. > > (I think I may have had evidence of this at one point, but who knows > now.) > > [1] http://www.haskell.org/ghc/docs/latest/html/users_guide/faster.html Very possible but correctness trumps speed ;-) The only only solution I've thought of is to use a C preprocessor to control what's exported. Of course that means the tests can't link against the library. /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/20120722/3866ff5b/attachment-0001.pgp> ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 49, Issue 25 *****************************************