From r.zilibowitz at student.unsw.edu.au Sun Apr 1 02:25:44 2007 From: r.zilibowitz at student.unsw.edu.au (Ruben Zilibowitz) Date: Sun Apr 1 02:24:51 2007 Subject: [Haskell-cafe] HGL on Mac OS X Message-ID: <06DB3C77-C224-4248-A87B-6881F1A98DA3@student.unsw.edu.au> Hi, Has anyone got the GHC module HGL to work on Mac OS X? If so I'd be very interested to know how. Cheers, Ruben From apfelmus at quantentunnel.de Sun Apr 1 04:27:08 2007 From: apfelmus at quantentunnel.de (apfelmus) Date: Sun Apr 1 04:26:20 2007 Subject: [Haskell-cafe] Re: HGL on Mac OS X In-Reply-To: <06DB3C77-C224-4248-A87B-6881F1A98DA3@student.unsw.edu.au> References: <06DB3C77-C224-4248-A87B-6881F1A98DA3@student.unsw.edu.au> Message-ID: Ruben Zilibowitz wrote: > Has anyone got the GHC module HGL to work on Mac OS X? If so I'd be very > interested to know how. As HGL uses X-Windows, you have to start /Programs/Utilities/X11.app before using HGL. Here is a terminal transcript of testing whether HGL works in ghci. localhost:~ apfelmus$ ghci ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. Prelude> :m +Graphics.HGL Prelude Graphics.HGL> runGraphics $ withWindow_ "Hello World" (300,200) getKey Loading package X11-1.1 ... linking ... done. Loading package HGL-3.1 ... linking ... done. A window should appear. Regards, apfelmus From isaacdupree at charter.net Sun Apr 1 08:00:18 2007 From: isaacdupree at charter.net (Isaac Dupree) Date: Sun Apr 1 07:58:11 2007 Subject: [Haskell-cafe] Why the Prelude must die In-Reply-To: References: <20070324024812.GA3712@localhost.localdomain> Message-ID: <460F9ED2.9@charter.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 David House wrote: > On 24/03/07, Stefan O'Rear wrote: >> This is a ranty request for comments, and the more replies the better. > > Without responding to any particular comment, my opinion is that we > should have a minimal Prelude with functions like (.) that couldn't be > reasonably redefined in any function. I can recall two variations on (.)... Strict composition, perhaps (.!), that is somehow strict in the functions that are its arguments. Unicode composition, i.e. use the Unicode character for function composition (?) instead of the overloaded (with module system syntax) "." symbol Not that these are worthy alternatives for our Prelude, just reasons that I don't entirely like the idea of any implicitly included prelude. Isaac -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGD57RHgcxvIWYTTURAjwuAKCeX5KJ+511lctcC5EXJ+7kYtsNqACfd/GS PSteOUuiJqYAaaJBwiblaso= =U/j/ -----END PGP SIGNATURE----- From r.zilibowitz at student.unsw.edu.au Sun Apr 1 10:33:16 2007 From: r.zilibowitz at student.unsw.edu.au (Ruben Zilibowitz) Date: Sun Apr 1 10:32:18 2007 Subject: [Haskell-cafe] ghc-6.7.20070330 on Mac OS X Message-ID: <99295021-E577-4005-8426-F98786FAA504@student.unsw.edu.au> I am trying to build this version of GHC on Mac OS X. I'm currently using GHC 6.6. The build is failing with the following error: ghci/InteractiveUI.hs:69:7: Could not find module `System.Console.Readline': Use -v to see a list of the files searched for. <> make[2]: *** [depend] Error 1 make[1]: *** [stage2] Error 2 make: *** [bootstrap2] Error 2 So it seems I need to install the Readline library. But building the Readline library is also giving me errors on my system. Just wondering if someone else has managed to build ghc-6.7.x on Mac OS X? If so, what did you need to do? Cheers, Ruben From dmhouse at gmail.com Sun Apr 1 10:58:29 2007 From: dmhouse at gmail.com (David House) Date: Sun Apr 1 10:57:28 2007 Subject: [Haskell-cafe] Unresolved overloading error In-Reply-To: References: <41581929-36B2-4877-BB14-92D076D34024@augustsson.net> <678045.48206.qm@web56405.mail.re3.yahoo.com> Message-ID: On 31/03/07, Bryan Burgers wrote: > As a matter of style suggestion, it might make 'binom' more clear if > you use 'div' as an infix operator: > > > binom n j = (fac n) `div` ( fac j * fac (n - j) ) You can even drop the first set of parentheses: binom n r = fac n `div` (fac r * fac (n - r)) Remember that prefix function application has a higher precedence than pretty much anything else. -- -David House, dmhouse@gmail.com From ml at wispery.info Sun Apr 1 12:24:23 2007 From: ml at wispery.info (Anthony Chaumas-Pellet) Date: Sun Apr 1 12:23:26 2007 Subject: [Haskell-cafe] Josephus problem and style Message-ID: <20070401.182423.123451473.alneyan@wispery.info> Hello, I've written a function to compute the general Josephus problem, giving both the number of the survivor and the order in which the others are killed. However, I am not overly fond of my actual Haskell implementation, so I would like some comments on elegance. My current function is as follow:: josephus k n = josephus' k 1 [1..n] [] where josephus' k i (x:xs) sorted | xs == [] = (x, reverse sorted) | i `mod` k == 0 = josephus' k (i+1) xs ([x] ++ sorted) | otherwise = josephus' k (i+1) (xs ++ [x]) sorted The biggest difficulty I had is representing the circle (a continuous unit, unlike the list). The only solution I've found is to explicitly concatenate lists during each iteration, using an index to check whether the current element should be kept. It seems to me that manupilating lists so often makes the resulting function unclear, and hides the basic principle behind the Josephus sequence. So, I'm looking for a better way to write this function, but enlightenment eludes me. I've taken up Haskell in earnest a couple weeks ago, after a fairly long stay in Lisp land (perhaps it shows). My previous "Eureka!" moment in Haskell was matrix multiplication, along the lines of: matProd a b = [[sum (zipWith (*) x y) | y <- transpose b]| x <- a] Thanks! Anthony Chaumas-Pellet From ross at soi.city.ac.uk Sun Apr 1 13:32:41 2007 From: ross at soi.city.ac.uk (Ross Paterson) Date: Sun Apr 1 13:31:41 2007 Subject: [Haskell-cafe] Josephus problem and style In-Reply-To: <20070401.182423.123451473.alneyan@wispery.info> References: <20070401.182423.123451473.alneyan@wispery.info> Message-ID: <20070401173241.GA26471@soi.city.ac.uk> On Sun, Apr 01, 2007 at 06:24:23PM +0200, Anthony Chaumas-Pellet wrote: > I've written a function to compute the general Josephus problem, > giving both the number of the survivor and the order in which the > others are killed. However, I am not overly fond of my actual Haskell > implementation, so I would like some comments on elegance. My current > function is as follow:: > > josephus k n = josephus' k 1 [1..n] [] where > josephus' k i (x:xs) sorted > | xs == [] = (x, reverse sorted) > | i `mod` k == 0 = josephus' k (i+1) xs ([x] ++ sorted) > | otherwise = josephus' k (i+1) (xs ++ [x]) sorted You show a bias towards tail recursion. It would be neater (and lazier) to return the executed ones incrementally. This is easier if you don't distinguish the survivor from the rest, i.e. just put it on the end of the list. If you represent the circle with the sequence in Data.Sequence instead of a list, you reduce the cost of adding at the end, for a cost of O(k) per execution. But there's a cheaper way of rotating by k-1 elements (at least for large n and k). Instead of moving k-1 elements one at a time to the other end, you could split after (k-1) `mod` length xs elements and append the pieces in the opposite order, for a cost of O(log k). From iseff at iseff.com Sun Apr 1 15:42:07 2007 From: iseff at iseff.com (Ian Sefferman) Date: Sun Apr 1 15:41:04 2007 Subject: [Haskell-cafe] String to Word64 Conversion Message-ID: I've been spending a lot of time trying to find a clean way to convert from a String to a Word64 for the Crypto library. Specifically, we're trying to encrypt the strings with Blowfish. The type for the encrypt function is: encrypt :: (Integral a) => a -> Word64 -> Word64 I assume I would want something like: toWord64s :: String -> [Word64] toWord64s = .... myEncrypt string = map (Blowfish.encrypt myKey) (toWord64s string) I would have to imagine that encrypting strings is a fairly common thing to do, so a conversion should be trivial, but I can't seem to find anything on it. I feel like I must be missing something rather obvious here. Am I? Thanks, Ian From paul.hudak at yale.edu Sun Apr 1 16:46:53 2007 From: paul.hudak at yale.edu (Paul Hudak) Date: Sun Apr 1 16:45:50 2007 Subject: [Haskell-cafe] Josephus problem and style In-Reply-To: <20070401.182423.123451473.alneyan@wispery.info> References: <20070401.182423.123451473.alneyan@wispery.info> Message-ID: <46101A3D.4050203@yale.edu> Here's a solution that I think is a bit more elegant. -Paul josephus n k = let loop xs = let d:r = drop (k-1) xs in d : loop (filter (/= d) r) in take n (loop (cycle [1..n])) Anthony Chaumas-Pellet wrote: > Hello, > > I've written a function to compute the general Josephus problem, > giving both the number of the survivor and the order in which the > others are killed. However, I am not overly fond of my actual Haskell > implementation, so I would like some comments on elegance. My current > function is as follow:: > > josephus k n = josephus' k 1 [1..n] [] where > josephus' k i (x:xs) sorted > | xs == [] = (x, reverse sorted) > | i `mod` k == 0 = josephus' k (i+1) xs ([x] ++ sorted) > | otherwise = josephus' k (i+1) (xs ++ [x]) sorted > > The biggest difficulty I had is representing the circle (a continuous > unit, unlike the list). The only solution I've found is to explicitly > concatenate lists during each iteration, using an index to check > whether the current element should be kept. > > It seems to me that manupilating lists so often makes the resulting > function unclear, and hides the basic principle behind the Josephus > sequence. So, I'm looking for a better way to write this function, but > enlightenment eludes me. > > I've taken up Haskell in earnest a couple weeks ago, after a fairly > long stay in Lisp land (perhaps it shows). My previous "Eureka!" > moment in Haskell was matrix multiplication, along the lines of: > > matProd a b = [[sum (zipWith (*) x y) | y <- transpose b]| x <- a] > > Thanks! > Anthony Chaumas-Pellet From duncan.coutts at worc.ox.ac.uk Sun Apr 1 19:12:17 2007 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Sun Apr 1 19:11:24 2007 Subject: [Haskell-cafe] Josephus problem and style In-Reply-To: <46101A3D.4050203@yale.edu> References: <20070401.182423.123451473.alneyan@wispery.info> <46101A3D.4050203@yale.edu> Message-ID: <1175469137.4994.69.camel@localhost> On Sun, 2007-04-01 at 16:46 -0400, Paul Hudak wrote: > Here's a solution that I think is a bit more elegant. > > -Paul > > josephus n k = > let loop xs = let d:r = drop (k-1) xs > in d : loop (filter (/= d) r) > in take n (loop (cycle [1..n])) Lovely. .. must.. resist ... urge to fuse ... Actually the interesting thing that makes this example tricky to fuse using automagic techniques is that while loop looks like it should be a good producer and consumer, it's also recursive. Hmm, interesting. Duncan From duncan.coutts at worc.ox.ac.uk Sun Apr 1 19:26:58 2007 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Sun Apr 1 19:26:05 2007 Subject: [Haskell-cafe] Data.ByteStream.Char8.words performance In-Reply-To: <05377278-2088-4775-9C07-BDC497AA2068@gmail.com> References: <1175306977.4994.21.camel@localhost> <05377278-2088-4775-9C07-BDC497AA2068@gmail.com> Message-ID: <1175470019.4994.73.camel@localhost> On Sun, 2007-04-01 at 17:25 +0200, Thomas Schilling wrote: > On 31 mar 2007, at 04.09, Duncan Coutts wrote: > > > > The ByteString libs was more-or-less the first high performance thing > > that we wrote and we've learnt plenty more since then. I think > > there's a > > good deal more performance too eek out of it yet, both at the low and > > high level. > > Is there some document available explaining those findings (other > than the ByteString paper)? Not yet. Duncan From ross at soi.city.ac.uk Sun Apr 1 19:41:46 2007 From: ross at soi.city.ac.uk (Ross Paterson) Date: Sun Apr 1 19:40:43 2007 Subject: [Haskell-cafe] Josephus problem and style In-Reply-To: <1175469137.4994.69.camel@localhost> References: <20070401.182423.123451473.alneyan@wispery.info> <46101A3D.4050203@yale.edu> <1175469137.4994.69.camel@localhost> Message-ID: <20070401234146.GA3136@soi.city.ac.uk> On Mon, Apr 02, 2007 at 09:12:17AM +1000, Duncan Coutts wrote: > On Sun, 2007-04-01 at 16:46 -0400, Paul Hudak wrote: > > Here's a solution that I think is a bit more elegant. > > > > -Paul > > > > josephus n k = > > let loop xs = let d:r = drop (k-1) xs > > in d : loop (filter (/= d) r) > > in take n (loop (cycle [1..n])) > > Lovely. > > .. must.. resist ... urge to fuse ... Resist -- there's little to gain from fusing an asymptotically slower algorithm. (This is O(n^2) compared with the original O(nk) and a possible O(n log k).) From ross at soi.city.ac.uk Sun Apr 1 19:50:22 2007 From: ross at soi.city.ac.uk (Ross Paterson) Date: Sun Apr 1 19:49:20 2007 Subject: [Haskell-cafe] Josephus problem and style In-Reply-To: <20070401173241.GA26471@soi.city.ac.uk> References: <20070401.182423.123451473.alneyan@wispery.info> <20070401173241.GA26471@soi.city.ac.uk> Message-ID: <20070401235022.GB3136@soi.city.ac.uk> Here's the sequence version: import Data.Sequence as Seq josephus k n = reduce (fromList [1..n]) where reduce xs | Seq.null xs = [] | otherwise = case viewl (rotate (k-1) xs) of x :< xs' -> x : reduce xs' rotate i xs = back >< front where (front, back) = Seq.splitAt (i `mod` Seq.length xs) xs From r.zilibowitz at student.unsw.edu.au Sun Apr 1 20:43:46 2007 From: r.zilibowitz at student.unsw.edu.au (Ruben Zilibowitz) Date: Sun Apr 1 20:42:47 2007 Subject: [Haskell-cafe] ghc-6.7.20070330 on Mac OS X In-Reply-To: References: <99295021-E577-4005-8426-F98786FAA504@student.unsw.edu.au> Message-ID: <76AF6473-A9DA-4BBC-B567-A775389D997D@student.unsw.edu.au> Hi, I managed to build it eventually using the instructions on: http://hackage.haskell.org/trac/ghc/wiki/Building/MacOSX Sorry to Greg - I accidentally sent this to your personal email address first. Ruben On 02/04/2007, at 4:34 AM, Gregory Wright wrote: > > Hi Ruben, > > The GHC wiki also has information on this, and should be your first > stop if you are experiencing build problems: > > http://hackage.haskell.org/trac/ghc/wiki/Building/MacOSX > > At least under MacPorts, I have had no trouble building 6.7-20070330. > I will be releasing a new portfile for ghc-devel in a few days that > will > build the latest from the darcs repository. > > Best Wishes, > Greg > > On Apr 1, 2007, at 11:50 AM, Pepe Iborra wrote: > >> (redirecting to glasgow-haskell-users) >> >> It is well known that the readline lib that comes with OS X is no >> good, and you need to use a replacement. A nice post from the >> blogosphere explaining all this: >> >> http://mult.ifario.us/articles/2006/10/17/ghc-6-6-and-mac-os-x- >> readline-quick-fix >> >> If that doesn't help, please post the errors that you get when >> building the readline package. >> >> Cheers >> pepe >> > From monnier at iro.umontreal.ca Sun Apr 1 21:20:34 2007 From: monnier at iro.umontreal.ca (Stefan Monnier) Date: Sun Apr 1 21:19:52 2007 Subject: [Haskell-cafe] Re: A wish for relaxed layout syntax References: <20070328231714.GT4626@momenergy.repetae.net> Message-ID: > list := '[' item* ';'? ']' Indeed, it's the same idea as the 'else' in do-blocks. Stefan From dons at cse.unsw.edu.au Sun Apr 1 22:06:17 2007 From: dons at cse.unsw.edu.au (Donald Bruce Stewart) Date: Sun Apr 1 22:05:17 2007 Subject: [Haskell-cafe] Mutable variables eliminated from .NET | Lambda the Ultimate Message-ID: <20070402020617.GA3584@cse.unsw.EDU.AU> As seen on reputable language news site, Lambda the Ultimate. http://lambda-the-ultimate.org/node/2164 Mutable variables eliminated from .NET Redmond, WA: At an unusual press conference held this Sunday morning, Bill Taylor, Microsoft's General Manager of Platform Strategy, announced that after much research into the causes of security holes and instabilities, Microsoft will eliminate mutable variables from the .NET platform and its languages, including C# and VB.NET. "One of our top researchers found that mutable variables were the major root cause preventing us from achieving the great user experience we always strive to deliver," said Taylor. "Once we realized that, eliminating them from .NET was a no-brainer." Given that this announcement was made on a Sunday, reactions have been limited so far, but one prominent VB.NET developer commented that "Compared to the switch from VB6 to VB.NET, this ought to be a breeze." A C# developer was heard to say, "After anonymous delegates, monads shouldn't be a problem." To ensure wide penetration of this significant update, Microsoft will be issuing updated Windows CDs to all licensed customers, free of charge. The new CDs can be identified by the distinctive holographic "Haskell Inside" logo, featuring a holographic version of this[1] portrait of Simon Peyton-Jones, grinning from ear to ear. [1] http://research.microsoft.com/~simonpj/GIFs/spj-snow.jpg From haskell-oren at ben-kiki.org Sun Apr 1 23:46:56 2007 From: haskell-oren at ben-kiki.org (Oren Ben-Kiki) Date: Sun Apr 1 23:45:53 2007 Subject: [Haskell-cafe] Memory leak in streaming parser Message-ID: I just created an initial version of a "streaming" parser. This parser is intended to serve as a reference parser for the YAML spec. Efficiency isn't the main concern; the priority was to have it use the BNF productions from the spec without any changes (ok, with tiny, minor, insignificant changes :-) and to allow it to stream large files. I'm happy to say I achieved the first goal, and the parser .hs file simply #includes a file that is, for all intents and purposes, a BNF file. I didn't have as much luck with the second goal. After putting a lot of effort into it, I have got to the point it is "streaming". That is, I can "cat" a large YAML file to the wrapper program and it will "immediately" start spitting out parsed tokens. This took some doing to ensure the resulting token stream is accessible while it is being generated, in the presence of potential parsing failures and, of course, parsing decision points. I must have done "too good a job" converting things to lazy form because, while the parser is streaming, it also hangs on to old state objects for no "obvious" reason. At least it isn't obvious to me after profiling it in any way I could think of and trying to `seq` the "obvious" suspects. Adding a `seq` in the wrong place will of course stop it from being a streaming parser... I'd take it as a kindness if someone who had some deeper knowledge of the Haskell internals would peek at it. It is packaged as Cabal .tar.gz file in http://www.ben-kiki.org/oren/YamlReference - it includes the wrapper program and a regression-test program. To watch it consume all available memory using a very small set of BNF productions, yes '#' | yaml2yeast -p s-l-comments (This basically matches "l-comment*" - each '#\n' is a comment line). You'll get a stream of parsed tokens to stdout and an ever-climbing memory usage in top (or htop). Any advice would be appreciated, Oren Ben-Kiki From himself at poczta.nom.pl Mon Apr 2 07:24:07 2007 From: himself at poczta.nom.pl (Andrzej Jaworski) Date: Mon Apr 2 07:21:10 2007 Subject: [Haskell-cafe] Mutable variables eliminated from .NET | Lambda theUltimate References: <20070402020617.GA3584@cse.unsw.EDU.AU> Message-ID: <003401c77519$6fb084e0$5b66ce57@bzdryk> > To ensure wide penetration of this significant update, Microsoft will be > issuing updated Windows CDs to all licensed customers, free of charge. > The new CDs can be identified by the distinctive holographic "Haskell > Inside" logo, featuring a holographic version of this[1] portrait of Simon > Peyton-Jones, grinning from ear to ear. >From the operating theater point of view Haskell is a donor! In this scenario usually the recipients grin;-) -Andrzej From Malcolm.Wallace at cs.york.ac.uk Mon Apr 2 08:54:09 2007 From: Malcolm.Wallace at cs.york.ac.uk (Malcolm Wallace) Date: Mon Apr 2 08:56:51 2007 Subject: [Haskell-cafe] Memory leak in streaming parser In-Reply-To: References: Message-ID: <20070402135409.54e8d9bb.Malcolm.Wallace@cs.york.ac.uk> "Oren Ben-Kiki" wrote: > I just created an initial version of a "streaming" parser. This parser > is intended to serve as a reference parser for the YAML spec. An observation about your state setter functions, e.g. setDecision :: String -> State -> State setDecision decision state = State { sName = state|>sName, sEncoding = state|>sEncoding, sDecision = decision, sLimit = state|>sLimit, sForbidden = state|>sForbidden, sIsPeek = state|>sIsPeek, sTokens = state|>sTokens, sCommits = state|>sCommits, sConsumed = state|>sConsumed, sChars = state|>sChars, sMessage = state|>sMessage, sLine = state|>sLine, sColumn = state|>sColumn, sCode = state|>sCode, sLast = state|>sLast, sInput = state|>sInput } You can shorten your code considerably by using the standard named-field update syntax for exactly this task: setDecision :: String -> State -> State setDecision decision state = state { sDecision = decision } Not only is it shorter, but it will often be much more efficient, since the entire structured value is copied once once, then a single field updated, rather than being re-built piece-by-piece in 15 steps. > I must have done "too good a job" converting things to lazy form > because, while the parser is streaming, it also hangs on to old state > objects for no "obvious" reason. At least it isn't obvious to me after > profiling it in any way I could think of and trying to `seq` the > "obvious" suspects. Adding a `seq` in the wrong place will of course > stop it from being a streaming parser... You probably want to be strict in the state component, but not in the output values of your monad. So as well as replacing let ... in (finalState, rightResult) with let ... in finalState `seq` (finalState, rightResult) in the (>>=) method in your Monad instance (and in the separate defn of /), you might also need to make all the named fields of your State datatype strict. Regards, Malcolm From tphyahoo at gmail.com Mon Apr 2 09:35:47 2007 From: tphyahoo at gmail.com (Thomas Hartman) Date: Mon Apr 2 09:34:46 2007 Subject: [Haskell-cafe] Re: ANN: HSH 1.2.0 In-Reply-To: <87aby6g6id.fsf@smtp.gmail.com> References: <45ED4FDA.6040906@microsoft.com> <20070313185028.GB7533@heave.ugcs.caltech.edu> <910ddf450703210107o74aeea41j6090df38b6bf8d2b@mail.gmail.com> <910ddf450703210107u2ed82beer992bcc189b992d88@mail.gmail.com> <910ddf450703210122r26738eecu4dd79a8caffac38a@mail.gmail.com> <910ddf450703210141x541f8ed2i889d14b62eef6c53@mail.gmail.com> <87aby6g6id.fsf@smtp.gmail.com> Message-ID: <910ddf450704020635o5d07ff5pfa89df0028b22134@mail.gmail.com> > As you have built ghc6.6 from sources I think that you also need to build > all haskell libs from sources. So, do I did this, and got the feeling this would probably work, but is a real sad world of dependency chasing with no (clear) end in sight. So I investigated your second suggestion > Another way is to take ghc6 and all haskell libs from fiesty. which to me seems much preferrable. http://old.pupeno.com/blog/unstable-packages-on-ubuntu/ Was indispensible in helping me figure out how to do this. To give some details on this (which is really more apt packaging know how than haskell but whatever), I did something like 1) change /etc/apt/sources.list to add deb-src http://archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse note, only add deb-src line here, not deb line, see article above for why. sudo aptitude install fakeroot (needed utility) fakeroot apt-get source --build ghc6 -- complains, some dependencies are missing sudo aptitude install ..... install packages with above command, not from source. it's my first time using the aptitude command, I wonder if this does the same thing as apt-get install, which is what I usually do. Whatever the case... fakeroot apt-get source --build ghc6 works :) 2007/3/21, Max Vasin : > >>>>> "Thomas" == Thomas Hartman writes: > > Thomas> Furthermore (as the above messages suggest and locate confirms), I > Thomas> seem to have mtl already > > Thomas> I took a wild guess and tried specifying this with ghc -i > > Thomas> like > > Thomas> sudo runghc -i/usr/lib/ghc6-mtl-dev Setup.lhs configure > Thomas> and sudo runghc -i/usr/lib/ Setup.lhs configure > > Thomas> but no dice. > > Thomas> *************** > > Thomas> thartman@linodewhyou:~/haskellInstalls/hsh$ locate libghc6-mtl-dev > Thomas> /home/thartman/libghc6-mtl-dev_1.0-3_i386.deb > Thomas> /usr/lib/libghc6-mtl-dev > Thomas> /usr/lib/libghc6-mtl-dev/register.sh > Thomas> /usr/lib/libghc6-mtl-dev/unregister.sh > Thomas> /usr/share/doc/libghc6-mtl-dev > Thomas> /usr/share/doc/libghc6-mtl-dev/changelog.Debian.gz > Thomas> /usr/share/doc/libghc6-mtl-dev/copyright > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.list > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.md5sums > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.postinst > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.prerm > > As you have built ghc6.6 from sources I think that you also need to build > all haskell libs from sources. So, do > > $ apt-get source libghc6-mtl-dev > $ cd > $ runhaskell Setup.lhs configure > $ runhaskell Setup.lhs build > $ sudo runhaskell Setup.lhs install > > Another way is to take ghc6 and all haskell libs from fiesty. > > -- > WBR, > Max Vasin. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From haskell-oren at ben-kiki.org Mon Apr 2 09:40:11 2007 From: haskell-oren at ben-kiki.org (Oren Ben-Kiki) Date: Mon Apr 2 09:39:06 2007 Subject: [Haskell-cafe] Memory leak in streaming parser Message-ID: On Mon, 2007-04-02 at 13:54 +0100, Malcolm Wallace wrote: > An observation about your state setter functions, ... > You can shorten your code considerably by using the standard named-field > update syntax for exactly this task: > > setDecision :: String -> State -> State > setDecision decision state = state { sDecision = decision } If I do that, the run time insists on the state being "more" evaluated before it changes that specific field. This kills streaming, enforcing each production (including the top one) to be fully parsed before I can access its generated tokens. So the GC won't be hanging on to State objects, but memory still explodes - with unconsumed Token objects. And there's no output from the program until it dies :-( > Not only is it shorter, but it will often be much more efficient, since > the entire structured value is copied once once, then a single field > updated, rather than being re-built piece-by-piece in 15 steps. I know! Is there an efficient way to lazily modify just one field record? > You probably want to be strict in the state component, but not in the > output values of your monad. So as well as replacing > let ... in (finalState, rightResult) > with > let ... in finalState `seq` (finalState, rightResult) > in the (>>=) method in your Monad instance (and in the separate defn of For some strange reason, adding this didn't solve the problem - the GC still refuses to collect the state objects. BTW, forcing the evaluation of the intermediate states (originalState, leftState, rightState etc.) doesn't help either. I have tried to ensure that when '>>=' and '/' will allow the GC to discard old states "as soon as possible", but I'm obviously missing something. Is there a way to get more detailed retainer information than what's available with '-hr'? > you might also need to make all the named fields of your State datatype > strict. If I make any of them strict, streaming goes away :-( Writing a streaming parser in Haskell is turning out to be much harder than I originally expected. Every fix I tried so far either broke streaming (memory blows up due to tokens) or had no effect (memory blows up due to states). I am assuming that there's a magic point in the middle where tokens are consumed and states are GC-ed... but it has eluded me so far. Thanks, Oren Ben-Kiki P.S. I uploaded the package to Hackage. I added a debug-leak production to make it easier to profile this with even less productions involved. ``yes '#' | yaml2yeast -p debug-leak''. From db4194 at bristol.ac.uk Mon Apr 2 10:26:05 2007 From: db4194 at bristol.ac.uk (Daniel Brownridge) Date: Mon Apr 2 10:25:20 2007 Subject: [Haskell-cafe] Binary I/O Message-ID: <4611127D.2000701@bristol.ac.uk> Hello. I am a Computer Science student attempting to write an emulator using Haskell. One of my main design choices is how to deal with machine code. Clearly it is possible to represent 0's and 1's as ASCII characters, however it strikes me that it would be much nicer to the I/O using raw binary. I don't seem to be able to find much documentation on this. Does anybody know how it's done, or can point me in the direction of some resources. Many thanks Daniel From tphyahoo at gmail.com Mon Apr 2 10:27:35 2007 From: tphyahoo at gmail.com (Thomas Hartman) Date: Mon Apr 2 10:26:32 2007 Subject: [Haskell-cafe] Re: ANN: HSH 1.2.0 In-Reply-To: <910ddf450704020635o5d07ff5pfa89df0028b22134@mail.gmail.com> References: <20070313185028.GB7533@heave.ugcs.caltech.edu> <910ddf450703210107o74aeea41j6090df38b6bf8d2b@mail.gmail.com> <910ddf450703210107u2ed82beer992bcc189b992d88@mail.gmail.com> <910ddf450703210122r26738eecu4dd79a8caffac38a@mail.gmail.com> <910ddf450703210141x541f8ed2i889d14b62eef6c53@mail.gmail.com> <87aby6g6id.fsf@smtp.gmail.com> <910ddf450704020635o5d07ff5pfa89df0028b22134@mail.gmail.com> Message-ID: <910ddf450704020727i2b8d137h2850da4dab6e9780@mail.gmail.com> Well, I guess I spoke to soon. After building ghc6 from feisty as described above, I tried building missingh and have basically what I started with. Is there something I can tweak to get the above straightened out using those nice deb packages, or do I have to do all the dependency chasing involved with building from source? Or is there another way? If this is too debian oriented please yell at me and I will ask about this on a deb/ubuntu forum. thanks... Note, should have mentioned, after doing as my above post describes, I installed all the newly generated deb packages with dpkg -i *.deb **************** thartman@linodewhyou:~/haskellInstalls/missingh>runghc Setup.hs configure Configuring MissingH-0.18.3... configure: /usr/lib/ghc-6.6/bin/ghc-pkg configure: Dependency unix-any: using unix-1.0 Setup.hs: cannot satisfy dependency network-any thartman@linodewhyou:~/haskellInstalls/missingh>which runghc /usr/lib/ghc-6.6/bin/runghc # note, definitely the thing I installed today: thartman@linodewhyou:~/haskellInstalls/missingh>ls -l `which runghc` -rwxr-xr-x 1 root root 300716 Apr 2 09:17 /usr/lib/ghc-6.6/bin/runghc thartman@linodewhyou:~/haskellInstalls/missingh> # and I installed it from deb ghc6, dpkg recognizes it thartman@linodewhyou:~/haskellInstalls/missingh>dpkg -S /usr/lib/ghc-6.6/bin/runghc ghc6: /usr/lib/ghc-6.6/bin/runghc # it does seem like ghc6 comes with a network package thartman@linodewhyou:~/learning/haskell>apt-cache showpkg ghc6 | grep -i network 6.4.1-2ubuntu2 - libghc6-readline-dev libghc6-stm-dev libghc6-hgl-dev libghc6-x11-dev libghc6-fgl-dev libghc6-mtl-dev libghc6-hunit-dev libghc6-quickcheck-dev libghc6-network-dev libghc6-haskell-src-dev libghc6-parsec-dev libghc6-cabal-dev libghc6-unix-dev libghc6-template-haskell-dev libghc6-haskell98-dev libghc6-base-dev libghc6-rts-dev ghc haskell-compiler # I get lost here. Do I have libghc6-network-dev, or don't I? thartman@linodewhyou:~/haskellInstalls/missingh>sudo apt-get install libghc6-network-dev Reading package lists... Done Building dependency tree... Done Note, selecting ghc6 instead of libghc6-network-dev ghc6 is already the newest version. You might want to run `apt-get -f install' to correct these: The following packages have unmet dependencies: hat-ghc6: Depends: ghc6 (< 6.4.1+) but 6.6-3 is to be installed libghc6-cabal-dev: Depends: ghc6 (< 6.4.2) but 6.6-3 is to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). 2007/4/2, Thomas Hartman : > > As you have built ghc6.6 from sources I think that you also need to build > > all haskell libs from sources. So, do > > I did this, and got the feeling this would probably work, but is a > real sad world of dependency chasing with no (clear) end in sight. > > So I investigated your second suggestion > > > Another way is to take ghc6 and all haskell libs from fiesty. > > which to me seems much preferrable. > > http://old.pupeno.com/blog/unstable-packages-on-ubuntu/ > > Was indispensible in helping me figure out how to do this. > > To give some details on this (which is really more apt packaging know > how than haskell but whatever), I did something like > > 1) change /etc/apt/sources.list to add > > deb-src http://archive.ubuntu.com/ubuntu/ feisty main restricted > universe multiverse > > note, only add deb-src line here, not deb line, see article above for why. > > sudo aptitude install fakeroot (needed utility) > fakeroot apt-get source --build ghc6 > -- complains, some dependencies are missing > > sudo aptitude install ..... > install packages with above command, not from source. it's my first > time using the aptitude command, I wonder if this does the same thing > as apt-get install, which is what I usually do. Whatever the case... > > fakeroot apt-get source --build ghc6 > > works :) > > 2007/3/21, Max Vasin : > > >>>>> "Thomas" == Thomas Hartman writes: > > > > Thomas> Furthermore (as the above messages suggest and locate confirms), I > > Thomas> seem to have mtl already > > > > Thomas> I took a wild guess and tried specifying this with ghc -i > > > > Thomas> like > > > > Thomas> sudo runghc -i/usr/lib/ghc6-mtl-dev Setup.lhs configure > > Thomas> and sudo runghc -i/usr/lib/ Setup.lhs configure > > > > Thomas> but no dice. > > > > Thomas> *************** > > > > Thomas> thartman@linodewhyou:~/haskellInstalls/hsh$ locate libghc6-mtl-dev > > Thomas> /home/thartman/libghc6-mtl-dev_1.0-3_i386.deb > > Thomas> /usr/lib/libghc6-mtl-dev > > Thomas> /usr/lib/libghc6-mtl-dev/register.sh > > Thomas> /usr/lib/libghc6-mtl-dev/unregister.sh > > Thomas> /usr/share/doc/libghc6-mtl-dev > > Thomas> /usr/share/doc/libghc6-mtl-dev/changelog.Debian.gz > > Thomas> /usr/share/doc/libghc6-mtl-dev/copyright > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.list > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.md5sums > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.postinst > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.prerm > > > > As you have built ghc6.6 from sources I think that you also need to build > > all haskell libs from sources. So, do > > > > $ apt-get source libghc6-mtl-dev > > $ cd > > $ runhaskell Setup.lhs configure > > $ runhaskell Setup.lhs build > > $ sudo runhaskell Setup.lhs install > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > -- > > WBR, > > Max Vasin. > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe@haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > From stefanor at cox.net Mon Apr 2 10:40:28 2007 From: stefanor at cox.net (Stefan O'Rear) Date: Mon Apr 2 10:39:25 2007 Subject: [Haskell-cafe] Binary I/O In-Reply-To: <4611127D.2000701@bristol.ac.uk> References: <4611127D.2000701@bristol.ac.uk> Message-ID: <20070402144028.GA3274@localhost.localdomain> On Mon, Apr 02, 2007 at 03:26:05PM +0100, Daniel Brownridge wrote: > Hello. > > I am a Computer Science student attempting to write an emulator using > Haskell. > One of my main design choices is how to deal with machine code. > Clearly it is possible to represent 0's and 1's as ASCII characters, > however it strikes me that it would be much nicer to the I/O using raw > binary. I don't seem to be able to find much documentation on this. > Does anybody know how it's done, or can point me in the direction of > some resources. The current Big Name in Haskell's binary support is the aptly named 'binary' library, available from hackagedb (http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3). binary works using two sets of functions, one for very efficiently building binary bytestrings (like [Char] -> [Char]): data Builder --abstract empty, append -- monoid ops singleton :: Word8 -> Builder putWord16be :: Word8 -> Builder ... toLazyByteString :: Builder -> ByteString and a monad for parsing binary data: data Get a -- abstract getWord8 :: Get Word8 getWord16be :: Get Word16 ... runGet :: Get a -> ByteString -> a (there's also a higher level interface paterned on Read/Show, but I don't think that's applicable here). Stefan From mnislaih at gmail.com Mon Apr 2 10:49:07 2007 From: mnislaih at gmail.com (Pepe Iborra) Date: Mon Apr 2 10:48:10 2007 Subject: [Haskell-cafe] Binary I/O In-Reply-To: <4611127D.2000701@bristol.ac.uk> References: <4611127D.2000701@bristol.ac.uk> Message-ID: On 02/04/2007, at 16:26, Daniel Brownridge wrote: > Hello. > > I am a Computer Science student attempting to write an emulator > using Haskell. > One of my main design choices is how to deal with machine code. > Clearly it is possible to represent 0's and 1's as ASCII > characters, however it strikes me that it would be much nicer to > the I/O using raw binary. I don't seem to be able to find much > documentation on this. > Does anybody know how it's done, or can point me in the direction > of some resources. > > Imho, just read directly to an Array and work with that. Probably you want to look at the OmegaGB Gameboy Emulator project for examples. http://www.mutantlemon.com/omegagb The code for loading ROM images to an Array of Words: http://darcs.mutantlemon.com/omegagb/src/RomImage.hs After that, opcodes are easily parsed by pattern matching on the hexadecimal values, e.g. see the mcti function in the Cpu module: http://darcs.mutantlemon.com/omegagb/src/Cpu.hs It would be nicer to write a Data.Binary instance for the Instruction datatype and use that to do the parsing, but I don't think that loading ROM files is a major speed concern here. Another interesting resource you may want to look at for your emulator code can be ICFPC'06 Universal Machine implementations. Don Stewart has a page with a few highly performant implementations (and there are benchmarks too, yay!): http://www.cse.unsw.edu.au/~dons/um.html Cheers pepe From bulat.ziganshin at gmail.com Mon Apr 2 11:09:37 2007 From: bulat.ziganshin at gmail.com (Bulat Ziganshin) Date: Mon Apr 2 11:10:27 2007 Subject: [Haskell-cafe] Binary I/O In-Reply-To: <4611127D.2000701@bristol.ac.uk> References: <4611127D.2000701@bristol.ac.uk> Message-ID: <559830863.20070402190937@gmail.com> Hello Daniel, Monday, April 2, 2007, 6:26:05 PM, you wrote: > however it strikes me that it would be much nicer to the I/O using raw > binary. I don't seem to be able to find much documentation on this. it's our secret weapon ;) http://haskell.org/haskellwiki/Library/Streams http://haskell.org/haskellwiki/Library/AltBinary i'm biased, though, because it's my creation ;) Binary library and hGetArray/hPutArray/hGetBuf/hPutBuf available, too -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com From dominic.steinitz at blueyonder.co.uk Mon Apr 2 12:57:41 2007 From: dominic.steinitz at blueyonder.co.uk (Dominic Steinitz) Date: Mon Apr 2 13:07:28 2007 Subject: [Haskell-cafe] String to Word64 Conversion Message-ID: <200704021757.43804.dominic.steinitz@blueyonder.co.uk> > [Haskell-cafe] String to Word64 Conversion > Ian Sefferman iseff at iseff.com > Sun Apr 1 15:42:07 EDT 2007 > Previous message: [Haskell-cafe] Josephus problem and style > Next message: [Haskell-cafe] Data.ByteStream.Char8.words performance > Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] > I've been spending a lot of time trying to find a clean way to convert > from a String to a Word64 for the Crypto library. > > Specifically, we're trying to encrypt the strings with Blowfish. The > type for the encrypt function is: > > encrypt :: (Integral a) => a -> Word64 -> Word64 > > I assume I would want something like: > toWord64s :: String -> [Word64] > toWord64s = .... > > myEncrypt string = map (Blowfish.encrypt myKey) (toWord64s string) > > I would have to imagine that encrypting strings is a fairly common > thing to do, so a conversion should be trivial, but I can't seem to > find anything on it. I feel like I must be missing something rather > obvious here. Am I? > > Thanks, > Ian Ian, Maybe something like this. I've pretty much taken it from http://darcs.haskell.org/crypto/Data/Digest/SHA1.hs. fromBytes :: (Bits a) => [a] -> a fromBytes input = let dofb accum [] = accum dofb accum (x:xs) = dofb ((shiftL accum 8) .|. x) xs in dofb 0 input blockWord8sIn64 :: [Word8] -> [[Word8]] blockWord8sIn64 = unfoldr g where g [] = Nothing g xs = Just (splitAt 8 xs) getWord64s :: [Word8] -> [Word64] getWord64s = map fromBytes . map (map fromIntegral) . blockWord8sIn64 Don't forget you will need to pad http://www.haskell.org/crypto/doc/html/Codec.Encryption.Padding.html. I don't know what your application is but I suggest NOT using ECB mode which your code suggests you are thinking of doing. The only mode currently supported in the crypto library is CBC but other modes should be trivial to add. Dominic. From jason.morton at gmail.com Mon Apr 2 13:31:58 2007 From: jason.morton at gmail.com (jasonm) Date: Mon Apr 2 13:30:53 2007 Subject: [Haskell-cafe] Mathematics in Haskell Re: Why the Prelude must die In-Reply-To: <46069EEE.70500@mcmaster.ca> References: <20070324024812.GA3712@localhost.localdomain> <005501c76e83$4403a850$6601a8c0@box> <46067F44.2010404@mcmaster.ca> <00ca01c76ef2$d4a6a320$32377ad5@cr3lt> <46069EEE.70500@mcmaster.ca> Message-ID: <9795282.post@talk.nabble.com> Jacques Carette wrote: > >> perhaps i was mistaken in thinking that there is a group of >> math-interested >> haskellers out there discussing, developing, and documenting the area? or >> perhaps that group needs introductory tutorials presenting its work? > My guess is that there are a number of people "waiting in the wings", > waiting for a critical mass of features to show up before really diving > in. See > http://www.cas.mcmaster.ca/plmms07/ > for my reasons for being both interested and wary). > > Probably the simplest test case is the difficulties that people are > (still) encountering doing matrix/vector algebra in Haskell. One either > quickly encounters efficiency issues (although PArr might help), or > typing issues (though many tricks are known, but not necessarily > simple). Blitz++ and the STL contributed heavily to C++ being taken > seriously by people in the scientific computation community. Haskell > has even more _potential_, but it is definitely unrealised potential. > I am one of those mathematicians "waiting in the wings." Haskell looked very appealing at first, and the type system seems perfect, especially for things like multilinear algebra where currying and duality is fundamental. I too was put off by the Num issues though--strange mixture of sophisticated category theory and lack of a sensible hierarchy of algebraic objects. However, I've decided I'm more interested in helping to fix it than wait; so count me in on an effort to make Haskell more mathematical. For me that probably starts with the semigroup/group/ring setup, and good arbitrary-precision as well as approximate linear algebra support. -- View this message in context: http://www.nabble.com/Why-the-Prelude-must-die-tf3457368.html#a9795282 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. From bryan.burgers at gmail.com Mon Apr 2 14:09:04 2007 From: bryan.burgers at gmail.com (Bryan Burgers) Date: Mon Apr 2 14:07:59 2007 Subject: [Haskell-cafe] Mathematics in Haskell Re: Why the Prelude must die In-Reply-To: <9795282.post@talk.nabble.com> References: <20070324024812.GA3712@localhost.localdomain> <005501c76e83$4403a850$6601a8c0@box> <46067F44.2010404@mcmaster.ca> <00ca01c76ef2$d4a6a320$32377ad5@cr3lt> <46069EEE.70500@mcmaster.ca> <9795282.post@talk.nabble.com> Message-ID: > Jacques Carette wrote: > > > >> perhaps i was mistaken in thinking that there is a group of > >> math-interested > >> haskellers out there discussing, developing, and documenting the area? or > >> perhaps that group needs introductory tutorials presenting its work? > > My guess is that there are a number of people "waiting in the wings", > > waiting for a critical mass of features to show up before really diving > > in. See > > http://www.cas.mcmaster.ca/plmms07/ > > for my reasons for being both interested and wary). > > > > Probably the simplest test case is the difficulties that people are > > (still) encountering doing matrix/vector algebra in Haskell. One either > > quickly encounters efficiency issues (although PArr might help), or > > typing issues (though many tricks are known, but not necessarily > > simple). Blitz++ and the STL contributed heavily to C++ being taken > > seriously by people in the scientific computation community. Haskell > > has even more _potential_, but it is definitely unrealised potential. > > > > I am one of those mathematicians "waiting in the wings." Haskell looked > very appealing at first, and the type system seems perfect, especially for > things like multilinear algebra where currying and duality is fundamental. > I too was put off by the Num issues though--strange mixture of sophisticated > category theory and lack of a sensible hierarchy of algebraic objects. > > However, I've decided I'm more interested in helping to fix it than wait; > so count me in on an effort to make Haskell more mathematical. For me that > probably starts with the semigroup/group/ring setup, and good > arbitrary-precision as well as approximate linear algebra support. I've been watching this thread for quite a while now, and it seems to me that there is quite a bit of interest in at least working on a new Prelude. I've also noticed a 'The Other Prelude' page on the wiki [http://haskell.org/haskellwiki/The_Other_Prelude] and they seem to have a start on this. So it seems that we should actually start this, because people will contribute. Can somebody with good Cabal skills and maybe access to darcs.haskell.org start a new library for people to start patching? Bryan Burgers From joelr1 at gmail.com Mon Apr 2 17:48:30 2007 From: joelr1 at gmail.com (Joel Reymont) Date: Mon Apr 2 17:47:23 2007 Subject: [Haskell-cafe] Keeping a symbol table with Parsec Message-ID: Folks, Are there any examples of keeping a symbol table with Parsec? I'm translating a parser from OCaml and I do this OUTPUT COLON ID LP NUMERIC_SIMPLE RP { add $3 TypNumOut; SimpleOutputDec ($3, Number) } Meaning that if a keyword Output is followed by ":" and an identifier and then "(NumericSimple)" then add identifier to the symbol table as a Number and box it in a constructor. Then in my lexer I do a lookup to check if I have seen this identifier and if I have seen one of type TypeNumOut I return the token NUM instead of ID. This ensures that I can have rules with the token NUM as opposed to ID everywhere. How would I accomplish the same with Parsec, that is 1) update a symbol table and 2) check identifiers and "return a different token"? Thanks, Joel -- http://wagerlabs.com/ From nicolas.frisby at gmail.com Mon Apr 2 18:17:02 2007 From: nicolas.frisby at gmail.com (Nicolas Frisby) Date: Mon Apr 2 18:15:54 2007 Subject: [Haskell-cafe] Keeping a symbol table with Parsec In-Reply-To: References: Message-ID: <5ce89fb50704021517hbd16461h323cf1098cf0c93a@mail.gmail.com> Section 2.12 of the Parsec manual[1] discusses "user state." It sounds like that is what you are after. Hope that helps, Nick [1] - http://www.cs.uu.nl/~daan/download/parsec/parsec.pdf On 4/2/07, Joel Reymont wrote: > Folks, > > Are there any examples of keeping a symbol table with Parsec? > > I'm translating a parser from OCaml and I do this > > OUTPUT COLON ID LP NUMERIC_SIMPLE RP > { add $3 TypNumOut; SimpleOutputDec ($3, Number) } > > Meaning that if a keyword Output is followed by ":" and an identifier > and then "(NumericSimple)" then add identifier to the symbol table as > a Number and box it in a constructor. > > Then in my lexer I do a lookup to check if I have seen this > identifier and if I have seen one of type TypeNumOut I return the > token NUM instead of ID. This ensures that I can have rules with the > token NUM as opposed to ID everywhere. > > How would I accomplish the same with Parsec, that is 1) update a > symbol table and 2) check identifiers and "return a different token"? > > Thanks, Joel > > -- > http://wagerlabs.com/ > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From joelr1 at gmail.com Mon Apr 2 18:20:15 2007 From: joelr1 at gmail.com (Joel Reymont) Date: Mon Apr 2 18:19:14 2007 Subject: [Haskell-cafe] Keeping a symbol table with Parsec In-Reply-To: <5ce89fb50704021517hbd16461h323cf1098cf0c93a@mail.gmail.com> References: <5ce89fb50704021517hbd16461h323cf1098cf0c93a@mail.gmail.com> Message-ID: <80383FBE-60AA-4C30-90CB-8C59A6CB9927@gmail.com> On Apr 2, 2007, at 11:17 PM, Nicolas Frisby wrote: > Section 2.12 of the Parsec manual[1] discusses "user state." It sounds > like that is what you are after. Yes, thanks. My question is mostly about how to "return a different token" when the lexer finds an identifier that's already in the symbol table. -- http://wagerlabs.com/ From himself at poczta.nom.pl Mon Apr 2 18:24:39 2007 From: himself at poczta.nom.pl (Andrzej Jaworski) Date: Mon Apr 2 18:22:20 2007 Subject: [Haskell-cafe] Mathematics in Haskell Re: Why the Prelude must die References: <20070324024812.GA3712@localhost.localdomain><005501c76e83$4403a850$6601a8c0@box> <46067F44.2010404@mcmaster.ca><00ca01c76ef2$d4a6a320$32377ad5@cr3lt> <46069EEE.70500@mcmaster.ca> <9795282.post@talk.nabble.com> Message-ID: <001801c77575$cf72d020$5b66ce57@bzdryk> > I too was put off by the Num issues though--strange mixture of sophisticated > category theory and lack of a sensible hierarchy of algebraic objects. Perhaps we should replace CT with lattice theoretic thinking (e.g. functor = monotonic function) before cleaning up the type-related mess? See: http://citeseer.ist.psu.edu/269479.html > so count me in on an effort to make Haskell more mathematical. For me that > probably starts with the semigroup/group/ring setup, and good > arbitrary-precision as well as approximate linear algebra support. I agree: semigoups like lattices are everywhere. Then there could be a uniform treatment of linear algebra, polynomial equations, operator algebra, etc. So, perhaps haste is not a good advice here? -Andrzej From trebla at vex.net Mon Apr 2 19:20:06 2007 From: trebla at vex.net (Albert Y. C. Lai) Date: Mon Apr 2 19:19:08 2007 Subject: [Haskell-cafe] Keeping a symbol table with Parsec In-Reply-To: References: Message-ID: <46118FA6.7000605@vex.net> Joel Reymont wrote: > Meaning that if a keyword Output is followed by ":" and an identifier > and then "(NumericSimple)" then add identifier to the symbol table as a > Number and box it in a constructor. > > Then in my lexer I do a lookup to check if I have seen this identifier > and if I have seen one of type TypeNumOut I return the token NUM instead > of ID. This ensures that I can have rules with the token NUM as opposed > to ID everywhere. I use a set of strings for the symbol table (I don't record the types of the identifiers, but you can add it back). I don't allow for whitespace, but you can add it back. The parser returns a string rather than a constructor with a string, but you can add it back. It is necessary to fuse the lexer and the parser together, so that they share state; but we can fuse them in a way that still leaves recognizable boundary, e.g., in the below, string "blah", ident, num, name, and numeric_simple are lexers (thus when you add back whitespace you know who are the suspects), and p0 is a parser that calls the lexers and do extra. The name lexer returns a sum type, so you can use its two cases to signify whether a name is in the table or not; then ident and num can fail on the wrong cases. (Alternatively, you can eliminate the sum type by copying the name code into the ident code and the num code.) import Text.ParserCombinators.Parsec import Monad(mzero) import Data.Set as Set main = do { input <- getLine ; print (runParser p0 Set.empty "stdin" input) } p0 = do { string "Output" ; string ":" ; i <- ident ; string "(" ; numeric_simple ; string ")" ; updateState (Set.insert i) ; return i } numeric_simple = many digit ident = do { n <- name ; case n of { ID i -> return i ; _ -> mzero } } name = do { c0 <- letter ; cs <- many alphaNum ; let n = c0 : cs ; table <- getState ; return (if n `Set.member` table then NUM n else ID n) } data Name = NUM String | ID String num = do { n <- name ; case n of { NUM i -> return i ; _ -> mzero } } From rfhayes at reillyhayes.com Tue Apr 3 00:46:34 2007 From: rfhayes at reillyhayes.com (R Hayes) Date: Tue Apr 3 00:46:18 2007 Subject: [Haskell-cafe] Re: Mathematics in Haskell In-Reply-To: <001801c77575$cf72d020$5b66ce57@bzdryk> References: <20070324024812.GA3712@localhost.localdomain><005501c76e83$4403a850$6601a8c0@box> <46067F44.2010404@mcmaster.ca><00ca01c76ef2$d4a6a320$32377ad5@cr3lt> <46069EEE.70500@mcmaster.ca> <9795282.post@talk.nabble.com> <001801c77575$cf72d020$5b66ce57@bzdryk> Message-ID: Wouldn't this be a good discussion for the Haskell Prime List? Reilly Hayes +1 415 388 3903 (office) +1 415 846 1827 (mobile) rfh@ridgecrestfinancial.com On Apr 2, 2007, at 3:24 PM, Andrzej Jaworski wrote: >> I too was put off by the Num issues though--strange mixture of >> sophisticated >> category theory and lack of a sensible hierarchy of algebraic >> objects. > > Perhaps we should replace CT with lattice theoretic thinking (e.g. > functor = monotonic > function) before cleaning up the type-related mess? > See: http://citeseer.ist.psu.edu/269479.html > >> so count me in on an effort to make Haskell more mathematical. >> For me that >> probably starts with the semigroup/group/ring setup, and good >> arbitrary-precision as well as approximate linear algebra support. > > I agree: semigoups like lattices are everywhere. > Then there could be a uniform treatment of linear algebra, > polynomial equations, operator > algebra, etc. So, perhaps haste is not a good advice here? > > -Andrzej > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070402/aae74f7d/attachment-0001.htm From haskell.vivian.mcphail at gmail.com Tue Apr 3 02:44:22 2007 From: haskell.vivian.mcphail at gmail.com (Alexander McPhail) Date: Tue Apr 3 02:43:14 2007 Subject: Matlab/BLAS/LAPack and Re: [Haskell-cafe] Mathematics in Haskell Re: Why the Prelude must Die Message-ID: <7b03b3c60704022344p26e9d1f0tc41689301b3ac628@mail.gmail.com> Since I brought this up (search haskell' list) I should probably volunteer to help. If people agree I can coordinate an effort to build a mathematically sound hierarchy. Unfortunately my mathematical knowledge is less than ideal for this purpose (I am actively remedying this at university). However, if there is an administrative burden I volunteer to shoulder it. On a related note I have written a binding to Matlab data files and arrays if anyone is interested, and I am embarking on a project to bind to CBLAS and CLAPack. Vivian > > Jacques Carette wrote: > > > >> perhaps i was mistaken in thinking that there is a group of > >> math-interested haskellers out there discussing, developing, and > >> documenting the area? or perhaps that group needs introductory > >> tutorials presenting its work? > > My guess is that there are a number of people "waiting in > the wings", > > waiting for a critical mass of features to show up before really > > diving in. See http://www.cas.mcmaster.ca/plmms07/ > > for my reasons for being both interested and wary). > > > > Probably the simplest test case is the difficulties that people are > > (still) encountering doing matrix/vector algebra in Haskell. One > > either quickly encounters efficiency issues (although PArr might > > help), or typing issues (though many tricks are known, but not > > necessarily simple). Blitz++ and the STL contributed > heavily to C++ > > being taken seriously by people in the scientific computation > > community. Haskell has even more _potential_, but it is > definitely unrealised potential. > > > > I am one of those mathematicians "waiting in the wings." > Haskell looked > very appealing at first, and the type system seems perfect, > especially for > things like multilinear algebra where currying and duality is > fundamental. > I too was put off by the Num issues though--strange mixture > of sophisticated > category theory and lack of a sensible hierarchy of algebraic objects. > > However, I've decided I'm more interested in helping to fix > it than wait; > so count me in on an effort to make Haskell more > mathematical. For me that > probably starts with the semigroup/group/ring setup, and good > arbitrary-precision as well as approximate linear algebra support. > > -- > > I've been watching this thread for quite a while now, and it seems to > me that there is quite a bit of interest in at least working on a new > Prelude. I've also noticed a 'The Other Prelude' page on the wiki > [http://haskell.org/haskellwiki/The_Other_Prelude] and they seem to > have a start on this. So it seems that we should actually start this, > because people will contribute. Can somebody with good Cabal skills > and maybe access to darcs.haskell.org start a new library for people > to start patching? > > Bryan Burgers > > > > On Apr 2, 2007, at 3:24 PM, Andrzej Jaworski wrote: > > >> I too was put off by the Num issues though--strange mixture of > >> sophisticated > >> category theory and lack of a sensible hierarchy of algebraic > >> objects. > > > > Perhaps we should replace CT with lattice theoretic thinking (e.g. > > functor = monotonic > > function) before cleaning up the type-related mess? > > See: http://citeseer.ist.psu.edu/269479.html > > > >> so count me in on an effort to make Haskell more mathematical. > >> For me that > >> probably starts with the semigroup/group/ring setup, and good > >> arbitrary-precision as well as approximate linear algebra support. > > > > I agree: semigoups like lattices are everywhere. > > Then there could be a uniform treatment of linear algebra, > > polynomial equations, operator > > algebra, etc. So, perhaps haste is not a good advice here? > > > > -Andrzej > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070403/c7d9b59c/attachment.htm From haskell.vivian.mcphail at gmail.com Tue Apr 3 04:47:32 2007 From: haskell.vivian.mcphail at gmail.com (Alexander McPhail) Date: Tue Apr 3 04:46:25 2007 Subject: [Haskell-cafe] Fwd: darcs.haskell.org access for maths hierarchy In-Reply-To: <4612102A.5070301@gmail.com> References: <7b03b3c60704030015o495eaa8fm68c5ae902124036a@mail.gmail.com> <4612102A.5070301@gmail.com> Message-ID: <7b03b3c60704030147l3b68cb31jd264a81b66f3ab9@mail.gmail.com> I have set up a page on the wiki for discussion: http://www.haskell.org/haskellwiki/Haskell_and_mathematics/Hierarchy And about a darcs repo for people to patch against: ---------- Forwarded message ---------- From: Simon Marlow Date: 03-Apr-2007 20:28 Subject: Re: darcs.haskell.org access for maths hierarchy To: Alexander McPhail Hi there, The plan is to set up a separate server for hosting community projects. Right now we have the server, but we still have to set it up. Hopefully it should be available soon, we'll announce something when it is. Cheers, Simon Alexander McPhail wrote: > Hi, > > There is some movement on the haskell-cafe mailing list to set up a repo > to develop a mathematically sound algebraic class hierarchy. I have > volunteered to coordinate this. > > What is the policy on giving access to darcs.haskell.org > ? > Cheers, > > Vivian > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070403/f55f6c77/attachment.htm From achaumas at wispery.info Tue Apr 3 05:35:36 2007 From: achaumas at wispery.info (Anthony Chaumas-Pellet) Date: Tue Apr 3 05:34:30 2007 Subject: [Haskell-cafe] Josephus problem and style In-Reply-To: <20070401173241.GA26471@soi.city.ac.uk> References: <20070401.182423.123451473.alneyan@wispery.info> <20070401173241.GA26471@soi.city.ac.uk> Message-ID: <20070403.113536.25474491.alneyan@wispery.info> Thanks for your comments everyone! There is one point that has left me puzzled, though. From: Ross Paterson > You show a bias towards tail recursion. It would be neater (and lazier) > to return the executed ones incrementally. This is easier if you don't > distinguish the survivor from the rest, i.e. just put it on the end of > the list. Why is tail recursion a bad thing for a finite function? (Of course, it would be... curious on functions that can produce infinite results) Is tail recursion simply not the most common Haskell idiom, or is there some technical reason I fail to see? Anthony Chaumas-Pellet From wferi at niif.hu Tue Apr 3 06:24:16 2007 From: wferi at niif.hu (Ferenc Wagner) Date: Tue Apr 3 06:23:11 2007 Subject: [Haskell-cafe] Re: Matlab/BLAS/LAPack In-Reply-To: <7b03b3c60704022344p26e9d1f0tc41689301b3ac628@mail.gmail.com> (Alexander McPhail's message of "Tue, 3 Apr 2007 18:44:22 +1200") References: <7b03b3c60704022344p26e9d1f0tc41689301b3ac628@mail.gmail.com> Message-ID: <87odm54uy7.fsf@tac.ki.iif.hu> "Alexander McPhail" 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. From lemming at henning-thielemann.de Tue Apr 3 06:23:42 2007 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Tue Apr 3 06:23:23 2007 Subject: [Haskell-cafe] Mathematics in Haskell Re: Why the Prelude must die In-Reply-To: <9795282.post@talk.nabble.com> References: <20070324024812.GA3712@localhost.localdomain> <005501c76e83$4403a850$6601a8c0@box> <46067F44.2010404@mcmaster.ca> <00ca01c76ef2$d4a6a320$32377ad5@cr3lt> <46069EEE.70500@mcmaster.ca> <9795282.post@talk.nabble.com> Message-ID: On Mon, 2 Apr 2007, jasonm wrote: > Jacques Carette wrote: > > > >> perhaps i was mistaken in thinking that there is a group of > >> math-interested > >> haskellers out there discussing, developing, and documenting the area? or > >> perhaps that group needs introductory tutorials presenting its work? > > My guess is that there are a number of people "waiting in the wings", > > waiting for a critical mass of features to show up before really diving > > in. See > > http://www.cas.mcmaster.ca/plmms07/ > > for my reasons for being both interested and wary). > > > > Probably the simplest test case is the difficulties that people are > > (still) encountering doing matrix/vector algebra in Haskell. One either > > quickly encounters efficiency issues (although PArr might help), or > > typing issues (though many tricks are known, but not necessarily > > simple). Blitz++ and the STL contributed heavily to C++ being taken > > seriously by people in the scientific computation community. Haskell > > has even more _potential_, but it is definitely unrealised potential. > > I am one of those mathematicians "waiting in the wings." Haskell looked > very appealing at first, and the type system seems perfect, especially for > things like multilinear algebra where currying and duality is fundamental. > I too was put off by the Num issues though--strange mixture of sophisticated > category theory and lack of a sensible hierarchy of algebraic objects. > > However, I've decided I'm more interested in helping to fix it than wait; > so count me in on an effort to make Haskell more mathematical. For me that > probably starts with the semigroup/group/ring setup, and good > arbitrary-precision as well as approximate linear algebra support. NumericPrelude popped up in this thread earlier. Is this the starting point you are after? http://darcs.haskell.org/numericprelude/ From lemming at henning-thielemann.de Tue Apr 3 06:28:01 2007 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Tue Apr 3 06:27:23 2007 Subject: [Haskell-cafe] Re: Matlab/BLAS/LAPack In-Reply-To: <87odm54uy7.fsf@tac.ki.iif.hu> References: <7b03b3c60704022344p26e9d1f0tc41689301b3ac628@mail.gmail.com> <87odm54uy7.fsf@tac.ki.iif.hu> Message-ID: On Tue, 3 Apr 2007, Ferenc Wagner wrote: > "Alexander McPhail" 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 ? ... not to forget GSLHaskell and http://www.haskell.org/haskellwiki/Libraries_and_tools/Mathematics#Linear_algebra at all. From Malcolm.Wallace at cs.york.ac.uk Tue Apr 3 07:43:12 2007 From: Malcolm.Wallace at cs.york.ac.uk (Malcolm Wallace) Date: Tue Apr 3 07:46:49 2007 Subject: [Haskell-cafe] Josephus problem and style In-Reply-To: <20070403.113536.25474491.alneyan@wispery.info> References: <20070401.182423.123451473.alneyan@wispery.info> <20070401173241.GA26471@soi.city.ac.uk> <20070403.113536.25474491.alneyan@wispery.info> Message-ID: <20070403124312.7ceec7db.Malcolm.Wallace@cs.york.ac.uk> Anthony Chaumas-Pellet wrote: > From: Ross Paterson > > You show a bias towards tail recursion. It would be neater (and > > lazier) to return the executed ones incrementally. > > Why is tail recursion a bad thing for a finite function? Tail recursion tends to create space-leaks, which in turn hurt time performance. Regards, Malcolm From tphyahoo at gmail.com Tue Apr 3 08:59:33 2007 From: tphyahoo at gmail.com (Thomas Hartman) Date: Tue Apr 3 08:58:29 2007 Subject: [Haskell-cafe] was Re: ANN: HSH 1.2.0 Message-ID: <910ddf450704030559k709bc344p130c543398dfebed@mail.gmail.com> I'm still trying to figure out how to do this on ubuntu. If this winds up being a garden path I'll try on debian next, but at least I'm learning a lot about getting haskell stuff built. Anyway, since I'm on a virtualized linux box, I decided to get a fresh start, unmounted my original OS profile and installed a fresh dapper 6. I then changed /etc/apt/sources.list to be okay for grabbing .debs from feisty. (No longer doing the build from source thing.) apt-get install ghc6, ok from feisty. (Is there another repo that gets all the extra libs at one go?) sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i missing libghc6-hdbc-missingh-dev - Integration of HDBC with MissingH, GHC version libghc6-missingh-dev - Library of utility functions for Haskell, GHC6 package thartman@linodehaskell:~/haskellinstalls/hsh>sudo apt-cache search -o hoorah, my apt cache search command seems ok. sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i hsh thartman@linodehaskell:~/haskellinstalls/hsh> too bad, still no hsh in ubuntu repo. darcs get http://darcs.complete.org/hsh/ (Or should I have used something else?) runghc Setup.hs configure same problems as before. But starting afresh seems to have detangled the issues I was having with packaging confusion. At least now I can apt-get install missingh And some other dependency following is made easier. Finally configure for hsh works. But then thartman@linodehaskell:~/haskellinstalls/hsh>sudo runghc Setup.lhs install Setup.lhs: Warning: The field "hs-source-dir" is deprecated, please use hs-source-dirs. Installing: /usr/local/lib/HSH-1.2.1/ghc-6.6 & /usr/local/bin HSH-1.2.1... Setup.lhs: Error: Could not find module: HSH with any suffix: ["hi"] So, I seem to be stuck at this point. 2007/4/2, Thomas Hartman : > Well, I guess I spoke to soon. After building ghc6 from feisty as > described above, I tried building missingh and have basically what I > started with. > > Is there something I can tweak to get the above straightened out using > those nice deb packages, or do I have to do all the dependency chasing > involved with building from source? Or is there another way? > > If this is too debian oriented please yell at me and I will ask about > this on a deb/ubuntu forum. > > thanks... > > Note, should have mentioned, after doing as my above post describes, I > installed all the newly generated deb packages with > > dpkg -i *.deb > > **************** > > thartman@linodewhyou:~/haskellInstalls/missingh>runghc Setup.hs configure > Configuring MissingH-0.18.3... > configure: /usr/lib/ghc-6.6/bin/ghc-pkg > configure: Dependency unix-any: using unix-1.0 > Setup.hs: cannot satisfy dependency network-any > > thartman@linodewhyou:~/haskellInstalls/missingh>which runghc > /usr/lib/ghc-6.6/bin/runghc > > # note, definitely the thing I installed today: > thartman@linodewhyou:~/haskellInstalls/missingh>ls -l `which runghc` > -rwxr-xr-x 1 root root 300716 Apr 2 09:17 /usr/lib/ghc-6.6/bin/runghc > thartman@linodewhyou:~/haskellInstalls/missingh> > > # and I installed it from deb ghc6, dpkg recognizes it > > thartman@linodewhyou:~/haskellInstalls/missingh>dpkg -S > /usr/lib/ghc-6.6/bin/runghc > ghc6: /usr/lib/ghc-6.6/bin/runghc > > # it does seem like ghc6 comes with a network package > thartman@linodewhyou:~/learning/haskell>apt-cache showpkg ghc6 | grep -i network > 6.4.1-2ubuntu2 - libghc6-readline-dev libghc6-stm-dev libghc6-hgl-dev > libghc6-x11-dev libghc6-fgl-dev libghc6-mtl-dev libghc6-hunit-dev > libghc6-quickcheck-dev libghc6-network-dev libghc6-haskell-src-dev > libghc6-parsec-dev libghc6-cabal-dev libghc6-unix-dev > libghc6-template-haskell-dev libghc6-haskell98-dev libghc6-base-dev > libghc6-rts-dev ghc haskell-compiler > > # I get lost here. Do I have libghc6-network-dev, or don't I? > > thartman@linodewhyou:~/haskellInstalls/missingh>sudo apt-get install > libghc6-network-dev > Reading package lists... Done > Building dependency tree... Done > Note, selecting ghc6 instead of libghc6-network-dev > ghc6 is already the newest version. > You might want to run `apt-get -f install' to correct these: > The following packages have unmet dependencies: > hat-ghc6: Depends: ghc6 (< 6.4.1+) but 6.6-3 is to be installed > libghc6-cabal-dev: Depends: ghc6 (< 6.4.2) but 6.6-3 is to be installed > E: Unmet dependencies. Try 'apt-get -f install' with no packages (or > specify a solution). > > > > > > > 2007/4/2, Thomas Hartman : > > > As you have built ghc6.6 from sources I think that you also need to build > > > all haskell libs from sources. So, do > > > > I did this, and got the feeling this would probably work, but is a > > real sad world of dependency chasing with no (clear) end in sight. > > > > So I investigated your second suggestion > > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > which to me seems much preferrable. > > > > http://old.pupeno.com/blog/unstable-packages-on-ubuntu/ > > > > Was indispensible in helping me figure out how to do this. > > > > To give some details on this (which is really more apt packaging know > > how than haskell but whatever), I did something like > > > > 1) change /etc/apt/sources.list to add > > > > deb-src http://archive.ubuntu.com/ubuntu/ feisty main restricted > > universe multiverse > > > > note, only add deb-src line here, not deb line, see article above for why. > > > > sudo aptitude install fakeroot (needed utility) > > fakeroot apt-get source --build ghc6 > > -- complains, some dependencies are missing > > > > sudo aptitude install ..... > > install packages with above command, not from source. it's my first > > time using the aptitude command, I wonder if this does the same thing > > as apt-get install, which is what I usually do. Whatever the case... > > > > fakeroot apt-get source --build ghc6 > > > > works :) > > > > 2007/3/21, Max Vasin : > > > >>>>> "Thomas" == Thomas Hartman writes: > > > > > > Thomas> Furthermore (as the above messages suggest and locate confirms), I > > > Thomas> seem to have mtl already > > > > > > Thomas> I took a wild guess and tried specifying this with ghc -i > > > > > > Thomas> like > > > > > > Thomas> sudo runghc -i/usr/lib/ghc6-mtl-dev Setup.lhs configure > > > Thomas> and sudo runghc -i/usr/lib/ Setup.lhs configure > > > > > > Thomas> but no dice. > > > > > > Thomas> *************** > > > > > > Thomas> thartman@linodewhyou:~/haskellInstalls/hsh$ locate libghc6-mtl-dev > > > Thomas> /home/thartman/libghc6-mtl-dev_1.0-3_i386.deb > > > Thomas> /usr/lib/libghc6-mtl-dev > > > Thomas> /usr/lib/libghc6-mtl-dev/register.sh > > > Thomas> /usr/lib/libghc6-mtl-dev/unregister.sh > > > Thomas> /usr/share/doc/libghc6-mtl-dev > > > Thomas> /usr/share/doc/libghc6-mtl-dev/changelog.Debian.gz > > > Thomas> /usr/share/doc/libghc6-mtl-dev/copyright > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.list > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.md5sums > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.postinst > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.prerm > > > > > > As you have built ghc6.6 from sources I think that you also need to build > > > all haskell libs from sources. So, do > > > > > > $ apt-get source libghc6-mtl-dev > > > $ cd > > > $ runhaskell Setup.lhs configure > > > $ runhaskell Setup.lhs build > > > $ sudo runhaskell Setup.lhs install > > > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > > > -- > > > WBR, > > > Max Vasin. > > > > > > _______________________________________________ > > > Haskell-Cafe mailing list > > > Haskell-Cafe@haskell.org > > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > From tphyahoo at gmail.com Tue Apr 3 09:11:05 2007 From: tphyahoo at gmail.com (Thomas Hartman) Date: Tue Apr 3 09:09:59 2007 Subject: [Haskell-cafe] Re: was Re: ANN: HSH 1.2.0 In-Reply-To: <910ddf450704030559k709bc344p130c543398dfebed@mail.gmail.com> References: <910ddf450704030559k709bc344p130c543398dfebed@mail.gmail.com> Message-ID: <910ddf450704030611j583e102ej2b14074400547e6@mail.gmail.com> That was a pretty badly titled top thead, which I regret -- probably should have been something like "figuring out how to track down and install packages in haskell, using ubuntu /deb-- was Ann:: HSH". To give additional context, this started out as http://groups.google.de/group/fa.haskell/browse_thread/thread/ca37248eae7a065f/d039de2f9bf6e848?lnk=st&q=hsh+tphyahoo&rnum=1&hl=en#d039de2f9bf6e848 Sorry about the bad title. Still hoping to get hsh working, though for me this has more morphed into learning about package and dependency chasing in a haskell/deb context. 2007/4/3, Thomas Hartman : > I'm still trying to figure out how to do this on ubuntu. If this winds > up being a garden path I'll try on debian next, but at least I'm > learning a lot about getting haskell stuff built. > > Anyway, since I'm on a virtualized linux box, I decided to get a fresh > start, unmounted my original OS profile and installed a fresh dapper > 6. > > I then changed /etc/apt/sources.list to be okay for grabbing .debs > from feisty. (No longer doing the build from source thing.) > > apt-get install ghc6, ok from feisty. > (Is there another repo that gets all the extra libs at one go?) > > sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i missing > > libghc6-hdbc-missingh-dev - Integration of HDBC with MissingH, GHC version > libghc6-missingh-dev - Library of utility functions for Haskell, GHC6 package > thartman@linodehaskell:~/haskellinstalls/hsh>sudo apt-cache search -o > > hoorah, my apt cache search command seems ok. > > > sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i hsh > thartman@linodehaskell:~/haskellinstalls/hsh> > > too bad, still no hsh in ubuntu repo. > > darcs get http://darcs.complete.org/hsh/ > (Or should I have used something else?) > > runghc Setup.hs configure > same problems as before. > > But starting afresh seems to have detangled the issues I was having > with packaging confusion. At least now I can apt-get install missingh > > And some other dependency following is made easier. > > Finally configure for hsh works. > > But then > > thartman@linodehaskell:~/haskellinstalls/hsh>sudo runghc Setup.lhs install > Setup.lhs: Warning: The field "hs-source-dir" is deprecated, please > use hs-source-dirs. > Installing: /usr/local/lib/HSH-1.2.1/ghc-6.6 & /usr/local/bin HSH-1.2.1... > Setup.lhs: Error: Could not find module: HSH with any suffix: ["hi"] > > So, I seem to be stuck at this point. > > 2007/4/2, Thomas Hartman : > > Well, I guess I spoke to soon. After building ghc6 from feisty as > > described above, I tried building missingh and have basically what I > > started with. > > > > Is there something I can tweak to get the above straightened out using > > those nice deb packages, or do I have to do all the dependency chasing > > involved with building from source? Or is there another way? > > > > If this is too debian oriented please yell at me and I will ask about > > this on a deb/ubuntu forum. > > > > thanks... > > > > Note, should have mentioned, after doing as my above post describes, I > > installed all the newly generated deb packages with > > > > dpkg -i *.deb > > > > **************** > > > > thartman@linodewhyou:~/haskellInstalls/missingh>runghc Setup.hs configure > > Configuring MissingH-0.18.3... > > configure: /usr/lib/ghc-6.6/bin/ghc-pkg > > configure: Dependency unix-any: using unix-1.0 > > Setup.hs: cannot satisfy dependency network-any > > > > thartman@linodewhyou:~/haskellInstalls/missingh>which runghc > > /usr/lib/ghc-6.6/bin/runghc > > > > # note, definitely the thing I installed today: > > thartman@linodewhyou:~/haskellInstalls/missingh>ls -l `which runghc` > > -rwxr-xr-x 1 root root 300716 Apr 2 09:17 /usr/lib/ghc-6.6/bin/runghc > > thartman@linodewhyou:~/haskellInstalls/missingh> > > > > # and I installed it from deb ghc6, dpkg recognizes it > > > > thartman@linodewhyou:~/haskellInstalls/missingh>dpkg -S > > /usr/lib/ghc-6.6/bin/runghc > > ghc6: /usr/lib/ghc-6.6/bin/runghc > > > > # it does seem like ghc6 comes with a network package > > thartman@linodewhyou:~/learning/haskell>apt-cache showpkg ghc6 | grep -i network > > 6.4.1-2ubuntu2 - libghc6-readline-dev libghc6-stm-dev libghc6-hgl-dev > > libghc6-x11-dev libghc6-fgl-dev libghc6-mtl-dev libghc6-hunit-dev > > libghc6-quickcheck-dev libghc6-network-dev libghc6-haskell-src-dev > > libghc6-parsec-dev libghc6-cabal-dev libghc6-unix-dev > > libghc6-template-haskell-dev libghc6-haskell98-dev libghc6-base-dev > > libghc6-rts-dev ghc haskell-compiler > > > > # I get lost here. Do I have libghc6-network-dev, or don't I? > > > > thartman@linodewhyou:~/haskellInstalls/missingh>sudo apt-get install > > libghc6-network-dev > > Reading package lists... Done > > Building dependency tree... Done > > Note, selecting ghc6 instead of libghc6-network-dev > > ghc6 is already the newest version. > > You might want to run `apt-get -f install' to correct these: > > The following packages have unmet dependencies: > > hat-ghc6: Depends: ghc6 (< 6.4.1+) but 6.6-3 is to be installed > > libghc6-cabal-dev: Depends: ghc6 (< 6.4.2) but 6.6-3 is to be installed > > E: Unmet dependencies. Try 'apt-get -f install' with no packages (or > > specify a solution). > > > > > > > > > > > > > > 2007/4/2, Thomas Hartman : > > > > As you have built ghc6.6 from sources I think that you also need to build > > > > all haskell libs from sources. So, do > > > > > > I did this, and got the feeling this would probably work, but is a > > > real sad world of dependency chasing with no (clear) end in sight. > > > > > > So I investigated your second suggestion > > > > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > > > which to me seems much preferrable. > > > > > > http://old.pupeno.com/blog/unstable-packages-on-ubuntu/ > > > > > > Was indispensible in helping me figure out how to do this. > > > > > > To give some details on this (which is really more apt packaging know > > > how than haskell but whatever), I did something like > > > > > > 1) change /etc/apt/sources.list to add > > > > > > deb-src http://archive.ubuntu.com/ubuntu/ feisty main restricted > > > universe multiverse > > > > > > note, only add deb-src line here, not deb line, see article above for why. > > > > > > sudo aptitude install fakeroot (needed utility) > > > fakeroot apt-get source --build ghc6 > > > -- complains, some dependencies are missing > > > > > > sudo aptitude install ..... > > > install packages with above command, not from source. it's my first > > > time using the aptitude command, I wonder if this does the same thing > > > as apt-get install, which is what I usually do. Whatever the case... > > > > > > fakeroot apt-get source --build ghc6 > > > > > > works :) > > > > > > 2007/3/21, Max Vasin : > > > > >>>>> "Thomas" == Thomas Hartman writes: > > > > > > > > Thomas> Furthermore (as the above messages suggest and locate confirms), I > > > > Thomas> seem to have mtl already > > > > > > > > Thomas> I took a wild guess and tried specifying this with ghc -i > > > > > > > > Thomas> like > > > > > > > > Thomas> sudo runghc -i/usr/lib/ghc6-mtl-dev Setup.lhs configure > > > > Thomas> and sudo runghc -i/usr/lib/ Setup.lhs configure > > > > > > > > Thomas> but no dice. > > > > > > > > Thomas> *************** > > > > > > > > Thomas> thartman@linodewhyou:~/haskellInstalls/hsh$ locate libghc6-mtl-dev > > > > Thomas> /home/thartman/libghc6-mtl-dev_1.0-3_i386.deb > > > > Thomas> /usr/lib/libghc6-mtl-dev > > > > Thomas> /usr/lib/libghc6-mtl-dev/register.sh > > > > Thomas> /usr/lib/libghc6-mtl-dev/unregister.sh > > > > Thomas> /usr/share/doc/libghc6-mtl-dev > > > > Thomas> /usr/share/doc/libghc6-mtl-dev/changelog.Debian.gz > > > > Thomas> /usr/share/doc/libghc6-mtl-dev/copyright > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.list > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.md5sums > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.postinst > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.prerm > > > > > > > > As you have built ghc6.6 from sources I think that you also need to build > > > > all haskell libs from sources. So, do > > > > > > > > $ apt-get source libghc6-mtl-dev > > > > $ cd > > > > $ runhaskell Setup.lhs configure > > > > $ runhaskell Setup.lhs build > > > > $ sudo runhaskell Setup.lhs install > > > > > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > > > > > -- > > > > WBR, > > > > Max Vasin. > > > > > > > > _______________________________________________ > > > > Haskell-Cafe mailing list > > > > Haskell-Cafe@haskell.org > > > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > > > > > From tphyahoo at gmail.com Tue Apr 3 10:25:30 2007 From: tphyahoo at gmail.com (Thomas Hartman) Date: Tue Apr 3 10:24:24 2007 Subject: [Haskell-cafe] Re: was Re: ANN: HSH 1.2.0 In-Reply-To: <910ddf450704030611j583e102ej2b14074400547e6@mail.gmail.com> References: <910ddf450704030559k709bc344p130c543398dfebed@mail.gmail.com> <910ddf450704030611j583e102ej2b14074400547e6@mail.gmail.com> Message-ID: <910ddf450704030725k13c6fce9tcfa61739af2a176e@mail.gmail.com> actually, maybe I'm more okay than I thought. I originally did this without reading the INSTALL file, and built using the process I have gotten used to: runghc Setup.hs configure; runghc Setup.hs build; runghc Setup.hs install. But when I followed the directions in the INSTALL file ... make setup Now: ./setup configure ./setup build ./setup install ... it seemed to work without that error message. So far so good! I was also able to do thartman@linodehaskell:~/haskellinstalls/hsh> ghci HSH ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. Ok, modules loaded: HSH, HSH.Command, HSH.ShellEquivs. Prelude HSH> however, when I tried copying a simple example from http://changelog.complete.org/posts/492-Announcing-HSH,-the-Haskell-Shell.html I got errors thartman@linodehaskell:~/haskellinstalls/hsh>ghci -fglasgow-exts HSH ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. Ok, modules loaded: HSH, HSH.Command, HSH.ShellEquivs. Prelude HSH> run $ ("ls", ["."]) :1:0: Ambiguous type variable `a' in the constraint: `RunResult a' arising from use of `run' at :1:0-2 Probable fix: add a type signature that fixes these type variable(s) Prelude HSH> So, that's where I'm at now. 2007/4/3, Thomas Hartman : > That was a pretty badly titled top thead, which I regret -- probably > should have been something like "figuring out how to track down and > install packages in haskell, using ubuntu /deb-- was Ann:: HSH". > > To give additional context, this started out as > > http://groups.google.de/group/fa.haskell/browse_thread/thread/ca37248eae7a065f/d039de2f9bf6e848?lnk=st&q=hsh+tphyahoo&rnum=1&hl=en#d039de2f9bf6e848 > > Sorry about the bad title. > > Still hoping to get hsh working, though for me this has more morphed > into learning about package and dependency chasing in a haskell/deb > context. > > > 2007/4/3, Thomas Hartman : > > I'm still trying to figure out how to do this on ubuntu. If this winds > > up being a garden path I'll try on debian next, but at least I'm > > learning a lot about getting haskell stuff built. > > > > Anyway, since I'm on a virtualized linux box, I decided to get a fresh > > start, unmounted my original OS profile and installed a fresh dapper > > 6. > > > > I then changed /etc/apt/sources.list to be okay for grabbing .debs > > from feisty. (No longer doing the build from source thing.) > > > > apt-get install ghc6, ok from feisty. > > (Is there another repo that gets all the extra libs at one go?) > > > > sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i missing > > > > libghc6-hdbc-missingh-dev - Integration of HDBC with MissingH, GHC version > > libghc6-missingh-dev - Library of utility functions for Haskell, GHC6 package > > thartman@linodehaskell:~/haskellinstalls/hsh>sudo apt-cache search -o > > > > hoorah, my apt cache search command seems ok. > > > > > > sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i hsh > > thartman@linodehaskell:~/haskellinstalls/hsh> > > > > too bad, still no hsh in ubuntu repo. > > > > darcs get http://darcs.complete.org/hsh/ > > (Or should I have used something else?) > > > > runghc Setup.hs configure > > same problems as before. > > > > But starting afresh seems to have detangled the issues I was having > > with packaging confusion. At least now I can apt-get install missingh > > > > And some other dependency following is made easier. > > > > Finally configure for hsh works. > > > > But then > > > > thartman@linodehaskell:~/haskellinstalls/hsh>sudo runghc Setup.lhs install > > Setup.lhs: Warning: The field "hs-source-dir" is deprecated, please > > use hs-source-dirs. > > Installing: /usr/local/lib/HSH-1.2.1/ghc-6.6 & /usr/local/bin HSH-1.2.1... > > Setup.lhs: Error: Could not find module: HSH with any suffix: ["hi"] > > > > So, I seem to be stuck at this point. > > > > 2007/4/2, Thomas Hartman : > > > Well, I guess I spoke to soon. After building ghc6 from feisty as > > > described above, I tried building missingh and have basically what I > > > started with. > > > > > > Is there something I can tweak to get the above straightened out using > > > those nice deb packages, or do I have to do all the dependency chasing > > > involved with building from source? Or is there another way? > > > > > > If this is too debian oriented please yell at me and I will ask about > > > this on a deb/ubuntu forum. > > > > > > thanks... > > > > > > Note, should have mentioned, after doing as my above post describes, I > > > installed all the newly generated deb packages with > > > > > > dpkg -i *.deb > > > > > > **************** > > > > > > thartman@linodewhyou:~/haskellInstalls/missingh>runghc Setup.hs configure > > > Configuring MissingH-0.18.3... > > > configure: /usr/lib/ghc-6.6/bin/ghc-pkg > > > configure: Dependency unix-any: using unix-1.0 > > > Setup.hs: cannot satisfy dependency network-any > > > > > > thartman@linodewhyou:~/haskellInstalls/missingh>which runghc > > > /usr/lib/ghc-6.6/bin/runghc > > > > > > # note, definitely the thing I installed today: > > > thartman@linodewhyou:~/haskellInstalls/missingh>ls -l `which runghc` > > > -rwxr-xr-x 1 root root 300716 Apr 2 09:17 /usr/lib/ghc-6.6/bin/runghc > > > thartman@linodewhyou:~/haskellInstalls/missingh> > > > > > > # and I installed it from deb ghc6, dpkg recognizes it > > > > > > thartman@linodewhyou:~/haskellInstalls/missingh>dpkg -S > > > /usr/lib/ghc-6.6/bin/runghc > > > ghc6: /usr/lib/ghc-6.6/bin/runghc > > > > > > # it does seem like ghc6 comes with a network package > > > thartman@linodewhyou:~/learning/haskell>apt-cache showpkg ghc6 | grep -i network > > > 6.4.1-2ubuntu2 - libghc6-readline-dev libghc6-stm-dev libghc6-hgl-dev > > > libghc6-x11-dev libghc6-fgl-dev libghc6-mtl-dev libghc6-hunit-dev > > > libghc6-quickcheck-dev libghc6-network-dev libghc6-haskell-src-dev > > > libghc6-parsec-dev libghc6-cabal-dev libghc6-unix-dev > > > libghc6-template-haskell-dev libghc6-haskell98-dev libghc6-base-dev > > > libghc6-rts-dev ghc haskell-compiler > > > > > > # I get lost here. Do I have libghc6-network-dev, or don't I? > > > > > > thartman@linodewhyou:~/haskellInstalls/missingh>sudo apt-get install > > > libghc6-network-dev > > > Reading package lists... Done > > > Building dependency tree... Done > > > Note, selecting ghc6 instead of libghc6-network-dev > > > ghc6 is already the newest version. > > > You might want to run `apt-get -f install' to correct these: > > > The following packages have unmet dependencies: > > > hat-ghc6: Depends: ghc6 (< 6.4.1+) but 6.6-3 is to be installed > > > libghc6-cabal-dev: Depends: ghc6 (< 6.4.2) but 6.6-3 is to be installed > > > E: Unmet dependencies. Try 'apt-get -f install' with no packages (or > > > specify a solution). > > > > > > > > > > > > > > > > > > > > > 2007/4/2, Thomas Hartman : > > > > > As you have built ghc6.6 from sources I think that you also need to build > > > > > all haskell libs from sources. So, do > > > > > > > > I did this, and got the feeling this would probably work, but is a > > > > real sad world of dependency chasing with no (clear) end in sight. > > > > > > > > So I investigated your second suggestion > > > > > > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > > > > > which to me seems much preferrable. > > > > > > > > http://old.pupeno.com/blog/unstable-packages-on-ubuntu/ > > > > > > > > Was indispensible in helping me figure out how to do this. > > > > > > > > To give some details on this (which is really more apt packaging know > > > > how than haskell but whatever), I did something like > > > > > > > > 1) change /etc/apt/sources.list to add > > > > > > > > deb-src http://archive.ubuntu.com/ubuntu/ feisty main restricted > > > > universe multiverse > > > > > > > > note, only add deb-src line here, not deb line, see article above for why. > > > > > > > > sudo aptitude install fakeroot (needed utility) > > > > fakeroot apt-get source --build ghc6 > > > > -- complains, some dependencies are missing > > > > > > > > sudo aptitude install ..... > > > > install packages with above command, not from source. it's my first > > > > time using the aptitude command, I wonder if this does the same thing > > > > as apt-get install, which is what I usually do. Whatever the case... > > > > > > > > fakeroot apt-get source --build ghc6 > > > > > > > > works :) > > > > > > > > 2007/3/21, Max Vasin : > > > > > >>>>> "Thomas" == Thomas Hartman writes: > > > > > > > > > > Thomas> Furthermore (as the above messages suggest and locate confirms), I > > > > > Thomas> seem to have mtl already > > > > > > > > > > Thomas> I took a wild guess and tried specifying this with ghc -i > > > > > > > > > > Thomas> like > > > > > > > > > > Thomas> sudo runghc -i/usr/lib/ghc6-mtl-dev Setup.lhs configure > > > > > Thomas> and sudo runghc -i/usr/lib/ Setup.lhs configure > > > > > > > > > > Thomas> but no dice. > > > > > > > > > > Thomas> *************** > > > > > > > > > > Thomas> thartman@linodewhyou:~/haskellInstalls/hsh$ locate libghc6-mtl-dev > > > > > Thomas> /home/thartman/libghc6-mtl-dev_1.0-3_i386.deb > > > > > Thomas> /usr/lib/libghc6-mtl-dev > > > > > Thomas> /usr/lib/libghc6-mtl-dev/register.sh > > > > > Thomas> /usr/lib/libghc6-mtl-dev/unregister.sh > > > > > Thomas> /usr/share/doc/libghc6-mtl-dev > > > > > Thomas> /usr/share/doc/libghc6-mtl-dev/changelog.Debian.gz > > > > > Thomas> /usr/share/doc/libghc6-mtl-dev/copyright > > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.list > > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.md5sums > > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.postinst > > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.prerm > > > > > > > > > > As you have built ghc6.6 from sources I think that you also need to build > > > > > all haskell libs from sources. So, do > > > > > > > > > > $ apt-get source libghc6-mtl-dev > > > > > $ cd > > > > > $ runhaskell Setup.lhs configure > > > > > $ runhaskell Setup.lhs build > > > > > $ sudo runhaskell Setup.lhs install > > > > > > > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > > > > > > > -- > > > > > WBR, > > > > > Max Vasin. > > > > > > > > > > _______________________________________________ > > > > > Haskell-Cafe mailing list > > > > > Haskell-Cafe@haskell.org > > > > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > > > > > > > > > > From tphyahoo at gmail.com Tue Apr 3 10:29:45 2007 From: tphyahoo at gmail.com (Thomas Hartman) Date: Tue Apr 3 10:28:38 2007 Subject: [Haskell-cafe] Re: was Re: ANN: HSH 1.2.0 In-Reply-To: <910ddf450704030725k13c6fce9tcfa61739af2a176e@mail.gmail.com> References: <910ddf450704030559k709bc344p130c543398dfebed@mail.gmail.com> <910ddf450704030611j583e102ej2b14074400547e6@mail.gmail.com> <910ddf450704030725k13c6fce9tcfa61739af2a176e@mail.gmail.com> Message-ID: <910ddf450704030729t6e9058e5rd96b150b59ea9771@mail.gmail.com> never mind. Prelude HSH> run $ ("ls", ["."]) :: IO String "COPYING\nCOPYRIGHT\nHSH\nHSH.cabal\nHSH.hi\nHSH.hs\nHSH.o\nINSTALL\nMakefile\nSetup.hi\nSetup.lhs\nSetup.o\n_darcs\ndebian\ndist\nsetup\ntest.hs\ntest2.hs\ntestsrc\n" I guess I got it installed. Only thing is you (jgoerzen) might want to change http://changelog.complete.org/posts/492-Announcing-HSH,-the-Haskell-Shell.html to include the type example, or explain why sometimes you need it sometimes no. (I'm guessing this just has to do with which version of the module you're using.) Finally looking forward to playing with my new toy :) 2007/4/3, Thomas Hartman : > actually, maybe I'm more okay than I thought. > > I originally did this without reading the INSTALL file, and built > using the process I have gotten used to: runghc Setup.hs configure; > runghc Setup.hs build; runghc Setup.hs install. > > But when I followed the directions in the INSTALL file ... > > make setup > > Now: > > ./setup configure > ./setup build > ./setup install > > ... it seemed to work without that error message. > > So far so good! > > I was also able to do > > thartman@linodehaskell:~/haskellinstalls/hsh> ghci HSH > ___ ___ _ > / _ \ /\ /\/ __(_) > / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. > / /_\\/ __ / /___| | http://www.haskell.org/ghc/ > \____/\/ /_/\____/|_| Type :? for help. > > Loading package base ... linking ... done. > Ok, modules loaded: HSH, HSH.Command, HSH.ShellEquivs. > Prelude HSH> > > however, when I tried copying a simple example from > > http://changelog.complete.org/posts/492-Announcing-HSH,-the-Haskell-Shell.html > > I got errors > > thartman@linodehaskell:~/haskellinstalls/hsh>ghci -fglasgow-exts HSH > ___ ___ _ > / _ \ /\ /\/ __(_) > / /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98. > / /_\\/ __ / /___| | http://www.haskell.org/ghc/ > \____/\/ /_/\____/|_| Type :? for help. > > Loading package base ... linking ... done. > Ok, modules loaded: HSH, HSH.Command, HSH.ShellEquivs. > Prelude HSH> run $ ("ls", ["."]) > > :1:0: > Ambiguous type variable `a' in the constraint: > `RunResult a' arising from use of `run' at :1:0-2 > Probable fix: add a type signature that fixes these type variable(s) > Prelude HSH> > > So, that's where I'm at now. > > 2007/4/3, Thomas Hartman : > > That was a pretty badly titled top thead, which I regret -- probably > > should have been something like "figuring out how to track down and > > install packages in haskell, using ubuntu /deb-- was Ann:: HSH". > > > > To give additional context, this started out as > > > > http://groups.google.de/group/fa.haskell/browse_thread/thread/ca37248eae7a065f/d039de2f9bf6e848?lnk=st&q=hsh+tphyahoo&rnum=1&hl=en#d039de2f9bf6e848 > > > > Sorry about the bad title. > > > > Still hoping to get hsh working, though for me this has more morphed > > into learning about package and dependency chasing in a haskell/deb > > context. > > > > > > 2007/4/3, Thomas Hartman : > > > I'm still trying to figure out how to do this on ubuntu. If this winds > > > up being a garden path I'll try on debian next, but at least I'm > > > learning a lot about getting haskell stuff built. > > > > > > Anyway, since I'm on a virtualized linux box, I decided to get a fresh > > > start, unmounted my original OS profile and installed a fresh dapper > > > 6. > > > > > > I then changed /etc/apt/sources.list to be okay for grabbing .debs > > > from feisty. (No longer doing the build from source thing.) > > > > > > apt-get install ghc6, ok from feisty. > > > (Is there another repo that gets all the extra libs at one go?) > > > > > > sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i missing > > > > > > libghc6-hdbc-missingh-dev - Integration of HDBC with MissingH, GHC version > > > libghc6-missingh-dev - Library of utility functions for Haskell, GHC6 package > > > thartman@linodehaskell:~/haskellinstalls/hsh>sudo apt-cache search -o > > > > > > hoorah, my apt cache search command seems ok. > > > > > > > > > sudo apt-cache search -o APT::Cache-Limit=25165824 ghc6 | grep -i hsh > > > thartman@linodehaskell:~/haskellinstalls/hsh> > > > > > > too bad, still no hsh in ubuntu repo. > > > > > > darcs get http://darcs.complete.org/hsh/ > > > (Or should I have used something else?) > > > > > > runghc Setup.hs configure > > > same problems as before. > > > > > > But starting afresh seems to have detangled the issues I was having > > > with packaging confusion. At least now I can apt-get install missingh > > > > > > And some other dependency following is made easier. > > > > > > Finally configure for hsh works. > > > > > > But then > > > > > > thartman@linodehaskell:~/haskellinstalls/hsh>sudo runghc Setup.lhs install > > > Setup.lhs: Warning: The field "hs-source-dir" is deprecated, please > > > use hs-source-dirs. > > > Installing: /usr/local/lib/HSH-1.2.1/ghc-6.6 & /usr/local/bin HSH-1.2.1... > > > Setup.lhs: Error: Could not find module: HSH with any suffix: ["hi"] > > > > > > So, I seem to be stuck at this point. > > > > > > 2007/4/2, Thomas Hartman : > > > > Well, I guess I spoke to soon. After building ghc6 from feisty as > > > > described above, I tried building missingh and have basically what I > > > > started with. > > > > > > > > Is there something I can tweak to get the above straightened out using > > > > those nice deb packages, or do I have to do all the dependency chasing > > > > involved with building from source? Or is there another way? > > > > > > > > If this is too debian oriented please yell at me and I will ask about > > > > this on a deb/ubuntu forum. > > > > > > > > thanks... > > > > > > > > Note, should have mentioned, after doing as my above post describes, I > > > > installed all the newly generated deb packages with > > > > > > > > dpkg -i *.deb > > > > > > > > **************** > > > > > > > > thartman@linodewhyou:~/haskellInstalls/missingh>runghc Setup.hs configure > > > > Configuring MissingH-0.18.3... > > > > configure: /usr/lib/ghc-6.6/bin/ghc-pkg > > > > configure: Dependency unix-any: using unix-1.0 > > > > Setup.hs: cannot satisfy dependency network-any > > > > > > > > thartman@linodewhyou:~/haskellInstalls/missingh>which runghc > > > > /usr/lib/ghc-6.6/bin/runghc > > > > > > > > # note, definitely the thing I installed today: > > > > thartman@linodewhyou:~/haskellInstalls/missingh>ls -l `which runghc` > > > > -rwxr-xr-x 1 root root 300716 Apr 2 09:17 /usr/lib/ghc-6.6/bin/runghc > > > > thartman@linodewhyou:~/haskellInstalls/missingh> > > > > > > > > # and I installed it from deb ghc6, dpkg recognizes it > > > > > > > > thartman@linodewhyou:~/haskellInstalls/missingh>dpkg -S > > > > /usr/lib/ghc-6.6/bin/runghc > > > > ghc6: /usr/lib/ghc-6.6/bin/runghc > > > > > > > > # it does seem like ghc6 comes with a network package > > > > thartman@linodewhyou:~/learning/haskell>apt-cache showpkg ghc6 | grep -i network > > > > 6.4.1-2ubuntu2 - libghc6-readline-dev libghc6-stm-dev libghc6-hgl-dev > > > > libghc6-x11-dev libghc6-fgl-dev libghc6-mtl-dev libghc6-hunit-dev > > > > libghc6-quickcheck-dev libghc6-network-dev libghc6-haskell-src-dev > > > > libghc6-parsec-dev libghc6-cabal-dev libghc6-unix-dev > > > > libghc6-template-haskell-dev libghc6-haskell98-dev libghc6-base-dev > > > > libghc6-rts-dev ghc haskell-compiler > > > > > > > > # I get lost here. Do I have libghc6-network-dev, or don't I? > > > > > > > > thartman@linodewhyou:~/haskellInstalls/missingh>sudo apt-get install > > > > libghc6-network-dev > > > > Reading package lists... Done > > > > Building dependency tree... Done > > > > Note, selecting ghc6 instead of libghc6-network-dev > > > > ghc6 is already the newest version. > > > > You might want to run `apt-get -f install' to correct these: > > > > The following packages have unmet dependencies: > > > > hat-ghc6: Depends: ghc6 (< 6.4.1+) but 6.6-3 is to be installed > > > > libghc6-cabal-dev: Depends: ghc6 (< 6.4.2) but 6.6-3 is to be installed > > > > E: Unmet dependencies. Try 'apt-get -f install' with no packages (or > > > > specify a solution). > > > > > > > > > > > > > > > > > > > > > > > > > > > > 2007/4/2, Thomas Hartman : > > > > > > As you have built ghc6.6 from sources I think that you also need to build > > > > > > all haskell libs from sources. So, do > > > > > > > > > > I did this, and got the feeling this would probably work, but is a > > > > > real sad world of dependency chasing with no (clear) end in sight. > > > > > > > > > > So I investigated your second suggestion > > > > > > > > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > > > > > > > which to me seems much preferrable. > > > > > > > > > > http://old.pupeno.com/blog/unstable-packages-on-ubuntu/ > > > > > > > > > > Was indispensible in helping me figure out how to do this. > > > > > > > > > > To give some details on this (which is really more apt packaging know > > > > > how than haskell but whatever), I did something like > > > > > > > > > > 1) change /etc/apt/sources.list to add > > > > > > > > > > deb-src http://archive.ubuntu.com/ubuntu/ feisty main restricted > > > > > universe multiverse > > > > > > > > > > note, only add deb-src line here, not deb line, see article above for why. > > > > > > > > > > sudo aptitude install fakeroot (needed utility) > > > > > fakeroot apt-get source --build ghc6 > > > > > -- complains, some dependencies are missing > > > > > > > > > > sudo aptitude install ..... > > > > > install packages with above command, not from source. it's my first > > > > > time using the aptitude command, I wonder if this does the same thing > > > > > as apt-get install, which is what I usually do. Whatever the case... > > > > > > > > > > fakeroot apt-get source --build ghc6 > > > > > > > > > > works :) > > > > > > > > > > 2007/3/21, Max Vasin : > > > > > > >>>>> "Thomas" == Thomas Hartman writes: > > > > > > > > > > > > Thomas> Furthermore (as the above messages suggest and locate confirms), I > > > > > > Thomas> seem to have mtl already > > > > > > > > > > > > Thomas> I took a wild guess and tried specifying this with ghc -i > > > > > > > > > > > > Thomas> like > > > > > > > > > > > > Thomas> sudo runghc -i/usr/lib/ghc6-mtl-dev Setup.lhs configure > > > > > > Thomas> and sudo runghc -i/usr/lib/ Setup.lhs configure > > > > > > > > > > > > Thomas> but no dice. > > > > > > > > > > > > Thomas> *************** > > > > > > > > > > > > Thomas> thartman@linodewhyou:~/haskellInstalls/hsh$ locate libghc6-mtl-dev > > > > > > Thomas> /home/thartman/libghc6-mtl-dev_1.0-3_i386.deb > > > > > > Thomas> /usr/lib/libghc6-mtl-dev > > > > > > Thomas> /usr/lib/libghc6-mtl-dev/register.sh > > > > > > Thomas> /usr/lib/libghc6-mtl-dev/unregister.sh > > > > > > Thomas> /usr/share/doc/libghc6-mtl-dev > > > > > > Thomas> /usr/share/doc/libghc6-mtl-dev/changelog.Debian.gz > > > > > > Thomas> /usr/share/doc/libghc6-mtl-dev/copyright > > > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.list > > > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.md5sums > > > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.postinst > > > > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.prerm > > > > > > > > > > > > As you have built ghc6.6 from sources I think that you also need to build > > > > > > all haskell libs from sources. So, do > > > > > > > > > > > > $ apt-get source libghc6-mtl-dev > > > > > > $ cd > > > > > > $ runhaskell Setup.lhs configure > > > > > > $ runhaskell Setup.lhs build > > > > > > $ sudo runhaskell Setup.lhs install > > > > > > > > > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > > > > > > > > > -- > > > > > > WBR, > > > > > > Max Vasin. > > > > > > > > > > > > _______________________________________________ > > > > > > Haskell-Cafe mailing list > > > > > > Haskell-Cafe@haskell.org > > > > > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > > > > > > > > > > > > > > > > From tphyahoo at gmail.com Tue Apr 3 10:30:44 2007 From: tphyahoo at gmail.com (Thomas Hartman) Date: Tue Apr 3 10:29:48 2007 Subject: [Haskell-cafe] Re: ANN: HSH 1.2.0 In-Reply-To: <910ddf450704020727i2b8d137h2850da4dab6e9780@mail.gmail.com> References: <20070313185028.GB7533@heave.ugcs.caltech.edu> <910ddf450703210107o74aeea41j6090df38b6bf8d2b@mail.gmail.com> <910ddf450703210107u2ed82beer992bcc189b992d88@mail.gmail.com> <910ddf450703210122r26738eecu4dd79a8caffac38a@mail.gmail.com> <910ddf450703210141x541f8ed2i889d14b62eef6c53@mail.gmail.com> <87aby6g6id.fsf@smtp.gmail.com> <910ddf450704020635o5d07ff5pfa89df0028b22134@mail.gmail.com> <910ddf450704020727i2b8d137h2850da4dab6e9780@mail.gmail.com> Message-ID: <910ddf450704030730j6b533c60i6ced40019fd4e637@mail.gmail.com> resolved issue at http://groups.google.de/group/fa.haskell/browse_thread/thread/ceabae2c3fdc8abc/5ab21d4ae2a9b1fc?lnk=st&q=hsh++tphyahoo&rnum=5&hl=en#5ab21d4ae2a9b1fc 2007/4/2, Thomas Hartman : > Well, I guess I spoke to soon. After building ghc6 from feisty as > described above, I tried building missingh and have basically what I > started with. > > Is there something I can tweak to get the above straightened out using > those nice deb packages, or do I have to do all the dependency chasing > involved with building from source? Or is there another way? > > If this is too debian oriented please yell at me and I will ask about > this on a deb/ubuntu forum. > > thanks... > > Note, should have mentioned, after doing as my above post describes, I > installed all the newly generated deb packages with > > dpkg -i *.deb > > **************** > > thartman@linodewhyou:~/haskellInstalls/missingh>runghc Setup.hs configure > Configuring MissingH-0.18.3... > configure: /usr/lib/ghc-6.6/bin/ghc-pkg > configure: Dependency unix-any: using unix-1.0 > Setup.hs: cannot satisfy dependency network-any > > thartman@linodewhyou:~/haskellInstalls/missingh>which runghc > /usr/lib/ghc-6.6/bin/runghc > > # note, definitely the thing I installed today: > thartman@linodewhyou:~/haskellInstalls/missingh>ls -l `which runghc` > -rwxr-xr-x 1 root root 300716 Apr 2 09:17 /usr/lib/ghc-6.6/bin/runghc > thartman@linodewhyou:~/haskellInstalls/missingh> > > # and I installed it from deb ghc6, dpkg recognizes it > > thartman@linodewhyou:~/haskellInstalls/missingh>dpkg -S > /usr/lib/ghc-6.6/bin/runghc > ghc6: /usr/lib/ghc-6.6/bin/runghc > > # it does seem like ghc6 comes with a network package > thartman@linodewhyou:~/learning/haskell>apt-cache showpkg ghc6 | grep -i network > 6.4.1-2ubuntu2 - libghc6-readline-dev libghc6-stm-dev libghc6-hgl-dev > libghc6-x11-dev libghc6-fgl-dev libghc6-mtl-dev libghc6-hunit-dev > libghc6-quickcheck-dev libghc6-network-dev libghc6-haskell-src-dev > libghc6-parsec-dev libghc6-cabal-dev libghc6-unix-dev > libghc6-template-haskell-dev libghc6-haskell98-dev libghc6-base-dev > libghc6-rts-dev ghc haskell-compiler > > # I get lost here. Do I have libghc6-network-dev, or don't I? > > thartman@linodewhyou:~/haskellInstalls/missingh>sudo apt-get install > libghc6-network-dev > Reading package lists... Done > Building dependency tree... Done > Note, selecting ghc6 instead of libghc6-network-dev > ghc6 is already the newest version. > You might want to run `apt-get -f install' to correct these: > The following packages have unmet dependencies: > hat-ghc6: Depends: ghc6 (< 6.4.1+) but 6.6-3 is to be installed > libghc6-cabal-dev: Depends: ghc6 (< 6.4.2) but 6.6-3 is to be installed > E: Unmet dependencies. Try 'apt-get -f install' with no packages (or > specify a solution). > > > > > > > 2007/4/2, Thomas Hartman : > > > As you have built ghc6.6 from sources I think that you also need to build > > > all haskell libs from sources. So, do > > > > I did this, and got the feeling this would probably work, but is a > > real sad world of dependency chasing with no (clear) end in sight. > > > > So I investigated your second suggestion > > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > which to me seems much preferrable. > > > > http://old.pupeno.com/blog/unstable-packages-on-ubuntu/ > > > > Was indispensible in helping me figure out how to do this. > > > > To give some details on this (which is really more apt packaging know > > how than haskell but whatever), I did something like > > > > 1) change /etc/apt/sources.list to add > > > > deb-src http://archive.ubuntu.com/ubuntu/ feisty main restricted > > universe multiverse > > > > note, only add deb-src line here, not deb line, see article above for why. > > > > sudo aptitude install fakeroot (needed utility) > > fakeroot apt-get source --build ghc6 > > -- complains, some dependencies are missing > > > > sudo aptitude install ..... > > install packages with above command, not from source. it's my first > > time using the aptitude command, I wonder if this does the same thing > > as apt-get install, which is what I usually do. Whatever the case... > > > > fakeroot apt-get source --build ghc6 > > > > works :) > > > > 2007/3/21, Max Vasin : > > > >>>>> "Thomas" == Thomas Hartman writes: > > > > > > Thomas> Furthermore (as the above messages suggest and locate confirms), I > > > Thomas> seem to have mtl already > > > > > > Thomas> I took a wild guess and tried specifying this with ghc -i > > > > > > Thomas> like > > > > > > Thomas> sudo runghc -i/usr/lib/ghc6-mtl-dev Setup.lhs configure > > > Thomas> and sudo runghc -i/usr/lib/ Setup.lhs configure > > > > > > Thomas> but no dice. > > > > > > Thomas> *************** > > > > > > Thomas> thartman@linodewhyou:~/haskellInstalls/hsh$ locate libghc6-mtl-dev > > > Thomas> /home/thartman/libghc6-mtl-dev_1.0-3_i386.deb > > > Thomas> /usr/lib/libghc6-mtl-dev > > > Thomas> /usr/lib/libghc6-mtl-dev/register.sh > > > Thomas> /usr/lib/libghc6-mtl-dev/unregister.sh > > > Thomas> /usr/share/doc/libghc6-mtl-dev > > > Thomas> /usr/share/doc/libghc6-mtl-dev/changelog.Debian.gz > > > Thomas> /usr/share/doc/libghc6-mtl-dev/copyright > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.list > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.md5sums > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.postinst > > > Thomas> /var/lib/dpkg/info/libghc6-mtl-dev.prerm > > > > > > As you have built ghc6.6 from sources I think that you also need to build > > > all haskell libs from sources. So, do > > > > > > $ apt-get source libghc6-mtl-dev > > > $ cd > > > $ runhaskell Setup.lhs configure > > > $ runhaskell Setup.lhs build > > > $ sudo runhaskell Setup.lhs install > > > > > > Another way is to take ghc6 and all haskell libs from fiesty. > > > > > > -- > > > WBR, > > > Max Vasin. > > > > > > _______________________________________________ > > > Haskell-Cafe mailing list > > > Haskell-Cafe@haskell.org > > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > From jason.morton at gmail.com Tue Apr 3 10:43:54 2007 From: jason.morton at gmail.com (Jason Morton) Date: Tue Apr 3 10:42:49 2007 Subject: [Haskell-cafe] Mathematics in Haskell Re: Why the Prelude must die In-Reply-To: References: <20070324024812.GA3712@localhost.localdomain> <005501c76e83$4403a850$6601a8c0@box> <46067F44.2010404@mcmaster.ca> <00ca01c76ef2$d4a6a320$32377ad5@cr3lt> <46069EEE.70500@mcmaster.ca> <9795282.post@talk.nabble.com> Message-ID: <5c007f070704030743o5d945e09h2b20047c95bd6843@mail.gmail.com> NumericPrelude does seem like a good starting point for discussion and addition. Is it still being actively developed, and what are the goals there? On 4/3/07, Henning Thielemann wrote: > > On Mon, 2 Apr 2007, jasonm wrote: > > > Jacques Carette wrote: > > > > > >> perhaps i was mistaken in thinking that there is a group of > > >> math-interested > > >> haskellers out there discussing, developing, and documenting the area? or > > >> perhaps that group needs introductory tutorials presenting its work? > > > My guess is that there are a number of people "waiting in the wings", > > > waiting for a critical mass of features to show up before really diving > > > in. See > > > http://www.cas.mcmaster.ca/plmms07/ > > > for my reasons for being both interested and wary). > > > > > > Probably the simplest test case is the difficulties that people are > > > (still) encountering doing matrix/vector algebra in Haskell. One either > > > quickly encounters efficiency issues (although PArr might help), or > > > typing issues (though many tricks are known, but not necessarily > > > simple). Blitz++ and the STL contributed heavily to C++ being taken > > > seriously by people in the scientific computation community. Haskell > > > has even more _potential_, but it is definitely unrealised potential. > > > > I am one of those mathematicians "waiting in the wings." Haskell looked > > very appealing at first, and the type system seems perfect, especially for > > things like multilinear algebra where currying and duality is fundamental. > > I too was put off by the Num issues though--strange mixture of sophisticated > > category theory and lack of a sensible hierarchy of algebraic objects. > > > > However, I've decided I'm more interested in helping to fix it than wait; > > so count me in on an effort to make Haskell more mathematical. For me that > > probably starts with the semigroup/group/ring setup, and good > > arbitrary-precision as well as approximate linear algebra support. > > NumericPrelude popped up in this thread earlier. Is this the starting > point you are after? > http://darcs.haskell.org/numericprelude/ > From lemming at henning-thielemann.de Tue Apr 3 10:46:28 2007 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Tue Apr 3 10:46:14 2007 Subject: [Haskell-cafe] Mathematics in Haskell Re: Why the Prelude must die In-Reply-To: <5c007f070704030743o5d945e09h2b20047c95bd6843@mail.gmail.com> References: <20070324024812.GA3712@localhost.localdomain> <005501c76e83$4403a850$6601a8c0@box> <46067F44.2010404@mcmaster.ca> <00ca01c76ef2$d4a6a320$32377ad5@cr3lt> <46069EEE.70500@mcmaster.ca> <9795282.post@talk.nabble.com> <5c007f070704030743o5d945e09h2b20047c95bd6843@mail.gmail.com> Message-ID: On Tue, 3 Apr 2007, Jason Morton wrote: > NumericPrelude does seem like a good starting point for discussion and > addition. Is it still being actively developed, slowly but actively > and what are the goals there? A more sophisticated numeric type class hierarchy. However it contains also some algorithms, because we have to test if the hierarchy indeed works. From joelr1 at gmail.com Tue Apr 3 11:01:56 2007 From: joelr1 at gmail.com (Joel Reymont) Date: Tue Apr 3 11:00:49 2007 Subject: [Haskell-cafe] SmallCheck and parser testing Message-ID: Folks, I'm trying to figure out how to test a Parsec-based parser with Smallcheck [1]. My test AST is below and the goal is to return StyleValue if the parser is fed an integer, or return Solid when parsing "Solid", etc. data Style = StyleValue Expr | Solid | Dashed | Dotted | Dashed2 | Dashed3 deriving Show I figure that the following is needed somehow: instance Serial Style where series = cons1 StyleValue . depth 0 \/ cons0 Solid \/ cons0 Dashed \/ cons0 Dashed2 \/ cons0 Dashed3 \/ cons0 Dotted My parser is 'style', so I would be passing it as p below run p input = case (parse p "" input) of Left err -> do { putStr "parse error at " ; print err } Right x -> x How do I go from here to making sure my parser is valid? I thought of the following property (thanks sjanssen) prop_parse p s = show (run p s) == s but I don't know how to proceed from here. Thanks, Joel [1] http://www.cs.york.ac.uk/fp/darcs/smallcheck/ -- http://wagerlabs.com/ From simonpj at microsoft.com Tue Apr 3 12:33:03 2007 From: simonpj at microsoft.com (Simon Peyton-Jones) Date: Tue Apr 3 12:31:56 2007 Subject: [Haskell-cafe] RE: A question about functional dependencies and existential quantification In-Reply-To: <20070327062128.9760AAD35@Adric.metnet.fnmoc.navy.mil> References: <20070327062128.9760AAD35@Adric.metnet.fnmoc.navy.mil> Message-ID: | > > class T root pos sel | pos -> root, root -> sel where | > > f :: pos -> sel -> Bool | > > | > > instance T root (Any root) sel where | > > f (ANY p) s = f p s ... | That is not surprising. What is surprising is why GHC 6.6 accepts such | an instance? Well, it shouldn't. As the user manual says, the flag -fallow-undecidable-instances lifts *both* the Paterson Conditions *and* the Coverage condition. I stupidly forgot that the Coverage Condition is needed both to help guarantee termination, and to help guarantee confluence (as our own paper says!). Losing the latter is more serious, and should not be an effect of -fallow-undecidable-instances. This is the same issue as http://hackage.haskell.org/trac/ghc/ticket/1241 What to do? - Never lift the Coverage Condition - Give it a flag all to itself -fno-coverage-condition - Combine it with -fallow-incoherent-instances More work is - Implement some of the more liberal coverage conditions described in the paper Simon From sjanssen at cse.unl.edu Tue Apr 3 12:43:53 2007 From: sjanssen at cse.unl.edu (Spencer Janssen) Date: Tue Apr 3 12:43:36 2007 Subject: [Haskell-cafe] SmallCheck and parser testing In-Reply-To: References: Message-ID: <20070403114353.7763cd37@localhost> On Tue, 3 Apr 2007 16:01:56 +0100 Joel Reymont wrote: > Folks, > > I'm trying to figure out how to test a Parsec-based parser with > Smallcheck [1]. My test AST is below and the goal is to return > StyleValue if the parser is fed an integer, or return > Solid when parsing "Solid", etc. > > data Style > = StyleValue Expr > | Solid > | Dashed > | Dotted > | Dashed2 > | Dashed3 > deriving Show > > I figure that the following is needed somehow: > > instance Serial Style where > series = cons1 StyleValue . depth 0 > \/ cons0 Solid > \/ cons0 Dashed > \/ cons0 Dashed2 > \/ cons0 Dashed3 > \/ cons0 Dotted > > My parser is 'style', so I would be passing it as p below > > run p input = > case (parse p "" input) of > Left err -> do { putStr "parse error at " > ; print err > } > Right x -> x > > How do I go from here to making sure my parser is valid? There are several ways to check your parser. If you have a pretty printer, you can check that the parse of a pretty printed term is equal to the term itself. \begin{code} parseEq :: String -> Style -> Bool parseEq s t = case parse style "" s of Left err -> False Right x -> x == t prop_parsePretty t = parseEq (pretty t) t \end{code} You can also use a unit-testing style. Imagine you have a list of strings and the correct parse trees for each. You can then check that the parses match the expected results. \begin{code} knownParses :: [(String, Style)] knownParses = ??? prop_unitTest = all (uncurry parseEq) knownParses \end{code} Cheers, Spencer Janssen > I thought of the following property (thanks sjanssen) > > prop_parse p s = > show (run p s) == s > > > but I don't know how to proceed from here. > > Thanks, Joel > > [1] http://www.cs.york.ac.uk/fp/darcs/smallcheck/ > > -- > http://wagerlabs.com/ > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From paul at cogito.org.uk Tue Apr 3 13:38:36 2007 From: paul at cogito.org.uk (Paul Johnson) Date: Tue Apr 3 13:37:30 2007 Subject: [Haskell-cafe] SmallCheck and parser testing In-Reply-To: <20070403114353.7763cd37@localhost> References: <20070403114353.7763cd37@localhost> Message-ID: <4612911C.7080908@cogito.org.uk> On Tue, 3 Apr 2007 16:01:56 +0100 Joel Reymont wrote: > Folks, > > I'm trying to figure out how to test a Parsec-based parser with > Smallcheck [1]. My test AST is below and the goal is to return > StyleValue if the parser is fed an integer, or return > Solid when parsing "Solid", etc. > >> data Style >> = StyleValue Expr >> | Solid >> | Dashed >> | Dotted >> | Dashed2 >> | Dashed3 >> deriving Show I'd use QuickCheck rather than SmallCheck. First write Arbitrary instances for Style and Expr (plus obviously any other types used by Expr). Then write another generator that converts a Style to a string with random formatting (whitespace, comments etc). Then assert that the parse of the generated string is equal to the original value. You might also want to write another string generator that also inserts random syntax errors, so you can test for the correct detection of syntax errors. Paul. From sebell at gmail.com Tue Apr 3 17:54:27 2007 From: sebell at gmail.com (Scott Bell) Date: Tue Apr 3 17:53:22 2007 Subject: [Haskell-cafe] `Expect'-like lazy reading/Parsec matching on TCP sockets Message-ID: <215432060704031454s44775e46t7864c172f726ab82@mail.gmail.com> Hello all, I'm writing an application to interact with other applications remotely though TCP sockets (pr