Re: How to best add logging/debugging code?

2003-11-17 Thread Johannes Waldmann
Ben Escoto wrote:
Hi all, does anyone have any tips on how to insert debugging or
logging statements through a program?  Here are two possibilities:
another thing I found quite useful is
to add a component  { .. , info :: Doc } to my data types,
and then set its value at each function call:
f x y = ( ... ) { info = parens $ fsep [ text "f", info x, info y ] }

( I figure this is sort of part of what
some tools can do automatically? )
that way you always know who built what.
and it's cheap - if you don't use this information,
then it's never created (due to laziness).
best regards,
--
-- Johannes Waldmann,  Tel/Fax: (0341) 3076 6479 / 6480 --
-- http://www.imn.htwk-leipzig.de/~waldmann/ -
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: How to best add logging/debugging code?

2003-11-17 Thread ketil+haskell
Johannes Waldmann <[EMAIL PROTECTED]> writes:

> f x y = ( ... ) { info = parens $ fsep [ text "f", info x, info y ] }

Cool!

> that way you always know who built what.
> and it's cheap - if you don't use this information,
> then it's never created (due to laziness).

Uh..is that really true?  I would think it would keep a lot of data
from being garbage collected?

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: Implementation of while loop

2003-11-17 Thread Abraham Egnor
While "while" can be implemented in haskell, I would strongly suggest you
look at using the many higher-order functions available (foldl/foldr, map,
filter, etc.) - they're much more in line with the spirit of the language,
and will lend themselves to much clearer expressions once you get the hang
of them.

What sort of thing do you want to do in your while loop?  Is it a pure
processing function, or an IO-related one?

Abe

[EMAIL PROTECTED] writes:
>Hi,does any one knows how to implement while-do loop or nested while-do
>loop?
>I'm in a situation that I need to implement  nested while do loop with
>some if-
>then-else condition in my code,but I have no idea about it.Thanks.
>
>Ray
>
>
>
>
>This mail sent through www.mywaterloo.ca
>___
>Haskell mailing list
>[EMAIL PROTECTED]
>http://www.haskell.org/mailman/listinfo/haskell
>



___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


ANN: H98 FFI Addendum 1.0, Release Candidate 16

2003-11-17 Thread Manuel M T Chakravarty
Dear Haskell Folks,

Release Candidate 16 of the H98 FFI Addendum 1.0 is now
available from

  http://www.cse.unsw.edu.au/~chak/haskell/ffi/

Since the last version of the Addendum announced on
<[EMAIL PROTECTED]>, namely RC12, the FFI Task Force
decided on a slight generalisation of the interface to
finalizers as well as the addition of some support for
string marshalling for characters sets beyond ASCII.  A
detailed change log is at the end of this message.

I'd like to propose RC16 as the final form of Version 1.0 of
the FFI Addendum.  If you find any problems with this
version, please raise them within the next two weeks.

Cheers,
Manuel

-=-

Changes since RC15:
* 6.3: Footnote regarding __STDC_ISO_10646__ added to text introducing
   `CWString'.

Changes since RC14:
* 6.2: CWChar -> CWchar
* 6.3: - CWChar -> CWchar
   - Stated explicitly that memory allocated by `newCString' and friends
 can be deallocated by `MarshalAlloc.free'
   - Improved documentation

Changes since RC13:
* 5.3: Fixed typo
* 5.7: Fixed a mistake in the type of `peekByteOff' and `pokeByteOff' (the
   type variable constrained by `Storable' must be different from the
   parameter of the `Ptr')
* 6.3: Improved documentation

Changes since RC12:
* Acks : Added John Meacham
* 4.1.5: Bug fix courtesy of Wolfgang Thaller
* 5.5  : Added `FinalizerEnvPtr', `newForeignPtrEnv', and
 `addForeignPtrFinalizerEnv'
* 6.3  : Added John Meacham proposal for `wchar_t' support as well localised
 string marshalling; in particular, this adds `CWString' and
 `CWStringLen' as well as the `CWString' and the `CAString' family
 of marshalling routines.  In addition, `charIsRepresentable' was
 added. 
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell