Re: [Haskell-cafe] tplot and splot - analyst's swiss army knifes for visualizing log files

2011-03-18 Thread Ferenc Wagner
Eugene Kirpichov ekirpic...@gmail.com writes:

 2011/3/17 Ferenc Wagner wf...@niif.hu:
 Eugene Kirpichov ekirpic...@gmail.com writes:

 2010/12/17 Henning Thielemann schlepp...@henning-thielemann.de:

 Eugene Kirpichov schrieb:

 I've published a large presentation about two Haskell-based tools of
 mine - tplot and splot.

 Their motto is visualize system behavior from logs with a shell 
 one-liner.
 Based on my experience, they usually seem to live up to this motto.


 http://www.slideshare.net/jkff/two-visualization-tools


 [attention attractor: the presentation has *really a lot* of pictures]

 ... and complete TeX code attached! :-) However can I also view a simple
 PDF document of the presentation?

 You can download the PDF here -
 http://www.slideshare.net/jkff/two-visualization-tools/download
 (however one has to be logged in to Slideshare, for example with a
 facebook acct., for this link to work)

 Just in case, I'm also attaching a PDF of the current version to this
 email, but visiting the link is preferable, since I'll be updating the
 contents.

 Please, if at all possible, link an up-to-date downloadable PDF from the
 documentation (http://hackage.haskell.org/package/timeplot) or from the
 homepage (http://haskell.org/haskellwiki/Timeplot) to make our life
 easier!

 Anyway, your tools look very interesting, I gave tplot a shot.
 Unfortunately, I hit various strange failures:

 $ head -4 or.log
 Mar  8 18:55:11 =overrun 1
 Mar  8 18:55:13 =overrun 6
 Mar  8 18:55:15 =overrun 13
 Mar  8 18:55:16 =overrun 3

 $ wc -l or.log
 466 or.log

 $ ls -l or.log overruns466.log
 lrwxrwxrwx 1 wferi wferi    15 Mar 17 14:45 or.log - overruns466.log
 -rw-rw-r-- 1 wferi wferi 12587 Mar 17 14:35 overruns466.log

 $ tplot -if or.log -tf 'date %b %e %T' -o overruns.png -k 'overrun' 'sum 10'

 This worked just fine.  However, when given the same file with a longer
 name, tplot does not terminate:

 $ tplot -if overruns466.log -tf 'date %b %e %T' -o overruns.png -k 'overrun' 
 'sum 10'
 ^C

 while doing the same the other way around still works:

 $ cat overruns466.log | tplot -if - -tf 'date %b %e %T' -o overruns.png -k 
 'overrun' 'sum 10'

 Choosing any other extension (svg, pdf or ps) also results in
 nontermination (or at least unbearable runtime and memory consumption).

 Adding a simple no-op statement, like:

 diff -ur ../timeplot-0.2.19/Tools/TimePlot.hs ./Tools/TimePlot.hs
 --- ../timeplot-0.2.19/Tools/TimePlot.hs        2011-03-09 
 11:36:24.0 +0100
 +++ ./Tools/TimePlot.hs 2011-03-17 16:42:57.247625607 +0100
 @@ -627,6 +627,7 @@
   when (null args || args == [--help]) $ showHelp  exitSuccess
   case (readConf args) of
     Conf conf - do
 +      putStr 
       let render = case (outFormat conf) of {
           PNG    - \c w h f - const () `fmap` renderableToPNGFile c w h f;
           PDF    - renderableToPDFFile ;

 also results in nontermination, even in the previously working case.
 Something is clearly wrong here, seemingly in the runtime IO system.
 [...]

 Thank you for reporting the bug - it's very curious, I will look into
 it in the nearest couple of days.

Great, thanks!

 Could you please send me privately the actual input file on which the
 program crashes?

Well, it compresses to 1511 bytes, so I risk attaching it here for
simplicity.

 I have added a downloadable link to the presentation to all places
 where the slideshare link was present (finally making some use of my
 hosting...).
 Here it is: http://jkff.info/presentations/two-visualization-tools.pdf

Wonderful, thanks a lot!
-- 
Regards,
Feri.



overruns466.log.gz
Description: Binary data
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] tplot and splot - analyst's swiss army knifes for visualizing log files

2011-03-17 Thread Ferenc Wagner
Eugene Kirpichov ekirpic...@gmail.com writes:

 2010/12/17 Henning Thielemann schlepp...@henning-thielemann.de:

 Eugene Kirpichov schrieb:

 I've published a large presentation about two Haskell-based tools of
 mine - tplot and splot.

 Their motto is visualize system behavior from logs with a shell one-liner.
 Based on my experience, they usually seem to live up to this motto.


 http://www.slideshare.net/jkff/two-visualization-tools


 [attention attractor: the presentation has *really a lot* of pictures]

 ... and complete TeX code attached! :-) However can I also view a simple
 PDF document of the presentation?

 You can download the PDF here -
 http://www.slideshare.net/jkff/two-visualization-tools/download
 (however one has to be logged in to Slideshare, for example with a
 facebook acct., for this link to work)

 Just in case, I'm also attaching a PDF of the current version to this
 email, but visiting the link is preferable, since I'll be updating the
 contents.

Please, if at all possible, link an up-to-date downloadable PDF from the
documentation (http://hackage.haskell.org/package/timeplot) or from the
homepage (http://haskell.org/haskellwiki/Timeplot) to make our life
easier!

Anyway, your tools look very interesting, I gave tplot a shot.
Unfortunately, I hit various strange failures:

$ head -4 or.log
Mar  8 18:55:11 =overrun 1
Mar  8 18:55:13 =overrun 6
Mar  8 18:55:15 =overrun 13
Mar  8 18:55:16 =overrun 3

$ wc -l or.log
466 or.log

$ ls -l or.log overruns466.log
lrwxrwxrwx 1 wferi wferi15 Mar 17 14:45 or.log - overruns466.log
-rw-rw-r-- 1 wferi wferi 12587 Mar 17 14:35 overruns466.log

$ tplot -if or.log -tf 'date %b %e %T' -o overruns.png -k 'overrun' 'sum 10'

This worked just fine.  However, when given the same file with a longer
name, tplot does not terminate:

$ tplot -if overruns466.log -tf 'date %b %e %T' -o overruns.png -k 'overrun' 
'sum 10'
^C

while doing the same the other way around still works:

$ cat overruns466.log | tplot -if - -tf 'date %b %e %T' -o overruns.png -k 
'overrun' 'sum 10'

Choosing any other extension (svg, pdf or ps) also results in
nontermination (or at least unbearable runtime and memory consumption).

Adding a simple no-op statement, like:

diff -ur ../timeplot-0.2.19/Tools/TimePlot.hs ./Tools/TimePlot.hs
--- ../timeplot-0.2.19/Tools/TimePlot.hs2011-03-09 11:36:24.0 
+0100
+++ ./Tools/TimePlot.hs 2011-03-17 16:42:57.247625607 +0100
@@ -627,6 +627,7 @@
   when (null args || args == [--help]) $ showHelp  exitSuccess
   case (readConf args) of
 Conf conf - do
+  putStr 
   let render = case (outFormat conf) of {
   PNG- \c w h f - const () `fmap` renderableToPNGFile c w h f;
   PDF- renderableToPDFFile ;

also results in nontermination, even in the previously working case.
Something is clearly wrong here, seemingly in the runtime IO system.
-- 
Thanks,
Feri.

GHC 6.12.1
Chart-0.14
bytestring-0.9.1.5
bytestring-lexing-0.2.1
cairo-0.11.0
colour-2.3.1
containers-0.3.0.0
data-accessor-0.2.1.3
data-accessor-template-0.2.1.7
haskell98-1.0.1.1
regex-tdfa-1.1.4
strptime-1.0.1
time-1.1.4

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


Re: [Haskell-cafe] HDF5 binding

2011-03-04 Thread Ferenc Wagner
James Andrew Cook mo...@deepbondi.net writes:

 What an interesting coincidence, that makes at least three of
 us. Apparently it's an idea whose time has come.

 Mine is also an incomplete low-level binding but is currently under
 semi-active development and I aim to make it cover the entire hdf5.h
 interface.

 If anyone is interested in it I've put it on github at:
 https://github.com/mokus0/bindings-hdf5

Hi,

This is fairly extensive indeed!  I got nowhere near this, but also took
a somewhat different angle, especially by using StorableArrays for
passing arrays around (I used HDF5 in conjunction with LaPack).  I also
experienced with going a little higher level here and there.  Attributes
aren't implemented yet, because that would require making location ids a
type class.  An unsolved problem is the safe representation of ranks: I
went for generality by using lists for indexing, but it would be nice to
express dimensionality constraints in the types (with sane syntax).
Maybe there's a handy technique for this, I didn't explore the field.
Talking about indexing, choosing Fortran convention seems to be a
mistake in retrospect, but that's no big deal.

I attach my code so you can get a better idea what I'm talking about,
maybe you can find some usable pieces.  Separating the generic hid type
into specific newtypes worked out to some extent, but maybe isn't a good
idea at the lowest level (where the FFI makes it automatic).  I'd need
broader experience with the HDF5 API to tell.
-- 
Regards,
Feri.



hdf5.tgz
Description: GNU Unix tar archive
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] HDF5 binding (was: why is ghci trying to load hsc file ??)

2011-03-02 Thread Ferenc Wagner
bri...@aracnet.com writes:

 I worked out a small hdf5 binding using cabal and bindings-DSL and
 sqlite3 as my example.

Hi,

I just wanted to add that I also started an HDF5 binding recently (using
hsc2hs only).  It does more than enough for me ATM, so I don't develop
it actively, but if you want to pursue this (and I think it would be a
useful addition to Hackage), we may share experience and code.  My
binding is part of a bigger project, but I meant to split it out anyway.
-- 
Regards,
Feri.

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


Re: Debian stable not supported?

2008-09-22 Thread Ferenc Wagner
Yitzchak Gale [EMAIL PROTECTED] writes:

 Roman Cheplyaka wrote:

 I think I'll face with the similar problem in the nearest future, except
 I have far more old system. So I'll be very greatful if you provide the
 instructions and record your experience.

 (Looks like I may need to do this again soon for 6.10,
 unless they support Debian stable this time.)

Hi,

Looks like it would be best to coordinate with debian-haskell:
http://urchin.earth.li/pipermail/debian-haskell/2008-September/000492.html
-- 
Cheers,
Feri.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell-cafe] Re: [darcs-users] poll: how can we help you contribute to darcs?

2008-08-04 Thread Ferenc Wagner
wren ng thornton [EMAIL PROTECTED] writes:

 [Bug trackers are an excellent source of tasks for active developers to 
 use so things don't get lost, but they're awful for new developers. For 
 someone just joining the project it's rarely clear how important a task 
 is, how hard, or how far reaching its consequences (or whether someone's 
 already working on it). Good trackers have fields to note these things, 
 but the notes are engineered for active developers; the extent to which 
 those notes are even used or accurate varies wildly from project to 
 project. Hence, having a clear discussion about what things really are 
 important and how much they interact with everything else is a great boon.]

Agreed.  In short, shouldn't Darcs come up with sth like
http://wiki.winehq.org/JanitorialProjects or
http://janitor.kernelnewbies.org/ perhaps?

And of course with some serious up-to-date documentation on the theory
behind Darcs.  AFAIK Ian Lynagh started working on one.  I'd say:
first be precise.  Don't be afraid of abstract algebra, it's
university material, quite some people actually understands it.  And
those can later explain the hard to grasp parts.  But I never felt
like diving into the bunch of hazy metaphors I found about the inner
workings of Darcs, even though I was and still am interested.  So I
nevert felt qualified to touch anything important or assess the
performance problems for example.
-- 
Cheers,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: problem in using wash

2008-03-04 Thread Ferenc Wagner
Vikrant [EMAIL PROTECTED] writes:

 I was trying to use wash to learn it. I am using ubuntu and I have ghc6.6.1
 installed on my system.
 I have also installed the package libghc6-wash-dev

 but in my code when i write

 import WASH.CGI

 it gives me following error

 firstCGI.hs:5:7:
 Could not find module `WASH.CGI':
   locations searched:
 WASH/CGI.hs
 WASH/CGI.lhs
 Failed, modules loaded: none.



 can somebody help me in this?

Check with 'ghc-pkg list' if the package is present, then use
'ghc-pkg describe WashNGo' to get the exported module names.  Also
don't forget to use --make when compiling (or explicit package name).
-- 
Regards,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Any Debian Etch packages for GHC 6.8.2?

2008-01-11 Thread Ferenc Wagner
Ian Lynagh [EMAIL PROTECTED] writes:

 On Tue, Jan 08, 2008 at 11:23:59AM +0100, Wagner Ferenc wrote:
 
 Ian uploaded 6.8.2 the day before yesterday...  Maybe when he's
 finished with this work, a rebuild on Etch won't be too difficult.

 I do plan to do this at some point, but it's not imminent I'm afraid.

Maybe I can lend you a hand if you describe the plan.  I've got some
packaging experience, but not with beasts of this complexity.
-- 
Regards,
Feri.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: GHC 6.6.1 on Debian Etch?

2007-06-08 Thread Ferenc Wagner
Wagner Ferenc [EMAIL PROTECTED] writes:

 Stefan O'Rear [EMAIL PROTECTED] writes:

 On Tue, Jun 05, 2007 at 10:13:41PM +0200, Wagner Ferenc wrote:

 what's the best way to install GHC 6.6.1 on a Debian Etch system?
 Basically: are there installable packages available somewhere, or
 should I recompile the Sid packages, or create a stub package from a
 binary .tar.gz bundle, or some other option I didn't think of?

 Yes.

 Install the binary .tar.gz bundle *without creating a stub package*

 It installs in /usr/local, so dpkg must not know about it.

 Hmm, you have got a point, but then I can't uninstall/upgrade later
 easily, I'm afraid.

I poked a little further down this road.  For creating a package, it
would be useful if I could ./configure --prefix=/usr and later
DESTDIR=/tmp/stage make install (or similar, you got the idea) so that
I can gather the would-be-installed files into a package for later
installation.  If no pathes are wired into the binaries during make
install, then setting prefix to /tmp/stage/usr would do the trick, but
it's not the case, I guess.  Something similar must be necessary for
Igloo to create the Debian Sid packages, so I find it somewhat
surprising that it's not present in Makefile.in (or Makefile-bin.in?)
On the other hand, he must be working with the source distribution,
which may have this infrastructure...  Anyway, it would be simple to
add this by augmenting the install commands, but before I dive into
this, I wanted to ask for your opinions.
-- 
Thanks,
Feri.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: GHC 6.6.1 on Debian Etch?

2007-06-08 Thread Ferenc Wagner
In the end I created a new ghc6 package from the binary bundle by
slight modifications and shameless theft from Ian Lynagh control
file.  It seems to work together with libreadline4 from Sarge.  I'm
willing to share it with anybody interested.
-- 
Regards,
Feri.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell-cafe] Re: Matlab/BLAS/LAPack

2007-04-03 Thread Ferenc Wagner
Alexander McPhail [EMAIL PROTECTED] writes:

 I am embarking on a project to bind to CBLAS and CLAPack.

Do you know of http://www.cs.utah.edu/~hal/HBlas/index.html ?
-- 
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Lazy IO and closing of file handles

2007-03-20 Thread Ferenc Wagner
Matthew Brecknell [EMAIL PROTECTED] writes:

 enumLines :: (a - String - Either a a) - a - FilePath - IO a
 enumLines iter accum filename = do
   h - openFile filename ReadMode
   flip fix accum $
 \iterate accum - do
   try_line - try (hGetLine h)
   case try_line of
 Left e - hClose h  return accum
 Right line - do
   case iter accum line of
 Left accum - hClose h  return accum
 Right accum - iterate accum

Another variation, enabling multiple iteratees (like a state machine),
exception propagation, and no flip fix :)

 newtype Iterator a = Iterator (a - String - (a,Maybe (Iterator a)))
 
 enumLines :: Iterator a - a - FilePath - IO (a,Maybe Exception)
 enumLines iterator start filename = do
   h - openFile filename ReadMode
   let f (Iterator iter) accum = do
 try_line - try (hGetLine h)
 case try_line of
   Left e - hClose h  return (accum,Just e)
   Right line - do
 case iter accum line of
   (acc',Nothing)   - hClose h  return (acc',Nothing)
   (acc',Just cont) - f cont acc'
   f iterator start
-- 
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: IO in lists

2007-01-19 Thread Ferenc Wagner
Magnus Therning [EMAIL PROTECTED] writes:

 Thanks for all the excellent answers to my original question.  Somehow
 it feels like I advanced and got one level closer to a black belt in
 Haskell due to this; I've now legitimately used a function from
 System.IO.Unsafe :-)

 I tried to document it all: http://therning.org/magnus/archives/249

I wonder whether the unsafeInterleaved solution is guarranteed to work
as per your specification.  Couldn't it read a character, write it,
then read three characters, write two, read one more then write two
again, and so on?  It has to catch up at the end, but needn't stay
synchronized during the process, perhaps...
-- 
Thanks,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell] Re: Capturing output from System.system

2007-01-17 Thread Ferenc Wagner
David House [EMAIL PROTECTED] writes:

 Sorry Mads for multiple copies.

 On 16/01/07, Mads Lindstrøm [EMAIL PROTECTED] wrote:

 The function System.system (:: String - IO ExitCode) makes the OS
 execute it first parameter as a command. It prints its output to
 standard output and standard error.

 How do I easily capture this output?

 Try System.Process.runInteractiveCommand:

 import System.Process
 import System.IO

 main = do
   (inH, outH, errH, _) - runInteractiveCommand wc -w
   hPutStr inH foo bar baz
   ws - hGetContents outH
   putStrLn ws

 -- Prints 3

Beware, deadlocks ahead.  See:

http://www.haskell.org/pipermail/libraries/2006-December/006635.html
http://www.haskell.org/pipermail/haskell-cafe/2006-December/020528.html
-- 
Feri.
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] exception output

2006-12-19 Thread Ferenc Wagner
Hi,

the following program

main = readFile nonexistent = putStr

is meant to produce an exception.  When compiled with GHC 6.4, it
outputs the *** Exception... string to stderr, which makes me happy.
However, when run with runghc6 or runhugs, the message is sent to
stdout, which makes me sad.

Is this inconsistency intentional?
-- 
Thanks,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Network.Socket endian problem?

2006-12-14 Thread Ferenc Wagner
Tomasz Zielonka [EMAIL PROTECTED] writes:

 On Wed, Dec 13, 2006 at 03:54:59PM -0600, Mark Hills wrote:
 It does expect the address to be in network byte order instead of host
 byte order, which is usually done using htons and htonl. This seems to
 do what you want (running SUSE 10.1 on an Intel box):

 Who agrees with me that it would be nice if network libraries used host
 byte order in their interface? Or at least they could use an abstract
 data type, whose byte order would be unobservable.

Why is this trapdoor present in the C library?
-- 
  Feri.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell-cafe] Re: best Linux for GHC?

2006-11-13 Thread Ferenc Wagner
Bulat Ziganshin [EMAIL PROTECTED] writes:

 of remaining, Ubuntu has widest support here while SuSe is favourite
 of my friend. one thing that i like in suse is that it uses the same
 RPMs as RedHat and RPMs is widely used for packaging software
 available via internet. Is Ubuntu supports RPMs too?

Hi Bulat,

forget RPM's, real men use DEB's.  Ubuntu -- being a Debian derivative
-- does so, too.  Btw Debian unstable has got GHC 6.6, and isn't
unstable nowadays, except for the name.  Better call it Sid; the
freezing process has already begun.  If you are interested in a stable
system with GHC 6.6, go with Debian Sid until it transforms into Etch
(the next stable version).  Then you can forget hacking Linux for a
couple of years.  On the other hand, it will probably take some months
until release, which brings some risk in the game.
-- 
Regards,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ldap-haskell questions

2006-07-26 Thread Ferenc Wagner
Donn Cave [EMAIL PROTECTED] writes:

 Now that I look at what I did with ldap_set_option, I recall that
 s actually a little difficult to assign a type, since the third
 parameter is sometimes Int, Enum, TimeVal, String, and LDAP_OPT_*
 values overlap in a way that doesn't really say enum to me.  So
 it's reasonably easy to do something, but harder to do it in a way
 that's generally useful.

 I'm also unsure of the portability of the things I'd propose to add.
 I know only the OpenLDAP API, but something about LDAP_OPT_X_TLS
 hints that it may be non-standard.

I ended up binding ldap_initialize, which supports ldaps:
URL-s, and was achievable in a 10 line absolutely
nonintrusive patch (darcs sent).  Good enough for me ATM.
-- 
Best wishes,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ldap-haskell questions

2006-07-15 Thread Ferenc Wagner
Donn Cave [EMAIL PROTECTED] writes:

 On Thu, 13 Jul 2006, Ferenc Wagner wrote:
 ...
 Second, I find no trace of SSL/TLS routines.  Is that really
 left out, or do I overlook something?

 OpenLDAP supports an option LDAP_OPT_X_TLS --

 ldap_set_option Nothing LDAP_OPT_X_TLS LDAP_OPT_X_TLS_DEMAND
 ...
 ldapconnection - ldap_initialize url

 I assume you will find something like that there (the above is
 actually from my own LDAP interface, but since I haven't seen
 any other response to this question ...)

find -type f | xargs grep -i tls
revealed nothing in my ldap-haskell tree.  Isn't your interface
available for the public by chance?

 Have no idea about static binaries, even what that means.  When 
 I compile with ghc, I get reasonably static libraries inasmuch
 as there aren't any GHC shared objects, but of course libc is
 shared, as well as anything specified on the link command that
 turns out to be a shared library.  If for example I have both
 a libldap.so and libldap.a and I want to link to the latter (as
 indeed I would), then it's up to me to say so on the link command,
 libldap.a instead of -lldap.  Pardon me if that's obvious!

Perhaps it should have been.  I tried putting -optl -static
on the command line here are there, and that indeed worked
until I started using the LDAP binding.  Erred out
afterwards.  But putting in libldap.a looks like a good
idea, I will try.
-- 
Thanks,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] can't WashNGo (abstract tables)

2006-07-14 Thread Ferenc Wagner
Hi,

trying to put WashNGo-2.9 to a nontrivial prototyping job
gave some very compelling results so far, but also got me
stumped on occasions.  I'd be grateful for some guidance on
the following points, concerning abstract tables mainly.

* selectionDisplay: looks like displayFun (fourth arg)
  mustn't fail for null arguments, as it's invoked with them
  after leaving the page it appears on.  An error or a
  feature?  Is it documented?

* trying to get around the Strings only restriction of
  AT's I threw in some show-read pairs, but got the
  impression that the channel is not Char-clean:
  Base64.encode . UTF8.encode helped.  What's the spec?

* should a click on an AT radio button result in submission
  of the form?  It does not, which is OK with me.  But the
  following code fails in a rather strange way:

 data Record = P String Person | R String Role | Unknown String deriving 
 (Read,Show)

 unAtSafe :: String - Record
 unAtSafe = read . fst . UTF8.decode . Base64.decode
 
 edit sg = case record of
   P dn p- editPerson dn p
   R dn r- editRole dn r
   Unknown s - standardQuery No dice $ CGI.div $ -- provokes error 
 in AbstractSelector.hs:115
do p $ text s
   goBack
 where record = unAtSafe $ head $ unAR $ value sg 
 
 editPerson :: String - Person - CGI ()
 editPerson dn p =
 standardQuery Edit person $ CGI.div $
 do inputs - personTable p
actionPar Modify (createPerson dn) inputs

  In this case Person and Role contain String fields only.
  The abstract table contains Records, and the above
  function 'edit' dispatches on the type of the selected
  Record.  The first two cases work, the Unknown case trips
  on an 'error' in the WashNGo code as indicated.  It's in
  the valueSelectionGroup function, if selectionValue is
  Nothing.  How could I fix this?

* Lastly, how can I go back some queries?  goBack above is
  basically a 'submit0 (return ())' which continues the main
  'forever' loop.  But what if I need to go back in the
  middle of the current loop, as if the user pressed Back
  several times?
-- 
Thanks,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ldap-haskell questions

2006-07-13 Thread Ferenc Wagner
Hi,

to start off, I'm using ldap-haskell straight from its darcs
repo under GHC-6.4.1, and it works.  Just not quite like I
want.

First, I can't make a static compile:
$ ghc --make prog.hs -o prog
works without a warning, while
$ ghc --make prog.hs -o prog -optl -static
[...]
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libldap.a(os-ip.o)(.text+0x38a): In 
function `ldap_pvt_is_socket_ready':
: warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libldap.a(os-ip.o)(.text+0x381): In 
function `ldap_pvt_is_socket_ready':
: warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libldap.a(os-ip.o)(.text+0x684): In 
function `ldap_connect_to_host':
: warning: Using 'getaddrinfo' in statically linked applications requires at 
runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libldap.a(util-int.o)(.text+0x232): 
In function `ldap_pvt_gethostbyaddr_a':
: warning: Using 'gethostbyaddr_r' in statically linked applications requires 
at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libldap.a(util-int.o)(.text+0x64): 
In function `ldap_pvt_gethostbyname_a':
: warning: Using 'gethostbyname_r' in statically linked applications requires 
at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libldap.a(open.o)(.text+0x1b7): In 
function `ldap_create':
: undefined reference to `ber_memcalloc'
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libldap.a(open.o)(.text+0x26d): In 
function `ldap_create':
: undefined reference to `ber_sockbuf_alloc'
[...]
(plenty of undefined references elided)

If I cut out the LDAP part, the above command creates a
static executable just fine.

Second, I find no trace of SSL/TLS routines.  Is that really
left out, or do I overlook something?
-- 
Thanks,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] DBDirect trouble

2006-06-14 Thread Ferenc Wagner
Hi!

Let me repeat my question from IRC here, too...
I installed HaskellDB and all the necessary stuff (I hope)
as local (not system-wide) packages:

$ ghc-pkg list
/usr/lib/ghc-6.4.1/package.conf:
rts-1.0, base-1.0, haskell98-1.0, template-haskell-1.0, unix-1.0,
Cabal-1.0, parsec-1.0, haskell-src-1.0, network-1.0,
QuickCheck-1.0, HUnit-1.1, mtl-1.0, fgl-5.2, X11-1.1, HGL-3.1,
stm-1.0, readline-1.0, (lang-1.0), (concurrent-1.0), (posix-1.0),
(util-1.0), (data-1.0), (text-1.0), (net-1.0), (hssource-1.0)
/home/wferi/.ghc/i386-linux-6.4.1/package.conf:
NewBinary-0.1, Crypto-3.0.3, (Cabal-1.0), Cabal-1.1.4, hsql-1.7,
hsql-mysql-1.7, haskelldb-0.9, plugins-1.0, haskelldb-dynamic-0.9,
haskelldb-hsql-0.9, haskelldb-hsql-mysql-0.9

Still, DBDirect doesn't run:

$ ~/haskell/installed/bin/DBDirect Test mysql 
server=myserver,db=test,uid=wferi,pwd=secret
DB/Direct: Daan Leijen (c) 1999, HWT (c) 2003-2004,
   Bjorn Bringert (c) 2005
Connecting to database...

DBDirect: user error (Couldn't load Database.HaskellDB.HSQL.MySQL.driver from 
package haskelldb-hsql-mysql-0.9)

strace -eopen shows it reads /usr/lib/ghc-6.4.1/package.conf
only, not the local one...  Any ideas how to persuade it to
use the locally installed packages?
-- 
Thanks,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] LDIF output library

2006-05-30 Thread Ferenc Wagner
Hi,

does anybody know of a library for writing LDIF files?  If
not, I may create one, and would be grateful for
suggestions.  Is it worth integrating with John Goerzen's
LDAP binding, for example?
-- 
Thanks,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Coin changing algorithm

2005-07-14 Thread Ferenc Wagner
Mark Carroll [EMAIL PROTECTED] writes:

 On Wed, 13 Jul 2005, Dinh Tien Tuan Anh wrote:

 (snip)
 eg: m = 75, k = 5
  =   [50, 20, 5]
  [50, 20, 1,2,2]
 (snip)
 Is this problem suitable for functional programming language ?

 Oh, what fun. I like this sort of thing. My quick attempt is:

Just for more fun, here is my solution for all the
partitions of all Ints.  Yes, I really used it for real work
(quantum field theory, heh).  There is no limit on the
lengths, but that could be easily added, I think.  And it's
fully memoized.  Here we go:

 partitions :: [[[Int]]]
 partitions =  [[]]:[[n]:concat [map (m:) $ dropWhile ((m).head) pars
 | (m,pars) - zip [n-1,n-2..1] (tail 
 partitions)]
 | n - [1..]]
-- 
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: CGI module almost useless

2005-06-03 Thread Ferenc Wagner
John Goerzen [EMAIL PROTECTED] writes:

 On 2005-06-02, Ferenc Wagner [EMAIL PROTECTED] wrote:

 Yes, I also mailed upstream and got no response.  But I'm
 using WASH under GHC 6.4 without any problems.  Automatic
 preprocessor invocation is not supported in 6.4, but that
 style of coding didn't really work out for me anyway.

 Can you enlighten us as to how you made that work?

Eh, why not, I guess...  I use this patch (from the Web, I
don't quite remember exactly where):
diff -ur WashNGo-2.3.1/cgi/Makefile ../WashNGo-2.3.1/cgi/Makefile
--- WashNGo-2.3.1/cgi/Makefile	2005-03-14 02:48:52.0 +0100
+++ ../WashNGo-2.3.1/cgi/Makefile	2005-04-19 12:36:52.977858992 +0200
@@ -9,7 +9,7 @@
 include $(TOP)/mk/config.mk
 include $(TOP)/mk/common.mk
 
-HC_SPEC_FLAGS=	-package-name $(PACKAGE) -package text # -fglasgow-exts		# -cpp -package posix -package data
+HC_SPEC_FLAGS=	-package-name $(PACKAGE) -package text -package lang-1.0 # -fglasgow-exts		# -cpp -package posix -package data
 HCLOADFLAGS=
 HCINCLUDES=	-i$(PATH_TO_UTILITY):$(PATH_TO_WASHMAIL):$(PATH_TO_WASHHTML)
 #OPT=		-fvia-C -O2-for-C 
@@ -18,7 +18,7 @@
 
 HCFLAGS=	$(HCEXTRAFLAGS) $(OPT) $(HC_SPEC_FLAGS) $(HCINCLUDES)
 
-HS_FILES=	$(LIBSOURCES) GuaranteedCGI.hs
+HS_FILES=	$(LIBSOURCES)# GuaranteedCGI.hs
 
 TMPDIR=/tmp
 FULLNAME=$(PACKAGE)-$(VERSION)
diff -ur WashNGo-2.3.1/cgi/Submit98.hs ../WashNGo-2.3.1/cgi/Submit98.hs
--- WashNGo-2.3.1/cgi/Submit98.hs	2004-12-14 13:56:10.0 +0100
+++ ../WashNGo-2.3.1/cgi/Submit98.hs	2005-04-19 12:30:31.105912352 +0200
@@ -1,7 +1,7 @@
 -- © 2002 Peter Thiemann
 -- |Haskell98 version of the submission functions.
 module Submit98
-	( InputHandle, HasValue (value)
+	( InputHandle (..), HasValue (value)
 	, F0 (F0), F1 (F1), F2 (F2), F3 (F3), F4 (F4), F5 (F5), F6 (F6), F7 (F7), F8 (F8)
 	, FL (FL), FA (FA)
 	, deF0, deF1, deF2, deF3, deF4, deF5, deF6, deF7, deF8
diff -ur WashNGo-2.3.1/Utility/Makefile ../WashNGo-2.3.1/Utility/Makefile
--- WashNGo-2.3.1/Utility/Makefile	2005-03-14 02:48:52.0 +0100
+++ ../WashNGo-2.3.1/Utility/Makefile	2005-04-19 12:36:52.584918728 +0200
@@ -94,7 +94,7 @@
 # generic stuff
 
 HC_SPEC_FLAGS=  -package-name $(PACKAGE)
-HCINCLUDES=	-package text
+HCINCLUDES=	-package text -package lang-1.0
 HCLOADFLAGS=
 
 OPT=		-O2 -ffi
diff -ur WashNGo-2.3.1/WASH/HTMLMonad98.hs ../WashNGo-2.3.1/WASH/HTMLMonad98.hs
--- WashNGo-2.3.1/WASH/HTMLMonad98.hs	2004-08-06 16:33:04.0 +0200
+++ ../WashNGo-2.3.1/WASH/HTMLMonad98.hs	2005-04-19 12:30:31.109911744 +0200
@@ -1287,6 +1287,7 @@
 instance AdmitChildOBJECT HEAD
 
 instance AdmitChildBODY NOFRAMES
+instance AdmitChildBODY HTML
 
 instance AdmitChildP IFRAME
 instance AdmitChildH1 IFRAME
diff -ur WashNGo-2.3.1/WASH/Makefile ../WashNGo-2.3.1/WASH/Makefile
--- WashNGo-2.3.1/WASH/Makefile	2005-03-14 02:48:52.0 +0100
+++ ../WashNGo-2.3.1/WASH/Makefile	2005-04-19 12:36:52.696901704 +0200
@@ -85,7 +85,7 @@
 ##
 # generic stuff
 
-HC_SPEC_FLAGS=	-package-name $(PACKAGE) # -fglasgow-exts		# -cpp -package posix -package data
+HC_SPEC_FLAGS=	-package-name $(PACKAGE) -package lang-1.0 # -fglasgow-exts		# -cpp -package posix -package data
 HCINCLUDES=	-i$(PATH_TO_UTILITY)
 HCLOADFLAGS=
 
diff -ur WashNGo-2.3.1/washparser/hs/Makefile ../WashNGo-2.3.1/washparser/hs/Makefile
--- WashNGo-2.3.1/washparser/hs/Makefile	2005-03-14 02:48:52.0 +0100
+++ ../WashNGo-2.3.1/washparser/hs/Makefile	2005-04-19 12:36:52.452938792 +0200
@@ -9,7 +9,7 @@
 HCFLAGS=	$(OPT) $(HC_SPEC_FLAGS) $(HINCLUDES)
 
 HINCLUDES=	$(HCPACKAGEFLAGS)
-HCPACKAGEFLAGS=	-package text
+HCPACKAGEFLAGS=	-package text -package lang-1.0
 
 
 LINK.o=		$(HC) $(HCLOADFLAGS)

After make install finishes unsuccessfully, I invoke this:
#!/bin/sh -e

ghc-pkg --package-conf=$HOME/wash/wash.conf --auto-ghci-libs update - EOF
name: Utility
version: 0.3.11
license: OtherLicense
copyright: Peter Thiemann
maintainer: [EMAIL PROTECTED]
homepage: http://www.informatik.uni-freiburg.de/~thiemann/haskell/WASH/
exposed: False
exposed-modules: Auxiliary, Base32, Base64, BulkIO, FileNames, Hex, ISO8601, IntToString, JavaScript, Locking, QuotedPrintable, RFC2047, RFC2279, RFC2397, SHA1, Shell, SimpleParser, URLCoding, Unique
import-dirs: /home/wferi/wash/lib/Utility-0.3.11/ghc-6-4/import
library-dirs: /home/wferi/wash/lib/Utility-0.3.11/ghc-6-4
hs-libraries: Utility
depends: text
EOF

ghc-pkg --package-conf=$HOME/wash/wash.conf --auto-ghci-libs update - EOF
name: WASHHTML
version: 0.14.8
license: OtherLicense
copyright: Peter Thiemann
maintainer: [EMAIL PROTECTED]
homepage: http://www.informatik.uni-freiburg.de/~thiemann/haskell/WASH/
exposed: False
exposed-modules: HTMLBase, HTMLMonad, HTMLMonad98, HTMLMonadAttrs, HTMLMonadBase, HTMLPrelude, HTMLPrelude98, HTMLTemplates, HTMLTypedBase, HTMLTypedBase98
import-dirs: /home/wferi/wash/lib/WASHHTML-0.14.8/ghc-6-4/import
library-dirs: /home/wferi/wash/lib/WASHHTML-0.14.8/ghc-6-4
hs-libraries

[Haskell-cafe] Re: CGI module almost useless

2005-06-02 Thread Ferenc Wagner
John Goerzen [EMAIL PROTECTED] writes:

 On Wed, Jun 01, 2005 at 10:54:54AM -0700, Jeremy Shaw wrote:

 I have done all of those things in WASH. [...]

 From what I can tell, there are two problems with WASH:

 1) Everything must be done the WASH way

 2) WASH is mostly broken with GHC 6.4

 Let me elaborate a bit on #1.

 Let's say I have a CGI interface pre-defined; I take certain parameters
 from a GET request and do certain things, generating certain headers no
 the result.

 WASH is all centered around generating its own forms, naming its own
 fields, passing around its own state.  It's not at all clear how to
 handle this myself, as I would with Perl or PHP.

Well, you can use htell instead of ask and handle input
with something like FormData.  You can hardly use type safe
callbacks in a pre-defined interface anyway.

 I think that the GHC 6.4 brokenness is fixable, but it makes me nervous
 that upstream has said nothing about it to date.

Yes, I also mailed upstream and got no response.  But I'm
using WASH under GHC 6.4 without any problems.  Automatic
preprocessor invocation is not supported in 6.4, but that
style of coding didn't really work out for me anyway.
-- 
Best wishes,
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [ ghc-Bugs-1188785 ] panic! ... forkM Declaration for tables{v}

2005-05-04 Thread Ferenc Wagner
Simon Marlow [EMAIL PROTECTED] writes:

 Comment By: Ferenc Wágner (wferi)

 Just to make sure: the Could not find module
 `HTMLMonadBase'... is entirely reasonable (and my
 package.conf is crap), it's the ghc: panic! I found worrying.

 Yes, we plan to fix the panic and emit a more helpful message.

Fine!

 Anyway.  Let me drift off topic: why no ghcOptions field in
 package.conf?  I'd perhaps try porting Wash if it were
 present...

 The ability to specify extra GHC options in a package was
 a misfeature that we removed.  It isn't reasonable for a
 package to be able to change the global GHC behaviour.

I see.  But why did hugsOptions remain, then?
-- 
Feri.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell] Re: Newbie : How come that cyclic recursive lists are efficient ?

2005-02-10 Thread Ferenc Wagner
Francis Girard [EMAIL PROTECTED] writes:

 But I can't help thinking that the distinction between being a list of 
 integers and being a function that returns a list of integers (without 
 arguments) is not always clear in FP ... since there is not really such a 
 thing as returning a value in declarative programming, neither in 
 mathematical thinking.

Please correct me if I'm wrong, but I can recall that this
distinction is made by hamming::[Integer] having no
arguments, so it gets memoized within its scope.  Being a
CAF (top level constant applicative form) only means it
can't go out of scope so has no chance of recomputation at
all.  Am I right?
-- 
Feri.
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] Re: I/O interface

2005-01-12 Thread Ferenc Wagner
Ben Rudiak-Gould [EMAIL PROTECTED] writes:

 Marcin 'Qrczak' Kowalczyk wrote:
 Ben Rudiak-Gould [EMAIL PROTECTED] writes:

 fileRead can be implemented in terms of OS primitives,

 Only if they already support reading from a fixed offset (like pread).
 I'm not sure if we can rely on something like this being always
 available, or whether it should be emulated using lseek which is safe
 only as long as we are the only process using the given open file.

 First of all, I don't think any OS shares file pointers between
 processes. Otherwise it would be practically impossible to safely use an
 inherited filehandle via any API.  Different threads using the same
 filehandle do share a file pointer (which is a major nuisance in my
 experience, because of the lack of an atomic seek- read/write), but a
 Posix fork duplicates the file pointer along with all other state. I can't
 believe I'm wrong about this, but someone please correct me if I am.

This may be what you wrote, but let me still put it:

dup()-ed filehandles share a common file position.
Handles straight from open() have independent file positions.
fork() duplicates filehandles and the child inherits those
= the child process shares the file position with its parent.
Threads or processes doesn't make the difference; dup() or
open() does.

This is my interpretation of the docs, I didn't test it... :)
-- 
Feri.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Parse text difficulty

2004-12-09 Thread Ferenc Wagner
Douglas Bromley [EMAIL PROTECTED] writes:

 I've show(n) a particular data type and it shows up as:
 [([2,6],British),([1],Charles),([1,8],Clarke),([2,6],Council),([2],Edinburgh),([1],Education),([4],Increasingly)]

 What I want to do is format that nicely into a table.
 Which would give: 
 [2,6],British
 [1],Charles
 [1,8],Clarke
 [2,6],Council
 ..etc

 makeIndex 
  = show .
shorten .-- [([Int], Word)] - [([Int], Word)] 

I'd use

unlines . map (\(f,s)-shows f (',':s))

instead of show; it also gets rid of the quotation marks.
-- 
Cheers,
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell] Re: Network.CGI: INPUT TYPE=file?

2004-11-30 Thread Ferenc Wagner
Johannes Waldmann [EMAIL PROTECTED] writes:

 The environment then contains

 , ( QUERY_STRING,  ), ( CONTENT_LENGTH, 1590 )
 , ( CONTENT_TYPE
, multipart/form-data;
 boundary=---1409895718904...
)

 Am I doing something wrong, HTML-wise (is it allowed to
 mix TYPE=file input with other input elements in one
 FORM?) or is this a problem with the library?

Yes, it is allowed.  Looks like the library can't parse
multipart/form-data encoded content.  If it's indeed the
case, you lost. :-(
-- 
Feri.
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] Re: Global Variables and IO initializers

2004-11-09 Thread Ferenc Wagner
Henning Thielemann [EMAIL PROTECTED] writes:

 On Mon, 8 Nov 2004, Keean Schupke wrote:

 If you tell me the library you wish to use I may be able
 to suggest a better alternative.

 I'm using FFTW and PLPlot (but not with Haskell), both
 uses internal states and thus must be considered as ill
 designed. Do you know of better alternatives?

I'm no expert on this, being exposed to FFTW for a couple of
hours, but isn't its internal state encapsulated into the
'plan', which is suitable as a handle?
-- 
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Tutorial about low-level I/O in Haskell

2004-10-11 Thread Ferenc Wagner
Peter Simons [EMAIL PROTECTED] writes:

   http://cryp.to/blockio/docs/tutorial.html

Pretty neat.  Wouldn't it be a nice addition to the
Tutorials section on the Haskell Bookshelf?

Note: as I gather, GHC's lists are not doubly linked.
-- 
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Newbie questions

2004-07-01 Thread Ferenc Wagner
Crypt Master [EMAIL PROTECTED] writes:

 -- gaSolutionSpace :: [a] - [a]
 gaSolutionSpace x = x : gaSolutionSpace (evolvepopulation x)

Stop deceiving yourself until it's too late. :)
Why did you comment out the type annotation?
-- 
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Syntax for modifying nested product types

2004-04-23 Thread Ferenc Wagner
Graham Klyne [EMAIL PROTECTED] writes:

 At 18:18 22/04/04 -0400, Mark Carroll wrote:

 I have data objects where each component is a labelled
 field through which I access or modify it.

 Wading into the labelled field debate...

 I have found that using the labelled field update syntax
 can lead to difficulties in changing the underlying
 implementation of a type.

Yeah, interesting this topic came up exactly when I got mad
with record updates.  I'd like to fill in a record from a
file which contains labels and values.  I'd like to give the
gist of this operation as a list of pairs:

[(label1, label1), (label2, label2), ...]

and abstract away the operation of updating the field.  I
couldn't find a way.  Basically, I couldn't write an update
function parametrized by the field name.  Is it possible at
all?
-- 
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Dividing integers?

2004-03-18 Thread Ferenc Wagner
Matias Hernandez [EMAIL PROTECTED] writes:

 I mean, apparently / is not defined for integers but I
 don't know how to cast the result of the length function
 into a Double...

 Prelude (length [1,2]) / 3

Prelude fromIntegral (length [1,2])/3
0.667

 Prelude 2 / 3
 0.

Literal 2 means fromIntegral 2, but length::[a]-Int.
-- 
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


ghci can't continue in a situation (HXml Toolbox)

2004-03-11 Thread Ferenc Wagner
   Hello,

Please have a look at the transcript below.  GHC happily
compiles the file with the Makefile, while GHCi chokes on
it.  I would be grateful for any insight into the problem.

Feri.

tba:~/haskell/xml/ $ cat xml2wiki.hs
import System

import XmlInput
import XmlTree
import XmlState

getLength :: String - XState () Int
getLength file = do [xmlTree] - getXmlContents $ newDocument file
io $ putStr $ show xmlTree
return 14

main :: IO ()
main = do [xmlFile] - getArgs
  l - run' $ getLength xmlFile
  putStrLn (show l)

--

tba:~/haskell/xml/ $ cat Makefile
HXT := $(HOME)/haskell/xml/HXmlToolbox-3.01
INCLUDES := 
$(HXT)/hdom:$(HXT)/hparser:$(HXT)/http:$(HXT)/popen:$(HXT)/parsec:$(HOME)/haskell/HTTP
PACKAGES := -package util -package net

xml2wiki: xml2wiki.hs
ghc -o $@ --make -i$(INCLUDES) $(PACKAGES) $

--

tba:~/haskell/xml/ $ cat .ghci
:set -package net -package util
:set 
-i/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom:/home/wferi/haskell/xml/HXmlToolbox-3.01/hparser:/home/wferi/haskell/xml/HXmlToolbox-3.01/http:/home/wferi/haskell/xml/HXmlToolbox-3.01/popen:/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec:/home/wferi/haskell/HTTP

--

tba:~/haskell/xml/ $ ghci xml2wiki
   ___ ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |  GHC Interactive, version 6.2, for Haskell 98.
/ /_\\/ __  / /___| |  http://www.haskell.org/ghc/
\/\/ /_/\/|_|  Type :? for help.

Loading package base ... linking ... done.
Loading package lang ... linking ... done.
Loading package concurrent ... linking ... done.
Loading package QuickCheck ... linking ... done.
Loading package readline ... linking ... done.
Loading package unix ... linking ... done.
Loading package posix ... linking ... done.
Loading package util ... linking ... done.
Loading package network ... linking ... done.
Loading package net ... linking ... done.
Skipping  Zord64_HARD  ( /home/wferi/haskell/HTTP/Zord64_HARD.lhs, 
/home/wferi/haskell/HTTP/Zord64_HARD.o )
Skipping  ParsecPos( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecPos.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecPos.o )
Skipping  ParsecError  ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecError.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecError.o )
Skipping  ParsecPrim   ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecPrim.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecPrim.o )
Skipping  ParsecChar   ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecChar.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecChar.o )
Skipping  ParsecCombinator ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecCombinator.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/ParsecCombinator.o )
Skipping  Base64   ( /home/wferi/haskell/xml/HXmlToolbox-3.01/http/Base64.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/http/Base64.o )
Skipping  MD5  ( /home/wferi/haskell/HTTP/MD5.lhs, 
/home/wferi/haskell/HTTP/MD5.o )
Skipping  AssocList( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/AssocList.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/AssocList.o )
Skipping  NTree( /home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/NTree.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/NTree.o )
Skipping  Util ( /home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/Util.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/Util.o )
Skipping  Unicode  ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hparser/Unicode.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hparser/Unicode.o )
Skipping  Parsec   ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/Parsec.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/parsec/Parsec.o )
Skipping  XmlCharParser( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hparser/XmlCharParser.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hparser/XmlCharParser.o )
Skipping  POpen( /home/wferi/haskell/xml/HXmlToolbox-3.01/popen/POpen.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/popen/POpen.o )
Skipping  HTTP ( /home/wferi/haskell/xml/HXmlToolbox-3.01/http/HTTP.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/http/HTTP.o )
Skipping  Browser  ( /home/wferi/haskell/xml/HXmlToolbox-3.01/http/Browser.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/http/Browser.o )
Skipping  XmlTreeTypes ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/XmlTreeTypes.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/XmlTreeTypes.o )
Skipping  XmlKeywords  ( 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/XmlKeywords.hs, 
/home/wferi/haskell/xml/HXmlToolbox-3.01/hdom/XmlKeywords.o )
Skipping  XmlTreeFunctions ( 

Re: ghci can't continue in a situation (HXml Toolbox)

2004-03-11 Thread Ferenc Wagner
Simon David Foster [EMAIL PROTECTED] writes:

 I had to remove POpen from HXT to make it work correctly
 with GHC 6.2. I think this because posix now includes
 popen and so it conflicts with the version in HXT. Try
 removing POpen.hs and doing it again, make sure you load
 package posix.

Yep, it seems you are right.  Although I don't really
understand this.  Is POpen a new addition to the old
libraries?  Btw, I didn't need to add -package posix
anywhere, it's probably implied by something else in my
case.

Thank you very much for the quick help!
-- 
Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell] Re: Compiling HXML toolbox under Hugs/Windows

2004-01-29 Thread Ferenc Wagner
Graham Klyne [EMAIL PROTECTED] writes:

 Well, further to my previous response, it appears that
 there's a problem with GHC as well...  The XmlInput module
 imports a module called MD5, and uses a maethod 'digest'
 from that module.  I cannot find a copy of that module
 either in the HXML toolbox distribution, or in the GHC
 distribution.  I did find this in the GHC 6.2 release
 notes:

 [[
 The MD5 library in the util package has been removed. We'll include a
 replacement in the hierarchical libraries if someone would like to
 send us one!
 ]]

 Is your software tested under GHC 6.2?

The software is not mine, but I committed the following hack
to have it compile:

h x = MD5.md5s (MD5.Str x)
{- h = IOExts.unsafePerformIO . MD5.digest -}

ie. commented out the second line instead of the first.  I
don't care about authentication, so I don't know if it
actually works...

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


[Haskell] Re: Weaving the Web with Haskell

2004-01-28 Thread Ferenc Wagner
Graham Klyne [EMAIL PROTECTED] writes:

 I have been trying to use the HXML toolbox, because I
 understand it's the only XML parser for Haskell that
 supports XML namespaces.  Unfortunately, it seems to be
 rather dependent on older versions of GHC (unless I'm
 missing something), which is making it more problematic to
 adopt than I had hoped.

I may misunderstand you, but I successfully compiled the
HXML Toolbox 3.01 with GHC-6.2 on Linux.  It did need some
tweaking, but nothing serious: if my memory serves me right
the forkProcess function changed and the MD5 library was
missing.  I understand that you have a POpen replacement for
Windows, so the rest should be easy...

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


Re: POpen, opening lots of processes

2004-01-12 Thread Ferenc Wagner
Tomasz Zielonka [EMAIL PROTECTED] writes:

 On Sun, Jan 11, 2004 at 10:22:09PM +0100, Ferenc Wagner wrote:

 It isn't suitable for exchanging bigger amounts of data
 between processes.
 
 May I ask why?

 Well, if you were collecting big amounts of data (like
 dozens of megabytes) from the child process, you would
 probably rather want to either:
   a) consume it incrementally 
   b) store it in a more economic data structure

 Of course, both can be done in Haskell. I wonder if I
 could change my code to abstract it away...

I remember a discussion on the Haskell list about consuming
database requests.  The consensus was to use some pre-fold
like callbacks (proposed by Oleg?) as the most general
solution for such problems.  You may want to look into that.

Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: POpen, opening lots of processes

2004-01-11 Thread Ferenc Wagner
Tomasz Zielonka [EMAIL PROTECTED] writes:

 On Sat, Jan 10, 2004 at 04:50:28PM -0500, Mark Carroll wrote:

Your code looks great,

 Thanks :)

 It isn't suitable for exchanging bigger amounts of data between
 processes.

May I ask why?

Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: POpen, opening lots of processes

2004-01-09 Thread Ferenc Wagner
Tomasz Zielonka [EMAIL PROTECTED] writes:

 I had a similar problem, and finally I created my own
 solution that doesn't leave zombies and doesn't block when
 the launched process writes too much to stderr.

Pretty neat, I've got an application idea for that code!
Couldn't it be include in the standard libraries?  Anyway,
thanks for posting it.

Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: POpen, opening lots of processes

2004-01-09 Thread Ferenc Wagner
Simon Marlow [EMAIL PROTECTED] writes:

 Tomasz Zielonka [EMAIL PROTECTED] writes:
 
 I had a similar problem, and finally I created my own
 solution that doesn't leave zombies and doesn't block when
 the launched process writes too much to stderr.
 
 Pretty neat, I've got an application idea for that code!
 Couldn't it be include in the standard libraries?  Anyway,
 thanks for posting it.

 There is an outstanding proposal for a System.Process library:

 http://www.haskell.org/~simonmar/System.Process.html

 This is currently stalled because we need a non-blocking
 implementation of getProcessStatus (which is in the
 pipeline).  Something akin to Tomasz's launch could also
 be included here.

How is it different from System.Posix.Process?  Supposed to
be more portable?  Sounds good.

Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: POpen, opening lots of processes

2004-01-08 Thread Ferenc Wagner
Hal Daume III [EMAIL PROTECTED] writes:

 On Thu, 8 Jan 2004, Glynn Clements wrote:

 What does the output from ps indicate?

 It lists all the processes as defunct:

 19981 pts/5Z  0:00 [suffixtree defunct]
 19982 pts/5Z  0:00 [suffixtree defunct]
 19983 pts/5Z  0:00 [suffixtree defunct]
 19984 pts/5Z  0:00 [suffixtree defunct]
 19985 pts/5Z  0:00 [suffixtree defunct]
 ...

 if you have zombies (Z state), the program has terminated
 but the parent (your program) hasn't called wait/waitpid
 (the Haskell interface is getProcessStatus,
 getProcessGroupStatus or getAnyProcessStatus).

 I don't mind evaluating the contents returned strictly,
 but I can't figure out how to force the process into a
 dead state...

They are dead, just not acknowledged by their parent, so the
OS keeps their exit statuses around.

 I don't see how any of these three functions accomplishes
 that... what am I missing?

These functions read the exit status, and the OS will clean
up.  If you start them sequentially, then simply insert a
call to the appropriate function at a point where the
previous child is already finished.  Or spawn a thread which
sequence_s nonblocking getAnyProcessStatuses... :)  Never
tried myself.  man waitpid

Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: getting the path to the executing program

2004-01-08 Thread Ferenc Wagner
Hal Daume III [EMAIL PROTECTED] writes:

 True.  Replace the with a and ? with , if it exists?.

 On Thu, 8 Jan 2004, Lennart Augustsson wrote:

 Hal Daume III wrote:

 is there a function, related to getProgName, which
 returns the (absolute) path to the current program?

 Well, the absolute path name is not necessarily unique,
 nor is it guaranteed to exist. :)

http://groups.google.com/groups?hl=enlr=ie=UTF-8oe=utf-8threadm=9201%40june.cs.washington.edurnum=1prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3Dutf-8%26selm%3D9201%2540june.cs.washington.edu

This is all you can get, I am afraid.

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


Re: GHC 6.2 breaks multiline string literals

2003-12-26 Thread Ferenc Wagner
Stefan Reich [EMAIL PROTECTED] writes:

 multilineLiteral = 
line1
line2

Use string gaps (see 2.6 in the Report):

multilineLiteral = \
\   line1\n\
\   line2

-- 
Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: ANNOUNCE: GHC version 6.2

2003-12-24 Thread Ferenc Wagner
Ian Lynagh [EMAIL PROTECTED] writes:


 The (Interactive) Glasgow Haskell Compiler -- version 6.2


 And, for Christmas, we at Debian bring you sackful of debs!

Fantastic!  Actually, I already downloaded them a couple of
days ago, but thought to wait with the thanks until the
announcement.

*THANKS!*  Both for the developers and for the packagers, who
take the pain of providing Woody packages, too!

Merry Christmas!

Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: ANNOUNCE: GHC version 6.2

2003-12-24 Thread Ferenc Wagner
Ian Lynagh [EMAIL PROTECTED] writes:


 The (Interactive) Glasgow Haskell Compiler -- version 6.2


 And, for Christmas, we at Debian bring you sackful of debs!

Fantastic!  Actually, I already downloaded them a couple of
days ago, but thought to wait with the thanks until the
announcement.

*THANKS!*  Both for the developers and for the packagers, who
take the pain of providing Woody packages, too!

Merry Christmas!

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


Re: Hugs98 November 2003 Debian Packages

2003-12-02 Thread Ferenc Wagner
Isaac Jones [EMAIL PROTECTED] writes:

 Woody backports are now available at the HE debian repository.

Thanks, installed, enjoying! :)

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


Re: Hugs98 November 2003 Debian Packages

2003-11-27 Thread Ferenc Wagner
Isaac Jones [EMAIL PROTECTED] writes:

 Let me know if anyone is interested in Woody (stable) backports.

Yes, I am.  I could probably make them myself, but if you
are willing to do so, I will let my 200 MHz machine do
something else... :)

Best wishes and big thanks anyway,
Feri.
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: hSetBuffering stdin NoBuffering messes up terminal

2003-10-17 Thread Ferenc Wagner
Glynn Clements [EMAIL PROTECTED] writes:

 David Roundy wrote:

 On my terminal (aterm), calling

 hSetBuffering stdin NoBuffering

 within my program messes up the terminal settings somehow
 [...]

 Disabling buffering with hSetBuffering not only disables
 the user-space buffering (analogous to setvbuf() etc in
 C), it also disables the terminal's buffering (more
 precisely, disables canonical mode).

According to me, hSetBuffering should not touch the terminal
settings ever.  It is not mentioned in the Report and it is
not implied by its name.  It only leads to confusion.

 BTW, if your program actually needs unbuffered terminal
 input (i.e.  you want to receive individual key codes
 without waiting for the user to hit Return), and
 hSetBuffering didn't change the terminal settings, you
 would have to do it yourself anyhow, leading to the same
 issues.

In my experience, one seldom wants to do this.  There are
specialised libraries which do things like this well and
easily.  Each time I wanted unbuffered input terminal was
used for testing only, in which case backspace is useful.

For stupid little programs we could provide some stupid
little functions which have the word 'Magic' in their
name, instead of abusing standard operations.

Strictly in my opinion,
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Haskell for non-Haskell's sake

2003-08-30 Thread Ferenc Wagner
Hello,

1 I wrote Haskell programs to compute matrix elements of
  operators (in physics).
2 I use Haskell for generating figures (Functional Metapost).
3 For generating HTML summaries out of some data.
4 For common text processing as an advanced sed.

Actually, I do not use Haskell for Haskell at all...
Sorry for that. :(

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


Re: Enum, Bounded, and Arithmetic Sequences

2003-06-25 Thread Ferenc Wagner
Johannes Waldmann [EMAIL PROTECTED] writes:

  x :: Foo - [ .. ] 

 A related point: the Haskell definition states that
For any type that is an instance of class Bounded as well as
Enum, the following should hold:

 enumFrom and enumFromThen should be defined with an implicit bound, thus:
   enumFrom x   = enumFromTo x maxBound

 I think this should be enforced -
 the *only* method in Enum should be `enumFromTo'.

 If one writes [ x .. ], then the compiler expands this to 
 `enumFromTo x  maxBound', and therefore adds a `Bounded' constraint.
 Likewise, [ .. y ] expands to `enumFromTo minBound y',

No, half infinite list like [1..] are useful.

 and [ .. ] to  `enumFromTo minBound maxBound' .

This I would not mind, I can not think of another reasonable
translation.  But why not define

elements :: (Enum a, Bounded a) = [a]
elements = [minBound .. maxBound]

instead?

 PS: and enumFromThenTo should just be removed, alongside n+k patterns :-)

Or preferably the Floating and Double Enum instances...
Feri.
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: Looking for Libraries

2003-03-20 Thread Ferenc Wagner
Matthew Donadio [EMAIL PROTECTED] writes:

 Is there a high level Haskell graphics library that would
 give functionality similar to gnuplot?

Why not simply USE gnuplot?  Or plotutils?  They have simple
textual interfaces, do good work, and are fairly standard
tools (on a Unix system, at least).

 Does anyone have an FFI interface to LAPACK?

Have a look at
http://www.haskell.org/pipermail/haskell/2002-June/009833.html

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


Re: Looking for Libraries

2003-03-20 Thread Ferenc Wagner
Matthew Donadio [EMAIL PROTECTED] writes:

 I would like to be able to have plotting capabilities
 directly from a Haskell program rather than using a
 spawned process

Plotutils' functionality is included in a library.  You can
easily write an FFI wrapper for that.  But I agree that a
native module would be better...

On the other hand, Octave uses Gnuplot for interactive
purposes, too (and I also did in a smaller project).  The
CVS Gnuplot also has mouse support, which makes it even more
usable this way.  I don't know an example, though.

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


Re: int to float problem

2003-03-01 Thread Ferenc Wagner
Mike T. Machenry [EMAIL PROTECTED] writes:

 I recently desided I wanted a bunch function to return
 float instead of Int. [...] I found fromInteger but it
 didn't seem to work on the return value of the cardinality
 function for instance.

Try fromIntegral, which works for Int and Integer, too.

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


Re: Graphics output from Haskell as eps

2003-02-17 Thread Ferenc Wagner
   Hi Sarah,

if Haskell - MetaPost - Postscript is good for you, have a
look at FMP.  It's somewhat old and doesn't cover the entire
MetaPost language, but works for me.
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: big rationals question

2003-02-16 Thread Ferenc Wagner
Damien R. Sullivan [EMAIL PROTECTED] writes:

 can I get Haskell to actually do that division itself?

You can use the function
fromRational :: Fractional a = Rational - a

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



Re: Beginner help

2003-02-11 Thread Ferenc Wagner
JJ [EMAIL PROTECTED] writes:

 From my perspective, the learning curve for Haskell seems to be near
 vertical.

I also found it very steep.  Keep on, read the Gentle
Introduction, and start coding.  Read the Haskell list,
you'll understand more and more.  Then read the Report...

Good luck!
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: Profiling trouble

2003-01-30 Thread Ferenc Wagner
Simon Marlow [EMAIL PROTECTED] writes:

 Both of these bugs were fixed in 5.04.2.

Great.

 I'm afraid there's no way at the moment, but I'll look
 into adding a flag.  The problem is that the longer the
 stacks get, the less room there is for the graph - hp2ps
 tends to squeeze the graph up to make room for the labels,
 which is why we truncate them.

