From Krprtn@aol.com Thu Jan 11 15:56:35 2001 Date: Thu, 11 Jan 2001 10:56:35 EST From: Krprtn@aol.com Krprtn@aol.com Subject: (no subject)
--part1_6a.a50259e.278f31b3_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit I have installed Hugs on my PC, could you please tell me how I can configure Hugs to use an editor. The editor I have got installed on my computer is winedt. --part1_6a.a50259e.278f31b3_boundary Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: 7bit <HTML><FONT FACE=arial,helvetica><FONT SIZE=2>I have installed Hugs on my PC, could you please tell me how I can configure <BR>Hugs to use an editor. The editor I have got installed on my computer is <BR>winedt. </FONT></HTML> --part1_6a.a50259e.278f31b3_boundary--From C.Reinke@ukc.ac.uk Thu Jan 11 16:58:41 2001 Date: Thu, 11 Jan 2001 16:58:41 +0000 From: C.Reinke C.Reinke@ukc.ac.uk Subject: Finalizer problems..
I would like to run some code when something is garbage-collected. Fine, he says, just the job for finalizers (module Weak). Unfortunately, they don't seem to offer a general solution, as the code below demonstrates (presumably, smallish things are copied, not shared, so that the finalizers run too early?). Is there a general way to add finalizers to values of arbitrary type (and have them run when the value, not just one copy of it, disappears)? Or is this behaviour -he hopes- a bug, to be fixed in the next release? Claus ------------- session Main> y nothing is 0 Main> x nothings are (0,0) Main> runAllFinalizers nothing was Main> y 0 Main> x (0,0) ------------- program import IOExts import Weak y = unsafePerformIO $ do { x<-return 0 ; putStrLn "nothing is" ; addFinalizer x (putStrLn "nothing was") ; return x } x = unsafePerformIO $ do { x<-return (0,0) ; putStrLn "nothings are" ; addFinalizer x (putStrLn "nothings were") ; return x }From reid@cs.utah.edu Thu Jan 11 17:47:18 2001 Date: Thu, 11 Jan 2001 10:47:18 -0700 From: Alastair Reid reid@cs.utah.edu Subject: Finalizer problems..
> I would like to run some code when something is > garbage-collected. Fine, he says, just the job for > finalizers (module Weak). Unfortunately, they don't > seem to offer a general solution, as the code below > demonstrates (presumably, smallish things are copied, > not shared, so that the finalizers run too early?). Yes, small Ints (approximately 30 bits worth) and Chars have a special representation which makes it impossible to tell if they have been GC'd GHC has a similar problem for Chars and small ints (-15..15 I think). > Is there a general way to add finalizers to values > of arbitrary type (and have them run when the value, > not just one copy of it, disappears)? No. Anything that is represented as an Int or Char on the heap could behave this way. (The unit value "()", occurences of [], etc may behave the same way.) The only fix is to wrap the object in a data constructor. > Or is this behaviour -he hopes- a bug, to be fixed in the next release? Bug? Probably Likely to be fixed anytime soon? I hesitate to speak for the current maintainers but, since it is caused by a fundamental part of Hugs' implementation, I wouldn't hold my breath waiting for a fix.From akirupairatnam@hotmail.com Thu Jan 11 23:01:22 2001 Date: Thu, 11 Jan 2001 23:01:22 -0000 From: Angela kirupairatnam akirupairatnam@hotmail.com Subject: hugs
<html><DIV>I have installed hugs on my PC, could you tell me how I can configure Hugs to use winedt (editor). I have used the hugs user manual to help me but I have been unsucessful, please could you help me. </DIV><br clear=all><hr>Get Your Private, Free E-mail from MSN Hotmail at <a href="http://www.hotmail.com">http://www.hotmail.com</a>.<br></p></html>From simonmar@microsoft.com Wed Jan 17 11:08:48 2001 Date: Wed, 17 Jan 2001 03:08:48 -0800 From: Simon Marlow simonmar@microsoft.com Subject: Finalizer problems..
> > I would like to run some code when something is > > garbage-collected. Fine, he says, just the job for > > finalizers (module Weak). Unfortunately, they don't > > seem to offer a general solution, as the code below > > demonstrates (presumably, smallish things are copied, > > not shared, so that the finalizers run too early?). > > Yes, small Ints (approximately 30 bits worth) and Chars have a special > representation which makes it impossible to tell if they have > been GC'd > > GHC has a similar problem for Chars and small ints (-15..15 I think). GHC has similar problems for just about all types, due to agressive inlining and other optimisations. We've found that the only reliable types on which you can set a finalizer are the primitive heap-resident ones, like ForeignObj# and MutVar#. That's why using addForeignFinalizer is better than using the generic addFinalizer. We dreamed up various hacks to subvert the optimisations, but haven't found any clean solutions yet. The problem is one of "identity": how to give an object a name such that you can refer to that particular object. Cheers, SimonFrom mpringle@sfu.ca Wed Jan 17 15:41:11 2001 Date: Wed, 17 Jan 2001 7:41:11 PST From: mpringle@sfu.ca mpringle@sfu.ca Subject: Finalizer problems..
Didn't ghc 4.08-1 just come out in the last couple of months or so? Maybe there have been some bug fixes that deal with this. Of course, maybe not. cheers, Micha On Wed, 17 Jan 2001 03:08:48 -0800 simonmar@microsoft.com wrote: > > > I would like to run some code when something is > > > garbage-collected. Fine, he says, just the job for > > > finalizers (module Weak). Unfortunately, they don't > > > seem to offer a general solution, as the code below > > > demonstrates (presumably, smallish things are copied, > > > not shared, so that the finalizers run too early?). > > > > Yes, small Ints (approximately 30 bits worth) and Chars have a special > > representation which makes it impossible to tell if they have > > been GC'd > > > > GHC has a similar problem for Chars and small ints (-15..15 I think). > > GHC has similar problems for just about all types, due to agressive > inlining and other optimisations. We've found that the only reliable > types on which you can set a finalizer are the primitive heap-resident > ones, like ForeignObj# and MutVar#. That's why using > addForeignFinalizer is better than using the generic addFinalizer. > > We dreamed up various hacks to subvert the optimisations, but haven't > found any clean solutions yet. The problem is one of "identity": how to > give an object a name such that you can refer to that particular object. > > Cheers, > Simon > > _______________________________________________ > Hugs-Users mailing list > Hugs-Users@haskell.org > http://www.haskell.org/mailman/listinfo/hugs-usersFrom reid@cs.utah.edu Wed Jan 17 16:09:28 2001 Date: Wed, 17 Jan 2001 09:09:28 -0700 From: Alastair Reid reid@cs.utah.edu Subject: Finalizer problems..
> Didn't ghc 4.08-1 just come out in the last couple of months or so? Maybe > there have been some bug fixes that deal with this. Of course, maybe not. I think Simon Marlow is very well placed to be able to comment on whether GHC has the problems Claus reported and whether they're just minor bugs or (and this is how I read his email) fundamental to the way GHC is implemented. (See the hall of fame in the GHC web pages for reasons to believe this but don't believe the photo on his home page - he doesn't look so glaikit in person.) -- Alastair Reid ps ghc 4.08-1 has a major bug in the finalizers which makes it unusable for people who need finalizers, the foreign function interface, etc. (There is a fix in the CVS repository but you have to build GHC yourself from source to be able to use it.)From mpringle@sfu.ca Wed Jan 17 18:41:06 2001 Date: Wed, 17 Jan 2001 10:41:06 -0800 (PST) From: Micha Julian Pringle mpringle@sfu.ca Subject: Finalizer problems..
Well that bites doesn't it? cheers, Micha On Wed, 17 Jan 2001, Alastair Reid wrote: > > Didn't ghc 4.08-1 just come out in the last couple of months or so? Maybe > > there have been some bug fixes that deal with this. Of course, maybe not. > > I think Simon Marlow is very well placed to be able to comment on whether GHC > has the problems Claus reported and whether they're just minor bugs or (and > this is how I read his email) fundamental to the way GHC is implemented. (See > the hall of fame in the GHC web pages for reasons to believe this but don't > believe the photo on his home page - he doesn't look so glaikit in person.) > > -- > Alastair Reid > > ps ghc 4.08-1 has a major bug in the finalizers which makes it unusable for > people who need finalizers, the foreign function interface, etc. (There is a > fix in the CVS repository but you have to build GHC yourself from source to be > able to use it.) > > > _______________________________________________ > Hugs-Users mailing list > Hugs-Users@haskell.org > http://www.haskell.org/mailman/listinfo/hugs-users >From doaitse@cs.uu.nl Tue Jan 23 18:31:42 2001 Date: Tue, 23 Jan 2001 19:31:42 +0100 From: S. Doaitse Swierstra doaitse@cs.uu.nl Subject: tail recursion
Using the combinators at: http://www.cs.uu.nl/groups/ST/Software/UU_Parsing the problem is solved by (see also the file demo.hs there): pLetter = pAnyOf "abcdefghijklmnopqrstuvwxyz" pString = pList pLetter pAll elems = foldr ((*>) . pSym) (pSucceed []) elems pRoot keys = pString <* pPacked (pSym '<') (pSym '>') (foldr (<|>) pFail (map pAll keys)) <* pString Doaitse Swierstra PS: small modifications may be needed depending on what you want to do with the part after the keyword At 01:24 -0500 2/8/00, Christopher Sharpe wrote: >Hello, > >Thanks to those who pointed out that my previous function p was not tail >recursive. >I think "exclude" (below) is. It seems to work on large files, although >on a 160K >file garbage collection fails to get enough space. > >What I am trying to do is find, in input such as an HTML file, like >"ab<table>c", >the string before the keyword such as "table". So I try the keyword >parsers >(in the list "ps" below) at each point in the input, and add the >character to >my answer if all the parsers fail. Something like a Boyer-Moore string >search might >be used to, though that would add complexity. I couldn't find such an >algorithm >in any Hugs library. > >---------------------------- program ----------------------------- > >import ParseLib > >exclude ans parsers = P (\inp -> case inp of > [] -> [(reverse ans,"")] > (c:cs) -> case papply try inp of > [(_,remaining)] -> [(reverse ans,remaining)] > [] -> papply (exclude >(c:ans) parsers) cs > ) > where try = commonSubstring >> foldr1 (+++) parsers > > >test = papply (exclude "" ps) "ab<table>c" > >commonSubstring = string "<" > >ps = [string "table>",string "/table>" ] >Content-Type: Haskell; > name="ww.hs" >Content-Transfer-Encoding: 7bit >Content-Disposition: inline; > filename="ww.hs" > >Attachment converted: Doaitse:ww.hs 2 (????/----) (00006585) -- __________________________________________________________________________ S. Doaitse Swierstra, Department of Computer Science, Utrecht University P.O.Box 80.089, 3508 TB UTRECHT, the Netherlands Mail: mailto:doaitse@cs.uu.nl WWW: http://www.cs.uu.nl/ PGP Public Key: http://www.cs.uu.nl/people/doaitse/ tel: +31 (30) 253 3962, fax: +31 (30) 2513791 __________________________________________________________________________