Re: [Haskell-cafe] question about STM and IO
Stephan Friedrichs-2 wrote: it's unsafe to perform IO inside of a transaction as it can't be undone, when rolling it back. I guess, unsafeIOToSTM has been designed in order to allow us to inject debugging output into a transaction, but you really shouldn't use it to perform real IO (like writing files, etc.). Simon Peyton Jones provides a good example of this in http://research.microsoft.com/~simonpj/papers/stm/beautiful.pdf atomically (do { x - readTVar xv ; y - readTVar yv ; if xy then launchMissiles else return () }) where launchMissiles :: IO () causes serious international side-effects. ;-) -- Ricardo Guimarães Herrmann There are only two industries that refer to their customers as 'users' -- Edward Tufte -- View this message in context: http://www.nabble.com/question-about-STM-and-IO-tp15439579p15481669.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] FFI: foreign label declaration
Hi everyone, I'm trying to get HBDD compiled under GHC 6.8.1 and now I'm stuck with a .chs file which uses a foreign label syntax, which seems deprecated, since the parser can't even recognize it: foreign label bdd_reorder_stable_window3 bdd_reorder_stable_window3 :: FunPtr (BDDManager - IO ()) Is there new syntax for this ? Or is it a deprecated functionality ? Thanks in advance, -- Ricardo Guimarães Herrmann In a concurrent world, imperative is the wrong default! -- Tim Sweeney (Epic Games) -- View this message in context: http://www.nabble.com/FFI%3A-%22foreign-label%22-declaration-tp14279625p14279625.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] FFI: foreign label declaration
Malcolm Wallace wrote: Ricardo Herrmann [EMAIL PROTECTED] wrote: a .chs file which uses a foreign label syntax, which seems deprecated, since the parser can't even recognize it: foreign label bdd_reorder_stable_window3 bdd_reorder_stable_window3 :: FunPtr (BDDManager - IO ()) Is there new syntax for this ? Or is it a deprecated functionality ? I believe it is now foreign import with an ampersand in front of the name of the foreign entity, e.g. foreign import bdd_reorder_stable_window3 bdd_reorder_stable_window3 :: FunPtr (BDDManager - IO ()) Changing foreign label to foreign import ccall (with the ampersand) did the trick, thanks. PS: At least it compiled, but I still didn't check if it works ;-) -- View this message in context: http://www.nabble.com/FFI%3A-%22foreign-label%22-declaration-tp14279625p14281281.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Brazilian Haskellers ?
Hi brazilian haskellers, How about trying to form a HUG-BR ? Maybe even something along the lines of FringeDC (http://www.lisperati.com/fringedc.html). I only know about 4 people that would join the cause, that's why I'm recruiting ;-) Feel free to contact me (I'm posting this from the Nabble interface, so I'm not sure my e-mail will show up ... just in case: [EMAIL PROTECTED]) -- Ricardo Guimarães Herrmann In a concurrent world, imperative is the wrong default! -- Tim Sweeney (Epic Games) -- View this message in context: http://www.nabble.com/Brazilian-Haskellers---tf4806561.html#a13751455 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Brazilian Haskellers ?
Just created: http://groups.google.com/group/hug-br Ricardo Herrmann wrote: Hi brazilian haskellers, How about trying to form a HUG-BR ? Maybe even something along the lines of FringeDC (http://www.lisperati.com/fringedc.html). I only know about 4 people that would join the cause, that's why I'm recruiting ;-) Feel free to contact me (I'm posting this from the Nabble interface, so I'm not sure my e-mail will show up ... just in case: [EMAIL PROTECTED]) -- Ricardo Guimarães Herrmann In a concurrent world, imperative is the wrong default! -- Tim Sweeney (Epic Games) -- View this message in context: http://www.nabble.com/Brazilian-Haskellers---tf4806561.html#a13751760 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Brazilian Haskellers ?
Thanks. I also put in that page a link pointing to the haskellers map in Frappr, in order to encourage new HUGs. I believe most of us are lazy enough (in the good Haskell way) to plot them in xearth ;-) Don Stewart-2 wrote: rherrmann: Hi brazilian haskellers, How about trying to form a HUG-BR ? Maybe even something along the lines of FringeDC (http://www.lisperati.com/fringedc.html). I only know about 4 people that would join the cause, that's why I'm recruiting ;-) Feel free to contact me (I'm posting this from the Nabble interface, so I'm not sure my e-mail will show up ... just in case: [EMAIL PROTECTED]) Added to: http://haskell.org/haskellwiki/User_groups ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- View this message in context: http://www.nabble.com/Brazilian-Haskellers---tf4806561.html#a13754985 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Any Haskellers anywhere? (was Re: Any Haskellers in St Louis, MO?)
http://www.haskell.org/hawiki/HaskellUserLocations On 5/5/07, Mark T.B. Carroll [EMAIL PROTECTED] wrote: Maybe we could use a page on the wiki to note who'd be interested in meeting up and where they all live? -- Mark ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ricardo Guimarães Herrmann You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete - R. Buckminster Fuller ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Any Haskellers anywhere?
Try this ... Google Maps - My Maps - Haskellers http://maps.google.com/maps/ms?f=qhl=ent=kie=UTF8om=1msa=0ll=-23.553838,-46.656811spn=0.004386,0.006738z=18 On 5/5/07, Rob Hoelz [EMAIL PROTECTED] wrote: Gabor Greif [EMAIL PROTECTED] wrote: Am 06.05.2007 um 03:52 schrieb Rob Hoelz: Sounds like a good idea to me. I'd like to see if any Haskellers are in Madison. Doesn't Google have a service for visualizing locations on a map? The wiki could point there, for example... Gabor I bet Google does have one, but first thing that came to my mind is Frappr: http://www.frappr.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ricardo Guimarães Herrmann You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete - R. Buckminster Fuller ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] generate Haskell code from model
On 4/13/07, Neil Mitchell [EMAIL PROTECTED] wrote: Second, if Haskell should be more successful in the real world there has to be a way of demonstrating basic ideas of a big program to customers. How would you do this? Everybody knows UML class diagrams, for example. In contrast, nobody knows about termgraphs or lambda *g*. The UML is not executable, draw a pretty picture. No one knows UML, everyone knows pretty pictures - most people can guess at the meaning of UML because they know the meaning of pictures. As to reverse engineering a diagram from code, that always leads to ugly (and pointless) diagrams. Speaking of pretty pictures, there's a tool from Business Objects called Gems, which is based on a lazily evaluated, strictly-typed language called CAL, with many similarities to Haskell From http://labs.businessobjects.com/cal/default.asp These pieces of business logic, which we called Gems to give them a nice friendly face, are declarative 'functional' objects. Although unrelated to UML, it provides a nice way of graphically representing functions, check it out: http://resources.businessobjects.com/labs/cal/gem_cutter_manual.pdf Or, if you prefer a (boring) video: http://resources.businessobjects.com/labs/cal/gem_part_1_mov.zip I haven't put much thought on that, but I think it's possible representing (de-sugared) Haskell functions using GraphML and relying on existing renderers for simplicity ... anyone tried that already ? -- Ricardo Guimarães Herrmann You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete - R. Buckminster Fuller ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Weaving fun
This reminded me of interleaving as in: Backtracking, Interleaving, and Terminating Monad Transformers http://www.cs.rutgers.edu/~ccshan/logicprog/LogicT-icfp2005.pdf On 4/10/07, Dave Feustel [EMAIL PROTECTED] wrote: Talk about synchronicity! I was just wondering whether 'weaving' of infinite lists is possible. eg weave the infinite lists [2,4..], [3,6..], [5,10..] to get [2,3,4,5,6,8,9,10,..] Is this kind of lazy evaluation possible? Thanks, Dave Feustel -Original Message- From: Bas van Dijk [EMAIL PROTECTED] Sent: Apr 10, 2007 6:13 PM To: haskell-cafe@haskell.org Subject: [Haskell-cafe] Weaving fun Hello, For my own exercise I'm writing a function 'weave' that weaves a list of lists together. For example: weave [[1,1,1], [2,2,2], [3,3]] == [1,2,3,1,2,3,1,2] weave [[1,1,1], [2,2], [3,3,3]] == [1,2,3,1,2,3,1] Note that 'weave' stops when a list is empty. Right now I have: weave :: [[a]] - [a] weave ll = work ll [] [] where work ll = foldr f (\rst acc - work (reverse rst) [] acc) ll f [] g = \_ acc - reverse acc f (x:xs) g = \rst acc - g (xs:rst) (x:acc) However I find this definition hard to read and I'm questioning its efficiency especially due to the 'reverse' parts (how do they impact performance and can they be removed?) So I'm wondering if 'weave' can be defined more elegantly (better readable, shorter, more efficient, etc.)? happy hacking, Bas van Dijk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe http://RepublicBroadcasting.org - Because You CAN Handle The Truth! http://iceagenow.com - Because Global Warming Is A Scam! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ricardo Guimarães Herrmann You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete - R. Buckminster Fuller ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [web-devel] A light-weight web framework
The maintenance nightmare happens when someone uses the embedded language to specify business logic, and that's entirely the web-{developer,designer}'s fault. Thus, the problem is not that these languages shouldn't be powerful enough. IMHO, a safe approach would be simply not allowing I/O inside templates (hey, sounds familiar ;-) On 4/5/07, Maurice Codik [EMAIL PROTECTED] wrote: A few things, some of which I sort of mentioned in my previous email: - If I'm already going to commit some time to learn a templating language, why dont I just spend that same amount of time learning the little bit of haskell I need to make the template work? If thats too much to ask, I can just spit out HTML, and have the programmer put in the dynamic parts for me. Both of these scenarios seem to be a more efficient use of time. - Who is the target audience? If its a big organization where there are multiple designers and multiple devs, then your approach may work just fine. If its the single developer, then something like what David suggested would work even better. If its a small team (which may or may not include a full-time designer), then something like what I suggested would work best. For a web framework for haskell, I would guess that the latter two are much more likely. - Embedding a real programming language in a template already gives you power to do what ever you need to do. What if you need to implement some logic that the template language doesnt support? In those cases, you're usually out of luck and have to move that logic into a controller, where it doesnt really belong (assuming its actual display logic, not business logic). - It's really just a matter of taste. Any web framework thats worth using should be flexible in its support of view technologies, but come with one thats a sensible default. Maurice On 4/5/07, Joel Reymont [EMAIL PROTECTED] wrote: Do you see anything wrong with the approach I suggested, though? On Apr 5, 2007, at 6:16 PM, Maurice Codik wrote: That's not necesarily true. Templates where there is mostly markup, but let you embed code into them using special tags (ex, % code % ) are extremely popular and work fairly well. They also keep the template language simple because there is already a full-powered programming language thats embedded into it. Good examples of this method are ERB templates in Rails, JSPs, Perl Mason templates, etc. -- http://wagerlabs.com/ -- http://blog.mauricecodik.com ___ web-devel mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/web-devel -- Ricardo Guimarães Herrmann Any sufficiently complicated C or Fortran program contains an ad hoc, informally specified, bug-ridden, slow implementation of half of Common Lisp Any sufficiently complicated Lisp or Ruby program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Haskell ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cost of modules
http://www.cs.utah.edu/~hal/HAllInOne/index.html On 3/27/07, Derek Elkins [EMAIL PROTECTED] wrote: Fawzi Mohamed wrote: I decided to cleanup my program by splitting it in different modules. As I was curious about the cost of splitting it, or dually the efficiency of the intermodule optimization I timed it before and after the split. These are the results (ghc-6.6.20070129 on Linux AMD64): A long long time ago, Hal Daume III made Haskell All-in-one which takes a Haskell program and puts all the modules into one file. The difference in efficiency was discussed on one of these mailinglists then. Google should be able to turn up something (albeit it seems to no longer index the haskell.org mailinglists directly). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ricardo Guimarães Herrmann Any sufficiently complicated C or Fortran program contains an ad hoc, informally specified, bug-ridden, slow implementation of half of Common Lisp Any sufficiently complicated Lisp or Ruby program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Haskell ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Chess
Same as the MIME case: http://web.engr.oregonstate.edu/~erwig/papers/Zurg_JFP04.pdfhttp://web.engr.oregonstate.edu/%7Eerwig/papers/Zurg_JFP04.pdf http://www.cs.rutgers.edu/~ccshan/logicprog/LogicT-icfp2005.pdfhttp://www.cs.rutgers.edu/%7Eccshan/logicprog/LogicT-icfp2005.pdf http://web.cecs.pdx.edu/~apt/jfp01.pshttp://web.cecs.pdx.edu/%7Eapt/jfp01.ps http://www.cs.yale.edu/homes/cc392/report.html It would be great trying to unify all of these (and many more) into a library. Following he AIMA structure could be a good start. At the moment I'm working on implementing some AI Planning systems in Haskell and wrote my own logic unification, for example. On 3/19/07, Andrew Wagner [EMAIL PROTECTED] wrote: Here's my take on this: I've thought for a while now that Haskell needs a general toolkit for AI. After all, functional programming has long been recognized for being good at AI, yet you rarely hear about it being done in Haskell. Anyway, my suggestion would be to concentrate on methods of AI. For example, if we implement alpha-beta polymorphically enough, it should be trivial to use it for any game that it makes sense to use it on. This kind of thing is what I was thinking of when I talked about some fundamental design ideas I had. Things like writing a Board type-class, so that you can implement any board representation you want to for chess. Or writing alpha-beta in terms of positions and moves, regardless of what kind of game you're talking about (I also think you simply must use unfoldTree, as this is a beautiful instance of it). Things like learning, and other general strategies, should be developed independently of any particular game, IMHO. On 3/19/07, Steffen Mazanek [EMAIL PROTECTED] wrote: I originally used a more general approach (probably similar to the one you refer to), but kicked generality out in favor of simplicity. In teaching one should probably just discuss this aspect, but stay with the simple approach (I'll add a note to the wiki page :-)). In contrast, for the real Haskell world such a library would be great. One could even use an abstract game specification and compute the corresponding core (if existing and computation being feasible according to the complexity of the game). Two-Player-zero-sum games are very library friendly kinds of games. However, interesting other games are probably too diverse to be pressed in a general framework, aren't they? Henning Thielemann schrieb: On Mon, 19 Mar 2007, Andrew Wagner wrote: Steffen, I've done some chess AI programming in the past, so I'd be happy to help with this project. I have some pretty fundamental design suggestions that I'll write up for the wiki page. As a spin-off, will there grow some library for general strategies in board games, like those described in why functional programming matters? ___ 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 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ricardo Guimarães Herrmann Any sufficiently complicated C or Fortran program contains an ad hoc, informally specified, bug-ridden, slow implementation of half of Common Lisp Any sufficiently complicated Lisp or Ruby program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Haskell ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Newbie: generating a truth table
One possible way to generate the values would be using a generic function for permutation with repetition, such as: permuteRep :: [a] - [b] - [[(a,b)]] permuteRep [] _ = [] permuteRep (a:[]) bs = [ [ (a,b) ] | b - bs ] permuteRep (a:as) bs = concat [ [ (a,b):p | p - permuteRep as bs ] | b - bs ] and then use: lines = permuteRep [x,y,z] [False,True] In case the variable names can be discarded (or, in this case, not generated ... lazy evaluation rox ;-), then: map (map snd) lines This avoids having to provide a domain for each variable in the list comprehension, which could be problematic when dealing with many variables On 2/21/07, Joe Thornber [EMAIL PROTECTED] wrote: On 2/10/07, Peter Berry [EMAIL PROTECTED] wrote: Prelude putStrLn $ concatMap (flip (++)\n) $ map show $ [(x,y,() x y) |x - [True,False],y - [True,False]] This can be simplified slightly to: Prelude putStrLn . unlines . map show $ [(x, y, x y) | x - [True, False], y - [True, False]] - Joe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ricardo Guimarães Herrmann Those who do not understand Lisp are doomed to reinvent it, poorly Curried food and curried functions are both acquired tastes If you think good architecture is expensive, try bad architecture ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] new member
I'd say your account is purely functional instead ;-) On 2/16/07, P. R. Stanley [EMAIL PROTECTED] wrote: Hi Paul here - new member - checking to see my account is fully functional. Does the list know of another list where I can post questions on functional programming and the related mathematics? I'm assuming Haskell Cafe is mainly for discussions on Haskell programming and not so much the underlying theory. Any help would be appreciated. Cheers Paul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ricardo Guimarães Herrmann Those who do not understand Lisp are doomed to reinvent it, poorly Curried food and curried functions are both acquired tastes If you think good architecture is expensive, try bad architecture ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe