[Haskell-cafe] Re: [Haskell-beginners] Ambigous Types with Haskell Functional Graph Library
Joe joesmo...@gmail.com writes: I tried using ucycle directly from Data.Graph.Inductive.Example by itself. I didn't realize there were two instances of Graph. How would you use the PatriciaTree Graph instance in the ucycle type signature? ucycle :: Graph gr = Int - gr () () You must have that Graph instance in scope. I can't give any more suggestions as I don't see the code in which you use `ucycle`. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] ANNOUNCE: GLUT 2.2.1.0
Am Sonntag, 16. August 2009 22:10:23 schrieb Rafael Gustavo da Cunha Pereira Pinto: BTW, as an enhancement for 2.2.2.0, you could treat unnamed mouse buttons. Mouses with more axis and more buttons are becoming increasingly common, and unmarshalMouseButton is not prepared to accept them!! Here are exceptions I caught, playing with my Genius Traveler 515 mouse: unmarshalMouseButton: illegal value 5 unmarshalMouseButton: illegal value 6 unmarshalMouseButton: illegal value 7 unmarshalMouseButton: illegal value 8 Good point, I had similar reports already, but I simply forgot to handle this in yesterday's release. The right way to handle this would probably be extending the MouseButton data type with an 'AdditionalButton Int' constructor and simply pass the unknown button numbers via this case. I am not so sure about a nice name for this constructor: AdditionalButton? GenericButton? Or simply MouseButton, just like the type itself? Cheers, S. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Got problems with classes
Hello! I can't understand why the following dummy example doesn't work. {-# OPTIONS -XTypeSynonymInstances #-} {-# OPTIONS -XFlexibleInstances #-} module Main where import Data.Array.Unboxed class Particle p type ParticleC = (Double, Double, Double) instance Particle ParticleC class Configuration c where getParticleI :: (Particle p) = c - Int - p type Collection p = UArray (Int,Int) Double instance Configuration (Collection p) where getParticleI config i = (1,1,1) :: ParticleC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Got problems with classes
Hello Grigory, Monday, August 17, 2009, 10:35:33 AM, you wrote: Hello! I can't understand why the following dummy example doesn't work. http://haskell.org/haskellwiki/OOP_vs_type_classes shortly speaking, throw away your OOP experience and learn new paradigm from scratch. also, http://rsdn.ru/forum/decl/2517181.1.aspx -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type family signatures
Somehow I didn't receive David's mail, but his explanation makes a lot of sense. I'm still wondering how this results in a type error involving rigid type variables. Ryan Ingram wrote: On Fri, Aug 14, 2009 at 12:03 PM, Dan Westonweston...@imageworks.com wrote: But presumably he can use a data family instead of a type family to restore injectivity, at the cost of adding an extra wrapped bottom value and one more layer of value constructor? Actually, you don't even necessarily pay this penalty, since you can put newtypes into data families. data family Foo a newtype instance Foo () = UnitFoo Int You do need to add the constructor wrap/unwrapping in code, but they all get erased after typechecking. -- ryan ___ 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
Re: [Haskell-cafe] Request for comments - hdnsomatic
Hi I should release a new version - the darcs version requires haskell-src-exts 1.1.*. I'll do that tonight. Thanks, Neil 2009/8/17 Jesús Alberto Sánchez Pimienta jesusalbertosanc...@gmail.com: Many Thanks Neil, I tried to build hlint before submitting to the mail list but i couldn't because my haskell-src-exts is version 1.1.1 and the cabal file of hlint requires a version 1.1. Now i modified the cabal depends and successfully installed hlint, it's a great tool. Piensa y trabaja Jesús Alberto Sánchez Pimienta Estudiante de la Lic. en Estudios Políticos y Gobierno Universidad de Guadalajara 2009/8/16 Neil Mitchell ndmitch...@gmail.com Hi An easy way to get some instant feedback is to run HLint on it: http://community.haskell.org/~ndm/hlint The results are: C:\Neil\hlinthlint Example.hs Example.hs:42:1: Warning: Use liftM Found: readFile p = return . lines = return . map (second tail . break (== '=') . filter (/= ' ')) Why not: liftM (map (second tail . break (== '=') . filter (/= ' '))) (readFile p = return . lines) Example.hs:42:1: Warning: Use liftM Found: readFile p = return . lines Why not: liftM lines (readFile p) Found 2 suggestions So using liftM instead of = return might be better style. You can also make minor tweaks like: if null args then readConfig defaultConfig else readConfig (head args) == readConfig $ if null args then defaultConfig else head args currentIP - catch (getIPAddress webIP) (\e - syslog Error (show e) return 0) oldIP - catch (S.readFile ipCache) (\e - syslog Error (show e) return 0) == let catch_ x = catch x (\e - syslog Error (show e) return 0) currentIP - catch_ $ getIPAddress webIP oldIP - catch_ (S.readFile ipCache) And there's no need to exitSuccess at the end of main, exitSuccess is the default. Thanks Neil 2009/8/16 Jesús Alberto Sánchez Pimienta jesusalbertosanc...@gmail.com: Hello haskellers, I just finished my first useful haskell program and I'd be glad if you make me some comments http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8244#a8244 Thank you, and sorry for my english. Piensa y trabaja Jesús Alberto Sánchez Pimienta Estudiante de la Lic. en Estudios Políticos y Gobierno Universidad de Guadalajara ___ 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
Re: [Haskell-cafe] Getting highest sum of list elements with Map
On Wed, Aug 5, 2009 at 10:51 AM, gwe...@gmail.com wrote: (Full source attached; or alternately, grab it: darcs get http://community.haskell.org/~gwern/hcorpus ) So I have this little program which hopefully will help me learn French by Probably off-topic, but also, I'm willing to help anyone learning French, for example by answering questions in French, or about French, or just writing about anything in French, or translating texts for you. Bon courage, David. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re : [Haskell-cafe] Elerea/GLFW Tetris
As I've been warned, two dependencies (Common.Utils and Common.Vector) are to be resolved in order to use this Tetris code. They're part of the elerea-examples package (from hackage) but their access is not public so a solution is to modify the cabal file during installation. Another solution is to create a Common directory in the current directory, then decompress the source located in http://hackage.haskell.org/package/elerea-examples and copy the two files Vector.lhs and Utils.lhs in Common. Hi Haskellers, Here is my first real program in Haskell. http://hpaste.org:80/fastcgi/hpaste.fcgi/view?id=8211 In fact, I'm not fully responsible because it's just an adapted version of a Tetris Creighton Hogg had written for Reactive/GLUT. As the first version, it's a very simple game (no levels, no points ...) but it's playable ! The major problem is when the board is full, the program sadly stops for an empty list : indeed, I wasn't interested in that part and I prefered dealing with the signals. As the frame is the same as the breakout frame, it is also possible to launch the game with ./Tetris --dump-dot | dot -Tsvg -o tetris.svg in order to get an svg showing a graph of the signals. Any help is welcome to understand this graph ! Every comment is welcome (especially about the first 170 lines). Enjoy! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: [Haskell] ANNOUNCE: GLUT 2.2.1.0
On Mon, Aug 17, 2009 at 03:17, Sven Panne sven.pa...@aedion.de wrote: Am Sonntag, 16. August 2009 22:10:23 schrieb Rafael Gustavo da Cunha Pereira Pinto: BTW, as an enhancement for 2.2.2.0, you could treat unnamed mouse buttons. Mouses with more axis and more buttons are becoming increasingly common, and unmarshalMouseButton is not prepared to accept them!! Here are exceptions I caught, playing with my Genius Traveler 515 mouse: unmarshalMouseButton: illegal value 5 unmarshalMouseButton: illegal value 6 unmarshalMouseButton: illegal value 7 unmarshalMouseButton: illegal value 8 Good point, I had similar reports already, but I simply forgot to handle this in yesterday's release. The right way to handle this would probably be extending the MouseButton data type with an 'AdditionalButton Int' constructor and simply pass the unknown button numbers via this case. I am not so sure about a nice name for this constructor: AdditionalButton? GenericButton? Or simply MouseButton, just like the type itself? Cheers, S. AdditionalButton seems good. My second choice would be to use MouseButton. -- Rafael Gustavo da Cunha Pereira Pinto ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re : [Haskell-cafe] Elerea/GLFW Tetris
As a side-note, it might be interesting to use the Vec package on Hackage, since it seems to offer fast, unboxed linear algebra. On Mon, Aug 17, 2009 at 2:01 PM, jean legrand kkwwe...@yahoo.fr wrote: As I've been warned, two dependencies (Common.Utils and Common.Vector) are to be resolved in order to use this Tetris code. They're part of the elerea-examples package (from hackage) but their access is not public so a solution is to modify the cabal file during installation. Another solution is to create a Common directory in the current directory, then decompress the source located in http://hackage.haskell.org/package/elerea-examples and copy the two files Vector.lhs and Utils.lhs in Common. Hi Haskellers, Here is my first real program in Haskell. http://hpaste.org:80/fastcgi/hpaste.fcgi/view?id=8211 In fact, I'm not fully responsible because it's just an adapted version of a Tetris Creighton Hogg had written for Reactive/GLUT. As the first version, it's a very simple game (no levels, no points ...) but it's playable ! The major problem is when the board is full, the program sadly stops for an empty list : indeed, I wasn't interested in that part and I prefered dealing with the signals. As the frame is the same as the breakout frame, it is also possible to launch the game with ./Tetris --dump-dot | dot -Tsvg -o tetris.svg in order to get an svg showing a graph of the signals. Any help is welcome to understand this graph ! Every comment is welcome (especially about the first 170 lines). Enjoy! ___ 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
Re : [Haskell-cafe] Elerea/GLFW Tetris
As I've been warned, two dependencies (Common.Utils and Common.Vector) are to be resolved in order to use this Tetris code. They're part of the elerea-examples package (from hackage) but their access is not public so a solution is to modify the cabal file during installation. Another solution is to create a Common directory in the current directory, then decompress the source located in http://hackage.haskell.org/package/elerea-examples and copy the two files Vector.lhs and Utils.lhs in Common. but the simplest soltution is to get rid of these dependancies as long as they are of very little importance actually : http://hpaste.org:80/fastcgi/hpaste.fcgi/view?id=8261 I added (line 291 to 309) the code needed to play Pentis but at this time the random generator bugs with 18 elements and only p12 is selected. Those who want to try can easily comment l.274 and decomment l.275 (then removing p17,p18 from the list because of the bug) and replace straight by p1 on l.80 Harder ! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: GLUT 2.2.1.0
Sven Panne wrote: and simply pass the unknown button numbers via this case. I am not so sure about a nice name for this constructor: AdditionalButton? GenericButton? Or simply MouseButton, just like the type itself? How about OtherButton? Martijn. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Got problems with classes
Hi, One reason (there may be more) is as follows: Grigory Sarnitskiy wrote: class Configuration c where getParticleI :: (Particle p) = c - Int - p This type signature declares that for any type c that has a Configuration instance (and an Int), you can give me back something that is of *any type* p, provided I have a Particle instance for p. So if I was to declare: instance Particle Int Then I should be able to do: x :: Int x = getParticleI someConfigurationItem 6 But... type Collection p = UArray (Int,Int) Double instance Configuration (Collection p) where getParticleI config i = (1,1,1) :: ParticleC What you are doing in your instance, however, is always returning a ParticleC, which is a specific type rather than any type that belongs to Particle. There are several ways to solve this. A few examples: 1. Make getParticleI specifically return a ParticleC, rather than the type p. 2. Add a makeParticle function to the particle type-class. If you had: class Particle p where makeParticle :: (Double, Double, Double) - p Then you could rewrite that last line as: getParticleI config i = makeParticle (1, 1, 1) And then the return would be of any type p that has a Particle instance. 3. Parameterise the collection over the particle, e.g. class Configuration c where getParticleI :: Particle p = c p - Int - p But currently Collection is not actually parameterised using the p parameter (the UArray has Double, not Particle), so I can't properly adjust your example for that. Hope that helps, Neil. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Grouping and SIMD in parallel Haskell (using Nested Data Parallel Haskell ideas in legacy code)
I haven't had enough time to polish a paper about the subject, so I decided to post my results here, in Haskell Café. When Simon Peyton-Jones was in Moscow about a month ago I made a bold statement that Parallel Haskell programs, expressed with the help of par and pseq, can be transformed into Nested Data Parallel Haskell. I wrote a simple model of what will be if we group arguments of par and pseq into queues based on parallel arrays from NDPH. We could then evaluate all thunks from that queues in parallel using SIMD (or just getting higher ILP). We also do not have to lock out main spark queue, we lock only queue we should put argument in. The latter turned out to be beneficial in itself, at least in my simple model. Let us look at famous parallel fib function: Fib n | N = 1 = 1 | otherwise = a `par` b `pseq` a+b where a = fib (n-1) b = fib (n-2) When we evaluate fib we put a spark of a into spark queue and proceed to evaluate b and, then, a+b. When we put a into spark queue, we lock queue out, modify and release. There is a big probability that threads on different cores will compete for queue lock and some of them (most of them) will waste time waiting for lock release. If we group a's into different queue and put to main spark queue a spark to evaluate a complete group of a's at once, we will get less wasted time. This will work even for single CPU. Below is a run of (fib 15) on my model with cpuCount 1, 4 and 16 and a's or b's group length 0 (no grouping) and 16: cpuCount groupLength=0 groupLength=16 modelTicks modelTicks 1 34535 27189 4 12178 7472 167568 3157 speedup 2.19 times 3.11 times ticks1/ticks16 I think results speak for itself. I think the idea of `par` argument grouping could be viable. I should note that I made several digressions when I wrote model. One of digressions is that all evaluations are put into queue. In (a `par` b `pseq` a+b) a put into a_queue, b put into b_queue and (a+b) put into main queue. Each evaluated spark update it's parent - a spark that wait for it. Also, main loop of single CPU changed from simple (reading main spark queue + execute when get something) into a series of attepmts with fall back on failure: - first read main queue and execute spark if succeed, - else read current a_queue and execute all sparks there if succeed, - else read current b_queue and execute all sparks there if succeed, - else go to main loop. The new (transformed) code for our fib below: -- |Create a new queue based on parallel array. It holds a parallel array with current arguments and a function that performs -- computation in RTS monad (evaluation function). newQueueParArray :: (x - RTS ()) - RTSRef ([: x :],x - RTS ()) a_queue = unsafePerformIO $ newQueueParArray (\x - fib (x-1)) -- RTSRef (Int,Int - Int) b_queue = unsafePerformIO $ newQueueParArray (\x - fib (x-2)) -- RTSRef (Int,Int - Int) fib n caller | n = 1 = 1 | otherwise = unsafePerformIO $ do Ab - addToMainQueue (defer (+) caller) A' - addToParArrQueue a_queue x ab B' - addToParArrQueue b_queue x ab addToMainQueue ab -- add a spark to check a' and b' evaluation status, compute a+b and update the caller. That transfomation cannot be done at the source level using usual type (class/families) hackery. It could be done, though, using core-to-core transformations. It is clear that several values of same type (Int for fib) and a function to perform operations over them leads to SIMD execution. I made some provisions to exploit SIMD and ILP in my model. It can load more than single task information and add several values per cycle. This also speeds execution up, but not so radically (about 3%). The source code for model is here: http://82.146.47.211/attachment/wiki/ndpph/ndp-ph.hs (it's a MskHUG.ru domain, we have temporary problems with DNS). It short of comments, but I tried to make understandable function names. Compile it with 'ghc -o ndp-ph --make -O2 ndp-ph' and run with a command line like the following: ndp-ph.exe cpuCount 1 usePrivateGroups 0 maxABTaskLength 64 taskFetchsPerCycle 1 thunksPerAddition 8 cyclesPerAddition 1 I decided to create a model of exexcution instead of modifying an existing implementation because I have not enough time. I wrote it over evenings and a weekend, so it is simple, it's rude and it does the job pretty fine. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Got problems with classes
I'm not exactly sure what you're trying to do, but the problem is that you're trying to return a specific value where the type signature is polymorphic. getParticleI returns a p, (with the constraint that p is a type in the class Particle) This means that getParticleI can be called in any context that needs a Particle p, but your getParticleI returns (Double, Double, Double) so it would only work in a context that needed a (Double, Double, Double), and the type signature doesn't reflect that, so you get an error. To emphasize the problem, say I make a ParticleD type ParticleD = (Int, Int) instance Particle ParticleD let (a, b) = getParticleI myConfig 5 -- this is perfectly valid since ParticleD is a Particle, but doesn't work with your getParticleI definition because it returns a specific type (Double, Double, Double). Do you see what I mean? You can fix it by either fixing the type of getParticleI: getParticleI :: c - Int - ParticleC or by using multiparameter type classes class Configuration c p where getParticleI :: (Particle p) = c - Int - p depending on what you're actually trying to do. - Job On Mon, Aug 17, 2009 at 2:35 AM, Grigory Sarnitskiy sargrig...@ya.ruwrote: Hello! I can't understand why the following dummy example doesn't work. {-# OPTIONS -XTypeSynonymInstances #-} {-# OPTIONS -XFlexibleInstances #-} module Main where import Data.Array.Unboxed class Particle p type ParticleC = (Double, Double, Double) instance Particle ParticleC class Configuration c where getParticleI :: (Particle p) = c - Int - p type Collection p = UArray (Int,Int) Double instance Configuration (Collection p) where getParticleI config i = (1,1,1) :: ParticleC ___ 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] Credit Suisse is hiring
Hi, Just to chime in with the spate of job advertisements, the Global Modelling and Analytics Group (GMAG) at Credit Suisse is once again looking to hire functional programmers. The group consists of about 130 people worldwide. The majority of the group are mathematicians engaged in developing mathematical models for financial products traded by the division. Approximately 20 people are primarily computing experts, based in the Architecture and Delivery (AD) subgroup within GMAG, and successful candidates will also be based in this group. We are already making heavy use of functional programming within the group, and we expect to increase this in the future. Some information about our Haskell projects can be found here: http://www.haskell.org/communities/05-2009/html/report.html#creditsuisse ; more recently we have adopted F# for implementing and deploying models on the .NET platform and we are currently ramping up our F# usage. Our team works closely with the modellers to help them leverage functional programming to improve the design of their code. Key requirements: At least one of: - An academic track record in functional programming. - Significant experience of real-world computing environments, preferably using functional programming. Excellent communication skills in order to convey new ideas to our modelling team. Location: London or New York Contact: Howard Mansell howard.mans...@credit-suisse.com Myself (Ganesh Sittampalam ganesh.sittampa...@credit-suisse.com) and Tobias Gedell tobias.ged...@credit-suisse.com will be attending ICFP 2009 and associated workshops in Edinburgh - if you'd like to discuss this in person, get in touch with us by email, or just grab one of us there. Background information: As one of the world's leading banks, Credit Suisse provides its clients with investment banking, private banking and asset management services worldwide. Founded in 1856, Credit Suisse has a long tradition of meeting the complex financial needs of a wide range of clients, offering advisory services, comprehensive solutions and innovative products to companies, institutional clients and high-net-worth private clients globally. Credit Suisse is active in over 50 countries and employs approximately 46,000 people. Further information can be found at www.credit-suisse.com. Cultural diversity is essential to our success. As such, we employ people from more than 100 countries. Credit Suisse empowers employees to work openly and respectfully with each other and with clients, ultimately striving to deliver superior results while offering initiatives and programs to assist employees achieve a healthy work-life balance. The Global Modelling and Analytics Group (GMAG) is responsible for producing state-of-the-art pricing, trading and risk management models for Credit Suisse. These models are used across a range of businesses in the Fixed Income and Equity departments. The group performs the full spectrum of quantitative work, from mathematical modelling through software implementation and delivery, to risk analysis of trades and existing portfolios. The group's mandate covers all major asset classes, including Credit Derivatives, Commodities, Emerging Markets, Equity Derivatives and Convertibles, Exotics, Foreign Exchange, Fund Linked Products, Interest Rate Products and Mortgage Derivatives. GMAG operates globally with members located in London, New York, Hong Kong, Tokyo, Zurich and São Paolo. Established in 1990, GMAG stands out as a unified quant group that has been covering all major product areas since its inception. The group has always enjoyed a strong relationship with Trading, Structuring and Sales, assisting them with trade pricing and risk management. As the group is based on the trading floor, it is ideally placed to respond to the financial modelling needs of the businesses it supports. The breadth of GMAG's mandate makes it uniquely positioned to leverage the skills and experience of its members, and to provide a consistent modelling approach across all areas. Over time, the group has developed an extensive suite of pricing models on a common platform with complete integration across all asset classes. Quantitative Analysts in GMAG carry out a range of activities which include the creation of sophisticated mathematical models for the valuation of complex derivatives, development of the technology platform used to deliver models and driving the use of these models throughout the bank. Our Quantitative Analysts typically hold an advanced quantitative degree, have excellent analytical and problem-solving skills, demonstrate creative thinking, have strong programming skills, and are confident communicators. === Please access the attached hyperlink for an important electronic communications disclaimer:
[Haskell-cafe] Re: Changelogs and available since
Laszlo Nagy rizso...@gmail.com writes: Hi All, I was volunteer to solve this problem: http://hackage.haskell.org/trac/summer-of-code/ticket/1565 In a conversation on the librar...@haskell.org I was suggested to scratch my idea here. I would use hoogle for this. Currently it stores the package name and the symbols of the modules about a package. What do you think about hayoo? I prefer this to hoogle, as hayoo has more complete database across hackage packages, AFAIK I would extend it to store the version of the package as well. Extend the query methods to use all the available package description at search. And make a VersionRange from the matched Versions. I wrote some code for doing this a while ago. Take a look and make some comments, I can extend this library to satisfy your needs http://hackage.haskell.org/package/cabal-query ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Got problems with classes
Thank you all, and especially Bulat. I've folowed the links and solved the problem in a new way. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: simple hsql question
Ok, let me ask it in another way. Is there a good way to access databases, mysql in particular, from haskell program? On Sun, 16 Aug 2009 18:54:32 +0400 AK == Alexander Kotelnikov sa...@myxomop.com wrote: AK AK Hi AK I wanted to see what access to databases HSQL provides and I stumbled in AK the very beginning. Assume I have a table map1 with attributes i and s AK interger and varchar() respectively. The following code fails (with AK segfault) for me. And I see no other way to tell compiler that I am AK expecting an interger to be found as 'i' in a fetched row. AK AK import Database.HSQL AK import Database.HSQL.MySQL AK AK main :: IO () AK main = do AK c - connect localhost tx_test sacha AK s - query c SELECT i FROM map1 AK print $ getFieldsTypes s AK i - (getFieldValue s i)::IO Int AK print i AK disconnect c AK AK -- AK Alexander Kotelnikov AK Saint-Petersburg, Russia AK -- Alexander Kotelnikov Saint-Petersburg, Russia ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Changelogs and available since
Hi I would use hoogle for this. Currently it stores the package name and the symbols of the modules about a package. What do you think about hayoo? I prefer this to hoogle, as hayoo has more complete database across hackage packages, AFAIK Hayoo gets it package database out of haddock with text hackery - try things like data Foo = Bar {a, b :: Foo}, it's not nearly complete. Hoogle on the other hand directly examines bits and produces an accurate index. That's also one of the reasons Hoogle is a bit behind Hayoo, it has to do more to get the full package information out. One day Hoogle will match Hayoo and index all packages. Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Changelogs and available since
What would it take to increase the hoogle index to most of the packages on hackage? I have been wanting to use hoogle to search hackage for a while and I would be interesting in helping make it happen. - Job On Mon, Aug 17, 2009 at 4:16 PM, Neil Mitchell ndmitch...@gmail.com wrote: Hi I would use hoogle for this. Currently it stores the package name and the symbols of the modules about a package. What do you think about hayoo? I prefer this to hoogle, as hayoo has more complete database across hackage packages, AFAIK Hayoo gets it package database out of haddock with text hackery - try things like data Foo = Bar {a, b :: Foo}, it's not nearly complete. Hoogle on the other hand directly examines bits and produces an accurate index. That's also one of the reasons Hoogle is a bit behind Hayoo, it has to do more to get the full package information out. One day Hoogle will match Hayoo and index all packages. Thanks Neil ___ 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
Re: [Haskell-cafe] Re: simple hsql question
Alexander Kotelnikov sa...@myxomop.com writes: Ok, let me ask it in another way. Is there a good way to access databases, mysql in particular, from haskell program? Use HDBC or Takusen. You can find them on hackage. HDBC is fairly usable, but you must write SQL queries by yourself or use some simple machinery to construct queries. I've written a bunch of helper functions to construct queries as strings, e.g.: insert :: String - [String] - String - String insert t = (++) . ( INSERT ++) . ( INTO++) . (t ++). ( ( ++) . (++ ) ) . join , select :: [String] - String - String select = (++) . ( SELECT ++) . join , from :: [String] - String - String from = (++) . ( FROM++) . join , In the end your query looks like: query' (select [max(cheque)] . from [history] $ ; In this way you avoid typical errors which emerge when you write simple SQL query strings. Though you don't get true static typing. There are haskelldb and Takusen, which provide more elaborate way of connecting to RDBMS, they demand more investigation though. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Request for Comments - hscurrency 0.0.1
Thanks for sharing this. If you haven't already, also check out http://hledger.org/api-doc - Amount and Commodity modules for possibly related work. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: OpenCLRaw 1.0.1000
All, I've released a raw binding to the OpenCL platform on Hackage. The main differences between it and the C bindings are that constants have been replaced by newtypes for type safety reasons, void-essential functions that return a token errorcode return a Maybe ErrorCode, and functions that return a handle/ptr and return an error-code through an out-parameter return instead an Either ErrorCode a. Modules are grouped roughly by the section in which they appear in the standard. I'm working on an OpenCL binding that is a little more cooked as well as a high-level OpenCL binding. OpenCL is a platform for single-host heterogenous, data-parallel computing that follows roughly the OpenGL and OpenAL conventions for how the library is architected. It will be available by default in the next version of Apple's OS-X, and there are drivers for AMD Opteron/Athlons and nVidia CUDA-based graphics cards. The basic procedure behind running an OpenCL program is: 1. get a list of platforms 2. choose a device on the platform that fits your needs 3. create a context for the platform and the device 4. compile a program and kernels written in OpenCL/C 5. create memory buffer objects. 6. execute kernels on the memory buffer objects. 7. rinse hands, repeat. Obviously this is not very functional, but we can't get there without a raw binding. Data Parallel computing is somewhere Haskell is excelling; hopefully this will generate some interest in creating a DPH binding to OpenCL's C99-based language, OpenCL/C. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANN: OpenCLRaw 1.0.1000
I've released a raw binding to the OpenCL platform on Hackage. The main differences between it and the C bindings are that constants have been replaced by newtypes for type safety reasons, (...) If you think there's something I could change in the package below to make it usefull for this kind of work in the future, please let me know: http://hackage.haskell.org/packages/archive/bindings-common/0.2.5/doc/html/Bindings.html Although, design decisions are pretty different, so may be it would not help, but I thought it worth sugesting. Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe