hugs Time
I just realized that the Hugs package does not seem to include Time (even though it is in the Library Report. Is there a Time library somewhere out on there that works with Hugs? -Alex- ___ S. Alexander Jacobson i2x Media 1-212-697-0184 voice1-212-697-1427 fax
mirroring. thanks
I asked recently for the DoCon directory mirroring. Thanks to everybody, who suggested the help. There were already three suggestions. So i order them and will speak to them further privately. The story was that about 50 users tried to download DoCon files. Some of them failed at the main archive. But one has complained. So i start thinking of mirrorring. Thank you. -- Sergey Mechveliani [EMAIL PROTECTED] http://www.botik.ru/~mechvel
Re: Wadler's prettier printer
Rossberg writes, thinking about whether the pretty printer proposed by Wadler requires some changes to be efficient in a strict language, I stumbled over the the last case defining `flatten': flatten (x :<|> y) = flatten x I wonder why it is necessary here to recurse on x. The only point were a doc (x:<|>y) is constructed is in the function `group': group z = flatten z :<|> z So the x above is always flat already. Wouldn't the equation flatten (x :<|> y) = x suffice? Doing recursion here seems to be unnecessary overhead. In particular, it prevents structure sharing between alternatives when grouping, because flatten rebuilds the whole doc tree (which might be more of a problem without laziness). Am I missing something? You're not the one who missed something. I didn't spot this optimization because I had in mind the case where the user might use <|> directly. If we disallow this, your tricky optimisation is quite sensible. As it happens, it doesn't seem to improve time or space by much, at least for the lazy version. I include modified code below. It's wonderful to have clever people reading and commenting on my code. Thanks! -- P --- Philip Wadler [EMAIL PROTECTED] Bell Labs, Lucent Technologies http://www.cs.bell-labs.com/~wadler 600 Mountain Ave, room 2T-402 office: +1 908 582 4004 Murray Hill, NJ 07974-0636 fax: +1 908 582 5857 USA home: +1 908 626 9252 --- -- Pretty printer based on grouping -- as in March 1998 version of `A prettier printer' -- Philip Wadler, March 1998 -- Modified version based on suggestion of Andreas Rossberg -- Philip Wadler, May 1998 -- Two optimized lines, marked below, exploit the invariant that -- the left hand argument of :<|> must be result of applying flatten. infixr 5 :<|> infixr 6 :<> infixr 6 <> data DOC= NIL | DOC :<> DOC | NEST Int DOC | TEXT String | LINE | DOC :<|> DOC data Doc= Nil | String `Text` Doc | Int `Line` Doc nil = NIL x <> y = x :<> y nest i x = NEST i x text s = TEXT s line = LINE group (x :<|> y) = x :<|> y-- *** remove line for unoptimized group x = flatten x :<|> x flatten NIL = NIL flatten (x :<> y)= flatten x :<> flatten y flatten (NEST i x) = NEST i (flatten x) flatten (TEXT s) = TEXT s flatten LINE = TEXT " " flatten (x :<|> y) = x -- *** replace by (flatten x) for unoptimized layout Nil = "" layout (s `Text` x) = s ++ layout x layout (i `Line` x) = '\n' : copy i ' ' ++ layout x copy i x = [ x | _ <- [1..i] ] best w k x = be w k [(0,x)] be w k []= Nil be w k ((i,NIL):z) = be w k z be w k ((i,x :<> y):z) = be w k ((i,x):(i,y):z) be w k ((i,NEST j x):z) = be w k ((i+j,x):z) be w k ((i,TEXT s):z)= s `Text` be w (k+length s) z be w k ((i,LINE):z) = i `Line` be w i z be w k ((i,x :<|> y):z) = better w k (be w k ((i,x):z)) (be w k ((i,y):z)) better w k x y = if fits (w-k) x then x else y fits w x | w < 0 = False fits w Nil = True fits w (s `Text` x) = fits (w - length s) x fits w (i `Line` x) = True pretty w x = layout (best w 0 x) -- Utilities space = text " " x y = x <> line <> y x <+> y = x <> space <> y par x = text "(" <> x <> text ")" stack = foldr1 () strip = foldr1 (<+>) -- Testing dataTerm= Term String [Term] prTerm (Term n []) = text n prTerm (Term n ts) = par (group (nest 2 (stack (text n : map prTerm ts szTerm (Term n ts) = length n + length ts + sum (map szTerm ts) mkTerm 0 i = Term (mkName i) [] mkTerm (d+1) i = Term (mkName i) (map (mkTerm d) (randoms i)) mkName i= [ 'x' | j <- [1..i] ] randoms i = [ i*j `
DoCon problems
Sergey Mechveliani writes: > There exists a computer algebra program DoCon written in Haskell, > distributed freely with the sources, at > ftp.botik.ru:/pub/local/Mechveliani/docon/ > > and some users say the main archive (about 600K byte) is very hard to > transfer. ... > Or maybe, simply somewhat keep a copy of the file(s) in some place > that we can reference publicly. ... > Sergey Mechveliani > [EMAIL PROTECTED] > http://www.botik.ru/~mechvel Well, the person who complained is your humble servitor. Others might have had more chances with ftp.botik.ru, so perhaps the situation is not as bad, but anyway, I put Sergey's files into ftp://ftp.info.unicaen.fr/pub/languages/docon (Caen is about 10 km from the Canal La Manche known by some strange-speaking nations as the English Channel, and I believe that our links may be a little faster than those of Pereslavl, but who knows.) Jerzy Karczmarczuk Caen, Normandy, France.
Re: asking for apllication access help
S.D.Mechveliani writes: > Dear all, > > There exists a computer algebra program DoCon written in Haskell, > distributed freely with the sources, at >ftp.botik.ru:/pub/local/Mechveliani/docon/ > > and some users say the main archive (about 600K byte) is very hard to > transfer. > > Is it possible, or could somebody kind and powerful provide the > mirroring of this directory? I mean, for free, no money. > Or maybe, simply somewhat keep a copy of the file(s) in some place > that we can reference publicly. > This sounds like a good idea, and I'd be happy to create a mirror of the above directory on the Glasgow ftp server. Let me know if you're interested; hopefully that will help some. --Sigbjorn
Re: ghc bug in haskell cgi scripts
S. Alexander Jacobson writes: > I have started to move my Hugs CGI scripts into GHC. > Here is an example hugs cgi script: > > -helloCGI.lhs- > #!/usr/local/bin/runhugs > > main=putStr "content-type: text/html\n\nhello world\n" > --- > > This is literate Haskell so it should be completely acceptable to any > Haskell compiler/interpreter and Hugs does accept it. > But, GHC rejects the #!/usr/local/bin/runhugs at the top of the script > with the message: > > hello.lhs:1:1: parse error on input: "#!/" > hi, this is a "feature" of the de-literate filter GHC is using, preserving lines that appear to have CPP markup on them (i.e., lines that start with '#'.) I've changed this to be more selective, #! will now be weeded out. Fixed in the next release (3.02). --Sigbjorn
asking for apllication access help
Dear all, There exists a computer algebra program DoCon written in Haskell, distributed freely with the sources, at ftp.botik.ru:/pub/local/Mechveliani/docon/ and some users say the main archive (about 600K byte) is very hard to transfer. Is it possible, or could somebody kind and powerful provide the mirroring of this directory? I mean, for free, no money. Or maybe, simply somewhat keep a copy of the file(s) in some place that we can reference publicly. I address to those who might be interested in Haskell application distribution. ?? Sergey Mechveliani [EMAIL PROTECTED] http://www.botik.ru/~mechvel