Re: [Haskell-cafe] How to deal with huge text file?
On 25 May 2010 16:12, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Yes, this code works with a little hack. Thank you. I'm scared to ask: what pray tell is this little hack? -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: Packages for computer vision, robotics, and FRP plus demo video of haskell-controlled robot
I'm pleased to announce the first public release, and a new version (still in alpha stage) of the following packages on hackage: - cv-combinators http://hackage.haskell.org/package/cv-combinators: Functional Combinators for Computer Vision (currently mostly a high level functional wrapper for HOpenCV) - Includes, among others, high-level code to get images from a webcam, detect faces, and show results in a window. - HOpenCV http://hackage.haskell.org/package/HOpenCV: Low-level bindings for the OpenCV computer vision library (for now, quite minimal but includes among others haar detection that can be used for face detection) - allocated-processorhttp://hackage.haskell.org/package/allocated-processor: Functional combinators for monadic actions that require allocation and de-allocation, and (building on that) a basic FRP framework that includes a generalized operator for expressing strictly causal systems - RMP http://hackage.haskell.org/package/RMP: Binding to code that controls a Segway RMP. Both RMP and cv-combinators include demo programs (under /src). Reading the code is highly recommended for people who are interested in using the packages. The demo program in the RMP package was used to control the robot in the following video: http://www.youtube.com/watch?v=2ZblWWxeLsYfeature=player_embedded More information can be found at: http://www.ee.bgu.ac.il/~noamle/ http://www.ee.bgu.ac.il/%7Enoamle/ Enjoy, Noam Lewis ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to deal with huge text file?
On Tuesday 25 May 2010 08:14:13, Ivan Miljenovic wrote: On 25 May 2010 16:12, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Yes, this code works with a little hack. Thank you. I'm scared to ask: what pray tell is this little hack? Looking at it again, probably making it work at all, because I never consumed the Log for lines, so produced an infinite list of empty lists :-/ Something like separateOutput :: String - [[String]] separateOutput file = let contents = dropWhile (not . (Log for `isPrefixOf`)) $ lines file split [] = ([],[]) split (h:tl) = let (lg,rst) = break (Log for `isPrefixOf`) tl in (h:lg,rst) msplit [] = Nothing msplit lns = Just (split lns) in unfoldr msplit contents which really works :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to deal with huge text file?
Daniel Fischer daniel.is.fisc...@web.de writes: On Tuesday 25 May 2010 08:14:13, Ivan Miljenovic wrote: On 25 May 2010 16:12, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Yes, this code works with a little hack. Thank you. I'm scared to ask: what pray tell is this little hack? Looking at it again, probably making it work at all, because I never consumed the Log for lines, so produced an infinite list of empty lists :-/ Oh, yeah, I've done that before (with custom chunking functions, etc.). Just so you know, the split package might already have a function to do what you want... -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [reactive] A pong and integrate
Wow... impressive... And now, with your experience, if you'd have to do this again, would you use Yampa or stick up with C#/C++ ? 2010/5/24 Peter Verswyvelen bugf...@gmail.com Yeah. Funny that we're still writing games in C++, while mission critical and hard real time systems are written in much nicer languages :) I made something similar to Lucid Synchrone for a game company I used to work, but with the purpose of making reactive programming accessible to computer artists. The integrated development environment provided the typical boxes-and-links user interface, where the boxes were signal functions. Signals itself were not exposed, like Yampa. The system did type inference so artists never really had to deal with types. Special nodes like feedback and delay where provided to allow transferring values to the next frame. This actually was a great success, digital artists could literally create little interactive applications with it, without much help from programmers. This resulted in a Playstation 3 visual experience Mesmerize (http://www.youtube.com/watch?v=rW7qGhBjwhY). This was before I knew Haskell or functional programming, so it was hacked together in C# and C++... I still believe that the reason why computers artists could work with this environment and were not able to learn imperative programming is functional programming itself: the system had all the goodies of FP: type inference, referential transparancy, etc... But is also provided the possibility to edit literals while the simulation was running, providing zero turnaround times, which was equally important for quick adoption of the software. So IMO Haskell and FRP systems have a huge potential for education of a much broader audience than just computer scientists... On Mon, May 24, 2010 at 6:13 PM, Limestraël limestr...@gmail.com wrote: I assumed also that it was a field which was still under research, however, Lustre, again, is used for critical control software in aircraft, helicopters, and nuclear power plants, according to wikipedia. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to deal with huge text file?
On Tuesday 25 May 2010 10:44:57, Ivan Lazar Miljenovic wrote: Daniel Fischer daniel.is.fisc...@web.de writes: On Tuesday 25 May 2010 08:14:13, Ivan Miljenovic wrote: On 25 May 2010 16:12, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Yes, this code works with a little hack. Thank you. I'm scared to ask: what pray tell is this little hack? Looking at it again, probably making it work at all, because I never consumed the Log for lines, so produced an infinite list of empty lists :-/ Oh, yeah, I've done that before (with custom chunking functions, etc.). Who hasn't? Just so you know, the split package might already have a function to do what you want... Sort of. Not one function, but the building blocks: import Data.List (isPrefixOf) import Data.List.Split msplit = split (keepDelimsL $ whenElt (Log for `isPrefixOf`)) I think. But who looks at API docs in the dead of the night when cooking up the function seems so easy :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Writing a web service client
Hi, café I've begun learning Haskell for some time already, and although I don't really feel confident writing real world Haskell, I have a little idea that I want to materialize in Haskell code so I'm pretty eager to do something instead of just reading books and blog posts. The first step that I want to undertake is to write a client library for the GitHub API, so my questions would be: 1. Is there any such library? 2. What other client library should I consider as an API model? Or maybe there's some paper/blog post on how do design a Haskell API? 3. What network package do people use for accessing simple, rest-like web services? Network.Curl? If not, which other? Thanks, -- Ionuț G. Stan | http://igstan.ro ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] TDD in Haskell
Hi, I'm doing TDD in pretty much all of the languages that I know, and I want to introduce it early in my Haskell learning process. I wonder though, if there's some established process regarding TDD, not unit testing. I've heard of QuickCheck and HUnit, but I've also read that QuickCheck is used mostly for testing pure code, while HUnit for impure code? What framework lends itself better for writing tests before the actual production code? Can you point out to some resources regarding this? Oh, and a small off-topic question? Is it considered a good practice to use implicit imports in Haskell? I'm trying to learn from existing packages, but all those import all statements drive me crazy. Thanks, -- Ionuț G. Stan | http://igstan.ro ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] TDD in Haskell
QuickCheck is great for TDD. I have used it for such purposes. You literally encode the contract of the function as quickcheck properties. It's very lovely. Cheers. ~Liam On 25 May 2010 21:36, Ionut G. Stan ionut.g.s...@gmail.com wrote: Hi, I'm doing TDD in pretty much all of the languages that I know, and I want to introduce it early in my Haskell learning process. I wonder though, if there's some established process regarding TDD, not unit testing. I've heard of QuickCheck and HUnit, but I've also read that QuickCheck is used mostly for testing pure code, while HUnit for impure code? What framework lends itself better for writing tests before the actual production code? Can you point out to some resources regarding this? Oh, and a small off-topic question? Is it considered a good practice to use implicit imports in Haskell? I'm trying to learn from existing packages, but all those import all statements drive me crazy. Thanks, -- Ionuț G. Stan | http://igstan.ro ___ 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] TDD in Haskell
On Tuesday 25 May 2010 13:36:01, Ionut G. Stan wrote: Hi, I'm doing TDD in pretty much all of the languages that I know, and I want to introduce it early in my Haskell learning process. I wonder though, if there's some established process regarding TDD, not unit testing. I've heard of QuickCheck and HUnit, but I've also read that QuickCheck is used mostly for testing pure code, while HUnit for impure code? And ghci or hugs are the most used tools for testing, be the code pure or impure. What framework lends itself better for writing tests before the actual production code? Can you point out to some resources regarding this? You can write the QuickCheck properties that your functions should satisfy before implementing the functions. However, when you've determined the specs, it's rather unimportant whether you write the properties first or the functions, IMO. Oh, and a small off-topic question? Is it considered a good practice to use implicit imports in Haskell? Generally, no. It's considered good practice to use explicit import (and export, of course) lists. But as lazy programmers, we can't always resist the temptation to skip some not strictly necessary work. The implicit import of the entire Prelude is a special case, modules from the same package are edge cases, but otherwise it's a code smell. I'm trying to learn from existing packages, but all those import all statements drive me crazy. Thanks, ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a web service client
2010/5/25 Ionut G. Stan ionut.g.s...@gmail.com: Hi, café I've begun learning Haskell for some time already, and although I don't really feel confident writing real world Haskell, I have a little idea that I want to materialize in Haskell code so I'm pretty eager to do something instead of just reading books and blog posts. The first step that I want to undertake is to write a client library for the GitHub API, so my questions would be: 1. Is there any such library? 2. What other client library should I consider as an API model? Or maybe there's some paper/blog post on how do design a Haskell API? 3. What network package do people use for accessing simple, rest-like web services? Network.Curl? If not, which other? Hi, 1. I don't think so. 2. Maybe Twidge, on hackage [1] 3. Have also a look at Network.Browser [2] Cheers, Thu [1] http://hackage.haskell.org/package/twidge [2] http://hackage.haskell.org/packages/archive/HTTP/latest/doc/html/Network-Browser.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] TDD in Haskell
I'm doing TDD in pretty much all of the languages that I know, and I want to introduce it early in my Haskell learning process. I wonder though, if there's some established process regarding TDD, not unit testing. TDD can be deciphered as Type Driven Design, and right now not so many languages would allow you to experience this. Take a look at this previous post here: http://www.haskell.org/pipermail/haskell-cafe/2010-May/077154.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a web service client
Hello, Thanks for all the links. It seems that I have a lot to study before I produce a decent library :) The Network.HTTP package looks nice too. It seems to be at the right level of abstraction compared to Network.Browser. I have to get used with searching the Hackage repository... :) On 5/25/10 3:12 PM, Christopher Done wrote: Hello Ionut, On 25 May 2010 13:26, Ionut G. Stanionut.g.s...@gmail.com wrote: The first step that I want to undertake is to write a client library for the GitHub API, so my questions would be: 1. Is there any such library? I don't know of nor have seen such a library on Hackage or Github. There was some brief talk on StackOverflow[1], but nothing about a full library. I would be interested in using such a library as I am an enthusiastic user of Github. [1]: http://stackoverflow.com/questions/1816092/using-the-github-gist-api-from-haskell 2. What other client library should I consider as an API model? Or maybe there's some paper/blog post on how do design a Haskell API? There are some good examples of Haskell code that uses REST-ish APIs.[1][2][3][4] Regarding designing a Haskell API, Real World Haskell has some chapters about that.[5] My personal advice would be at least to ensure you make it cabal-install-able, so that entails having a proper cabal file, documented with Haddock format, with QuickCheck test cases if appropriate, and provide one or two examples in the documentation, see Don's guide about writing a Haskell program[8]. [1]: http://hackage.haskell.org/package/flickr [2]: http://hackage.haskell.org/package/twitter [3]: http://hackage.haskell.org/package/feed-cli [4]: http://hackage.haskell.org/package/Bitly [5]: http://book.realworldhaskell.org/read/writing-a-library-working-with-json-data.html [6]: http://book.realworldhaskell.org/read/io-case-study-a-library-for-searching-the-filesystem.html [7]: http://book.realworldhaskell.org/read/advanced-library-design-building-a-bloom-filter.html [8]: http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program 3. What network package do people use for accessing simple, rest-like web services? Network.Curl? If not, which other? Network.Curl is OK but it relies on a C library which is another dependency and it's maybe preferable to use the HTTP library or similar library written in pure Haskell, that you can find on Hackage. -- Ionuț G. Stan | http://igstan.ro ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] TDD in Haskell
On 25 May 2010 13:36, Ionut G. Stan ionut.g.s...@gmail.com wrote: I'm doing TDD in pretty much all of the languages that I know, and I want to introduce it early in my Haskell learning process. I wonder though, if there's some established process regarding TDD, not unit testing. I've heard of QuickCheck and HUnit, but I've also read that QuickCheck is used mostly for testing pure code, while HUnit for impure code? What framework lends itself better for writing tests before the actual production code? Can you point out to some resources regarding this? Real World Haskell has a chapter dedicated to writing Tests for your code using QuickCheck[1]. The writers of this book work in industries where well tested programs are essential. Personally I suppose I follow a methodology of type driven development followed by tests. I wrote a simple Emacs library to make testing QuickCheck properties easier[2]. It's convenient because it lets you check a function when your cursor is at the definition, or test all properties in the current file. It picks up properties by symbols named foo_prop, where foo is the function that the foo_prop property is written for. Maybe this workflow suites your needs. Oh, and a small off-topic question? Is it considered a good practice to use implicit imports in Haskell? I'm trying to learn from existing packages, but all those import all statements drive me crazy. I would follow tibbe's Haskell style guide[3] because it is strict and reasonable. To quote it on this topic: Always use explicit import lists or qualified imports for standard and third party libraries. This makes the code more robust against changes in these libraries. Exception: The Prelude. [1]: http://book.realworldhaskell.org/read/testing-and-quality-assurance.html [2]: http://www.emacswiki.org/emacs-en/QuickCheckHaskell [3]: http://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] TDD in Haskell
On 5/25/10 2:50 PM, Daniel Fischer wrote: On Tuesday 25 May 2010 13:36:01, Ionut G. Stan wrote: Hi, I'm doing TDD in pretty much all of the languages that I know, and I want to introduce it early in my Haskell learning process. I wonder though, if there's some established process regarding TDD, not unit testing. I've heard of QuickCheck and HUnit, but I've also read that QuickCheck is used mostly for testing pure code, while HUnit for impure code? And ghci or hugs are the most used tools for testing, be the code pure or impure. Well, probably. I'm looking for an automated solution though. I want to be able to rerun the tests on every commit or version release. What framework lends itself better for writing tests before the actual production code? Can you point out to some resources regarding this? You can write the QuickCheck properties that your functions should satisfy before implementing the functions. However, when you've determined the specs, it's rather unimportant whether you write the properties first or the functions, IMO. It may be true. I've got accustomed though to write code in iterative steps, where I first think about the smallest feature that I want to implement, then write the test, then again feature - test - code/refactor. I will certainly have to adapt my work flow within the Haskell way of doing things, until then though I'll start from what I know has produced good results for me and change it along the way. Oh, and a small off-topic question? Is it considered a good practice to use implicit imports in Haskell? Generally, no. It's considered good practice to use explicit import (and export, of course) lists. But as lazy programmers, we can't always resist the temptation to skip some not strictly necessary work. The implicit import of the entire Prelude is a special case, modules from the same package are edge cases, but otherwise it's a code smell. I thought so. Good to know. I'm trying to learn from existing packages, but all those import all statements drive me crazy. Thanks, ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Thanks, -- Ionuț G. Stan | http://igstan.ro ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] TDD in Haskell
On Tue, May 25, 2010 at 12:36 PM, Ionut G. Stan ionut.g.s...@gmail.com wrote: Oh, and a small off-topic question? Is it considered a good practice to use implicit imports in Haskell? I'm trying to learn from existing packages, but all those import all statements drive me crazy. It's pretty common but I don't like it. Whenever I have to debug someone else's code usually the first thing I'll do is make all the import lists explicit so I can work out where a troublesome function is coming from, and that's a bit of a waste of time. In some cases though it can get a little silly. Here is an import statement from one of my projects: import Language.Haskell.Exts ( Alt (Alt), Binds (BDecls), Decl (PatBind, FunBind, InfixDecl), Exp (App, Case, Con, Do, If, InfixApp, Lambda, LeftSection, Let, List, Lit, Paren, RightSection, Tuple, Var, XPcdata), GuardedAlt (GuardedAlt), GuardedAlts (UnGuardedAlt, GuardedAlts), Literal (Char, Frac, Int, String), Match (Match), Op (ConOp, VarOp), Pat (PApp, PInfixApp, PList, PLit, PParen, PTuple, PVar, PWildCard), Name (Ident, Symbol), QName (Special, UnQual), QOp (QConOp, QVarOp), Rhs (UnGuardedRhs), SpecialCon (Cons), SrcLoc (), -- (SrcLoc), Stmt (Generator, LetStmt, Qualifier), preludeFixities, prettyPrint ) ...there comes a certain point where one can probably leave the biggest import implicit, on the basis that if it's from nowhere else, it's probably there. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] TDD in Haskell
On 25/05/10 12:36, Ionut G. Stan wrote: Hi, I'm doing TDD in pretty much all of the languages that I know, and I want to introduce it early in my Haskell learning process. I wonder though, if there's some established process regarding TDD, not unit testing. I've heard of QuickCheck and HUnit, but I've also read that QuickCheck is used mostly for testing pure code, while HUnit for impure code? I tend to use HUnit more than QuickCheck (even for pure code), but that may be a reflection of the projects I've worked on. Reasons why I have used HUnit: - Writing an Arbitrary instance for a data type wasn't worth the effort. When writing a nanopass compiler, it seemed like too much effort to write an Arbitrary instance to produce a valid fragment of AST for that particular pass (given that each pass would probably need a different instance). Problems with the instance include: * If I allowed every instance to generate the full variety of AST elements, the chances of generating an AST fragment that tested the pass in question would be vanishingly small, which would require customising the instance (or adding generation conditions) in fiddly ways for each pass to make sure I got good coverage. * For most passes, the AST must obey many pre-conditions, such as all variables being declared before use, all expressions type-checking, passing various safety/sanity checks and so on. All these (and different sets of them) would need to be considered for each Arbitrary instance, which adds a lot of effort to the instance generation, when I can easily craft a few targeted pieces of input myself. - With some functions I can provide an exhaustive check of all inputs, for which QuickCheck is ill-suited. This would suit SmallCheck and LazySmallCheck, but often it's just easier to write something like: assertTrue $ and [checkResult x (f x) | x - allInputs] than to use the other frameworks. - For QuickCheck 1, testing of things like IO actions was very difficult (I think unsafePerformIO was needed?) but QuickCheck 2 is much better in that regard once you've gone the hang of it. More generally, I often think it is less effort to test the corner/edge cases carefully with HUnit than it is to express the properties of the function (and the properties are almost always noticeably longer than the function being tested) and construct an Arbitrary instance that produces valid input. Perhaps I just haven't worked on the right projects for QuickCheck or haven't got into the property-based testing mindset, though. Thanks, Neil. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] TDD in Haskell
On Tuesday 25 May 2010 14:36:46, Ionut G. Stan wrote: On 5/25/10 2:50 PM, Daniel Fischer wrote: On Tuesday 25 May 2010 13:36:01, Ionut G. Stan wrote: Hi, I'm doing TDD in pretty much all of the languages that I know, and I want to introduce it early in my Haskell learning process. I wonder though, if there's some established process regarding TDD, not unit testing. I've heard of QuickCheck and HUnit, but I've also read that QuickCheck is used mostly for testing pure code, while HUnit for impure code? And ghci or hugs are the most used tools for testing, be the code pure or impure. Well, probably. I'm looking for an automated solution though. I want to be able to rerun the tests on every commit or version release. Good practice. You can configure darcs to run the tests on every record (or version-tag or whatever). The testing in ghci/hugs is primarily done while writing the code, after that QuickCheck takes over. What framework lends itself better for writing tests before the actual production code? Can you point out to some resources regarding this? You can write the QuickCheck properties that your functions should satisfy before implementing the functions. However, when you've determined the specs, it's rather unimportant whether you write the properties first or the functions, IMO. It may be true. I've got accustomed though to write code in iterative steps, where I first think about the smallest feature that I want to implement, then write the test, then again feature - test - code/refactor. I will certainly have to adapt my work flow within the Haskell way of doing things, until then though I'll start from what I know has produced good results for me and change it along the way. You will have to adapt your way of thinking about your tasks to Haskell (discover new fun ways of doing things :D), but I see no reason why you should stop writing the tests first. What I meant is, once you know what the function should do, it's not important whether you write the Quickcheck property before the function or the other way round - you can't run the tests before both are written anyway :) Of course, if you write the tests first, you don't risk omitting them. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] currying combinators
Hi all, I've posted some code on hpaste http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=25694 in which I attempt to develop a currying combinator library. I'm stuck at some point and would appreciate any help. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] [ANNOUNCE] SyntaxMacros-0.1
We are pleased to announce the first release of SyntaxMacros [1]. SyntaxMacros is an EDSL for constructing compilers out of a collection of pre-compiled, statically type-checked, possibly mutually dependent ``language-definition fragments''. This way of constructing a compiler brings syntax macros for free. This approach is based on a collection of techniques we have previously developed: - transformation of typed abstract syntax trees [2] makes it possible to construct parsers on the fly in a type-safe way - parser combinators [3] make it possible to construct parsers dynamically - first-class attribute grammars [4] make it possible to define semantics in a compositional way More information can be found at: http://www.cs.uu.nl/wiki/Center/SyntaxMacrosForFree Regards, Marcos Viera, Doaitse Swierstra, Atze Dijkstra and Arthur Baars [1]- http://hackage.haskell.org/package/SyntaxMacros [2]- http://www.cs.uu.nl/wiki/Center/TTTAS [3]- http://www.cs.uu.nl/wiki/bin/view/HUT/ParserCombinators [4]- http://www.cs.uu.nl/wiki/Center/AspectAG ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a web service client
I've been playing around with creating a binding for Zenfolio's JSON-RPC API for the last few days. I've been looking at Sigbjorn Finne's excellent packages on Hackage for guidance, including flickr, delicious, and hs-twitter. I've also been looking at HTTP's Network.Browser and HAXR's Network.XmlRpc since I'm having to implement the underying JSON-RPC protocol too (again based on Sigbjorn's excellent json package). -md begin Ionut G. Stan quotation: Hello, Thanks for all the links. It seems that I have a lot to study before I produce a decent library :) The Network.HTTP package looks nice too. It seems to be at the right level of abstraction compared to Network.Browser. I have to get used with searching the Hackage repository... :) On 5/25/10 3:12 PM, Christopher Done wrote: Hello Ionut, On 25 May 2010 13:26, Ionut G. Stanionut.g.s...@gmail.com wrote: The first step that I want to undertake is to write a client library for the GitHub API, so my questions would be: 1. Is there any such library? I don't know of nor have seen such a library on Hackage or Github. There was some brief talk on StackOverflow[1], but nothing about a full library. I would be interested in using such a library as I am an enthusiastic user of Github. [1]: http://stackoverflow.com/questions/1816092/using-the-github-gist-api-from-haskell 2. What other client library should I consider as an API model? Or maybe there's some paper/blog post on how do design a Haskell API? There are some good examples of Haskell code that uses REST-ish APIs.[1][2][3][4] Regarding designing a Haskell API, Real World Haskell has some chapters about that.[5] My personal advice would be at least to ensure you make it cabal-install-able, so that entails having a proper cabal file, documented with Haddock format, with QuickCheck test cases if appropriate, and provide one or two examples in the documentation, see Don's guide about writing a Haskell program[8]. [1]: http://hackage.haskell.org/package/flickr [2]: http://hackage.haskell.org/package/twitter [3]: http://hackage.haskell.org/package/feed-cli [4]: http://hackage.haskell.org/package/Bitly [5]: http://book.realworldhaskell.org/read/writing-a-library-working-with-json-data.html [6]: http://book.realworldhaskell.org/read/io-case-study-a-library-for-searching-the-filesystem.html [7]: http://book.realworldhaskell.org/read/advanced-library-design-building-a-bloom-filter.html [8]: http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program 3. What network package do people use for accessing simple, rest-like web services? Network.Curl? If not, which other? Network.Curl is OK but it relies on a C library which is another dependency and it's maybe preferable to use the HTTP library or similar library written in pure Haskell, that you can find on Hackage. -- Ionuț G. Stan | http://igstan.ro ___ 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] Haskell, Queries and Monad Comprehension
I would be intrested in seeing this! Could you paste or upload it somewhere? 2010/5/24 C. McCann c...@uptoisomorphism.net: 2010/5/23 Günther Schmidt gue.schm...@web.de: is there anybody currently using Haskell to construct or implement a query language? I've a half-baked, type-indexed (in HList style) implementation of relational algebra lying around somewhere, if that counts as a query language. I was experimenting with using it as a sort of abstract collection interface, which actually worked rather nicely I think, but I didn't have time to flesh it out completely. In particular, only very simple queries and limited kinds of relation composition were supported. Definitely just toy code, though, and dreadfully inefficient; if you're looking for an actual implementation meaning usable interface to an external persistence layer then disregard this. - C. ___ 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] currying combinators
Günther Schmidt wrote: http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=25694 in which I attempt to develop a currying combinator library. I'm stuck at some point and would appreciate any help. How about this: keep :: ((t - b) - u - b) - ((t1 - t) - b) - (t1 - u) - b so then nameZip = keep (drop' . drop') names Regards, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Re: Data instance for a GADT
There have been a couple of emails about Template Haskell support for · GADTs · View patterns · Reifying instances There’s a ticket for this already http://hackage.haskell.org/trac/ghc/ticket/3497 It’s mainly a library design question, in this case the design of the Template Haskell data types in Language.Haskell.TH.Syntax. It needs some motivated person to propose a design, get a consensus, and write some boilerplate code. Just use the standard libraries process An issue is the extent to which it’s ok to change the Template Haskell data types (and thereby break people’s code), but that’s something the interested parties can work out together. If you evolve a consensus design I’m more than happy to make it part of GHC. I just don’t want to drive the consensus building! Simon From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Ozgur Akgun Sent: 14 April 2010 10:53 To: Haskell cafe Subject: [Haskell-cafe] Re: Data instance for a GADT Seeing this old thread[1], I hope something happened towards enabling this. Does anybody know the current status about using TH on GADTs? [1] http://www.haskell.org/pipermail/template-haskell/2006-August/000567.html On 14 April 2010 10:32, Ozgur Akgun ozgurak...@gmail.commailto:ozgurak...@gmail.com wrote: answering to myself: I guess this is related: http://hackage.haskell.org/trac/ghc/ticket/3497 On 14 April 2010 10:13, Ozgur Akgun ozgurak...@gmail.commailto:ozgurak...@gmail.com wrote: Cafe, How can I provide a Data instance for a GADT? I am trying to TH on it, and Uniplate requires Data. I tried StandaloneDeriving, but it seems not to work. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] TDD in Haskell
On 25 May 2010 13:25, Christopher Done chrisd...@googlemail.com wrote: I would follow tibbe's Haskell style guide[3] because it is strict and reasonable. To quote it on this topic: Always use explicit import lists or qualified imports for standard and third party libraries. This makes the code more robust against changes in these libraries. Exception: The Prelude. [3]: http://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md The possible advantage in robustness is pretty small - if the imported library adds and exports a new definition using a name you were already using then you'll get a name conflict. The GHC style guide has better[*] reasons for avoiding them: http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle [*] Better - as in it conforms to my prejudice Best wishes Stephen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Exception: : changeWorkingDirectory: does not exist (No such file or directory)
there must have been some linker incompatibility. gentoo must have updated some library that ghci depended on causing this breakage. I re-installed ghc and everything started working. On Mon, May 24, 2010 at 1:19 PM, Daniel Fischer daniel.is.fisc...@web.de wrote: On Monday 24 May 2010 21:35:10, Anatoly Yakovenko wrote: :set -fglasgow-exts Can't you be more discriminating and turn on only those extensions you regularly use? :set prompt Thats all i have in my .ghci file Shouldn't cause a cd. Maybe $ ghci -v4 would give a hint? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Declaring a tuple of instances of Enums as an instance of the Enum class
Daniel Fischer schrieb: On Sunday 23 May 2010 15:33:58, Ivan Lazar Miljenovic wrote: R J rj248...@hotmail.com writes: Say I've got a type Month declared as an instance of the Enum class, and a type MonthPair declared as a pair of months: data Month = January | February | March | April | May | June | July | August | September | October | November | December deriving (Eq, Enum, Ord, Show) type MonthPair = (Month, Month) deriving (Enum) The deriving on MonthPair gives me the error parse error on input deriving'. You can't derive instances for type aliases (as its mainly there for documentation reasons, etc.). However, pairs don't have Enum instances by default so you still can't use its instance. If you define data MonthPair = MonthPair Month Month then you should be able to derive Enum. No, per the report (http://haskell.org/onlinereport/derived.html) Derived instance declarations for the class Enum are only possible for enumerations (data types with only nullary constructors). You might define an instance more generally: data EnumPair a b = EnumPair a b instance (Enum a, Bounded b, Enum b) = Enum (EnumPair a b) where ... Then define something like fromEnum (EnumPair a b) = (maxBound - minBound)*a + b (needs still some asTypeOf's and fromEnum's) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] MultiParamClasses question
Hello, all! I'm trying to create set of polymorphic functions for working with custom containers. I decided to try out typeclass and define generic function, which uses the methods from the typeclass. The quick and naive solution is listed below: {-# OPTIONS_GHC -XMultiParamTypeClasses -XTypeSynonymInstances #-} import Data.List as L class Storage k t a b where stExists :: k - t - b - Bool stAdjust :: k - t - ( a - a ) - b - b stInsert :: k - t - a - b - b stList :: b - [a] type IxPair k t = ( k, t, String, String) data Pair = Pair { name, value :: String } type IxPairParser k t = Pair - Maybe (IxPair k t) type RecordUpdateF r = String - String - r - r convertPairsToRecords :: (Storage k t a b) = b - RecordUpdateF a - IxPairParser k t - a - [Pair] - [a] convertPairsToRecords storg updateRecF parsePairF initRec = stList . processWithPairs where processWithPairs = foldl' ( (. parsePairF) . updateStorage ) storg updateStorage st Nothing = st updateStorage st ( Just (idx, sType, name, value) ) | stExists idx sType st = stAdjust idx sType (updateRecF name value) st | otherwise = stInsert idx sType (updateRecF name value initRec) st so I want to provide methods for checking if a record with given key exists, update a record, insert a record and get list of records. Sounds similar as for Map, but I want also to be able to operate on map of maps, or lists, or whatever. I don't really see any problem with the code above, however GHC 6.12.1 does think that I am doing something weird. And it gives me this error log: test.hs:19:60: Could not deduce (Storage k t a1 b) from the context (Storage k1 t1 a1 b) arising from a use of `stList' at test.hs:19:60-65 Possible fix: add (Storage k t a1 b) to the context of the type signature for `convertPairsToRecords' In the first argument of `(.)', namely `stList' In the expression: stList . processWithPairs In the definition of `convertPairsToRecords': convertPairsToRecords storg updateRecF parsePairF initRec = stList . processWithPairs where processWithPairs = foldl' ((. parsePairF) . updateStorage) storg updateStorage st Nothing = st updateStorage st (Just (idx, sType, name, value)) | stExists idx sType st = stAdjust idx sType (updateRecF name value) st | otherwise = stInsert idx sType (updateRecF name value initRec) st test.hs:21:53: Could not deduce (Storage k1 t1 a b) from the context (Storage k1 t1 a1 b) arising from a use of `updateStorage' at test.hs:21:53-65 Possible fix: add (Storage k1 t1 a b) to the context of the type signature for `convertPairsToRecords' In the second argument of `(.)', namely `updateStorage' In the first argument of `foldl'', namely `((. parsePairF) . updateStorage)' In the expression: foldl' ((. parsePairF) . updateStorage) storg Can somebody please advice, what am I doing in wrong way? Thank you all in advance! -- Eugene Dzhurinsky pgpzU1NdMQ3jN.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] MultiParamClasses question
Hi Eugeny Its not that GHC thinks you're doing something weird, but that there is no relation between the type parameters in the Storage class. You could use either functional dependencies or type families to introduce a relation / relations, but personally I would look at doing something simpler - for instance why do you need a map type that is polymorphic on shape? Best wishes Stephen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Cabal sqlite3 installation problems
i have this exact problem, on linux x86_64, as well. b Hok Shun Poon fushunpoon at googlemail.com Sun May 23 19:51:20 EDT 2010 Previous message: memory useage of data types in the time package Next message: Text.Regex library with bytestrings? Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Hello, This is a question about how cabal-install finds 'installed foreign libraries' when trying to satisfy dependencies for packages like hdbc-sqlite3 on Windows. Sadly, the current setup means that I must use Windows 7 to develop code. I've already followed steps on http://wiki.github.com/jgoerzen/hdbc/frequentlyaskedquestions to place the .dll and the .h files in the correct places; it's just that cabal never seems to find it, despite being given --extra-lib-dirs= and --extra-include-dirs= directives. The message is as follows: cabal install hdbc-sqlite3 --extra-lib-dirs=D:\dev\libs\database\sqlite Resolving dependencies... Configuring HDBC-sqlite3-2.3.0.0... cabal: Missing dependency on a foreign library: * Missing C library: sqlite3 This problem can usually be solved by installing the system package that provides this library (you may need the -dev version). If the library is already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where it is. cabal: Error: some packages failed to install: HDBC-sqlite3-2.3.0.0 failed during the configure step. The exception was: ExitFailure 1 The strangest thing is, I've successfully made cabal build this package before (with a different version of Haskell Platform)... what's going on? I'm using cabal-install version 0.8.2 and Cabal library version 1.8.0.2. Hok ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] MultiParamClasses question
On Tue, 25 May 2010, Eugeny N Dzhurinsky wrote: I'm trying to create set of polymorphic functions for working with custom containers. I decided to try out typeclass and define generic function, which uses the methods from the typeclass. The quick and naive solution is listed below: There are also frameworks for dealing with different kinds of containers like Edison. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] MultiParamClasses question
On Tuesday 25 May 2010 20:51:06, Eugeny N Dzhurinsky wrote: Hello, all! I'm trying to create set of polymorphic functions for working with custom containers. I decided to try out typeclass and define generic function, which uses the methods from the typeclass. The quick and naive solution is listed below: As Stephen said, FunctionalDependencies and TypeFamilies are two options. The problem is that stList is unusable because there's no way to find out which instance to use (determine k and t) from a use of stList. Also, you can't determine a from a use of stExists, so that's unusable, too. You could make all class parameters depend on b (via FunDeps or TypeFamilies), or - make b a type constructor of kind (* - *) and - move stList to its own class. class StList b where stList :: b a - [a] class Storage k t b where stExists :: k - t - b a - Bool stAdjust :: k - t - (a - a) - b a - b a stInsert :: k - t - a - b a - b a Don't put language extensions in an OPTIONS_GHC pragma, use a LANGUAGE pragma instead. {-# OPTIONS_GHC -XMultiParamTypeClasses -XTypeSynonymInstances #-} import Data.List as L class Storage k t a b where stExists :: k - t - b - Bool stAdjust :: k - t - ( a - a ) - b - b stInsert :: k - t - a - b - b stList :: b - [a] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell, Queries and Monad Comprehension
Günther, On May 24, 2010, at 03:20 , Günther Schmidt wrote: Hi all, is there anybody currently using Haskell to construct or implement a query language? I have read a couple of papers on Monad Comprehension Calculus and similar but none using Haskell nor any other existing programming language to build an actual implementation. Most papers give some sort of Pseudo code, but I couldn't find any meat. we are currently underway building the second version (as in: done right this time) of Ferry, a query compiler that (1) accepts queries over ordered, nested lists, (2) compiles these queries into an intermediate algebraic form, then (3) emits (small bundles of) SQL queries that evaluate the input query over your off-the-shelf RDBMS. We've used Ferry's first version to build new LINQ to SQL providers for Microsoft's LINQ as well as a new code generator for Phil Wadler's Links. The Ferry compiler itself is built in Haskell. Surf to www.ferry-lang.org for more information, screencasts, papers, talks, and contact us for more details. We will be happy to share Ferry's Haskell code once in digestable shape (soon). Cheers, --Torsten -- | Prof. Dr. Torsten Grust torsten.gr...@uni-tuebingen.de | | www-db.informatik.uni-tuebingen.de | | Database Systems - Universität Tübingen (Germany) | ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [reactive] A pong and integrate
Well, first of all, I did not make these PS3 visualization, my former colleagues and I just made the editor, language and runtime that allowed video game artists to do the job for us in a couple of weeks time :-) I wouldn't use Yampa, for performance reasons, and difficulty to get it running on alien platforms (it is well known it performs relatively badly, although the work done by Paul Liu and co on Causal Commutative Arrows looks very promising, but does not support dynamic switching yet). After all, Yampa models a synchronous dataflow language, and compilers for these languages are relatively easy to make IMO. My previous - now defunct - company Anygma spent a lot of money on trying to use Haskell and Reactive for game programming, which unfortunately ended in some nasty GHC bugs popping up (see http://www.haskell.org/haskellwiki/Unamb), and not all problems with Reactive got fixed; it is amazing how difficult this all turned out to be. The GHC bugs are now fixed, so it might be stable enough for another adventure like that, but I don't think I would bet on it again. IMO Haskell is great for writing small clean prototypes, doing interesting research, and maybe making some fun little games, but I wouldn't use it for production reactive game coding, not yet at least. On Tue, May 25, 2010 at 10:49 AM, Limestraël limestr...@gmail.com wrote: Wow... impressive... And now, with your experience, if you'd have to do this again, would you use Yampa or stick up with C#/C++ ? 2010/5/24 Peter Verswyvelen bugf...@gmail.com Yeah. Funny that we're still writing games in C++, while mission critical and hard real time systems are written in much nicer languages :) I made something similar to Lucid Synchrone for a game company I used to work, but with the purpose of making reactive programming accessible to computer artists. The integrated development environment provided the typical boxes-and-links user interface, where the boxes were signal functions. Signals itself were not exposed, like Yampa. The system did type inference so artists never really had to deal with types. Special nodes like feedback and delay where provided to allow transferring values to the next frame. This actually was a great success, digital artists could literally create little interactive applications with it, without much help from programmers. This resulted in a Playstation 3 visual experience Mesmerize (http://www.youtube.com/watch?v=rW7qGhBjwhY). This was before I knew Haskell or functional programming, so it was hacked together in C# and C++... I still believe that the reason why computers artists could work with this environment and were not able to learn imperative programming is functional programming itself: the system had all the goodies of FP: type inference, referential transparancy, etc... But is also provided the possibility to edit literals while the simulation was running, providing zero turnaround times, which was equally important for quick adoption of the software. So IMO Haskell and FRP systems have a huge potential for education of a much broader audience than just computer scientists... On Mon, May 24, 2010 at 6:13 PM, Limestraël limestr...@gmail.com wrote: I assumed also that it was a field which was still under research, however, Lustre, again, is used for critical control software in aircraft, helicopters, and nuclear power plants, according to wikipedia. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell, Queries and Monad Comprehension
Hello Torsten, well thank you for taking the time and answering that. It seems that the one thing I am good for, as far as contributions to this list go, is coaxing answers out of our Functional Pros. :) That is good news then, I was getting frustrated reading fantastic papers which eventually were nothing more than teasers. So, will Ferry then be usable from within Haskell? Best regards Günther Am 25.05.10 21:28, schrieb Torsten Grust: Günther, we are currently underway building the second version (as in: done right this time) of Ferry, a query compiler that (1) accepts queries over ordered, nested lists, (2) compiles these queries into an intermediate algebraic form, then (3) emits (small bundles of) SQL queries that evaluate the input query over your off-the-shelf RDBMS. We've used Ferry's first version to build new LINQ to SQL providers for Microsoft's LINQ as well as a new code generator for Phil Wadler's Links. The Ferry compiler itself is built in Haskell. Surf to www.ferry-lang.org for more information, screencasts, papers, talks, and contact us for more details. We will be happy to share Ferry's Haskell code once in digestable shape (soon). Cheers, --Torsten On May 24, 2010, at 03:20 , Günther Schmidt wrote: Hi all, is there anybody currently using Haskell to construct or implement a query language? I have read a couple of papers on Monad Comprehension Calculus and similar but none using Haskell nor any other existing programming language to build an actual implementation. Most papers give some sort of Pseudo code, but I couldn't find any meat. Günther ___ 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] Haskell, Queries and Monad Comprehension
Hi Günther, On May 25, 2010, at 21:37 , Günther Schmidt wrote: Hello Torsten, well thank you for taking the time and answering that. It seems that the one thing I am good for, as far as contributions to this list go, is coaxing answers out of our Functional Pros. :) That is good news then, I was getting frustrated reading fantastic papers which eventually were nothing more than teasers. So, will Ferry then be usable from within Haskell? Ferry is much more about the compilation of queries (over list-based data models) than the invention of some new query syntax. We thus are mostly after embeddings of queries into existing host languages. Such embeddings exist for -- C#(Ferry-based LINQ to SQL) -- Links (new Ferry-based SQL code generator) -- Ruby (in the works, provides a much richer and arguably more seamless embedding of queries over Ruby arrays as well as relational tables than does ARel or ActiveRevord's find_by* methods). There's some interesting connection between the compilation techniques employed by Ferry and Data Parallel Haskell. I talked to Simon Peyton Jones and he suggested to attempt a Haskell embedding. So, Haskell: not yet. But conceivable. Cheers, --Torsten Am 25.05.10 21:28, schrieb Torsten Grust: Günther, we are currently underway building the second version (as in: done right this time) of Ferry, a query compiler that (1) accepts queries over ordered, nested lists, (2) compiles these queries into an intermediate algebraic form, then (3) emits (small bundles of) SQL queries that evaluate the input query over your off-the-shelf RDBMS. We've used Ferry's first version to build new LINQ to SQL providers for Microsoft's LINQ as well as a new code generator for Phil Wadler's Links. The Ferry compiler itself is built in Haskell. Surf to www.ferry-lang.org for more information, screencasts, papers, talks, and contact us for more details. We will be happy to share Ferry's Haskell code once in digestable shape (soon). Cheers, --Torsten On May 24, 2010, at 03:20 , Günther Schmidt wrote: Hi all, is there anybody currently using Haskell to construct or implement a query language? I have read a couple of papers on Monad Comprehension Calculus and similar but none using Haskell nor any other existing programming language to build an actual implementation. Most papers give some sort of Pseudo code, but I couldn't find any meat. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- | Prof. Dr. Torsten Grust torsten.gr...@uni-tuebingen.de | | www-db.informatik.uni-tuebingen.de | | Database Systems - Universität Tübingen (Germany) | ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Haskell, Queries and Monad Comprehension
2010/5/23 Günther Schmidtgue.schm...@web.de: is there anybody currently using Haskell to construct or implement a query language? I've a half-baked, type-indexed (in HList style) implementation of relational algebra lying around somewhere, if that counts as a query language. I was experimenting with using it as a sort of abstract collection interface, which actually worked rather nicely I think, but I didn't have time to flesh it out completely. In particular, only very simple queries and limited kinds of relation composition were supported. Definitely just toy code, though, and dreadfully inefficient; if you're looking for an actual implementation meaning usable interface to an external persistence layer then disregard this. Well you're on the radar now :) BTW: I'm working on alternative, non-type-indexed version of extensible records (Which I have gathered to be an essential ingredient when you want to roll a Relational Algebra lib). There will be no first-class labels, but there also will be no need for singleton-types either (which is what you need with type-indexed solutions). And a bit less overhead all-around so it's kind making up for not having 1st class labels. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] MultiParamClasses question
On Tue, May 25, 2010 at 07:59:24PM +0100, Stephen Tetley wrote: Hi Eugeny Its not that GHC thinks you're doing something weird, but that there is no relation between the type parameters in the Storage class. You could use either functional dependencies or type families to introduce a relation / relations, but personally I would look at doing something simpler - for instance why do you need a map type that is polymorphic on shape? Currently I am creating set of objects from name-value pairs, and I decided to use Map for keeping relations between an object id and record with the id. So I will be able to parse the parameter like param_1_propname=value then take the object with ID=1 from Map, and update it's property 'propname' with value, and put it back into the Map. But I faced several cases when a set of name-value pairs describes 2 or even more kinds of objects. And I want to be able to parse them all at one pass, so I would need 2 or more maps. And I simply tried to generalize the solution. Probably I should think in different way. May be a chain of Writer monads or something similar. -- Eugene Dzhurinsky pgpziyjo4T7jQ.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Cabal sqlite3 installation problems
Hi Hok, I know the problem and the only solution I found to work is using an older version of cabal.exe. I still have one lying around for these cases, in my Path called cabalOld.exe and use it only in situations like these. Lemme know if I should send it to you. Günther Am 25.05.10 21:05, schrieb Ben: i have this exact problem, on linux x86_64, as well. b Hok Shun Poon fushunpoon at googlemail.com Sun May 23 19:51:20 EDT 2010 Previous message: memory useage of data types in the time package Next message: Text.Regex library with bytestrings? Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Hello, This is a question about how cabal-install finds 'installed foreign libraries' when trying to satisfy dependencies for packages like hdbc-sqlite3 on Windows. Sadly, the current setup means that I must use Windows 7 to develop code. I've already followed steps on http://wiki.github.com/jgoerzen/hdbc/frequentlyaskedquestions to place the ..dll and the .h files in the correct places; it's just that cabal never seems to find it, despite being given --extra-lib-dirs= and --extra-include-dirs= directives. The message is as follows: cabal install hdbc-sqlite3 --extra-lib-dirs=D:\dev\libs\database\sqlite Resolving dependencies... Configuring HDBC-sqlite3-2.3.0.0... cabal: Missing dependency on a foreign library: * Missing C library: sqlite3 This problem can usually be solved by installing the system package that provides this library (you may need the -dev version). If the library is already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where it is. cabal: Error: some packages failed to install: HDBC-sqlite3-2.3.0.0 failed during the configure step. The exception was: ExitFailure 1 The strangest thing is, I've successfully made cabal build this package before (with a different version of Haskell Platform)... what's going on? I'm using cabal-install version 0.8.2 and Cabal library version 1.8.0.2. Hok ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNOUNCE] SyntaxMacros-0.1
We are pleased to announce the first release of SyntaxMacros [1]. Very interesting. This is something I've been interested in since I first heard of Ziggurat. In which order do you recommend I try to learn the packages: HList - AspectAG - SyntaxMacros? I tried to read the SyntaxMacros-paper but had a hard time understanding which parts belonged to the package and which parts belonged to your new mini-language. Do you got the mini-language as a separate download? You mention in the paper that the source of the paper is in literate Haskell and that the code is available but I can't find it at the wiki. I found some code (Expr.hs, Main.hs) in the examples-folder in the packages source code (SyntaxMacrox-0.1.tar.gz) but it doesn't seem to match 1:1 to the code in the paper (couldn't for example find extSpecChars in the paper or updateFinalEnv in the source code). -- Oscar ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] MultiParamClasses question
Hi Eugene You can store different things in a Map by collecting them with a simple 'sum' type: import qualified Data.Map as Map type DateTime = String-- just String for now.. type URL = String type UniqueID = String Here's the sum type: data LogData = LastLogin DateTime | LastLogout DateTime | ReferringURL URL deriving (Eq, Show) type ExtraInfo = Map.Map UniqueID [LogData] addData :: UniqueID - LogData - ExtraInfo - ExtraInfo addData uid prop infos = case Map.lookup uid infos of Nothing - Map.insert uid [prop]infos Just xs - Map.insert uid (prop:xs) infos Note - this stores all the LastLogin's ReferringURLS etc. As the list is LIFO the first @LastLogin@ in the list will be the latest one. If you don't like storing multiples, you could instead recast LogData as a record rather than sum type, but you then have to account for 'missing' data with Maybe's. data LogData2 = LogData2 { last_login:: Maybe DateTime , last_logout :: Maybe DateTime , referring_URL :: Maybe URL } emptyLogData2 :: LogData2 emptyLogData2 = LogData2 Nothing Nothing Nothing type ExtraInfo_ALT = Map.Map UniqueID LogData2 addLastLogin :: UniqueID - DateTime - ExtraInfo_ALT - ExtraInfo_ALT addLastLogin uid lasttime infos = case Map.lookup uid infos of Nothing - Map.insert uid (emptyLogData2 { last_login = Just lasttime}) infos Just ld2 - Map.insert uid (ld2 { last_login = Just lasttime}) infos Make similar functions for last_logout, referring_url. Best wishes Stephen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Math questions
Hello I am try to solve this equation Define a higher order function that tests whether two functions , both defined on integers , coincide for all integers between 1 and 100 how can I solve this ? is there any thing in Haskell library to solve this kind ? -- Mujtaba Ali Alboori ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Math questions
Quoting Mujtaba Boori mujtaba.bo...@gmail.com: Hello I am try to solve this equation Define a higher order function that tests whether two functions , both defined on integers , coincide for all integers between 1 and 100 how can I solve this ? is there any thing in Haskell library to solve this kind ? -- Mujtaba Ali Alboori This sounds like homework. In any case, won't your HOF take as input the two functions and the input range to check. Then think about how you might compare the output of the two functions. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Math questions
On Tuesday 25 May 2010 23:47:30, Mujtaba Boori wrote: Hello I am try to solve this equation Define a higher order function that tests whether two functions , both defined on integers , coincide for all integers between 1 and 100 how can I solve this ? is there any thing in Haskell library to solve this kind ? Sure. Lots of things to do it in different ways. All boil down to - for each integer from 1 to 100 - check whether f i == g i Look at http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Prelude.html , there are useful functions for this. You will probably want to use 'and' or 'all'. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Math questions
Thank you all you , that is really impressive . I will read your response carefully , and I think this it is enough to understand it. On 25 May 2010 23:43, Daniel Fischer daniel.is.fisc...@web.de wrote: On Tuesday 25 May 2010 23:47:30, Mujtaba Boori wrote: Hello I am try to solve this equation Define a higher order function that tests whether two functions , both defined on integers , coincide for all integers between 1 and 100 how can I solve this ? is there any thing in Haskell library to solve this kind ? Sure. Lots of things to do it in different ways. All boil down to - for each integer from 1 to 100 - check whether f i == g i Look at http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Prelude.html , there are useful functions for this. You will probably want to use 'and' or 'all'. -- Mujtaba Ali Alboori ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] TagSoup 0.9
Hi, From what I can tell of your example you've managed to get the raw HTTP response in Unicode, which isn't suitable for sending to tagsoup. I've not used the Network.HTTP library for downloading much, but when I did I thought it stripped the headers automatically. Can you just print the first few lines of the output you get from the HTTP library, without passing them through tagsoup. That should show the problem independent of tagsoup. Thanks, Neil On Mon, May 24, 2010 at 3:24 AM, Ralph Hodgson rhodg...@topquadrant.com wrote: Thanks Neil, Using Network.HTTP worked. However something else I have just run into concerns some web pages that start with: ?xml version=1.0 encoding=iso-8859-1? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; I get the following bad result: TagText HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nLast-Modified: Tue, 27 Oct 2009 19:30:40 GMT\r\nETag: \6f248cf73b57ca1:25e2\\r\nDate: Sun, 23 May 2010 22:46:41 GMT\r\nTransfer-Encoding: chunked\r\nConnection: close\r\nConnection: Transfer-Encoding\r\n\r\n4000\r\n\255\254\NUL?\NULx\NULm\NULl\NUL \NULv\NULe\NULr\NULs\NULi\NULo\NULn\NUL=\NUL\\NUL1\NUL.\NUL0\NUL\\NUL \NULe\NULn\NULc\NULo\NULd\NULi\NULn\NULg\NUL=\NUL\\NULi\NULs\NULo\NUL-\NUL8\NUL8\NUL5\NUL9\NUL-\NUL1\NUL\\NUL etc etc Is this an easy thing to fix? I've started to look over the code. -Original Message- From: Neil Mitchell [mailto:ndmitch...@gmail.com] Sent: Wednesday, May 19, 2010 12:19 PM To: Ralph Hodgson Cc: Daniel Fischer; haskell-cafe@haskell.org; Don Stewart Subject: Re: [Haskell-cafe] TagSoup 0.9 Hi Ralph, I was using TagSoup 0.8 with great success. On upgrading to 0.9 I have this error: TQ\TagSoup\TagSoupExtensions.lhs:29:17: `Tag' is not applied to enough type arguments Expected kind `*', but `Tag' has kind `* - *' In the type synonym declaration for `Bundle' Failed, modules loaded: TQ.Common.TextAndListHandling. My change notes have this being a change between 0.6 and 0.8. As Malcolm says, any old uses of Tag should become Tag String. The reason is that Tag is now parameterised, and you can use Tag ByteString etc. However, I should point out that Tag ByteString won't be any faster than Tag String in this version (it's in the future work pile). Forgot to add: I now need to understand the following warnings on this line import Text.HTML.Download: Everyone's comments have been right. I previously included Text.HTML.Download so that it was easy to test tagsoup against the web. Since I first wrote that snippet the HTTP downloading libraries have improved substantially, so people should use those in favour of the version in tagsoup - you'll be able to connect to more websites in more reliable ways, go through proxies etc. I don't intend to remove the Download module any time soon, but I will do eventually. Thanks, Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: currying combinators
Hi Yitz, embarrassingly I was unable to deduce the implementation from the type signature, don't be tease man, show me what you got :) Günther Am 25.05.10 18:27, schrieb Yitzchak Gale: Günther Schmidt wrote: http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=25694 in which I attempt to develop a currying combinator library. I'm stuck at some point and would appreciate any help. How about this: keep :: ((t - b) - u - b) - ((t1 - t) - b) - (t1 - u) - b so then nameZip = keep (drop' . drop') names Regards, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: currying combinators
Djinn can't figure it out, and neither can I :P 2010/5/25 Günther Schmidt gue.schm...@web.de Hi Yitz, embarrassingly I was unable to deduce the implementation from the type signature, don't be tease man, show me what you got :) Günther Am 25.05.10 18:27, schrieb Yitzchak Gale: Günther Schmidt wrote: http://www.hpaste.org/fastcgi/hpaste.fcgi/view?id=25694 in which I attempt to develop a currying combinator library. I'm stuck at some point and would appreciate any help. How about this: keep :: ((t - b) - u - b) - ((t1 - t) - b) - (t1 - u) - b so then nameZip = keep (drop' . drop') names Regards, Yitz ___ 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] [ANNOUNCE] SyntaxMacros-0.1
Hi Oscar, In which order do you recommend I try to learn the packages: HList - AspectAG - SyntaxMacros? I think HList - TTTAS - AspectAG - SyntaxMacros is the best. I tried to read the SyntaxMacros-paper but had a hard time understanding which parts belonged to the package and which parts belonged to your new mini-language. Do you got the mini-language as a separate download? The examples folder in the package has the implementation of the mini-language and its extension. You mention in the paper that the source of the paper is in literate Haskell and that the code is available but I can't find it at the wiki. I found some code (Expr.hs, Main.hs) in the examples-folder in the packages source code (SyntaxMacrox-0.1.tar.gz) but it doesn't seem to match 1:1 to the code in the paper (couldn't for example find extSpecChars in the paper or updateFinalEnv in the source code). The package includes the code of the paper: - Language.Grammars.Grammar has the grammar representation (section 3.1) - Language.Grammars.SyntaxMacros has the code of the syntax macros library (section 3.3) - The mini-language is in the examples folder, as I said before. Main.hs has the code of the first figures and Expr.hs has the code of the semantics definitions and redefinitons. - updateFinalEnv and the other functions and datatypes showed in section 3.2 are included in the package TTTAS. - extSpecChars and extKeywordsTxt are used to extend the scanner. That's not explained in the paper :-( I hope that helped, if you have any other questions don't hesitate to ask. Regards, marcos ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Declaring a tuple of instances of Enums as an instance of the Enum class
Also, this way lies a bit of madness, since fromEnum/toEnum work on Int, not Integer. This means EnumPair (EnumPair Month Month) (EnumPair Month Month) overflows -- ryan On Tue, May 25, 2010 at 11:30 AM, Henning Thielemann schlepp...@henning-thielemann.de wrote: Daniel Fischer schrieb: On Sunday 23 May 2010 15:33:58, Ivan Lazar Miljenovic wrote: R J rj248...@hotmail.com writes: Say I've got a type Month declared as an instance of the Enum class, and a type MonthPair declared as a pair of months: data Month = January | February | March | April | May | June | July | August | September | October | November | December deriving (Eq, Enum, Ord, Show) type MonthPair = (Month, Month) deriving (Enum) The deriving on MonthPair gives me the error parse error on input deriving'. You can't derive instances for type aliases (as its mainly there for documentation reasons, etc.). However, pairs don't have Enum instances by default so you still can't use its instance. If you define data MonthPair = MonthPair Month Month then you should be able to derive Enum. No, per the report (http://haskell.org/onlinereport/derived.html) Derived instance declarations for the class Enum are only possible for enumerations (data types with only nullary constructors). You might define an instance more generally: data EnumPair a b = EnumPair a b instance (Enum a, Bounded b, Enum b) = Enum (EnumPair a b) where ... Then define something like fromEnum (EnumPair a b) = (maxBound - minBound)*a + b (needs still some asTypeOf's and fromEnum's) ___ 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