It's clear.  The disappointing thing was to find truncated
names in the .hp file, too...  Btw, a wonderful XML tool is
coming, isn't it? :) Till then, a switch would be more than
enough.  The .prof file also helps.  And the letters could
be smaller, and the text could be wrapped, and...  For a
screen view (I've never printed a profile) almost everything
will do.

 Your other problem (misattribution of costs in the
 profile) seems to be related to the use of overloaded
 functions, and the compiler isn't translating the
 definition of getStates properly.  I haven't found a fix
 yet.

On the other hand, I've already found the problem with my
code (the heap profiler helped much), so I'm coding away
happily!  Thanks for the good work!

Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Profiling trouble

2003-01-28 Thread Ferenc Wagner
   Hello,

something interesting turned up again.  Setting cut=8 in
Show2.hs and running it with ./show +RTS -h -i0.01 gives

show: fatal error: main thread has been GC'd

It may be silly, since 0.01  1/50, but this error message
isn't too helpful.  Btw, +RTS -? says:

  -imsec   Time between heap samples (msec, default: 100)

which is wrong (time is given in seconds really).

One more question: is there a way not to truncate the call
stacks?  Ie in the hp file I see lines like

(144)showData2/showData/ma...   12

and I'd like to see showData2/showData/main or so.

Cheers: Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Profiling trouble

2003-01-24 Thread Ferenc Wagner
   Hello,

Please help me understanding GHC 5.02.2 profiling output!
Here is the root of my program (Show.hs):

\begin{code}
showData:: BaseVector a = Params - Operator a - String
showData params pot =  unlines [Version 3.1,
,
showParams pot params,
tcsdim:  ++ tcsDim,
,
conformal energies:,
diagonals,
perturbation matrix:] ++
   matrixElements
where
cutStates   =  {-# SCC showData1 #-} getStates params
tcsDim  =  {-# SCC showData2 #-} show (length cutStates)
diagonals   =  {-# SCC showData3 #-} unlines $ map (show . 
energy) cutStates
matrixElements  =  {-# SCC showData4 #-} unlines $ map unwords off
off =  {-# SCC showData5 #-} [map (myShow . pot outV) 
(take i cutStates)
| (outV,i) - zip cutStates [1..]]

main=  do params - option
  putStr $ showData params (superPot params)
\end{code}

If I compile it via

ghc -package util -o show --make Show.hs -prof -auto-all

I get in show.prof:

Fri Jan 24 17:46 2003 Time and Allocation Profiling Report  (Final)

   show +RTS -p -RTS -c 5 -s R -p 0 -t 0 -r 3

total time  =   94.54 secs   (4727 ticks @ 20 ms)
total alloc = 2,313,980,136 bytes  (excludes profiling overheads)

COST CENTRE  MODULE %time %alloc

showData1Main86.1   88.5
cutAbove4Tcsa 3.61.5
ncEpsEpsilon  3.33.1
GC   GC   2.20.0
vopMode  Boson1.51.1
ncVopBoson1.21.0
getStatesTcsa 0.61.2


  individual inherited
COST CENTRE  MODULE entries  %time %alloc   %time %alloc

MAIN MAIN 00.0   0.0100.0 100.0
 mainMain 00.1   0.0100.0 100.0
  [...]
  showData   Main 10.0   0.0 91.1  91.9
   showData5 Main 10.0   0.0  0.3   0.4
myShow   Main  94530.3   0.3  0.3   0.3
   showData4 Main 10.0   0.1  0.0   0.1
   showData3 Main 10.1   0.1  0.1   0.1
   showData1 Main 1   86.1  88.5 90.8  91.4
cutAbove Tcsa280.0   0.0  3.6   1.5
 cutAbove2   Tcsa 10.0   0.0  0.0   0.0
 cutAbove3   Tcsa270.0   0.0  0.0   0.0
 cutAbove4   Tcsa283.6   1.5  3.6   1.5
spinSelect   Tcsa 10.0   0.0  0.0   0.0
getStatesTcsa 10.6   1.2  1.0   1.4
 incrementalBase Fermion  10.3   0.2  0.4   0.2
  fermionNumber  Fermion  776640.1   0.0  0.1   0.0
 allTowers   Boson10.0   0.0  0.0   0.0
  inModule   Boson   170.0   0.0  0.0   0.0
 mergeUp Boson60.0   0.0  0.0   0.0
   showData2 Main 10.0   0.0  0.0   0.0
  [...]

My question: showData1 is a single function call, how can it
still have such a big individual share?  Where is the
program spending its time?  Sorry if it is a trivial
question, functional profiling is new to me.

Thanks: Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Ambiguous defaults

2003-01-02 Thread Ferenc Wagner
   Hello,

What's the way to express the following: a compound object
is generally made up of two components with identical type.
For this common case I'd like to provide some default
methods, which take the object apart, operate on the parts
and put the results back together.  In other cases this
default method should be overridden, eg. when the compound
object isn't made of two identical components.  My first try
(below) doesn't work, can you recommend a solution?

 Thanks: Feri.

\begin{code}
module Test where

class Component b where
property :: b - Int

class Compound a where
decompose :: Component b = a - (b,b)
additive :: a - Int
additive x = property l + property r
where (l,r) = decompose x
\end{code}

ghci: test.hs:9:
Ambiguous type variable(s) `b' in the constraint `Component b'
arising from use of `property' at test.hs:9

hugs: ERROR test.hs:9 - Cannot justify constraints in default member binding
*** Expression: additive
*** Type  : Compound a = a - Int
*** Given context : Compound a
*** Constraints   : Component b
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: storing to a file

2002-11-14 Thread Ferenc Wagner
Johan Steunenberg [EMAIL PROTECTED] writes:

 how to store a Double, or any non-char, to a file.

I can give you a general advice: store it in ASCII format
via show, unless you have *VERY* strong reasons against it.
Yes, it results in bigger files (but you can compress them),
and slower (what compression makes even worse) but you gain
easy view/edit and compatibility.  I couple of years ago I
was very fond of binary formats...

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



Re: storing to a file

2002-11-14 Thread Ferenc Wagner
Johan Steunenberg [EMAIL PROTECTED] writes:

 how to store a Double, or any non-char, to a file.

I can give you a general advice: store it in ASCII format
via show, unless you have *VERY* strong reasons against it.
Yes, it results in bigger files (but you can compress them),
and slower (what compression makes even worse) but you gain
easy view/edit and compatibility.  I couple of years ago I
was very fond of binary formats...

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



Re: Rational sequence

2002-10-24 Thread Ferenc Wagner
Dean Herington [EMAIL PROTECTED] writes:

 It's inconsistent to remove the +1/2 for
 numericEnumFromTo but to leave the +(n'-n) for
 numericEnumFromThenTo.  I think you probably mean to
 remove both (actually, all three).

You are right, what I meant is

numericEnumFromTo n m = takeWhile (= m) (numericEnumFrom n)
numericEnumFromThenTo n n' m = takeWhile p (numericEnumFromThen n n')
 where
   p | n' = n   = (= m)
 | otherwise = (= m)

 I wouldn't recommend these changes for Float and Double
 (the increments are there to account for arithmetic
 inexactness)

That's clear, but see below.

 (1) In section A (Standard Prelude), in the definition of
 `numericEnumFromThenTo`, change n'  n to n' = n, to
 agree with the last bullet in section 6.3.4.

Good point, also included in the above code.

George Russell [EMAIL PROTECTED] writes:

 Indeed I think the Haskell Library Report contains quite a
 few examples of floating point code which a numerical
 analyst would have written rather better.  So I don't
 think it's good enough to treat every Float/Double
 operation as if it had an implicit UNSAFE flag
 indicating that the compiler was entitled to weird
 behaviour only comprehensible to experts, as seems to be
 the case with floating enumerations now.

Simon made clear that he wants to change as little as
possible.  This area is inconsistent as a whole, and I agree
that the best solution would be to do away with the
'impossible' stuff at least (Float and Double): then every
user could define her Enum instance in the most appropriate
way, fuzzing with +epsilon or *(1+epsilon) or whatever.  Or
simply doesn't use the nice syntax.  In my opinion getting
elements MUCH greater than the upper limit is more confusing
than losing the last one, which is a familiar and well known
consequence of finite precision.  And the above MUCH is very
hard to tell.  Just think of [1%1..2], [1%2..2], [1%3..2],
etc.  Which sequence is the first with three elements?
Currently the second.

For Floats my above argument is even less convincing.  It's
impossible to do it right, but apparently we have to do
something.  I vote for less magic (MUCH=0), so that the
resulting weirdness be comprehensible to more experts, not
only to the ones who know the language definition by heart.

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



Rational sequence

2002-10-22 Thread Ferenc Wagner
With GHC-5.02.2, I do

$ ghci
Prelude :m Ratio
Ratio [1%2..10%2]
[1 % 2,3 % 2,5 % 2,7 % 2,9 % 2,11 % 2]

The question is, why is there 11%2 at the end of the list?
It's inconsistent with the (good) rules for Integer, since

Ratio [1,3..10]
[1,3,5,7,9]

Is this intentional?
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: Rational sequence

2002-10-22 Thread Ferenc Wagner
Simon Peyton-Jones [EMAIL PROTECTED] writes:

 The Report says that the Enum instance for Ratio uses the
 same rule as for Float/Double,

Now I can see that the revised Report contains more about
this than the one on haskell.org.  But I still can't see the
statement you cited above.  Where should I look?

On the other hand, I found that 'the instance for Ratio t
simply lifts the corresponding operations over t.'  What
does this mean with respect to Enum?

 namely that [a..b] means takeWhile (= (b+1/2)) [a, a+1,
 a+2, ...]

 You may say that the = should be  but that's what
 the Report says.

Well, neither makes more sense to me.  For an imprecise type
I don't expect precise behaviour.

 I'm not sure what your rule should be, though.  (What
 about [2%4, ...  20%4]?)

Rationals are represented precisely, so that well defined
precise mathematical rules apply to them:

[2%4..20%4] == [1%2..10%2] == [1%2,3%2,5%2,7%2,9%2],

that's to say

[a..b] = takeWhile (= b) [a, a+1, a+2, ...]

Those fuzzy 1/2-s are inserted solely to 'overcome' the
imprecise floating point representation, and make 'simple
stupid' programs work and programming newbies happy, aren't
they?  For serious work they don't count, only create one
more peculiarity to observe.  Please correct me if I'm
mistaken.

And please don't feel offended, I suppose that our opinions
differ on this point, as shown by a previous thread.  Still
I don't think things like this promote Haskell, or make it
more acceptable for anyone.

 Anyway, it's a bit late to change the Report

As I told above, I can't see anything to change, except
implementation.  If it's only my stupidity, then sorry for
the nitpicking.
Feri.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe



Re: Graphics output

2002-10-08 Thread Ferenc Wagner

Gerhard Navratil [EMAIL PROTECTED] writes:

 I would like to write line graphics into a file
 (e.g. contour lines calculated by a Haskell function) and
 access the data from standard programs.  For the output I
 need a Library.

Why don't you output some ASCII numbers, and use another
program (gnuplot, plotutils, whatever) to produce graphics?

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



Re: Haskell 98: Behaviour of hClose

2002-09-18 Thread Ferenc Wagner

Simon Peyton-Jones [EMAIL PROTECTED] writes:

 If that's the consensus I'll happily leave echoing
 behaviour unspecified. Remember, that means that a
 conforming implementation can do whatever it pleases, and
 hence it's impossible to write a portable interactive
 Haskell program.  Is that you what you intend?

The Report should not let an implementation do whatever it
pleases.  But it could specify that the runtime system *does
not mess* with the terminal settings, so users' preferences
prevail.  For buffering, the recipe is: terminals are line
buffered, everything else is block buffered.  I find this
appropriate for most applications, except some close (one
keypress) interactions, which are done better via
specialised libraries anyway.  (I have to admit I'm from the
Unix world.  Other perspectives are surely possible.)

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



Re: passing an option to gcc without a -

2002-07-25 Thread Ferenc Wagner

Hal Daume III [EMAIL PROTECTED] writes:

 I'm linking with a .a file built from C [...] so i tried

   ghc MyFile.hs -o myout -optctheafile.a

 but this doesn't appear to pass the paramter.

If it's acceptable, you can try

mv theafile.a libtheafile.a
ghc MyFile.hs -o myout -L. -ltheafile

Just a thought.
Feri.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: GreenCard --target=ffi

2002-06-08 Thread Ferenc Wagner

Alastair Reid [EMAIL PROTECTED] writes:

 At the moment, Hugs' ffi doesn't work with GreenCard

Thanks for the input.  It's not a big problem, since GC has
native Hugs target.  But the GC docs should be corrected
then.  (CCd to sof at galois.com)

 and isn't compatible with GHC and NHC.  I'm trying to
 update Hugs' ffi implementation in my spare time.

Your help (previous answers) is very valuable for me, thanks
for taking time again!

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



GreenCard --target=ffi

2002-06-07 Thread Ferenc Wagner

The GreenCard manual promotes use of the FFI target (`You're
encouraged to use the ffi target, since the Haskell output
it generates can be used with all Haskell systems that
support the common FFI (as of June 2001, all of them).'),
but doesn't give any examples for using it.

In the distribution there is an StdDIS.gc for Hugs and
another for GHC, but what should I import with the FFI
target?

The C stub #includes HsFFI.h, which GHC provides, but Hugs
doesn't.  What should I use?

If I go ahead using what I have, Hugs says that `initModule
undefined' when I try to load the GC module.

Any help appreciated.

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



Re: GreenCard: list marshalling

2002-06-03 Thread Ferenc Wagner

Alastair Reid [EMAIL PROTECTED] writes:

 Here's some code from the Xlib interface: hslibs/xlib/Xlib.gc
 (This code is part of the HGL (http://haskell.org/graphics).)

[...]

 Hope this helps,

It helped much.  Thanks for the comments, especially.  Now
I'm going to check whether the garbage collector works: both
the Haskell and the C representation won't fit in memory...

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



GreenCard: list marshalling

2002-06-02 Thread Ferenc Wagner

   Hi,

I'd like to call LaPack routines from Haskell.  Having read
the GreenCard documentation it's still not obvious to me how
I could marshall a list of numbers to C.  Surely it's
possible to create a ForeignObj, then fill it in element-by-
element.  But isn't there a more straightforward way?  Even
without monads?

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



Re: ANN: Functional Metapost 1.2

2002-05-28 Thread Ferenc Wagner

Jorge Adriano [EMAIL PROTECTED] writes:

 By the way, the link in: The latest and greatest version
 with documentation included: FuncMP-1.2.tgz (1.6 MB).
 points to version 1.1 instead of 1.2.

Oops.  Fixed.  Thanks.  Sorry.

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



ANN: Functional Metapost 1.2

2002-05-27 Thread Ferenc Wagner

   Dear Haskell Community,

version 1.2 of Functional Metapost is now available at

  http://afavant.elte.hu/~wferi/funcmp/

News:

* This version includes English translations of the most
important parts of the documentation!  Thanks to Meik
Hellmund, who contributed the translations.

* 8-bit color depth bitmaps work.

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



Functional Metapost revival

2001-11-24 Thread Ferenc Wagner

You can find a version of Functional Metapost, which works
with current (2001 February) Hugs, on the following page:

http://afavant.elte.hu/~wferi/funcmp/

This version is able to produce all the illustrations in the
enclosed Tutorial on my machine.

  Good luck, waiting for your comments: Feri.

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