Re: [Haskell-cafe] Adding gcc type options with cabal (e.g. -mno-cygwin)
On Feb 4, 2008 5:55 PM, Duncan Coutts [EMAIL PROTECTED] wrote: On Mon, 2008-02-04 at 17:18 -0500, bbrown wrote: Is there a way to pass misc options to the cabal, ghc process. I tried the following: extra-libraries: sqlite3 extra-lib-dirs: C:\cygwin\lib include-dirs:C:\cygwin\usr\include ghc-options: -mno-cygwin runhaskell Setup.lhs build --ghc-options=-mno-cygwin -v No dice, doesn't show up. Really? That's odd, works for me: $ runhaskell Setup.lhs build --ghc-options=-mno-cygwin -v ... [snip] ... ghc-6.8.2: unrecognised flags: -mno-cygwin Usage: For basic information, try the `--help' option. Also works with runhaskell Setup.lhs configure --ghc-options=-mno-cygwin Works in the sense that it passes the flag through to ghc. Of course I'm on unix and ghc does not recognise that flag. What version of Cabal are you using? Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe It looked like it passed the option, but didn't resolve the issue. Anyone seen that before? See error in previous post. -- Berlin Brown http://botspiritcompany.com/botlist/spring/help/about.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Enterprise Haskell AMQP library initial start and would like to pass it off to someone.
On Jan 27, 2008 3:06 AM, Don Stewart [EMAIL PROTECTED] wrote: berlin.brown: I started a AMQP library; there really isn't a lot there but at least I was able to connect to the server. Here is the code and hopefully someone else can continue with the project. The AMQP protocol is moderately complex. HTTP is simple and stuff like RMI, JMS, Database Protocols are really complicated. AMQP seems to be in the middle. There is a lot of documentation and at least two good implementations. The included java implementation and I used the python implementation as a guide. http://www.iona.com/opensource/amqp/ http://barryp.org/software/py-amqplib/ Here is my source (in subversion): http://openbotlist.googlecode.com/svn/trunk/botlistprojects/botspider/spider/lib/haskell/src/Data/AMQP/QueueClient.hs If were to make a suggestion; Barry's python code is really easy to follow. I would suggest using that as a guide. and if you are brave, you can really analyze the protocol and just go off the docs. Either way. My code got as far as connecting to the server, sending the protocol out and getting back an initial response. I didnt build a queue message (frame) or much else. -- Berlin Brown http://botspiritcompany.com/botlist/spring/help/about.html Thanks! Would you like this packaged up for hackage.haskell.org, so others can find and improve it? (or maybe move the repo to code.haskell.org?) Let me work on it a little more; probably will be more useful if it does basic queueing operations. -- Berlin Brown http://botspiritcompany.com/botlist/spring/help/about.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Enterprise Haskell AMQP library initial start and would like to pass it off to someone.
I started a AMQP library; there really isn't a lot there but at least I was able to connect to the server. Here is the code and hopefully someone else can continue with the project. The AMQP protocol is moderately complex. HTTP is simple and stuff like RMI, JMS, Database Protocols are really complicated. AMQP seems to be in the middle. There is a lot of documentation and at least two good implementations. The included java implementation and I used the python implementation as a guide. http://www.iona.com/opensource/amqp/ http://barryp.org/software/py-amqplib/ Here is my source (in subversion): http://openbotlist.googlecode.com/svn/trunk/botlistprojects/botspider/spider/lib/haskell/src/Data/AMQP/QueueClient.hs If were to make a suggestion; Barry's python code is really easy to follow. I would suggest using that as a guide. and if you are brave, you can really analyze the protocol and just go off the docs. Either way. My code got as far as connecting to the server, sending the protocol out and getting back an initial response. I didnt build a queue message (frame) or much else. -- Berlin Brown http://botspiritcompany.com/botlist/spring/help/about.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Scheme in Haskell, Parsec Example, how to add scheme comments
On Nov 18, 2007 8:01 PM, Thomas Schilling [EMAIL PROTECTED] wrote: On Sun, 2007-11-18 at 19:37 -0500, Berlin Brown wrote: On Nov 18, 2007 7:32 PM, Berlin Brown [EMAIL PROTECTED] wrote: I am sure many of you have looked at the scheme in haskell example that is on the web by Jonathan Tang. If you are familiar with the code, I need a little help trying to add scheme style comments: ; This is my comment The preferred way to do that is to use a token helper function: token :: P a - P a token p = do r - p whiteSpace return r -- or, if you add a Control.Applicative instance for your -- parser type, this is just: token p = p * whiteSpace Then you handle comments as whitespace: whiteSpace :: P () whiteSpace = skipMany $ spaces | (char ';' skipMany (satisfy (/='\n'))) Then you just use that like this: symbol :: P String symbol = token $ many1 $ satisfy $ not . (`elem` ()[]; ) See also Parsec's TokenParser. token :: Parser - Parser String token p = do r - p whiteSpace return $ String r I know I am being lazy, but what am I missing in your pseudo code: I tried playing with your example but kept getting these errors: Parsec3.hs:23:13: The last statement in a 'do' construct must be an expression at the token line. -- Berlin Brown http://botspiritcompany.com/botlist/spring/help/about.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Scheme in Haskell, Parsec Example, how to add scheme comments
I am sure many of you have looked at the scheme in haskell example that is on the web by Jonathan Tang. If you are familiar with the code, I need a little help trying to add scheme style comments: ; This is my comment I added this code here and I think it works (I replaced the name parseSpaces with his spaces function). But, if I start a line with a comment, it errors out with unbound variable. Anybody have any ideas? -- Added the ';' symbol :: Parser Char symbol = oneOf ;!$%|*+-/:=[EMAIL PROTECTED] -- -- Handle whitespace and comments parseSpaces :: Parser () parseSpaces = (try oneLineComment) | whiteSpace | return () where whiteSpace = do skipMany1 space parseSpaces oneLineComment = do { try (string ;) ; skipMany (satisfy (/= '\n')) ; parseSpaces } http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Scheme in Haskell, Parsec Example, how to add scheme comments
On Nov 18, 2007 7:32 PM, Berlin Brown [EMAIL PROTECTED] wrote: I am sure many of you have looked at the scheme in haskell example that is on the web by Jonathan Tang. If you are familiar with the code, I need a little help trying to add scheme style comments: ; This is my comment I added this code here and I think it works (I replaced the name parseSpaces with his spaces function). But, if I start a line with a comment, it errors out with unbound variable. Anybody have any ideas? -- Added the ';' symbol :: Parser Char symbol = oneOf ;!$%|*+-/:=[EMAIL PROTECTED] -- -- Handle whitespace and comments parseSpaces :: Parser () parseSpaces = (try oneLineComment) | whiteSpace | return () where whiteSpace = do skipMany1 space parseSpaces oneLineComment = do { try (string ;) ; skipMany (satisfy (/= '\n')) ; parseSpaces } http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html Sorry, I am using the full scheme parser in this example: http://halogen.note.amherst.edu/~jdtang/scheme_in_48/scheme_in_48.zip -- Berlin Brown http://botspiritcompany.com/botlist/spring/help/about.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] WideFinder
Sterling Clover wrote: Um... you do realize that the code is only supposed to match against very specific lines in sample data sets that Bray provides, right? If your access log doesn't have lines exactly like those (and why would it?) then there's no reason to expect a result. --S On Nov 9, 2007, at 11:19 PM, Berlin Brown wrote: Sterling Clover wrote: I hacked together a version that I'm pretty happy with today. Started off trying an algorithm with channels and forking, then realized that in Haskell thanks to referential transparency we can get parallelism almost for free, and redid it all in Control.Parallel (below). Unfortunately, I don't have a multicore processor so I can't put this through any special paces. However, its compactness and expressively match or beat the simple Ruby, etc. scripts while it gets (theoretically) most of the parallel benefits of the enormous and unwieldy Erlang and JOcaml ones. --S module Main where import qualified Data.ByteString.Lazy.Char8 as LB import Data.List (foldl', unfoldr, insertBy) import qualified Data.Map as M import System.Environment (getArgs) import Control.Parallel (par) import Control.Parallel.Strategies (parMap, rwhnf) count :: M.Map LB.ByteString Int - LB.ByteString - M.Map LB.ByteString Int count m line = if LB.pack /ongoing/When `LB.isPrefixOf` myLn then M.insertWith' (+) (LB.drop 14 myLn) 1 m else m where myLn = (LB.takeWhile (/=' ') . LB.dropWhile (/='/') . LB.dropWhile (/='\')) line mapUnionPar :: (Ord k, Num a) = [M.Map k a] - M.Map k a mapUnionPar m = head $ until (null . tail) mapUnionPar' m where a |:| b = par a . par b $ a : b mapUnionPar' (x:x':xs) = (M.unionWith (+) x x' |:| mapUnionPar' xs) mapUnionPar' x = x newPar :: FilePath - IO (M.Map LB.ByteString Int) newPar = ((mapUnionPar . parMap rwhnf (foldl' count M.empty) . chunkify . LB.lines) `fmap`) . LB.readFile where chunkify = unfoldr (\x - if null x then Nothing else Just (splitAt 512 x)) main = mapM_ ((print . fst . foldl' takeTop ([],[]) . M.toList =) . newPar) = getArgs where takeTop ac@(bs,low) a = if null low || (snd . head) low snd a then (splitAt 10 . insertBy ((. snd) . flip compare . snd) a) bs else ac On Nov 7, 2007, at 9:06 AM, Bayley, Alistair wrote: From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of manu Haskell is conspicuously absent from the languages used to tackle Tim Bray's Wide Finder problem (http://www.tbray.org/ongoing/When/200x/2007/10/30/WF-Results?updated). So far we have Ocaml, Erlang, Python, Ruby, etc... Tim Bray mentions that GHC won't build on Solaris, so presumably that problem would need to be solved before Haskell appears in his table. I see that there are Solaris binary packages: http://www.haskell.org/ghc/download_ghc_661.html#sparcsolaris so perhaps he just needs to be pointed to them? Alistair * Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. * ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe You didn't do a whole lot when I tried to run it. I know I am being mean, but that seems to be what Tim Bray is doing. He takes code and if it doesnt work, he isn't spending 3 weeks to figure it out. So, I would just like to comment. I ran your code against an access.log file and it gave me this: [] ./a.out access.log Which data set did you test it on? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] WideFinder
Sterling Clover wrote: I hacked together a version that I'm pretty happy with today. Started off trying an algorithm with channels and forking, then realized that in Haskell thanks to referential transparency we can get parallelism almost for free, and redid it all in Control.Parallel (below). Unfortunately, I don't have a multicore processor so I can't put this through any special paces. However, its compactness and expressively match or beat the simple Ruby, etc. scripts while it gets (theoretically) most of the parallel benefits of the enormous and unwieldy Erlang and JOcaml ones. --S module Main where import qualified Data.ByteString.Lazy.Char8 as LB import Data.List (foldl', unfoldr, insertBy) import qualified Data.Map as M import System.Environment (getArgs) import Control.Parallel (par) import Control.Parallel.Strategies (parMap, rwhnf) count :: M.Map LB.ByteString Int - LB.ByteString - M.Map LB.ByteString Int count m line = if LB.pack /ongoing/When `LB.isPrefixOf` myLn then M.insertWith' (+) (LB.drop 14 myLn) 1 m else m where myLn = (LB.takeWhile (/=' ') . LB.dropWhile (/='/') . LB.dropWhile (/='\')) line mapUnionPar :: (Ord k, Num a) = [M.Map k a] - M.Map k a mapUnionPar m = head $ until (null . tail) mapUnionPar' m where a |:| b = par a . par b $ a : b mapUnionPar' (x:x':xs) = (M.unionWith (+) x x' |:| mapUnionPar' xs) mapUnionPar' x = x newPar :: FilePath - IO (M.Map LB.ByteString Int) newPar = ((mapUnionPar . parMap rwhnf (foldl' count M.empty) . chunkify . LB.lines) `fmap`) . LB.readFile where chunkify = unfoldr (\x - if null x then Nothing else Just (splitAt 512 x)) main = mapM_ ((print . fst . foldl' takeTop ([],[]) . M.toList =) . newPar) = getArgs where takeTop ac@(bs,low) a = if null low || (snd . head) low snd a then (splitAt 10 . insertBy ((. snd) . flip compare . snd) a) bs else ac On Nov 7, 2007, at 9:06 AM, Bayley, Alistair wrote: From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of manu Haskell is conspicuously absent from the languages used to tackle Tim Bray's Wide Finder problem (http://www.tbray.org/ongoing/When/200x/2007/10/30/WF-Results?updated). So far we have Ocaml, Erlang, Python, Ruby, etc... Tim Bray mentions that GHC won't build on Solaris, so presumably that problem would need to be solved before Haskell appears in his table. I see that there are Solaris binary packages: http://www.haskell.org/ghc/download_ghc_661.html#sparcsolaris so perhaps he just needs to be pointed to them? Alistair * Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. * ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe You didn't do a whole lot when I tried to run it. I know I am being mean, but that seems to be what Tim Bray is doing. He takes code and if it doesnt work, he isn't spending 3 weeks to figure it out. So, I would just like to comment. I ran your code against an access.log file and it gave me this: [] ./a.out access.log ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Recipes for organizing HUnit tests
Isaac Dupree wrote: Mushfeq Khan wrote: I'm new to Haskell and am trying to find a good way to organize my HUnit tests. Having used some of the other XUnit frameworks, I tended towards trying to organize them all in a parallel test folder structure, but this seems to be a bad fit for Haskell, since the test modules cannot see the source modules unless they are either in the same folder or a folder above it. That's without modifying the module search path when I run the tests, which I would like to avoid. Well, it's certainly possible to use parallel directory structures -- this is one way to do it: Xyzzy/Gizmo.hs: module Xyzzy.Gizmo where ... Test/Gizmo.hs: module Test.Gizmo where import Xyzzy.Gizmo main = ... ghc --make -main-is Test.Gizmo.main Test/Gizmo.hs Or without -main-is, Tests.hs: module Main where import Test.Gizmo import Test.Bar ... main = testGizmo, testBar ... ghc --make Tests Isaac ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe I asked the same question a while back. Yea, you want the parallel directory structure and you use the -iMyPack -iHUnit option when compiling you haskell code. You can kind of see what I did with this project. I have HUnit source in one module and Tests in a different module, different directory. http://octanemech.googlecode.com/svn/trunk/octanemech/src/ http://octanemech.googlecode.com/svn/trunk/octanemech/src/Makefile ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe