Re: [Haskell-cafe] Cairo and Haskell
Hello Paulo, I guess that would be using Cairo so I can have a 2d canvas to draw in and maybe even preview before exporting to PDF. However, I can't find any documentation on Cairo with Haskell or any code examples related to what I want to do. With regard to export to pdf and other formats this might be useful: http://muitovar.com/gtk2hs/app1.html (There's a Spanish translation too.) However, this tutorial is a few years old now, and I don't know if it's still up to date for the later Gtk2Hs versions. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Stone age programming for space age hardware?
That's interesting, writing a DSL that compiles to C. I've actually inerviewed Gerard Holzamann twice, the first time when he received the ACM Software System Award in 2002 [1] and in 2008 after he moved to JPL [2]. What they use to test distributed software is the Process Meta Language (Promela) which models communication between distributed processes. Now Spin checks all possible models for deadlock, liveness etc. You can also use asserts to test conditions, just as in C. It also uses LTL (linear temporal logic) to formulate statements like, will the railroad crossing always eventually open and such. Two articles about Spin are [3] and [4]. Unfortunately, all four are in Dutch, but, hey, surely somebody here must be able to read that language g. The articles on Spin contain listings in Promela. Now, what Gerard Holzmann told me in the interview, is that NASA is very conservative in it's use of software tools. They don't use C++, just C, and a well defined version of the GNU C compiler at that. The coding standards, which even prohibit the use of C pointers, are aimed to keep everything as simple as possible. Just imagine hundreds of people working over many years to produce code where any error, how trivial it may be, will occur millions of miles away, cost hundreds of millions of dollars, and could damage the reputation of the company and its future funding. Now, if you can use a DSL to make embedded software absolutely failsafe, that would certainly grab NASA's attention. But again, they are very conservative, it seems... [1] http://muitovar.com/pub/pdf/holzmann.pdf [2] http://muitovar.com/pub/pdf/acmaw.pdf [3] http://muitovar.com/pub/pdf/spin1.pdf [4] http://muitovar.com/pub/pdf/spin2.pdf On Tue, 2010-06-08 at 18:27 +0200, Heinrich Apfelmus wrote: Michael Schuerig wrote: I was dumbfounded, although I have known all this. I have no personal experience with either embedded or real time software, but I've been aware that C still is the most popular language for that purpose and that coding standards are very restrictive. The real reason behind my surprise was, that I was wondering how more modern languages could make inroads into such an environment. Haskell without recursion and dynamic memory allocation? Hard to imagine. I have absolutely no experience with real time system, but if I were tasked to write with these coding standards, I would refuse and instead create a small DSL in Haskell that compiles to the requested subset of C. After all, the question is this: why use C if you don't actually use C? The reason is probably that designing/writing a proper DSL is considered too error prone, but with today's theorem provers, this should no longer be the case. Regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell and the Job Market, e.g. with Google
Hello, Somewhat in response to the original post about Haskell engineers I, II and III. This confirms the remark that Haskell experience is now being appreciated, though not (yet) used (very much). Steven Grant, recruiter from Google, asked me to bring to his attention anyone who might be suitable, so that's what I'm doing. start quote We are currently aggressively recruiting for a large number of engineers in EMEA. I spotted your extensive open source experience and was particularily interested to see you have worked with Haskell. I am not looking for a Haskell developer but more interested in people that have worked in exotic languages such as Haskell or Erlang or Scheme. The roles we have are heavily open sourced based and will be mainly working with Python, C, Linux, shell etc and are based in Dublin, London or Zurich. If you have any interest in discussing these further, drop me an email to stevengr...@google.com and we can discuss. end quote From a second email: start quote The job specs are below. http://www.google.ie/support/jobs/bin/answer.py?answer=34884 http://www.google.ie/support/jobs/bin/answer.py?answer=34883 The roles are within a very specialist team within Google. They are a hybrid type role and are responsible for making our products reliable scalable and more efficient. end quote Get in touch with Steven: Steven Grant European IT Staffing Phone: +353 1 543 5083 Google Ireland Ltd., Barrow Street, Dublin 4, Ireland Registered in Dublin, Ireland Registration Number: 368047 I think this is interesting even to those who are not looking for a job right now, since it shows the current mind-set regarding Haskell, at a major and leading IT company. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Ann: Emping-0.6 and Tests/Examples
Hello All, Version 0.6 of Emping is now, imo, at the level of a working prototype. It is available on Hackage (but won't build there because it uses Gtk2Hs. It did build with Cabal on FC8 with GhC 6.8 and Gtk2Hs 0.9.13). The package includes a user guide, but see the update on my web site about two UI corner case bugs (program hangs). My site http://www.muitovar.com discusses three examples of possible use, with tests using SQLite, OO Calc and dotty. There's also a .zip archive of all sources (two data sets from the UCI machine learning repository) and .csv and .dot files with the results. All comments most welcome... Emping is a (prototype) interactive tool for the discovery and analysis of (universal, not statistical) predictive rules in tables of nominal data. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Confusion on the third monad law when using lambda abstractions
On Wed, 2009-06-17 at 21:26 -0500, Jake McArthur wrote: Jon Strait wrote: I'm reading the third (bind associativity) law for monads in this form: m = (\x - k x = h) = (m = k) = h Arguably, that law would be better stated as: (h = k) = m = h = (k = m) This wouldn't be so unintuitive. Hi, The only place I've ever seen Kleisli composition, or its flip, used is in demonstrating the monad laws. Yet it is so elegant and, even having its own name, it must have some practical use. Do you, or anybody else, have some pointers? Best Regards, Hans van Thiel - Jake ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Confusion on the third monad law when using lambda abstractions
On Thu, 2009-06-18 at 08:34 -0500, Jake McArthur wrote: [snip] So, `(=)` is just like `($)` except for the information carried along by the monad. Anyway, the obvious thing to do is to drop the `x` from both sides of the definition for `bar`. To do that with `foo` earlier, we had to substitute `($)` with `(.)`. What we are looking for is an equivalent operator for monads: (.) ::(b c) - (a - b) - (a - c) Just to show I'm paying attention, there's an arrow missing, right? (.) ::(b - c) - (a - b) - (a - c) Many thanks, also to the others who've replied. I've wondered about (=) usage for a long time too, and this is all very illuminating. I'll work this through and put it in my monad tutorial, if I may (without implicating you guys in any way, of course, unless you insist...) Regards, Hans van Thiel [snip] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] May all logos be freely used?
Hello, What's the status of the logos on http://www.haskell.org/logos/results.html I'd like to use one or more in an about message in a Haskell program. Is this allowed, and if so, are there any conditions? I've just looked at them again, and it's a really fine collection, I think. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] FGL Question
[snip] Hi Hans, I believe the problem is to do with the inductive nature of the FGL library. A graph in FGL is a series of contexts, each corresponding to a node. Each context contains lists of links to/from the latest node to nodes in previous contexts. Each link is only recorded once, and whether it appears in the context for the source or destination node depends on the order that the graph is constructed. Ah, that was my mistake! I thought a context was an 'in' adjacency list, a node, a label and and 'out' adjacency list, and this for each node. So each link would be recorded twice! Based on this assumption I tried to, and thought I did, construct a new unconnected graph. [snip] Based on the idea that gsel didn't work as I expected, I already found a workaround, but your example solutions look better. I'll look at my code again. Many thanks for your helpful reply! Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] FGL Question
Hello, I want to get the top or the bottom elements of a graph, but the following code appears to give the wrong answer in most cases, and the right answer in a few cases. Any ideas? -- get the most general or the least general elements graphMLGen :: Bool - Gr [Rule] () - Gr [Rule] () graphMLGen pm gr = buildGr unctxls where unctxls = map remadj ctxls remadj (_,n,r,_) = ([],n,r,[]) ctxls | pm = gsel (\x - outdeg' x == 0) gr | otherwise = gsel (\x - indeg' x == 0) gr Many thanks, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What are side effects in Haskell?
On Sat, 2008-12-27 at 11:54 -0600, Jake McArthur wrote: Hans van Thiel wrote: However, some functions in Haskell may have side effects, like printing something on the screen, updating a database, or producing a random number. These functions are called 'actions' in Haskell. Not really true (disregarding things like unsafePerformIO). I haven't been following this thread, so I don't know if anybody else has suggested this, but perhaps it would be helpful to distinguish between evaluating expressions and performing actions. Evaluation is simply graph reduction, which is Haskell's only method of computation. There are no side-effects when you evaluate an expression (again, disregarding unsafePerformIO and company), even if that expression evaluates to an IO action. To perform an action is to cause the side-effect which that action represents. *You* never perform an action in Haskell. The runtime does. All you do is say how to evaluate those actions. Essentially, what the IO monad does is give you a DSL for constructing (by evaluation) effectful, imperative programs at runtime. The runtime will cause your program to evaluate the next action, then perform it, then cause your program to evaluate the next action, then perform it, and so on. At no point is the purity of your program broken by this. [snip] I'm starting to understand it now...thanks again to everybody for all the helpful replies! Best regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Request for feedback: Understanding Haskell Monads
On Sat, 2008-12-27 at 02:35 +0100, Ertugrul Soeylemez wrote: Hello fellow Haskellers, In the last few weeks I have written a comprehensive tutorial about Haskell monads [1], and I was hoping to get some constructive feedback. I'd appreciate any well meant criticism. [1] http://ertes.de/articles/monads.html Greets, Ertugrul. Looks pretty good to me! Could you add a link in the Haskell tutorials section? Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What are side effects in Haskell?
On Fri, 2008-12-26 at 15:38 +0100, Peter Verswyvelen wrote: Using GHCi I found it informative to see that IO indeed is a kind of state monad. Here's a GHCi session to show that: Prelude :m GHC.Prim Prelude GHC.Prim :i IO newtype IO a = GHC.IOBase.IO (State# RealWorld - (# State# RealWorld, a #)) -- Defined in GHC.IOBase instance Monad IO -- Defined in GHC.IOBase instance Functor IO -- Defined in GHC.IOBase So every IO a action takes the RealWorld as input, and outputs the RealWorld and some extra value a :) [snip] Thanks to all who've replied! So, the way I get it, everything in Haskell is a function, including IO. Moreover, there exist mathematical foundations for what functions are, in set theory and, more modern, more expressive, in category theory. However, some functions in Haskell may have side effects, like printing something on the screen, updating a database, or producing a random number. These functions are called 'actions' in Haskell. Now I'm starting to guess... There is no mathematical foundation for these side effects (likewise for persistent data), yet they are needed sometimes. However, there is a mechanism (sometimes) to compose functions using an extra type m a, m b, m c etc. instead of types a, b, c... This does not solve the problem concerning side effects, but it does provide a sort of 'Chinese boxes' to contain them within these type constructors m. Moreover, in the case of the type designation 'IO ...', you can't get anything out of the box. So now, at least, you've got a clean interface between the parts of your program which do not involve side effects, and the 'actions'. If I guess correctly, then the general statement 'monads are for actions' is wrong. It should be something like, 'monadic composition is a useful method of generalization, which, by the way, allows you to isolate side effects in a controlled manner'. Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] What are side effects in Haskell?
Hello All, I just saw somewhere that one of the purposes of monads is to capture side effects. I understand what a side effect is in C, for example. Say you want to switch the contents of two variables. Then you need a third temporary variable to store an intermediate result. If this is global, then it will be changed by the operation. But what is a side effect in an fp language like Haskell? As a follow up, I understand why an IO action like getLine or getChar is not a function; its results can be different for different calls. But why not have something like getChar c or getLine str? The types of c or str are pretty clear, aren't they? Just something that's been puzzling me for some time now...thanks. Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Proof of a multi-threaded application
On Mon, 2008-11-17 at 05:52 -0700, Luke Palmer wrote: On Mon, Nov 17, 2008 at 4:04 AM, Silviu ANDRICA [EMAIL PROTECTED] wrote: Hello, I am very new to Haskell, this is my first day, and I wanted to know if it is possible to prove correctness of a multi-threaded application written in Haskell. Basically, I want to check that a multi-threaded implementation of an algorithm that detects cycles in a dynamically changing graph, actually detects the cycles. Also, the algorithm prevents previously detected cycles from happening by not allowing certain edges to be added. And I want to check that this property also holds. This is going to be difficult -- no matter what language you try to prove it in. In Haskell you have a decent shot, I suppose, since you could at least prove the pure bits correct without much fuss. The way I might try to approach this is to model your algorithm and the dynamically changing graph together as a nondeterministic state machine: a function of type State - [State] (returning all the possible next steps of the system). Then I would look for some invariant that is preserved at each step, and prove its preservation. That is how you could prove your *algorithm* correct. But I suspect there will be many difficulties proving that your implementation corresponds to your algorithm. This is mostly because in the IO monad, anything goes; i.e. the semantics are complex and mostly unknown. You might make some progress by isolating a small portion of the IO monad and assuming that it obeys some particular reasonable nondeterministic semantics. But that will be a large, intuitive assumption which will decrease the degree of certainty of your proof. If you implement your algorithm in terms of STM (one of Haskell's flaunting points :-) rather than more traditional primitives (eg. locks) you will have a better shot, since you can more easily show that an invariant is kept before and after a transaction, without having to fuss with the concurrency details inside where the invariant is briefly broken. Concurrency is quite hard to reason about formally (no matter what language it is in). Good luck! Luke Yes, but if it's worth the effort you could do a formal verification, not of the code, but of a model with the Spin model checker. http://spinroot.com/spin/whatispin.html First you write a model in Promela (Process meta language) which looks a lot like C, but abstracts from (most of) the computations and instead concentrates on communication and coordination of non-deterministic processes. With Spin and the graphical interface XSpin (or the alternative JSpin) you can both simulate and verify your model. It finds deadlocks, you can write asserts, test liveness and you can even check claims in LTL (linear temporal logic) about execution paths. It's all open source and free. 'The Spin Model Checker', by Gerard Holzmann, is the reference, but there are several other books about Spin and its principles. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hackage and GUI (was Hackage status with GHC 6.10 release candidate)
On Sun, 2008-10-12 at 14:46 -0700, Don Stewart wrote: Hey all. The GHC 6.10 RCs are out, and we're preparing the release. To help manage the transistion to GHC 6.10 it is now possible to actually build all the 3rd party Haskell packages, and publish their results wrt. the release candidate. For the first time ever, we're able to have all the 3rd party code tested and ready to go *prior* to the release of the new compiler and base libraries. Using GHC 6.10 RC, Cabal 1.6 and cabal-install 1.16, of 682 libraries and apps tried in total, 1 UnpackFailed 2 DownloadFailed 2 InstallFailed 16 ConfigureFailed 73 DependencyFailed 132 BuildFailed 456 InstallOk Note that these builds are with soft deps, provided on hackage, base 4 parsec 3 HaXml == 1.13.* QuickCheck 2 which train cabal-install to build a larger set of packages. What's the status of Gtk2Hs with regard to Cabal? Is it correct that not one of the applications on Hackage, and there are some, uses or can use a GUI at this point in time? Secondly, has Gtk2Hs compatibility been tested with GHC 6.10? In the past there have sometimes been problems with new GHC releases and Gtk2Hs. These have always been addressed, but it usually took a few months.. Cheers, Hans van Thiel [snip] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell versus F#, OCaml, et. al. ...
On Tue, 2008-09-30 at 01:55 -0700, Don Stewart wrote: dons: kr.angelov: On Tue, Sep 30, 2008 at 8:46 AM, Don Stewart [EMAIL PROTECTED] wrote: There's almost 800 Haskell libraries on hackage.haskell.org (millions of lines of code). On average, 2 new libraries are released each day (though 12 new libs were released in the last 24 hours). That's 700 new libraries a year at the current rate. This is missleading and depends on how you count the libraries. For instance base is now split into arrays, containers, process, parallel etc. In the same time on platforms like Java and .NET this might be only one package. Basically, pick a way to divide this graph of the libraries, and what they depend on, sensibly into units, and you'll know how many libraries there are, with distinct capabilities, http://galois.com/~dons/tmp/hackage.png -- Don But not all 'libraries' are libraries, some are applications. The difference, IMO, is that a library is meant to be used in other programs, possibly very different ones. An application is for a specific purpose. Another way to put it, to use a library you need a (documented) API, to use an application you need a user guide (or not, in the rare case it's self documenting). I feel it's a mistake not to distinguish between those two, in particular when the number of packages gets very large, as is now happening. Secondly, some major libraries are not on Hackage (yet), e.g. Gtk2Hs. Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Re: ANN: First Monad Tutorial of the Season
[snip] Most probably you are confusing type and data constructor. This is a common error and a hurdle I remember falling over more than once. It is due to the fact that in Haskell both are in completely separate name spaces, nevertheless both use capitalized names. Thus people often use the same name for both, especially with newtype, as there may only be one data constructor. In your case you have newtype State s a = State { runState :: (s - (a, s)) } where the type constructor takes two (type-) arguments (even for a newtype it can take as many as you like), but the data constructor takes only one value as argument, namely a function from s to (a,s). Clear now? A newtype has only one data constructor, a data definition may have more (when it contains a choice (|) operator). That's clear now. Third, newtype is unlifted. The books I use for reference, the Craft and SOE, don't seem to mention this. I have to confess, I don't really understand the difference between newtype and data. Again, an explanation would be appreciated. Did Ryan's explanation help? As a general comment on the teaching of Haskell, all books and tutorials, which I've seen, appear to treat this aspect of Haskell as if it were self explanatory. This while the better known imperative languages don't have anything like it. Only Real World Haskell explains algebraic data types to some satisfaction (IMHO, of course). This is one of the more difficult aspects Haskell, IME. I found the Haskell wiki book (http://en.wikibooks.org/wiki/Haskell) very useful, especially the chapter on denotational semantics (http://en.wikibooks.org/wiki/Haskell/Denotational_semantics). The wikibook has a lot of good material, IMO. I'll certainly read that chapter. If you have a background in imperative languages, especially low-level ones like C, then it may help to think of the values of a lifted type (data ...) as being represented by a pointer to the data proper (e.g. a struct), whereas values of an unlifted type (newtype ...) are represented exactly as the argument type. That makes sense to me. Thanks, everybody! A value of a lifted type always has one additional value in its type, namely bottom. You may think of bottom as being represented by a null pointer. In fact, one could say that, in Java, Objects are always lifted whereas basic types like integer are unlifted. Now, before I get shot down by the purists, I know that this is not exactly true, since bottom is also the value of an infinite loop, so Java in fact has a 'real' bottom in addition to null, etc. See the above cited online book chapter for a more precise (and still very readable) treatment. Cheers Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: ANN: First Monad Tutorial of the Season
On Mon, 2008-08-25 at 00:33 +0200, Ben Franksen wrote: Hans van Thiel wrote: so 'The Greenhorn's Guide to becoming a Monad Cowboy' is on http://www.muitovar.com/monad/moncow.xhtml Forgot to say: nicely written! Some more comments: You can declare a fixity (infixr) for flop instead of using parentheses (yes, this is allowed; see 'elem' in the Prelude). Would make the code more readable. (Recall that a type definition is just like a data definition, but with no choice operator (|).) First, you mean to say 'newtype', not 'type' (as in the code). Thanks for the feedback. If and when I get some more comments and error reports, I'll try to fix them. Second, a newtype may also contain only one data element (i.e. one type expression after the constructor), not many, as in a data type definition. Yes, that's what I thought too, but then I got confused by State s a, which looks to have two. Could you explain? Third, newtype is unlifted. The books I use for reference, the Craft and SOE, don't seem to mention this. I have to confess, I don't really understand the difference between newtype and data. Again, an explanation would be appreciated. As a general comment on the teaching of Haskell, all books and tutorials, which I've seen, appear to treat this aspect of Haskell as if it were self explanatory. This while the better known imperative languages don't have anything like it. Only Real World Haskell explains algebraic data types to some satisfaction (IMHO, of course). Best Regards, Hans ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: First Monad Tutorial of the Season
Hello All, I'm proud to announce the first monad tutorial of the new season. It's under the Wiki permissive licence, but the web page has some clip art, so 'The Greenhorn's Guide to becoming a Monad Cowboy' is on http://www.muitovar.com/monad/moncow.xhtml Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?
On Wed, 2008-06-18 at 09:46 +0100, Jules Bean wrote: PR Stanley wrote: With respect, do you not think it'd be wiser for the community [snip] *disgusted* This is exactly the sort of message that haskell-cafe does not normally contain. Let's not start now. This is a civilized mailing list. Either comment on the nice gentlemen's PHP closure proposal from a language point of view, or don't say anything. Jules Hear, hear... Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage being too strict?
[snip] The current a priori check, which said there were no fatal errors, while the a posteriori check failed, is misleading. Wouldn't it be better to warn potential uploaders that this first check is not complete? I'm not sure I see what you're getting at. We can't do a full build check synchronously at upload time. Yes, I thought something like that would probably be the reason. What I meant is that not everybody will realize this immediately, and will think everything is OK because the message was that there are no fatal errors (even though there's another message on the page that uploaders should test their builds first...) I'd also like the warning about the -O2 optimization flag to go away...I'd guess this is a leftover from an earlier time in GHC. It's not a leftover, it was added recently. The intention is that user gets to set the optimisation level (cabal configure -O or -O2 or -O0). It's not really great when packages override that choice. From experience packaging haskell libraries for gentoo we found that most packages that do set -O2 do so out of habit without any particular justification and it significantly increases compile times and memory use. Compile time was negligible in my case, but I didn't think about memory usage. That does not seem an issue either right now, but it's useful to know, for the future... It's not banned though as there are some cases where it's perfectly justified. Oh, all right. So it's recommended to leave that as a user option when configuring the installation. More importantly, if Cabal is sort of an rpm for Haskell programs, shouldn't the uploader use version numbers of the libraries in the Cabal file? For example, I believe in my case at least gtk2hs 0.9.12 is needed, while Ubuntu seems to have only 0.9.11 (until a few months ago, at least). So, if an uploader knows such dependencies, how to express them? build-depends: gtk = 0.9.12 0.10 Thanks, that's clear now. Regards, Hans ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Hackage being too strict?
On Fri, 2008-04-18 at 16:19 +0100, Duncan Coutts wrote: If there are any that you think are rejecting legitimate packages then do complain (as in this thread). I was sloppy in my upload of Emping 0.5 in not checking the libraries dependencies sufficiently and not doing a build (my apologies about that). So then I did do a local build, and even corrected a warning about a type conversion to Double that GHC 6.8.2 (my version on FC 8) with -Wall -Werror seems to have missed. So the local build went well, but the Hackage build still appears to fail. Message: ** setup configure Configuring Emping-0.5.1... cabal-setup: At least the following dependencies are missing: gtk -any I'll have to leave it at that, since my local Cabal version does configure and build, and I obviously can't use Hackage as a development tool, uploading new versions until I get it right. Or, on second thought, does the above message just mean there's no gtk on Hackage? Some general questions, suggestions: To improve the usability of Hackage, wouldn't it be better to hold new uploads in limbo until they pass all the checks, instead of publishing them anyway? The current a priori check, which said there were no fatal errors, while the a posteriori check failed, is misleading. Wouldn't it be better to warn potential uploaders that this first check is not complete? I'd also like the warning about the -O2 optimization flag to go away...I'd guess this is a leftover from an earlier time in GHC. More importantly, if Cabal is sort of an rpm for Haskell programs, shouldn't the uploader use version numbers of the libraries in the Cabal file? For example, I believe in my case at least gtk2hs 0.9.12 is needed, while Ubuntu seems to have only 0.9.11 (until a few months ago, at least). So, if an uploader knows such dependencies, how to express them? Thanks in advance, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Ann: Emping 0.5 in Hackage
Emping is a utility which derives the shortest rules from a table of rules. For example, in a list of 8000 different mushrooms, it finds 21 single predicates that determine the mushroom is poisonous, and 23 that it is edible. But it also finds all combinations of two, three and more predicates that determine this property. Each shorter rule is a generalization of an original one. So, if r1 covers {a,b,c} and r2 {a,b}, then r2 implies r1 (r1 entails r2). The shorter rules are partially ordered. Thanks to the functional graphs library, which comes with ghc, the reduced rules are now displayed as graphs which can be viewed with a Graphviz viewer. Also new in 0.5 is that the reduced rules, and the reduced rules in an equivalence class, are ordered by length. Lastly, the GUI has been improved. Testing has also shown some bugs and issues, most importantly when the data contains ambiguous rules. Ambiguities are rules with the same antecedent, but a different consequent. You can test for them, but if the user turns the checks off and run Emping without correcting the data, the program could hang, in a special case. See http://home.telfort.nl/sp969709/emp/empug.html for more info and a few screenshots. Thank you all, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] An offer to any haskell projects out there.
On Tue, 2008-03-11 at 18:46 -0400, [EMAIL PROTECTED] wrote: Hello, My name is Michael Litchard. I'm a techie living in silicon valley, and I want to move into tech writing. I've got the background, now I need a portfolio. I figured the best way to go is to attach myself to some open source projects, and haskell has had my heart for a few years now. I am by no means an expert at haskell. My expertise is writing. So I make this offer. If you need documentation written for your haskell project, I'm your man. Whatever it is, I'll write it or edit it. Thanks for your time. P.S If this was the wrong list, or if anyone has other ideas about how to propogate my proposal, please let me know. Michael Hello Michael, I agree that improving the docs for (some) standard libraries would be the most helpful. However, specializing in a special project would probably be better, if it's a visible portfolio you want. Have you thought of writing a tutorial on one of the HackageDB libraries, for example,database connectivity, XML processing, or even Cabal itself? That would be useful, and give you a clear cut deliverable too. http://www.gordonandgordon.com/aboutus.html is a web site with some good info on technical writing, and the differences between sdk documentation, white papers and technical marketing. All of which would be useful to the Haskell community, IMO, but that's a personal view. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Emping 0.4
Hello All, Emping 0.4, a utility which can derive heuristic rules from facts in Open Office Calc spreadsheet .csv format, has been released on HackageDB. Version 0.4 supports blank fields, treated as 'none of the others', which allows for split attribute values. For example, Owns Car could have values Yes or 'No, and then Yes could be split into Make, Price Range and so on, while the fields for No could be blank for these attributes. Data still have to be in the spreadsheet format of rows and columns (and in OO Calc .csv). Version 0.4 has a Gtk2Hs based GUI and the code has been changed in several places. Compiled with GHC 6.8 it appears to be noticeably faster than version 0.3. The package comes with a user guide, a white paper, and two data files from the UCI Machine Learning Repository. To get an impression see: http://j-van-thiel.speedlinq.nl/emp/empug.html The compiled binary for Linux, with documentation, can also be downloaded directly from my web site. Thank you, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[2]: The programming language market (was Re: [Haskell-cafe] Why functional programming matters
On Sun, 2008-01-27 at 11:49 +0300, Bulat Ziganshin wrote: Hello Dipankar, Sunday, January 27, 2008, 12:16:38 AM, you wrote: Anyway, no we're older, and we realize that it would have helped our math understanding out quite a bit had we learned more physics, engineering, etc. Or had we learned 19th century mathematics well. The Russian program seems to do this, actually (at least for the sample set of kids that make it to the US). oh, yes, they are really still study 19th century physics, but not because of great mind, but due to age of university professors. i've studied at Moscow University in 89-91 and department of computer languages still studied Lisp at those times (!). a few months ago i have a conversation with today student and they still learn Lisp (!!!). it seems that they will switch to more modern FP languages no earlier that this concrete professor, head of PL department, which in 60s done interesting AI research, will dead, or at least go to the pension This reminds me, I worked at a Dutch telecomm software production company for a short while in 1999 and they had two Russian software engineers there, one from St. Petersburg and one from Wladiwostok, both female and under 25 years of age. They programmed in C and were highly respected by their managers and colleagues! So, there are at least counterexamples :-) Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Ann: Drawing with Cairo: Getting Started
Hello All, There is now an appendix to the Gtk2Hs tutorial on getting started with Cairo drawing. It's not actually about drawing, but on how to get drawings on the screen and how to write them to .png, .pdf, .ps. or .svg files. Though this is very easy, the 'recipes' are not self-evident, so this mini-tutorial could save prospective users some time. See: http://darcs.haskell.org/gtk2hs/docs/tutorial/Tutorial_Port/app1.xhtml or: http://j-van-thiel.speedlinq.nl/gtk2hs/app1.html I'd like to add, for Spanish readers, that the Gtk2Hs tutorial itself has been translated into Spanish. See: http://darcs.haskell.org/gtk2hs/docs/tutorial/Tutorial_Port/es-index.xhtml or: http://j-van-thiel.speedlinq.nl/gtk2hs/es-index.html Alex Tarkovsky's Glade tutorial http://haskell.org/gtk2hs/docs/tutorial/glade/ has also been translated into Spanish: http://j-van-thiel.speedlinq.nl/glade/es-index.html The translator of both texts prefers to be known as Laszlo Keuschnig. In case anyone wonders, this is not me, though I wish.. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] IO is a bad example for Monads
On Wed, 2007-12-12 at 16:27 +0100, Hans van Thiel wrote: [snip] I fear those people can do vast amounts of damage. :( When inept programming yields the wrong result, it is clear (even to the inept) that the program is bad. When the result is correct but there are egregious time or space leaks, it is clear to everyone but the Haskell guru that it must be the programming language that is deficient, and will be duly flamed far and wide. This perception will be impossible to reverse when it gains traction (and nothing ever goes away on the Internet). Seeming deus ex machina code changes (perhaps helpfully offered on haskell-cafe) to minimize or correct the undesirable runtime behavior appear even to many Haskellites to be black magic, accompanied by the runes of profile dumps (like knowing what generation 0 and generation 1 garbage collection is). I see your point, but maybe there should be better analyzing tools then, as well as tutorials which explain that problem. Haskell is not a quick-and-dirty language but quite the opposite. Haskell’s unique selling propositions are features like type classes, higher order functions and lazy evaluation which make life easier in the long term. The downside of these features is that they might make life harder in the short term. I don't know. In a sense Haskell is easier than, for example, C, because the concept of a function definition is more natural that that of assignments and loops. The idea that x = 5; x = x + 7 makes sense requires a complete new way of thinking. OK, once you've been doing it for a few years switching back to x = 5 + 7 is hard. I would limit that to say that *denotational* semantic intuition is easy to wield in Haskell. Operational semantic intuition is Haskell is very non-obvious to the imperative (and many functional) programmers. Making matters worse, the first is an advantage well-hyped by functionistas, the second hurdle is rarely admitted to. I admit I don't understand this. That said, I definitely think that we should make learning the language as easy as possible. But our ultimate goal should be to primarily show newcomers the Haskell way of problem solving, not how to emulate Python or Java programming in Haskell. Again, is there a danger of that happening? Yes. Those absent the necessary humility to approach haskell-cafe with open mind and flame-retardant dialog will fall back on what they know: transliterated Java/Python with a morass of do blocks and IO monads, then (rightly) bash how ugly Haskell syntax is when used in this way. This type of programmer looking to use Haskell casually should sign a benefit of the doubt contract whereby they assume that any runtime suboptimalities derive from their own coding and not from Haskell's defects. This is the innate assumption of the curious, the self-motivated, the clever. This is not typically the starting assumption of the I'm an expert at Joe-imperative language hacker who took 10 years to perfect his Java skills and expects thereby to jump to at least year 5 of Haskell without effort. But that person will be used to all the help he's gotten from the Java and/or Eclipse, with tutorials and reference implementations. Now he has to depend on dissertations and JFP articles for anything that's less than 10 years old, and a few helpful experts (much appreciated, I want to add) who are willing to spend the time to answer questions. I do strongly believe in stimulating the curiosity of all comers, just not in giving the false impression that a quick read-through of a few tutorials will let you write lightning-fast code, or know when to abandon [Char] for something more clever, or where to insert those bangs and fold left instead of right, and how ad hoc and parametric polymorphism differ, and what Rank-n and existential means (and why you can just pickle any object in Python but need to know a half dozen abstract things including who Peano was to do the same in Haskell), and what the heck an infinite type is, and on and on. It's possible, IMO, that Haskell requires a higher skill level in information science that the imperative languages. Many working programmers come from different backgrounds and are not experts in computer science. But, like a skyscraper is not built just by the architects, maybe those 'lower' skills have their place too. Maybe not, or not in Haskell. Could be, though I don't think so, myself. Haskell has definitely been teaching me some serious humility! Possibly it is best that those not ready for that lesson might better stick with Python. If they read this, I'm sure they will. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org
Re: [Haskell-cafe] IO is a bad example for Monads
On Mon, 2007-12-10 at 20:00 +0100, Henning Thielemann wrote: [snip] I raise my question once again: Must Haskell's tutorials be tailored to impatient programmers? Does Haskell need quickdirty hackers? IMO yes, because it exposes the language to the outside world and that's a form of testing. In the end, anything that's not usable is useless. Paraphrasing a quote about science in general, There is nothing about Haskell that cannot be grasped by a second rate mind through persistence. Let's not exaggerate how difficult and special it all is. And the purpose of a tutorial is not to make the writer look smart and important, but to ease things for the reader. I wouldn't want to exclude the scurrilous unwashed from the Haskell experience, this close to Christmas, too. :-) Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] IO is a bad example for Monads
On Tue, 2007-12-11 at 16:56 +0100, Wolfgang Jeltsch wrote: Am Dienstag, 11. Dezember 2007 14:46 schrieb Hans van Thiel: On Mon, 2007-12-10 at 20:00 +0100, Henning Thielemann wrote: [snip] I raise my question once again: Must Haskell's tutorials be tailored to impatient programmers? Does Haskell need quickdirty hackers? IMO yes, because it exposes the language to the outside world and that's a form of testing. In the end, anything that's not usable is useless. Paraphrasing a quote about science in general, There is nothing about Haskell that cannot be grasped by a second rate mind through persistence. Let's not exaggerate how difficult and special it all is. And the purpose of a tutorial is not to make the writer look smart and important, but to ease things for the reader. I wouldn't want to exclude the scurrilous unwashed from the Haskell experience, this close to Christmas, too. :-) Regards, Hans van Thiel Maybe there are also patient people in the outside world so that we can still expose Haskell to the outside world while not trying to attract quick-and-dirty hackers. ;-) But who are those people? And what harm can they possibly do, assuming they fit the derogatory description? Haskell is not a quick-and-dirty language but quite the opposite. Haskell’s unique selling propositions are features like type classes, higher order functions and lazy evaluation which make life easier in the long term. The downside of these features is that they might make life harder in the short term. I don't know. In a sense Haskell is easier than, for example, C, because the concept of a function definition is more natural that that of assignments and loops. The idea that x = 5; x = x + 7 makes sense requires a complete new way of thinking. OK, once you've been doing it for a few years switching back to x = 5 + 7 is hard. I guess I do agree with you on lazy evaluation.. That said, I definitely think that we should make learning the language as easy as possible. But our ultimate goal should be to primarily show newcomers the Haskell way of problem solving, not how to emulate Python or Java programming in Haskell. Again, is there a danger of that happening? Regards, Hans Best wishes, Wolfgang ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Teach Yourself Gtk2Hs in 21 Hours
Hello All, The Gtk2Hs basics tutorial, based on the Tony Gale and Ian Main GTK+2.0 tutorial, is now available for review and comment. The TOC: 1. Introduction 2. Getting Started 3. Packing 3.1 Packing Widgets 3.2 Packing Demonstration Program 3.3 Packing Using Tables 4. Miscellaneous Widgets 4.1 The Button Widget 4.2 Adjustments, Scale and Range 4.3 Labels 4.4 Arrows and Tooltips 4.5 Dialogs, Stock Items and Progress Bars 4.6 Text Entries and Status Bars 4.7 Spin Buttons 5. Aggregated Widgets 5.1 Calendar 5.2 File Selection 5.3 Font and Color Selection 5.4 Notebook 6 Supporting Widgets 6.1 Scrolled Windows 6.2 Event Boxes and Button Boxes 6.3 The Layout Container 6.4 Paned Windows and Aspect Frames 7. Action Based Widgets 7.1 Menus and Toolbars 7.2 Popup Menus, Radio Actions and Toggle Actions This covers about half of Gtk2Hs (guesstimate) but (hopefully) most of what's needed for the run of the mill GUI. It's available or will be on http://darcs.haskell.org/gtk2hs/docs/tutorial/Tutorial_Port/ http://j-van-thiel.speedlinq.nl/gtk2hs/index.html Thanks to Alex Tarkovsky it's in XHTML and well structured for easy maintenance and adaptation. I hope a Gtk2Hs basics tutorial will help to popularize this large, powerful and sophisticated gui library for Haskell. Needless to say, please don't hesitate to comment and report errors. Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsing unstructured data
On Wed, 2007-11-28 at 12:58 -0500, Olivier Boudry wrote: Hi all, This e-mail may be a bit off topic. My question is more about methods and algorithms than Haskell. I'm looking for links to methods or tools for parsing unstructured data. I'm currently working on data cleaning of a Customer Addresses database. Addresses are stored as 3 lines of text without any structure and people made used lots of imagination to create the data (20 years of data using no rules at all). Postal code, street, city, state, region, country and other details as suite, building, dock, doors, PO box, etc... are all stored in free form in those 3 lines. I already wrote a haskell program to do the job. It correctly parses about 2/3 addresses and parses much of the rest but with unrecognized parts left. The current program works by trying to recognize words used to tag parts like STE, SUITE, BLDG, street words (STR, AVE, CIRCLE, etc...) and countries from a list (including typos). It uses regular expressions to recognize variation of those words, lookup tables for countries, street words, regular expression rules for postal codes, etc... The most difficult task is splitting the address parts. There is no clearly defined separator for the fields. It can be dot, space, comma, dash, slash, or anything you can imagine using as a separator and this separator can of course also be found inside an address part. In the current application when part of an address is recognized it will not be parsed again by the other rules. A system trying all rules and tagging them with probabilities would probably give better results. Have you looked at the Java Rule Engine (I believe JSR 94) and in particular Jess? http://herzberg.ca.sandia.gov/ I have no experience with it myself, though, just heard of it. Regards, Hans van Thiel Any link to tools or methods that could help me in that task would be greatly appreciated. I already searched for fuzzy, probabilistic or statistical parsing but without much success. Thanks, Olivier. PS: just in case someone's interested I attached the code and partial data to this e-mail. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Some More Sinus Results
Thanks to all who've replied; Carl's explanation in particular was very interesting. So the precision, suggested by the many decimals in the 'show', is not the actual precision the user should 'count on'. If you take 1/60 of a degree to be approximately 0.0003 radians, you should not use sin for smaller values. In all cases the actual precision of sin appears to be 4 to 5 decimals, and results should be rounded to that before using them. Now I'm wondering about cos, tan and also the inverses, asin etc. :-) Regards, Hans van Thiel Hugs sin (1.000 * pi) 1.22460635382238e-16 Hugs sin (0.999 * pi) 0.00314158748587949 Hugs sin (1.1 * pi) -3.14159265309255e-05 Hugs sin (0.9 * pi) 3.14159265307264e-05 Hugs sin (1.001 * pi) -0.00314158748587925 Hugs sin (0.999 * pi) 0.00314158748587949 Hugs sin (1.0001 * pi) -0.000314159260191213 Hugs sin (0. * pi) 0.000314159260191458 Hugs sin (1.1 * pi) -3.14159265309255e-05 Hugs sin (1.0001 * pi) -0.000314159260191213 Hugs sin (0. * pi) 0.000314159260191458 Hugs sin (1.1 * pi) -3.14159265309255e-05 Hugs sin (0.9 * pi) 3.14159265307264e-05 Hugs sin (6.0001 * pi) 0.000314159260189269 Hugs sin (5. * pi) -0.000314159260190738 Hugs sin (6.1 * pi) 3.14159265298692e-05 Hugs sin (5.9 * pi) -3.14159265313387e-05 Hugs sin pi 1.22460635382238e-16 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Some More Sinus Results
On Sat, 2007-11-10 at 11:14 -0800, David Roundy wrote: On Sat, Nov 10, 2007 at 06:56:23PM +0100, Hans van Thiel wrote: Thanks to all who've replied; Carl's explanation in particular was very interesting. So the precision, suggested by the many decimals in the 'show', is not the actual precision the user should 'count on'. If you take 1/60 of a degree to be approximately 0.0003 radians, you should not use sin for smaller values. In all cases the actual precision of sin appears to be 4 to 5 decimals, and results should be rounded to that before using them. Now I'm wondering about cos, tan and also the inverses, asin etc. :-) What you're observing in these calculations is not so much the inaccuracy of sin as the inaccuracy of pi. Pi is an irrational number, so the Double constant pi is only an approximation, with an error probably around 3e-16 (1e-16 fractional error). Simple calculus tells you that the error in sin(pi) will thus be around: sin(truepi+3e-16) ~ 0 + 3e-16 from which we conclude that the error in pi isn't really as bad as we'd naively expect. For small epsilon, we can see that sin((1+/-epsilon)*(truepi+3e-16)) ~ 0 +/- pi*epsilon + 3e-16. which roughly explains your data quoted. Results of sin should *not* be rounded before using them, unless you really want a less accurate answer. Users who count on a particular precision, should not be using computers to do their arithmetic. A limitation in the technology, which derives from the floating point representation, should not become a norm, IMHO. Every engineering discipline uses error approximation and calculation of the cumulation/cancelation of those errors to estimate the reliability of the total. That's if you use a slide rule, that's if you use a computer. There's no difference. If you mean that people should not do arithmetic on computers, if the results are vital, unless they understand the scope and limits of the tools they're using, I agree, of course. The blog article on the accuracy of sine glossed over the relevant issue: that there's no point in getting better accuracy. It points out that sin(pi) only has five or six digits of accuracy, it means that the correct answer is about 1.225e-16, because correct is defined to mean the sine of the double which is nearest to the actual value of pi. It's nice to be accurate, but the claim that for large arguments the computed value of sin is effectively random is pretty irrelevant, as the same thing can be said of the true value of sin, when defined as the sine of the double closest to your desired x value which is the closest we could possibly come to a true sin. If you're taking the sine of a large number, your code is broken, and no sin function is going to fix it. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Sinus in Haskell
Hello All, Can anybody explain the results for 1.0, 2.0 and 3.0 times pi below? GHCi yields the same results. I did search the Haskell report and my text books, but to no avail. Thanks in advance, Hans van Thiel Hugs sin (0.0 * pi) 0.0 Hugs sin (0.5 * pi) 1.0 Hugs sin (1.0 * pi) 1.22460635382238e-16 Hugs sin (1.5 * pi) -1.0 Hugs sin (2.0 * pi) -2.44921270764475e-16 Hugs sin (2.5 * pi) 1.0 Hugs sin (3.0 * pi) 3.67381906146713e-16 Hugs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Sinus in Haskell
On Fri, 2007-11-09 at 14:30 -0500, Brent Yorgey wrote: On Nov 9, 2007 2:08 PM, Hans van Thiel [EMAIL PROTECTED] wrote: Hello All, Can anybody explain the results for 1.0, 2.0 and 3.0 times pi below? GHCi yields the same results. I did search the Haskell report and my text books, but to no avail. Thanks in advance, Hans van Thiel Hugs sin (0.0 * pi) 0.0 Hugs sin (0.5 * pi) 1.0 Hugs sin (1.0 * pi) 1.22460635382238e-16 Hugs sin (1.5 * pi) -1.0 Hugs sin (2.0 * pi) -2.44921270764475e-16 Hugs sin ( 2.5 * pi) 1.0 Hugs sin (3.0 * pi) 3.67381906146713e-16 Hugs More generally, this is due to the fact that floating-point numbers can only have finite precision, so a little bit of rounding error is inevitable when dealing with irrational numbers like pi. This problem is in no way specific to Haskell. -Brent All right, I'd have guessed that myself, if it hadn't been for the exact computation results for 0, 0.5, 1.5 and 2.5 times pi. So the rounding errors are only manifest for 1.0, 2.0 and 3.0 times pi. But look at the difference between sin (1.0 * pi) and sin (3.0 * pi). That's not a rounding error, but a factor 3 difference.. and sin (as well as cos) are modulo (2 * pi), right? Regards, Hans ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Ann: Gtk2Hs Tutorial Port
Hello All, I've already announced this on the Gtk2Hs users' list, but for those who are not using Gtk2Hs at the moment, but who might be interested: I've started a port of the Gtk+2.0 tutorial by Tony Gail and Ian Main and the first part is available on: http://darcs.haskell.org/gtk2hs/docs/tutorial/Tutorial_Port/ The chapters are: Contents and Copyright Notice chap1.html Getting Started chap3.html Packing Widgets chap4.html Packing Demonstration Program chap5a.html Packing Using Tableschap5b.html The Button Widget chap6.html Adjustments, Scale and Rangechap7.html All examples are also available as .hs files. For a beginner, working through these should be sufficient, so that he/she can carry on with the original C based tutorial. The correlation between the examples and the Gtk2Hs API is (mostly) straightforward. But I'm working on the other widgets in the Gtk+2.0 tutorial too (might take a while). Currently available on my own web site (but no .hs files): Labels chap8.html Arrows and Tooltips chap9.html http://j-van-thiel.speedlinq.nl/gtk2hs/chap8.html http://j-van-thiel.speedlinq.nl/gtk2hs/chap9.html New additions will be listed in chap1.html As said, probably the second part of the port is not really needed, as the Gtk2Hs API documentation maps (mostly) very clearly onto the C functions. Note 1: I'm not a Gtk2Hs expert, but I'm journaling my own learning experience. The code works, but feel free to comment. Someone has kindly promised to review this version, so it will certainly be improved later on. Note 2: the Gtk+2.0 tutorial has not been updated since 2002 (if the copyright notice is to be trusted) and does not cover everything. The same applies to the port. Moreover, advanced widgets like Tree List are large and complicated and will not be treated at all. Note 3: This tutorial, and in particular the 'Getting Started' chapter, replaces the old 'Getting Started' page, which has been removed. Many Thanks, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell for the Enterprise (topic for a MSc dissertation?)
On Wed, 2007-08-15 at 15:04 +0200, Lars Oppermann wrote: Hi All, This is my first post here, so I'll start with a quick introduction... I live and work in Hamburg, Germany. My day job is as a software engineer at Sun Microsystems at the OpenOffice.org development team where I'm mostly doing XML (ODF) related things. Beside of that, I'm currently pursuing an M.Sc degree in software engineering in a part-time post graduate program where I am now nearing the phase where I have to develop a topic for my dissertation. Apart from a little dabbling with Miranda during my undergraduate CS days I haven't touched functional programming ever since and have been doing Java, C# and C++ most of the time. However, I have over the last few month fallen in love with the great expressiveness offered by Haskell and through that have gained some great new perspectives and discovered new ways to think when writing programs. Consequently, my idea to combine all of this into a topic for my dissertation is to write about the existing and potential benefits (and shortcomings) of a functional programming language for the development of typical enterprise applications (especially with regards to more and more concepts from functional programming being adopted in imperative languages). I would start off with an existing J2EE application, analyze the abstractions and patterns that it uses. I will then discuss similar and alternative abstractions and patterns available in functional programming which can be applied in order to solve the same problem in a functional setting, leveraging some existing infrastructure, such as HAppS. What would follow is a comparison of the two resulting applications from a software engineering standpoint: How maintainable are these implementations? How can they be tested? Can formal validation techniques be applied to parts of the functional implementation that can be used to establish its correctness. Maybe analysis of performance... One of my potential supervisors for the dissertation has already indicated some interest in the topic so it all looks quite well to me. The overview that I gave above obviously needs much more elaboration, but as I said, I have just started developing topics. I would love to hear your comments on this. Has this been done over and over already? Are there any source which you think of from the top of your head which I should check out? Books that you would want to recommend? There is a lot of scientific literature, but not much has been done with actual engineering in mind. There is no Red Hat, no Suse, no MontaVista and there is no company sponsoring its development in a big way, like Sun. It's not supported by any business consortium or even standardized by any official group. But people are working on an O'Reilly book about Haskell in practice (Real World Haskell). You might also want to read the 'History of Haskell' which has a section on use in industry. Maybe you could talk to some of those people. What I know is that it is being deployed other than in open source, but that fact is not being advertised in the marketing. Maintainability should be excellent in Haskell, due to the fine grained modularity without side effects. Best Regards, Hans van Thiel As I wrote above, I'm quite new to Haskell. Thus if anyone wants to recommend some readings specifically on the aspect of modeling in a functional environment I'd be happy to hear about that too. All the best, Lars -- Lars Oppermann Hamburg, Germany ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Ann: Emping 0.3
Hello All, Version 0.3 of Emping is available. Emping is a utility that reads a table in a csv (comma separated) format that can be generated from Open Office Calc (spreadsheet), derives all shortest rules for a selected attribute, and writes them to a .csv file that can be read by OO Calc. The shortest rules may be partially ordered by implication (entailment) and equivalence (equality) and the top level is also shown in .csv format. Optionally all logical entailments and equalities are listed as well. If the data set contains ambiguous rules or more occurrences of the same rule, the user is warned. The main difference with V0.2 is that v0.3 can now handle intermediate size files (100 to a few thousand rules) because the transformation of conjunctive form (ands of ors) to disjunctive (ors of ands), which seemed to be exponential in the number of rules, has been optimized by using an intermediate 'maybe tree'. Probably I also used the wrong fold, without strictness, in the prior version, but it would still have been exponential. I 'think' it's now closer to linear to the number of rules, and quadratic to the number of attributes. But tests show the completion time is highly dependent on how well the data is structured. Obviously, much has still to be done. More info, for those who are interested, on http://j-van-thiel.speedlinq.nl/emp/empug.html Thank you, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Tree Guidance
On Fri, 2007-06-29 at 19:35 +0200, Thomas Schilling wrote: On 27 jun 2007, at 18.41, Hans van Thiel wrote: [snip] Thanks, Apfelmus, for the references. Guess I'll start there, then. And thanks, Chris, for the info and code. Read only 'up pointers' could be what is needed. But before going on, I want first to get more confortable with programming with trees. It's all very well to say they're easy to roll, but lists are even simpler, and look at them... I guess it's in the papers, too, but the chapter on zippers in the Wikibook is very nice, too: http://en.wikibooks.org/wiki/Haskell/Zippers / Thomas Yes, I've seen this. Thanks! Regards, Hans ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Tree Guidance
[snip] Thanks, Apfelmus, for the references. Guess I'll start there, then. And thanks, Chris, for the info and code. Read only 'up pointers' could be what is needed. But before going on, I want first to get more confortable with programming with trees. It's all very well to say they're easy to roll, but lists are even simpler, and look at them... Regards, Hans ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Tree Guidance
Hello All, Both CFP and SOE have chapters on trees and there is a standard library Data.Tree. I expected to find all kinds of functions there, as in Data.List, but instead the functions are defined as instances of more general structures. It uses: import Control.Applicative (Applicative(..), ($)) import Control.Monad import Data.Monoid (Monoid(..)) import Data.Sequence (Seq, empty, singleton, (|), (|), fromList, ViewL(..), ViewR(..), viewl, viewr) import Data.Foldable (Foldable(foldMap), toList) import Data.Traversable (Traversable(traverse)) import Data.Typeable When looking at those it is not clear (to me) what those all mean and I have not been able to find much on the WiKi either. Could someone with more experience provide some guidance on how to learn to use these libraries (and ultimately on the tree type in Data.Tree, which is what I want). There is a Zipper Monad with defined functions, which look promising, but I have not heard of this before, and it appears not to be standard. http://www.haskell.org/haskellwiki/Zipper_monad/TravelBTree http://www.haskell.org/haskellwiki/Zipper_monad Does anybody have any experience with these libraries they could share? Ideally I would want a N-ary tree, where the branches are what's actually the represented data, and so I would like to access it both from the root and the leaves. In an imperative language I would just add an up-pointer in each node, but I have no idea how expensive this would be in Haskell, or if it's necessary at all. Many thanks for your help, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Plugin Problem
On Thu, 2007-06-21 at 01:49 +0200, Daniel Fischer wrote: It half worked in ghci. Only all evals failed. That gave me a lead and after a lot of tinkering with the code of plugins-1.0, I found out one major problem. As of 6.6, ghc calls all interfaces interface main:Modulename and so plugins tries to load main_resource_closure instead of Modulename_resource_closure. That of course fails. Unfortunately, I don't know how to fix it. I suppose in contrast to the version from HackageDB, which I got myself on monday, the darcs version works with ghc = 6.6, or I probably would have heard about it. So I'll try to get me that, only where? And I'm rather annoyed that the stuff from HackageDB tends to be obsolete. How could we attract people to Haskell, if the downloaded packages just don't work? It would be a nice feature, if authors could remove obsolete packages from HackageDB as well as add new versions. It would also be helpful to see download statistics. If something is much in demand, this would probably be an incentive to update it more often.. Regards, Hans van Thiel Cheers, Daniel Am Mittwoch, 20. Juni 2007 20:32 schrieb ich: Hi again, I thought, I'd try out the plugins package, cause lambdabot segfaulted while loading plugins (or immediately after). So I wrote a very simpleminded test for eval(_) and unsafeEval(_) from System.Eval.Haskell. Compiled, but: [EMAIL PROTECTED]:~/Documents ghc --make PlugTest [1 of 1] Compiling Main ( PlugTest.hs, PlugTest.o ) Linking PlugTest ... [EMAIL PROTECTED]:~/Documents PlugTest PlugTest: /tmp/MectNX2619.o: unknown symbol `pluginszm1zi0_AltDataziDynamic_toDyn_closure' PlugTest: user error (resolvedObjs failed.) What does that tell more knowledgeable persons? Thanks, Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] IDE?
On Sun, 2007-06-17 at 02:00 +0100, Donnchadh Ó Donnabháin wrote: Hi Peter, I'm also just starting to learn Haskell and tried the eclipsefp eclipse plugin [1] (since my day job is java development). Hello Donnchadh, What operating system do you use? I've tried it several times on Fedora Core 6 but it doesn't work, either with the FC Eclipse or the official Eclipse version. The Haskell plug-in installs fine, but the editor crashes, not always the same way. The problem seems to be the different Java versions, and Java Virtual Machines, which are in use on different systems. The Fedora Eclipse also has problems with some other plug-ins which are not supported (yet). Something similar happened with an Open Office Java utility which, according to the documentation, only works with the Sun JVM. Even though OO allows selection among different JVMs, that didn't work either. The eclipsefp site does list some bugs I've encountered, but does not mention any JVM or other preferences. But I'm convinced that's the problem... It seems a little basic at the moment, but judging from this blog [2] it seems to have a lot of potential. What I've seen of it, before it crashes, looks very nice. Regards, Hans van Thiel In fact part of the project seems to be to allow the development of eclipse plugins written in haskell, which could allow the possibility of integrating some of the tools listed on the haskell wiki with it. I also tried eclipsedarcs [3] for darcs repository access but it only really seems to work with local repositories. Donnchadh [1] http://eclipsefp.sourceforge.net/haskell/index.html [2] http://cohatoe.blogspot.com/ [3] http://eclipsedarcs.org/doku.php ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] New book: Real-World Haskell!
On Wed, 2007-05-23 at 17:01 +1000, Donald Bruce Stewart wrote: Bryan O'Sullivan, Don Stewart and John Goerzen are pleased, and frankly, very excited to announce that were developing a new book for O'Reilly, on practical Haskell programming. The working title is Real-World Haskell. The plan is to cover the major techniques used to write serious, real-world Haskell code, so that programmers can just get to work in the language. By the end of the book readers should be able to write real libraries and applications in Haskell, and be able to: * design data structures * know how to write, and when to use, monads and monad transformers * use Haskells concurrency and parallelism abstractions * be able to write parsers for custom formats in Parsec. * be able to do IO and binary IO of all forms * be able to bind Haskell to foreign functions in C * be able to do database, network and gui programming * know how to do exception and error handling in Haskell * have a good knowledge of the core libraries * be able to use the type system to track and prevent errors * take advantage of tools like QuickCheck, Cabal and Haddock * understand advanced parts of the language, such as GADTs and MPTCs. That is, you should be able to just write Haskell! The existing handful of books about Haskell are all aimed at teaching programming to early undergraduate audiences, so they are ill-suited to people who already know how to code. And while theres a huge body of introductory material available on the web, you have to be both tremendously motivated and skilled to find the good stuff and apply it to your own learning needs. The time has come for the advanced, practical Haskell book. Great, this surely meets a demand and I'll buy it, for sure. Here's my wish list: Heres the proposed chapter outline: 1. Why functional programming? Why Haskell? Compared to Erlang. While other functional languages are mentioned occoasionally on this list, Erlang is notably absent. This while the Erlang processes seem to be very useful, especially for concurrency and embedded systems programming. Is Haskell useful for embedded systems at all? 2. Getting started: compiler, interpreter, values, simple functions, and types 3. Syntax, type system basics, type class basics 4. Write a real library: the rope data structure, cabal, building projects 5. Typeclasses and their use 6. Bringing it all together: file name matching and regular expressions 7. All about I/O 8. I/O case study: a DSL for searching the filesystem 9. Code case study: barcode recognition 10. Testing the Haskell way: QuickCheck 11. Handling binary files and formats 12. Designing and using data structures 13. Monads 14. Monad case study: refactoring the filesystem seacher 15. Monad transformers 16. Using parsec: parsing a bioinformatics format All great! 17. Interfacing with C: the FFI Number two on my wish list: interfacing with Java. Not because of the language, but the many libraries. For instance, there is a Java library to interface with the open document format, something I'd like to do. I know there is a Haskell Java interface, but it seems to be outside of the mainstream and hardly documented. Or am I wrong? 18. Error handling 19. Haskell for systems programming 20. Talking to databases: Data.Typeable Yes. 21. Web client programming: client/server networking 22. GUI programming: gtk2hs 23. Data mining and web applications 24. Basics of concurrent and parallel Haskell 25. Advanced concurrent and parallel programming 26. Concurrency case study: a lockless database with STM 27. Performance and efficiency: profiling 28. Advanced Haskell: MPTCs, TH, strong typing, GADTs 29. Appendices Number one on my wish list: maybe this will be covered in the chapters so far, but what about lazy versus strict? I understand the importance of laziness to define infinite lists and other data structures, but not the impact on performance and what to look out for when writing code. Similarly safe and unsafe and memoization. Could this be a separate chapter? We're seeking technical reviewers from both inside and outside the Haskell community, to help review and improve the content, with the intent that this text will become the standard reference for those seeking to learn serious Haskell. A critical note here. Before you can learn 'serious' Haskell you'll have to learn basic Haskell. I'm sure it is unintentional, but avoid any impression of superiority. Writing a good text book is very hard and very time consuming, and succesful communication with an audience is a separate skill. How about 'Applying Haskell' or something like that as the working title; what is the 'real world' anyway? But I'll be looking forward to the book, whatever its name! Regards, Hans van Thiel If you'd like to be a reviewer, please drop us
Re: [Haskell-cafe] Ann: Emping 0.2
On Mon, 2007-05-21 at 14:06 -0700, Scott Cruzen wrote: Is Emping an implementation of C4.5 or something new? No, it's new. The reduction algorithm is not based on a measure and is not a search either. It's a construction of predicate combinations, starting with singletons, that are not contradictory to known facts. The third step, following hypothesis and then falsification, is verification with observed rules. The complexity appears to be quadratic to the original rule length and also to the number of original rules, but I have yet to prove this. I believe I have proved that the algorithm produces the complete and shortest disjunctive normal form of a logical rule table. The white paper 'Deriving heuristic rules from facts' http://j-van-thiel.speedlinq.nl/dwnl/EmpingWP.pdf (21 pages) discusses the theory from examples, and an earlier wp (also available on the web site) uses some first order predicate logic and set theory. Version 0.2 also shows logical dependencies in the reduced rules and this is just a search in the original rules and in the poset of reductions. So this is not new in a theoretical sense, though I believe no other implementation has ever considered such dependencies. Regards, Hans van Thiel * Hans van Thiel [EMAIL PROTECTED] [070521 05:45]: Hello All, Version 0.2 of Emping, a utility to derive heuristic rules from a table of nominal data, is available. In addition to a reduced normal form in .csv format, which can be read by Open Office Calc, it now also displays observed implications and equivalences in the reduced rules (if present) and ambiguities in original rules (if present). A bug in the response to a user typing error has been fixed and some code has been simplified, compared to 0.1. An online user guide is at: http://j-van-thiel.speedlinq.nl/emp/empug.html and the Cabal package can be downloaded from there, or from the HackageDB. Thanks, Hans van Thiel ___ 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] Ann: Emping 0.2
Hello All, Version 0.2 of Emping, a utility to derive heuristic rules from a table of nominal data, is available. In addition to a reduced normal form in .csv format, which can be read by Open Office Calc, it now also displays observed implications and equivalences in the reduced rules (if present) and ambiguities in original rules (if present). A bug in the response to a user typing error has been fixed and some code has been simplified, compared to 0.1. An online user guide is at: http://j-van-thiel.speedlinq.nl/emp/empug.html and the Cabal package can be downloaded from there, or from the HackageDB. Thanks, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Behavior of groupBy
Thanks for the help! Strangely, I just now received your messages from April 28, hence the late reply... Hans van Thiel On Sat, 2007-04-28 at 18:09 +0200, Henning Thielemann wrote: On Sat, 28 Apr 2007, Hans van Thiel wrote: Hello All, The standard function groupBy of List.hs doesn't work as I expect in this case: groupBy (\x y - (last x) == (last y)) [abc, bd,cac] results in: [[abc],[bd],[cac]] where I want: [[abc,cac], [bd]] I think you must roll your own one. How about repeated 'partition' to extract all elements that have the same trailing character like the head word of the list? I have done this in a more complex setting and called it 'slice': http://darcs.haskell.org/haskore/src/Haskore/Basic/TimeOrderedList.lhs slice :: (Eq a, Num time) = (body - a) - T time body - [(a, T time body)] slice f perf = let splitByHeadKey pf = fmap (\ev - let i = f (eventBody ev) (pf0, pf1) = partition ((i==) . f) 0 0 pf in ((i,pf0), pf1)) (listToMaybe pf) in List.unfoldr splitByHeadKey perf ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Accepted by Hugs, not by GHC
Hello All, Defining a partially ordered set as: data Porder = HI | LW | NT deriving (Eq) class (Eq a) = Poset a where pcompare :: a - a - Porder and defining an instance for type synonym RuRe: type RuRe = ([Int],[Int]) instance Poset RuRe where pcompare (x1,y1) (x2,y2) | isSub x2 x1 = HI | isSub x1 x2 = LW | otherwise = NT causes no problems in Hugs (-98 flag) but compiling with GHC produces: [EMAIL PROTECTED] Sandbox]$ ghc --make Main.hs -O [5 of 6] Compiling Abduce ( Abduce.hs, Abduce.o ) Abduce.hs:110:0: Illegal instance declaration for `Poset RuRe' (The instance type must be of form (T a b c) where T is not a synonym, and a,b,c are distinct type variables) In the instance declaration for `Poset RuRe' I've tried several changes, like not using the type synonym, but can't get it right. (I'm using the ghc 6.6.1 Fedora Core 6 package). Many thanks in advance! Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Accepted by Hugs, not by GHC
On Sat, 2007-05-19 at 15:30 +0100, David House wrote: On 19/05/07, Hans van Thiel [EMAIL PROTECTED] wrote: causes no problems in Hugs (-98 flag) but compiling with GHC produces: There's the solution to your problem: type synonym instances aren't Haskell98, so you have to pass the -98 flag ('turn on extensions') to Hugs in order for it to work. The corresponding GHC flag is -fglasgow-exts. Try that. Works like a charm! Many thanks, Hans ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] PartitionBy (was: Behavior groupBy)
Hello All, As usual, my first attempt could be better.. -- partitions a list according to an equivalence relation import Data.List (partition) partitionBy :: (a - a - Bool) - [a] - [[a]] partitionBy eq [] = [] partitionBy eq ls = x:(partitionBy eq y) where (x,y) = partition ((head ls) `eq`) ls example partitionBy (\x y - (last x) == (last y)) [abc,bd,bdc,abd] result [[abc,bdc],[bd,abd]] Of course, any crits would be appreciated, but maybe this will save somebody some time.. Thanks, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Behavior of groupBy
Hello All, The standard function groupBy of List.hs doesn't work as I expect in this case: groupBy (\x y - (last x) == (last y)) [abc, bd,cac] results in: [[abc],[bd],[cac]] where I want: [[abc,cac], [bd]] Am I doing something wrong, or is this a bug? The function is defined (in List.hs in the hugs Data library) as : -- | The 'groupBy' function is the non-overloaded version of 'group'. groupBy :: (a - a - Bool) - [a] - [[a]] groupBy _ [] = [] groupBy eq (x:xs) = (x:ys) : groupBy eq zs where (ys,zs) = span (eq x) xs Thanks, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Behavior of groupBy
On Sat, 2007-04-28 at 06:45 -0700, Stefan O'Rear wrote: On Sat, Apr 28, 2007 at 03:49:44PM +0200, Hans van Thiel wrote: Hello All, The standard function groupBy of List.hs doesn't work as I expect in this case: groupBy (\x y - (last x) == (last y)) [abc, bd,cac] results in: [[abc],[bd],[cac]] where I want: [[abc,cac], [bd]] Am I doing something wrong, or is this a bug? The function is defined (in List.hs in the hugs Data library) as : -- | The 'groupBy' function is the non-overloaded version of 'group'. groupBy :: (a - a - Bool) - [a] - [[a]] groupBy _ [] = [] groupBy eq (x:xs) = (x:ys) : groupBy eq zs where (ys,zs) = span (eq x) xs You are doing something wrong. groupBy is specified to never reorder elements. You probably want to use sortBy first. Stefan Ah, many thanks... Hans ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Behavior of groupBy
On Sat, 2007-04-28 at 15:08 +0100, Neil Mitchell wrote: Hi Hans, The standard function groupBy of List.hs doesn't work as I expect in this case: groupBy (\x y - (last x) == (last y)) [abc, bd,cac] You are doing something wrong. groupBy is specified to never reorder elements. You probably want to use sortBy first. I have a defined groupSetBy which does groupBy working as though the list was in fact a set (which is often what it really is). Its a common thing to want - perhaps it should be a library function. And thanks again. I'll roll my own then.. Hans Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Follow up on 'GroupBy behavior'
Thanks again for the help, and, to follow up, this now does what I need.. -- partitions a list according to an equivalence relation partition1 :: (a - a - Bool) - [a] - ([a],[a]) partition1 eq ls = partition ((head ls) `eq`) ls -- partitionBy :: (a - a - Bool) - [a] - [[a]] partitionBy eq [] = [] partitionBy eq ls = (fst x):(partitionBy eq (snd x)) where x = partition1 eq ls Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Tutorial on Haskell
On Mon, 2007-04-16 at 09:34 +0100, Simon Peyton-Jones wrote: Friends I have agreed to give a 3-hr tutorial on Haskell at the Open Source Convention 2007 http://conferences.oreillynet.com/os2007/ I'm quite excited about this: it is a great opportunity to expose Haskell to a bunch of smart folk, many of whom won't know much about Haskell. My guess is that they'll be Linux/Perl/Ruby types, and they'll be practitioners rather than pointy-headed academics. One possibility is to do a tutorial along the lines of here's how to reverse a list, here's what a type is etc; you know the kind of thing. But instead, I'd prefer to show them programs that they might consider *useful* rather than cute, and introduce the language along the way, as it were. So this message is to ask you for your advice. Many of you are exactly the kind of folk that come to OSCON --- except that you know Haskell. So help me out: Suggest concrete examples of programs that are * small * useful * demonstrate Haskell's power * preferably something that might be a bit tricky in another language For example, a possible unifying theme would be this: http://haskell.org/haskellwiki/Simple_unix_tools Another might be Don's cpu-scaling example http://cgi.cse.unsw.edu.au/~dons/blog/2007/03/10 But there must be lots of others. For example, there are lots in the blog entries that Don collects for the Haskell Weekly Newsletter. But I'd like to use you as a filter: tell me your favourites, the examples you find compelling. (It doesn't have to be *your* program... a URL to a great blog entry is just fine.) Of course I'll give credit to the author. Remember, the goal is _not_ explain monads. It's Haskell is a great way to Get The Job Done. Thanks! Simon I'm really enthusiastic about parsec. Even though the principles are (still) far above my head, I've been able to use it on a .csv table produced by OO Calc (the spreadsheet). The tutorial is also very good, and maybe parsec is also an example of (possible) interaction of Haskell to 'modules' written in other programming languages. You can do something (simple but useful) with parsec after just an afternoon's reading. fwiw, summing up my own Haskell experience: I've been learning Haskell for a year now, and I find it very difficult. I miss a training in computer science and often I feel like the guy in that movie who's on a 500 mile trip driving an old lawn mower. Traffic zooms past, and often you depend on people who're willing to lend a hand. Having said that, it's also fun and I enjoy the pioneer spirit in the community. The major advantages of Haskell are, IMO, 1) the type system is a great aid to the programmer and programs are short. Therefore Haskell is very well suited for the independent developer who can't afford huge amounts of code. Open Source has many of those. 2) polymorphism is also a great advantage. You can write your program in the most general types using e.g. only equality and order, and fine tune them later to more specific types which perform better. 3) the difficulty of Haskell is not necessarily a bad thing, it also makes it interesting, and there are many good libraries to use. But Haskell is also pretty scaleable, in the sense that you can do a lot of things just with recursion, then do them better with maps, folds, list comprehensions, then do them better with some monadic replacements, and so on. 4) there is a very helpful and knowledgeable community. A major disadvantage of Haskell is the lack of books, especially with regard to intermediate level programming and the libraries. Documentation that is available varies in quality and is, in general, fragmented. Best Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: utility for deriving rules from a nominal table
Hello All, I'd like to announce the availability of Emping, a utility that reads a table in a csv format that can be generated from Open Office Calc, derives all shortest rules for a selected attribute, and writes them to a .csv file that can be read by OO Calc. See http://j-van-thiel.speedlinq.nl/emp/empug.html for more and, if you're interested, a download. The package is built by Cabal. However, I couldn't install it myself from there with Cabal. Configuration seemed to go OK, but build generated a message that ghc found no source files. I couldn't get it right, but I'm leaving it at that, because (1) I'm assuming the package itself is OK and (2) it's a standalone utility so maybe Cabal is overkill anyway (though it's nice how Cabal forces a structure). Just compiling the source modules is, probably, the preferred option here. Thanks, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type and State Confusion
On Tue, 2007-03-13 at 00:47 -0400, Albert Y. C. Lai wrote: Hans van Thiel wrote: sequence :: Monad m = [m a] - m [a] You write: The = used by sequence is the same = in the MyState monad, since you instantiate m to MyState String. Therefore, sequence performs all the state transformations correctly, since = is correct. So the m becomes MyState String, and therefore the list elements have type (MyState String Int), or the other way around. I understand, from your explanation, how this works from there on, but I'm still confused about what the Monad is. Is it MyState which takes two types, or (MyState String) which takes one type? Or neither? Does it involve some 'sort of currying' of type parameters? The monad is (MyState String) or generally (MyState a) which takes one type. So this is some sort of currying of type parameters. With this in mind, the rest is straightforward: data MyState a b = MyStateC ([a] - ([a], b)) This defines an algebraic data type (...why is it called algebraic?) with two type variables and a unary constructor. instance Monad (MyState a) where return x = MyStateC (\tb - (tb, x)) (MyStateC st) = f = MyStateC (\tb - let (newtb, y) = st tb (MyStateC trans) = f y in trans newtb ) Now, if the instantiated a has type String, Int or whatever, I would understand, but the type of the Monad seems to be built up from two types. The general type of return is return :: (Monad m) = b - m b Tailor-made to our case, m = MyState a, return :: b - MyState a b Similarly, the general type of = is (=) :: (Monad m) = m b - (b - m c) - m c Tailor-made to our case, m = MyState a, (=) :: MyState a b - (b - MyState a c) - MyState a c If we now consider foo = toMyState then a=String, b=String, c=Int. Note again that the part (MyState a), or now (MyState String), is the monad. Got it! Many thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Type and State Confusion
Albert, Thanks very much for your explanation. I see now that I confused the state function with the f, but it's still not quite clear. data MyState a b = MyStateC ([a] - ([a], b)) This defines an algebraic data type (...why is it called algebraic?) with two type variables and a unary constructor. instance Monad (MyState a) where return x = MyStateC (\tb - (tb, x)) (MyStateC st) = f = MyStateC (\tb - let (newtb, y) = st tb (MyStateC trans) = f y in trans newtb ) Now, if the instantiated a has type String, Int or whatever, I would understand, but the type of the Monad seems to be built up from two types. You write: ...y has type String. In more detail: in order for foo = toMyState to make sense, these must be the types: foo :: MyState String String st :: [String] - ([String], String) y is forced to have type String for the sake of toMyState. But how do the two occurrences of String in the foo type, in general a and b, match to the single a in the instance declaration? In particular when I have: toMyState :: String - MyState String Int toMyState x = MyStateC (f x) This is mapped onto a list of strings, on which the Prelude sequence is applied. sequence :: Monad m = [m a] - m [a] You write: The = used by sequence is the same = in the MyState monad, since you instantiate m to MyState String. Therefore, sequence performs all the state transformations correctly, since = is correct. So the m becomes MyState String, and therefore the list elements have type (MyState String Int), or the other way around. I understand, from your explanation, how this works from there on, but I'm still confused about what the Monad is. Is it MyState which takes two types, or (MyState String) which takes one type? Or neither? Does it involve some 'sort of currying' of type parameters? Thanks again, Hans ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] State of Ignorance
Hello All, I have the following functions, based on Thompson's CFP example (also in Control.Monad.State documentation) of using a state monad on a tree. My functions (on a list) work, but I don't understand why. Main getInds [house,tree,cat,house,cat,dog,tree] [0,1,2,0,2,3,1] Main getTb [house,tree,cat,house,cat,dog,tree] [house,tree,cat,dog] This, from CFP, is clear enough. repl1 :: String - [String] - ([String], Int) repl1 x tb | elem x tb = (tb, fromJust (elemIndex x tb)) | otherwise = (tb ++ [x], length tb) then, turn this into a function to a state monad type: toMyState :: String - MyState String Int toMyState x = MyStateC (repl1 x) where the monad is defined as: data MyState a b = MyStateC ([a] - ([a], b)) instance Monad (MyState a) where return x = MyStateC (\tb - (tb, x)) (MyStateC st) = f = MyStateC (\tb - let (newtb, y) = st tb (MyStateC trans) = f y in trans newtb ) Now I understand this (barely) in the sense that = works through defining how f takes its values from st. So, f would be the function: toMystate and trans would be: (repl1 x). But then y would have to be of type String, whereas the y in the tuple would have type Int, since it is generated by st. I just don't get it. Next the book explains how to extract values from a state and again that's pretty clear: extr1 :: MyState a b - b extr1 (MyStateC st) = snd (st []) extr2 :: MyState a b - [a] extr2 (MyStateC st) = fst (st []) I have a list instead of a tree, so I tried: strtoMS :: [String] - [MyState String Int] strtoMS ls = map toMyState ls and the final functions are: getInds :: [String] - [Int] getInds = extr1 . sequence . strtoMS getTb :: [String] - [String] getTb = extr2 . sequence . strtoMS They work, but now I don't understand sequence, defined in the Prelude. From: a Tour of the Haskell Monad Functions http://members.chello.nl/hjgtuyl/tourdemonad.html sequence :: Monad m = [m a] - m [a] sequence = foldr mcons (return []) where mcons p q = p = \x - q = \y - return (x : y) This has a different bind (=) from the one in the MyState monad, yet is appears to perform all the state transformations. The documentation says: sequence xs evaluates all monadic values in the list xs, from left to right, and returns a list of the contents of these monads, placing this list in a monad of the same type. Note, that evaluating can be interpreted as performing an action, for example in the case of print. It looks to me as if sequence works here because values of MyState are themselves functions, but how? Many thanks for any pointers and clarification! Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] class question
Hello, I'm trying to understand classes and defined: class Monoid a where e :: a add :: a - a - a add a e = a add e a = a instance Monoid a Int where e = 0 add x y = x + y This works just fine, also for instance definitions of Char, Bool and lists. But defining: class (Num a, Monoid a) = NumMon a where e = 0 add x y = x + y reults in error messages. -- Hugs: ERROR Chap12.hs:57 - No member e in class NumMon -- GHCi: Chap12.hs:58:3: `add' is not a (visible) method of class NumMon' I've also tried instance definitions of NumMon (leaving out 'where' and what's next in the class declaration) and get similar messages. The definition of NumMon by itself, just the first line, is accepted by Hugs and GHCi both. What am I doing wrong? Many thanks in advance. Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] class question
On Sun, 2007-01-21 at 09:42 -0800, Stefan O'Rear wrote: On Sun, Jan 21, 2007 at 06:21:34PM +0100, Hans van Thiel wrote: class (Num a, Monoid a) = NumMon a where e = 0 add x y = x + y What am I doing wrong? Many thanks in advance. Nothing! What you are trying to do, declare a class B containing all members of a class A, is simply not supported in Haskell. This is the closest you'll get with Haskell98: newtype Wrap a = Wrap (Wrap a) instance Num a = Monoid (Wrap a) where e = Wrap 0 add (Wrap x) (Wrap y) = Wrap (x + y) This is the closest you'll get with GHC extensions: {-# OPTIONS_GHC -fallow-undecidable-instances #-} instance Num a = Monoid a where e = 0 add = (+) Hope this helps. Yes, thank you. The one with the gHC extension looks like what I wanted to do, but then in reverse order, declare the numbers to be monoids. Expanding on this, I've now got: class Monoid a = Group a where inv :: a - a minus :: a- a - a minus x y = add x (inv y) inv x = minus e x instance Group Int where minus = flip subtract -- inv x = -x This seems to work. What I like is that, like in EQ and Ord, functions are defined in several ways by default. So, for Int, you can choose to define either inv or minus, you don't have to do both. But subtract and - are defined over all types of Num, so it would be nice to have something like instance Group a = Num a where . I understand this cannot be done in Haskell98, but it can with the GHC extension? Does {-# OPTIONS_GHC -fallow-undecidable-instances #-} refer to possibly infinite definitions? Thanks again! Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] class question
I. On Sun, 2007-01-21 at 11:20 -0800, Stefan O'Rear wrote: On Sun, Jan 21, 2007 at 08:00:53PM +0100, Hans van Thiel wrote: On Sun, 2007-01-21 at 09:42 -0800, Stefan O'Rear wrote: This is the closest you'll get with GHC extensions: {-# OPTIONS_GHC -fallow-undecidable-instances #-} instance Num a = Monoid a where e = 0 add = (+) Yes, thank you. The one with the gHC extension looks like what I wanted to do, but then in reverse order, declare the numbers to be monoids. Expanding on this, I've now got: In an instance definition, the = is implication; a number is a monoid if it is a number. (Yes, we know the class syntax is backward :( ) Thanks for pointing this out. :-) class Monoid a = Group a where inv :: a - a minus :: a- a - a minus x y = add x (inv y) inv x = minus e x instance Group Int where minus = flip subtract -- inv x = -x This seems to work. What I like is that, like in EQ and Ord, functions are defined in several ways by default. So, for Int, you can choose to define either inv or minus, you don't have to do both. looks correct But subtract and - are defined over all types of Num, so it would be nice to have something like instance Group a = Num a where . I understand this cannot be done in Haskell98, but it can with the GHC extension? Does {-# OPTIONS_GHC -fallow-undecidable-instances #-} refer to possibly infinite definitions? Thanks again! Almost - that instance definition says that every group is a number (~= ring), which probably isn't what you meant :) As above, useful to know :-) instance Num a = Group a where . Haskell instance definitions, unrestricted, effectively force the compiler to solve arbitrary logic problems, which can take up to and including forever. To keep type inference terminating, H98 imposes a number of severe restrictions. GHC has a number of options to relax the restrictions in ways that complicate typechecking but don't make it impossible (-fallow-overlapping-instances, etc); -fallow-undecidable-instances is the ultimate flag and basically says Do what I say - I accept responsibility if the typechecker goes into an infinite loop. Keep SIGINT handy. It's pretty clear now, thanks for the help! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Beta Gtk2Hs Getting Started
On Mon, 2007-01-08 at 16:11 -0200, Alex Queiroz wrote: Hallo, On 1/8/07, Hans van Thiel [EMAIL PROTECTED] wrote: Hello All, The beta of the 'Gtk2Hs:Getting Started' short tutorial for beginners, Haskell GUI for Dummies, if you like :-) can be viewed at http://j-van-thiel.speedlinq.nl/gtk2hs/gtk2hsGetStart.html Nitpicking: Glade does not belong to GTK+, neither does libglade, which are independent projects. Thanks, I didn't know that. What other widget libraries are supported at this time? Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Beta Gtk2Hs Getting Started
Hello All, The beta of the 'Gtk2Hs:Getting Started' short tutorial for beginners, Haskell GUI for Dummies, if you like :-) can be viewed at http://j-van-thiel.speedlinq.nl/gtk2hs/gtk2hsGetStart.html It tells what Gtk2Hs is, shows how to write and run 'Hello World', introduces the api and explains how to use it, refers to the Glade tutorials, gives an example of widget layout, and ends with some general pointers. It should take no more than 2,3 hours of the user's time. All feedback very welcome. Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Glade Gtk2Hs Tutorial
Hello, The Haskell Gtk2Hs adaptation of the 'Developing Gnome Apps with Glade' tutorial for beginners is now also on http://eddy.writelinux.com/ Note there are translations there of the original version for C in French, Dutch, Spanish, Turkish and Korean. Native speakers of those languages who are interested could use these and check out the Haskell Gtk2Hs listings later. Thanks, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Re: Read a single Char
That is normal Unix behaviour. Try the same input with head -1c | od -c; head -1c | od -c The terminal buffer is only discarded if a program changes the terminal mode. Hugs and ghci do (because they use readline), but runhugs doesn't. Ah, so that's it! Thanks, all. Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Re: Read a single char
On Tue, Oct 24, 2006 at 06:14:14PM +0200, Hans van Thiel wrote: I have a similar question. When I use getChar with Hugs the newline (caused by pressing 'Enter') seems to be carried over into the next call of main, where it is treated as a single input character. The workaround is getLine and head, but it would be nice to drop the newline right away. I suppose the solution offered here: that is the correct behavior, input is never discarded, it is just saved up until you press enter for the first time. if you type fooenter, your next four getChars will get 'f' 'o' 'o' and '\n'. it is not haskell that is treating enter as specially, it is your terminal, getChar just returns exactly what was passed to it. Yes, but the problem is with two subsequent runs of main. I'd have thought the buffer would flush automatically and the second run would start with an empty buffer. Now I enter 'b', then press 'Enter' and it works as expected. Then I 'main' again, and it terminates right away with a blank line. If I enter 'a', 'b' and then Enter, the second run takes the second character. If I'm not doing anything wrong (always a possibility :-), then it seems more like a (small) bug in Hugs, as Neil suggested. I'll have to check what chgi does. John -- John Meacham - ⑆repetae.net⑆john⑈ Regards, Hans ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Read a single Char
Hello, I have a similar question. When I use getChar with Hugs the newline (caused by pressing 'Enter') seems to be carried over into the next call of main, where it is treated as a single input character. The workaround is getLine and head, but it would be nice to drop the newline right away. I suppose the solution offered here: hSetBuffering stdin NoBuffering will have the desired effect, but is there another way? Thanks, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Read a single Char
No, it happens with Hugs on Fedora Core 5 (the fc5 Hugs package), not WinHugs. Thanks, Hans On Tue, 2006-10-24 at 17:27 +0100, Neil Mitchell wrote: Hi I have a similar question. When I use getChar with Hugs the newline (caused by pressing 'Enter') seems to be carried over into the next call of main, where it is treated as a single input character. The workaround is getLine and head, but it would be nice to drop the newline right away. I suppose the solution offered here: Hmm, sounds like a bug in WinHugs, I'll check it out Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Gtk2Hs and Glade Tutorial
Hello, There is a very nice tutorial on the Glade Interface Designer at http://www.writelinux.com/glade and I've been using it with 'An Introduction to Gtk2Hs, A Haskell GUI Library', by Kenneth Hoste at http://haskell.org/~shae/memory.pdf to learn Gtk2Hs and Glade. The 'Gtk2Hs Introduction', however, is not really aimed at the absolute beginner and so I've written down my experience as an 'appendix' to the glade tutorial, which really is for getting started. I've just asked the author, Eddy Ahmed, for permission to 'translate' his tutorial to Haskell Gtk2Hs, but meanwhile I'd like to submit my separate concept (attached) for comments. Thanks, Hans van Thiel Gtk2HsGlade.odt Description: application/vnd.oasis.opendocument.text ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Why Haskell?
Hello All, Thanks for the many helpful replies to my question about the suitability of Haskell for industrial/commercial application. From those I gather there are no licensing problems regarding the use of the standard functions and modules. Use of proprietary modules may or not be restricted by the authors, but of course this is to be expected and fair. Performance and size of Haskell programs don't seem to be problematic either, at least for small and medium size applications. Tool support, however, is less than for the more established languages. But maybe the Eclipse support which is under development will be a boost. Also, there are good interfaces with open source gui widgets etc. So, the summary conclusion would be that Haskell can be used (and is being used) provided the developers are aware that unexpected problems may arise in practice. Advantages of Haskell seem to be short size of code (and all the advantages that implies) and the high abstraction level and mathematical rigour (which makes for less programming errors). As for the 'popularity' of Haskell, someone made the very common sense remark that all successful languages have been promoted by some large corporation. (Please note 'successful' stands for 'spread of use', not 'quality' here.) If fp is to reach the mainstream, it will probably be because of some centralized support from outside the academic world. Maybe something like a 'Haskell Consortium' or 'Haskell Initiative' to promote Haskell should be set up. An example could be the promotion of SystemC for hardware and software co-design by the Open SystemC Initiative www.systemc.org . Availability of an IEEE standard for Haskell would also be a good thing for its acceptance, I think. That is, assuming 'mainstream' is the goal, of course. Regards, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re:Re: Why Haskell
From: Hans van Thiel [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Johan Tibell [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] Re: Why Haskell? Date: Mon, 07 Aug 2006 17:21:17 +0200 On Mon, 2006-08-07 at 15:23 +0200, Johan Tibell wrote: For me library support, for networking in particular, has been the major hurdle. It gets problematic when too many libraries are still marked as experimental and only partially implements the specification (e.g. protocol) that they are supposed to handle. Also after a quick look at the source for some common (networking) libraries I found a few too many calls to error to feel comfortable. It's not okay for a library to bring down my application behind my back, error should be reported even if this uglifies the code and interfaces. Furthermore I think that Haskell would benefit from moving some commonly used functionality such as HTTP, SQL and XML support into the standard libraries. I haven't seen any news about the progress of HaskellNet but I guess it could solve my problems. That's good to know, thanks! I really don't have much problems with tool support, speed and the like. I'm convinced it's a library (and library documentation!) thing. Likewise. Having someone pay a group of people to hack on Haskell implementations would indeed be desirable. Without knowing the details Ubuntu looks like a promising model. If we could just find a willing billionaire out there.. Candidates would be companies that have an interest in promoting Haskell and/or fp, large and small. Ericsson comes to mind, if they are still active in fp. Or maybe one of the rising Indian, Chinese or or other 'globalization' firms could be the principal here? Personally, I'd love to see a Brazilian company like, for example, PetroBras pick this up. And just from a PR point of view, Haskell does project a cutting edge image. Anyway... Regards, Hans Cheers, Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Why Not Haskell?
Hello All, I'm wondering why I can't find any commercial Haskell applications on the Internet. Is there any reason for this? I can think of the following possibilities only: 1) Haskell is too slow for practical use, but the benchmarks I found appear to contradict this. 2) Input and output are not good enough, in particular for graphical user interfacing and/or data base interaction. But it seems there are several user interfaces and SQL and other data base interfaces for Haskell, even though the tutorials don't seem to cover this. 3) Haskell is not scaleable for commercial use. This looks unlikely to me, but could this be a factor? 4) Haskell is open source and licensing restrictions forbid commercial applications. I haven't seen any such restrictions, but is this a problem for the standard modules? Are there other reasons why there seem to be just a few thousand (hundred?) Haskell programmers in the world, compared to the 3 million Java programmers and x million C/C++ programmers? The reason I ask is that in the early nineties I wrote a data mining /machine learning program. This was not a commercial success and since then I've been working as a free lance IT journalist. As such I covered the O'Reilly European Open Source Convention in Amsterdam last year and there I heard of Haskell. I became interested and started learning from the available free tutorials and Hugs. As an aside, I'd like to thank all those people. I really appreciate their work and I'd like to single out Hal Daume III's 'Yet Another Haskell Tutorial', while not diminishing the other authors in any way. Meanwhile I kept working on a data mining algorithm in my spare time and finally I came up with something that appears to work. While I was learning Haskell, I thought, why not try this part of the algorithm as a Haskell exercise. I could easily test it in Hugs. To my own surprise, after only a few weeks of this, I had a working prototype of my algorithm, printed out on less than 3 pages, using only standard functions in the Prelude. So, I'm really impressed by the power of Haskell, and I'm just a beginner. Now I'm trying to come up with a business model for my algorithm and to avoid the mistakes I made 10 years ago. There is a lot of difference between a prototype and a working tool, and then there is a lot of difference between a working tool and a successful commercial application. Probably it doesn't make much sense to try and develop a tool in C++ or even Java, but if I have to go on my own on this, maybe Haskell could be feasible, both for fun and profit. So, that's the background of my question (while introducing myself to the Cafe at the same time). Why hasn't Haskell made it into the business world (yet), after being available for 15 years, or is this the wrong question? Many thanks for your comments, Hans van Thiel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe