Re: [Haskell-cafe] [Haskell] ANNOUNCE: control-monad-loop 0.1

2012-07-11 Thread Roman Cheplyaka
* Joey Adams joeyadams3.14...@gmail.com [2012-07-09 14:29:43-0400]
  Also, it's not obvious how your tests work. Please consider using HUnit
  and test-framework (or similar) to organize them.
 
 The tests currently aren't automated.  It's hard to write an automated
 test to make sure a program doesn't leak.  Not impossible (thanks to
 GHC.Stats), but hard.

Unfortunately, in Haskell space usage is not modular[1], so ensuring
that a library (as opposed to a particular program) doesn't lead to
memory leaks is often hard.

Unit/property tests have more obvious benefits, IMO.

[1]: http://ro-che.info/articles/2012-04-08-space-usage-reasoning.html

-- 
Roman I. Cheplyaka :: http://ro-che.info/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANNOUNCE: control-monad-loop 0.1

2012-07-09 Thread Roman Cheplyaka
* Joey Adams joeyadams3.14...@gmail.com [2012-07-09 01:38:06-0400]
 This package provides imperative-style loops supporting continue and
 break.  For example:
 
 import Control.Monad
 import Control.Monad.IO.Class
 import Control.Monad.Trans.Loop
 import Control.Monad.Trans.Class
 
 main :: IO ()
 main =
 foreach [0..] $ \i -
 foreach [0..] $ \j - do
 when (j == 0) $
 continue-- skip to next iteration
 when (j = 5) $
 exit-- exit the loop
 when (i = 5) $
 lift exit   -- exit the outer loop by calling 'exit'
 in the parent monad
 liftIO $ print (i, j)

Very nice!

Here's a patch to generalize foreach to any Foldable:
https://github.com/joeyadams/haskell-control-monad-loop/pull/1

Also, it's not obvious how your tests work. Please consider using HUnit
and test-framework (or similar) to organize them.

-- 
Roman I. Cheplyaka :: http://ro-che.info/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANNOUNCE: control-monad-loop 0.1

2012-07-09 Thread Joey Adams
On Mon, Jul 9, 2012 at 8:28 AM, Roman Cheplyaka r...@ro-che.info wrote:
 Very nice!

 Here's a patch to generalize foreach to any Foldable:
 https://github.com/joeyadams/haskell-control-monad-loop/pull/1

Thanks for the patch!  I merged it, but I plan to wait a little while
before uploading another release to Hackage.  This changes the
signature of an existing function, so I'll have to bump the major
version number.

 Also, it's not obvious how your tests work. Please consider using HUnit
 and test-framework (or similar) to organize them.

The tests currently aren't automated.  It's hard to write an automated
test to make sure a program doesn't leak.  Not impossible (thanks to
GHC.Stats), but hard.

Thanks for pointing out test-framework, though.

-Joey

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe