[Haskell-cafe] Writing a compiler in Hakell
Hi everyone. I am designing my own programming language. I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction? I know about Happy. Is that a good tool to use? The compiler is intended for serious use and I would like it to be very efficient, maybe competing with compilers written in C. It should also be very easy to extend as the languoge grows. Are there any good books that you can recommend on compiler construction in general and specific to haskell? On another note, how is the operator + implemented in haskell? is there a primitve (say #+) that is wrapped by the haskell operator +? Maybe something like: (+) :: a - a - a v1 + v2 = #+ v1 v2 Thanks in advance Rouan. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a compiler in Hakell
2009/5/6 Rouan van Dalen rvda...@yahoo.co.uk: Hi everyone. I am designing my own programming language. I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction? I know about Happy. Is that a good tool to use? The compiler is intended for serious use and I would like it to be very efficient, maybe competing with compilers written in C. It should also be very easy to extend as the languoge grows. Hi, This seems an interesting project. Can you tell us a bit more about your language (functional, dynamic, lazy, does it support call/cc, ...) ? What about the target language (C, C--, x86 assembly, some virtual machine) ? What about the syntax ? Depending of the kind of answers you might provide, specific directions can probably be given. Also, you say maybe competing with compilers written in C, do you really talk about compiler performance or about generated code performance ? Once those questions are resolved, you can go to hackage, see a list of packages. http://hackage.haskell.org/packages/archive/pkg-list.html For x86 machine code: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/harpy For LLVM: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/llvm For C: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/language-c Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a compiler in Hakell
On Wed, May 6, 2009 at 12:07 AM, Rouan van Dalen rvda...@yahoo.co.ukwrote: Hi everyone. I am designing my own programming language. I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction? I know about Happy. Is that a good tool to use? I don't like Happy. Using a parser generator is like admitting defeat, when we have no defeat to admit. I would recommend a parser combinator library like Parsec (or if you like building things from the ground up, ReadP). The compiler is intended for serious use and I would like it to be very efficient, maybe competing with compilers written in C. It should also be very easy to extend as the languoge grows. I agree with minh thu; there are too many questions to consider before giving too much specific advice. But in almost all cases, plan on the production version of your compiler being written in the language it is compiling. This has many advantages. Are there any good books that you can recommend on compiler construction in general and specific to haskell? On another note, how is the operator + implemented in haskell? is there a primitve (say #+) that is wrapped by the haskell operator +? Maybe something like: (+) :: a - a - a v1 + v2 = #+ v1 v2 It varies from compiler to compiler, but in general, yes. And in GHC I think it is called +#, actually, but you need to do some digging to find it, and your code won't be portable once you do. Luke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a compiler in Hakell
Hello Rouan My bible : The dragon book of Aho, Sethi Ullman http://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools Regards J-C On Wed, May 6, 2009 at 8:07 AM, Rouan van Dalen rvda...@yahoo.co.uk wrote: Hi everyone. I am designing my own programming language. I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction? I know about Happy. Is that a good tool to use? The compiler is intended for serious use and I would like it to be very efficient, maybe competing with compilers written in C. It should also be very easy to extend as the languoge grows. Are there any good books that you can recommend on compiler construction in general and specific to haskell? On another note, how is the operator + implemented in haskell? is there a primitve (say #+) that is wrapped by the haskell operator +? Maybe something like: (+) :: a - a - a v1 + v2 = #+ v1 v2 Thanks in advance Rouan. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a compiler in Hakell
On Tue, May 5, 2009 at 11:07 PM, Rouan van Dalen rvda...@yahoo.co.uk wrote: Hi everyone. I am designing my own programming language. I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction? I think GHC itself uses Alex and Happy for tokenizing and parsing respectively. Parsec is a nice parser combinator library. Another tool you could employ is Higher Order Abstract Syntax (more of an idiom), and there are papers about it if you google for them. It's a way of representing the program you want to compile and doing transformations on it. I know about Happy. Is that a good tool to use? My understanding is that GHC uses it. I think they are happy with happy, but maybe a GHC dev could comment. The compiler is intended for serious use and I would like it to be very efficient, maybe competing with compilers written in C. It should also be very easy to extend as the languoge grows. I think one of the biggest slow downs for compilers is the complexity of parsing and the complexity of the compilation. For example, If you pick a grammar that parses efficiently and do less sophisticated analyses involving a single pass and so on it will be fast to compile. The draw back is that the compiled programs may execute more slowly than if you did lots of analysis or optimization. As an example of what not to do, C++ has a notoriously complex to parse grammar along with some other issues that make it a slow compiling language :) Are there any good books that you can recommend on compiler construction in general and specific to haskell? I like Modern Compiler Design myself: http://www.amazon.com/Modern-Compiler-Design-D-Grune/dp/0471976970 I would also recommend reading the haskell report to get an idea of what a friendly language specification looks like: http://www.haskell.org/onlinereport/ One point of advice I would give is defining your language as an embedded language in Haskell first. You can start with the data type that holds your intermediate representation or abstract syntax. Then you can work on either code generation or evaluation. As you start to settle on your data structures and the language primitives you can begin working on a parser. In a sense, the parser is the last part you need to finish. I've found this approach to be quite accommodating and to also save me a lot of time. If you google for it, there is a fair bit of literature about domain specific and embedded domain specific languages in Haskell. It's quite a good language for prototyping this way. Once you write some code you'll discover that some things are taking too long. In that case, you'll want to learn how to make proper use of the GHC profiler, assuming you use GHC as your haskell compiler. It's quite powerful and by using it correctly you can zoom in on the slow spots and dramatically improve the performance of your compiler. I found this paper to be a nice way to get started: http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf One of the brilliant bits in that paper is that it teaches you to use an existing compiler (gcc) to generate code and then learn how to implement things by example! I highly recommend reading it. It's written about a scheme compiler, but it applies equally well to other languages. Good luck! Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Reply to
I feel that the haskell mailing lists must have the reply-to field set, so that a person can reply to the list by just clicking reply. I am unsure if I am the only one facing this problem. --- Ashok `ScriptDevil` Gautham ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a compiler in Hakell
Rouan van Dalen wrote: Hi everyone. I am designing my own programming language. I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction? I know about Happy. Is that a good tool to use? The compiler is intended for serious use and I would like it to be very efficient, maybe competing with compilers written in C. It should also be very easy to extend as the languoge grows. Be sure to take a look at attribute grammars (AG). From what I hear it varies whether people like using them, but they're worth a try at least. The Monad Reader Issue 4 has an introductory article on AGs [1] by Wouter Swierstra, explaining what they do and how they are useful. I hear Happy has an AG system [2]. Probably the most mature standalone AG is the UUAG [3], with which the Utrecht Haskell Compiler [4] was built. HTH, Martijn. [1] http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue4/Why_Attribute_Grammars_Matter [2] http://www.haskell.org/happy/doc/html/sec-AttributeGrammar.html [3] http://www.cs.uu.nl/wiki/HUT/AttributeGrammarSystem [4] http://www.cs.uu.nl/wiki/UHC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] List comprehension
por...@porg.es wrote: -- or with Data.Function.Predicate (shameless plug) http://hackage.haskell.org/packages/archive/predicates/0.1/doc/html/Data-Function-Predicate.html: Whoa, a function called isn't, why is this the first time I see that? :-) Martijn. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Reply to
Hi Ashok, I feel that the haskell mailing lists must have the reply-to field set, so that a person can reply to the list by just clicking reply. Most email clients have a followup or reply-to-all feature, that will do this. Better email clients also support (setting and reading) the Mail-Followup-To header, which can prevents duplicates from being sent to someone who is also subscribed to the list and ensure that replies are sent directly to someone who is not on the list. Using the reply-to header for this purpos is really wrong IMHO, since that prevents people from easily replying directly to the author (and usually makes personal email end up on the list as well) and makes it impossible for people to use the Reply-To header for the purpose it was really meant for. See also http://cr.yp.to/proto/replyto.html Gr. Matthijs signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a compiler in Hakell
2009/5/6 Rouan van Dalen rvda...@yahoo.co.uk I know about Happy. Is that a good tool to use? Alex and Happy are used in (at least) these two packages: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/language-python http://hackage.haskell.org/cgi-bin/hackage-scripts/package/language-c You should be able to find lots of useful code to start with in both of those. You can get good performance out of Alex and Happy. Of course there are more considerations than just performance, and you will get different opinions about those other aspects. I wrote the python parser above and I was quite pleased with Alex and Happy from a usability perspective. LLVM is a nice framework for building the backend of a compiler, and the Haskell bindings are quite useful: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/llvm The amount of work you have to do depends on your runtime system (GC, threads, exceptions etc). If your language has fairly conventional semantics (a typical imperative language) then you can reuse a lot of the existing infrastructure that LLVM provides. On another note, how is the operator + implemented in haskell? It is good to differentiate Haskell the language specification from compilers (and other tools) which implement it. The language specification does not say exactly how the primitive operations should be implemented; that is a detail which is up to the compiler writer to decide. GHC's implementation is the best documented, and there are many research papers which describe aspects of it (some outdated). For numerical primitives, you could start by looking at this paper: Unboxed values as first class citizens in a non-strict functional language Peyton Jones and Launchbury. http://research.microsoft.com/en-us/um/people/simonpj/papers/unboxed-values.ps.Z Cheers, Bernie. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a compiler in Hakell
On May 6, 2009, at 8:07 AM, Rouan van Dalen wrote: Hi everyone. I am designing my own programming language. I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction? I know about Happy. Is that a good tool to use? The compiler is intended for serious use and I would like it to be very efficient, maybe competing with compilers written in C. It should also be very easy to extend as the languoge grows. Are there any good books that you can recommend on compiler construction in general and specific to haskell? What is your goal? Writing a compiler, for fun and educational purposes, or to implement a new language? When the actual language is the main purpose and your language will be a functional one you can try to piggyback on existing compilers. For example, translate your language to the GHC core or UHC[1] core and you get a cross platform highly optimizing compiler for free. You can now freely focus on the semantics of your language and let an existing code generator do the dirty work for you. When, in the end when your languages is finished, the existing compiler is not fast enough, improve it and everyone benefits! On another note, how is the operator + implemented in haskell? is there a primitve (say #+) that is wrapped by the haskell operator +? Maybe something like: (+) :: a - a - a v1 + v2 = #+ v1 v2 Thanks in advance Rouan. [1] https://svn.cs.uu.nl:12443/repos/EHC/trunk/EHC/src/ehc/Core/AbsSyn.cag -- Sebastiaan Visser ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Reply to
On Wed, May 6, 2009 at 7:51 AM, Ashok Gautham scriptdevil.hask...@gmail.com wrote: I feel that the haskell mailing lists must have the reply-to field set, so that a person can reply to the list by just clicking reply. I am unsure if I am the only one facing this problem. This is a contentious issue: http://www.unicom.com/pw/reply-to-harmful.html http://marc.merlins.org/netrants/reply-to-useful.html I personally think mailing-lists shouldn't put themselves in the Reply-To, and that easy replying to the list is something that should be handled in the mail client (I base my choice of mail client on this). What client are you using? /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] calling a variable length parameter lambda expression
On Tue, May 5, 2009 at 8:49 PM, Nico Rolle nro...@web.de wrote: Hi everyone. I have a problem. A function is recieving a lambda expression like this: (\ x y - x y) or like this (\ x y z a - (x y) (z a) my problem is now i know i have a list filled with the parameters for the lambda expression. but how can i call that expression? [parameters] is my list of parameters for the lambda expression. lambda_ex is my lambda expression is there a function wich can do smth like that? lambda _ex (unfold_parameters parameters) Why not: lam1 = \[x, y] - x y lam2 = \[x, y, z, a] - (x y) (z a) doLam :: Ord a = ([a] - Bool) - [a] - Bool doLam lam params = lam params So, this will work fine: doLam lam1 [1, 2] doLam lam2 [1,2,3,4] -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Writing a compiler in Hakell (continued 1)
Hi everyone. Thanks for the speedy replies. Let me elaborate on my language and situation. The language I have in mind is a statically typed, hybrid (OOP + functional), strict language. It contains both functional and imperitive features (much the same as OCaml/F#) with ideas from haskell, scheme, smalltalk, mozart/oz, F#, C#. The syntax is kept as succint as possible, adding things that I think would be useful that are not defined in any of the inspirational languages. As for the target language, im not quite sure yet. I am doing a lot of work in .NET/C# at the moment, but I would eventually like to use my own programming language, instead of C#. I would also like to use my language for linux programming, so I will eventually support both Windows and Linux environments. My aim with this project is to further explore haskell and deepen my understanding of it, while at the same time creating something useful where I can explore my own ideas about programmnig languages and concepts. I don't really intend to write the next programming language used by billions of people. If others find it useful, that's awsome. I definitely intend to use my language for my own projects and to make it freely availble on the net. So it is not just for learning or fun, it is more focused on implementing a decent programming language that can be used for commercial applications (and fun). The compiler for my language should have a decent compile time, comparing to compilers written in C. The approach that I have in mind is to piggy back on existing languages/compilers until their implementation is no longer adequite or I have time to write my own code generator. So the first stage would be something like translate to C# and then use the C# compiler to obtain an executable. I want the first steps to go as quick as possible so that I can refine the language and test ideas quickly, and once the language has stabalized, concentrarte on my own full fledged compiler (if it is necessary). I think I will try Parsec as a starting point for creating a parser. Thanks again everyone. Regards Rouan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Reply to
Am Mittwoch 06 Mai 2009 11:05:05 schrieb Magnus Therning: On Wed, May 6, 2009 at 7:51 AM, Ashok Gautham scriptdevil.hask...@gmail.com wrote: I feel that the haskell mailing lists must have the reply-to field set, so that a person can reply to the list by just clicking reply. I am unsure if I am the only one facing this problem. This is a contentious issue: http://www.unicom.com/pw/reply-to-harmful.html http://marc.merlins.org/netrants/reply-to-useful.html May I add http://woozle.org/~neale/papers/reply-to-still-harmful.html I personally think mailing-lists shouldn't put themselves in the Reply-To, and that easy replying to the list is something that should be handled in the mail client (I base my choice of mail client on this). Indeed. I have reply, reply-to-all and reply-to-list one click or one key combination away, and as far as I know those features are present in almost all mail clients since several years, so ease of replying to list shouldn't be an issue. On the other hand, I do not want messages intended to be private communications to end up on the list, which would happen more easily with munged headers. So, count me in the leave-reply-to-alone camp. What client are you using? /M Cheers, Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell IO problem
I havent done much IO at all in haskell, only within the function itself. However I want to get the input from the interface for the function and havent done this before. // Say I have this as my data type and list of films data Film = Film String String Int [String] -- List of films testDatabase :: [Film] testDatabase = [(Film Casino Royale Martin Campbell 2006 [Garry, Dave, Zoe]) ] // with functions such as: becomeFan :: String - String - [Film] - [Film] becomeFan _ _ [] = [] becomeFan filmName fanName ((Film title director year fans):xs) | filmName == title = (Film title director year fanName:fans) : xs | otherwise = (Film title director year fans) : becomeFan filmName fanName xs filmsInGivenYear :: Int - [Film] - [String] filmsInGivenYear filmYear films = [ title | (Film title director year fans) - films, year == filmYear] // I want to ask the user what function they want to use, I have this so far main :: IO() do putStr Hi there! what is your name: fanName = getLine do putStr 1 = Insert film, 2 = Become a Fan, 3 = The number of fans of a film, 4 = Film released in a year: input = getLine read input :: Int (if input == 1 then main x = insertFilm [] else if input == 2 then main x = becomeFan [] else if input == 3 then main x = numberOfFans []) // I thought using the if statement would work, but now I cant think how to gather the needed input for the function they have chosen? thanks apple -- View this message in context: http://www.nabble.com/Haskell-IO-problem-tp23404351p23404351.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a compiler in Hakell (continued 1)
On Wed, May 6, 2009 at 4:17 AM, Rouan van Dalen rvda...@yahoo.co.uk wrote: As for the target language, im not quite sure yet. I am doing a lot of work in .NET/C# at the moment, but I would eventually like to use my own programming language, instead of C#. I would also like to use my language for linux programming, so I will eventually support both Windows and Linux environments. C# seems like a fine choice for target language, at least for starters. The CLR is a great virtual machine, with a good garbage collector and a mature JIT engine. Mono is also pretty nice and will give you support for linux. My aim with this project is to further explore haskell and deepen my understanding of it, while at the same time creating something useful where I can explore my own ideas about programmnig languages and concepts. I don't really intend to write the next programming language used by billions of people. If others find it useful, that's awsome. I definitely intend to use my language for my own projects and to make it freely availble on the net. So it is not just for learning or fun, it is more focused on implementing a decent programming language that can be used for commercial applications (and fun). Great! Yes, absolutely write your compiler in your language itself after you have bootstrapped a little bit of it. This will stress-test the viability of your language to complex symbol manipulation tasks, and also give you the kind of self-referential improvements you see from such a situation. The compiler for my language should have a decent compile time, comparing to compilers written in C. That's not too hard. The design of C is terrible for that. Recompiling every header file each time it is included! With a decent module system and interface format it shouldn't be that hard to compete with C. The approach that I have in mind is to piggy back on existing languages/compilers until their implementation is no longer adequite or I have time to write my own code generator. So the first stage would be something like translate to C# and then use the C# compiler to obtain an executable. I want the first steps to go as quick as possible so that I can refine the language and test ideas quickly, and once the language has stabalized, concentrarte on my own full fledged compiler (if it is necessary). I think I will try Parsec as a starting point for creating a parser. A final bit of advice. A compiler is best as a composition of lots of very small compilers (sans parsers; keep your data structured). Use lots of intermediate formats, and keep the translation between each intermediate format as small as possible. See UHC for an excellent example of this approach. In particular, aim for getting your language down to the smallest core calculus that you can think of. This makes it very easy to write interpreters, code generators and optimizers. A compiler is a large project, but you will safe yourself a lot of pain and complexity if you think of it as a bunch of small ones. Good luck! I'm interested to see what your language looks like (particularly the features you think are missing from your inspriations). And also have fun learning Haskell; you may find your principles of language design changing along the way as a result... :-) Luke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ST.Lazy vs ST.Strict
On 05/05/2009 20:42, Tobias Olausson wrote: This simple implementation of CPU does not behave as expected in the latest version of ghc using ST.Lazy since it updates the `pc` in the wrong order. When we use ghc-6.8 the code works as expected both with lazy and strict ST. How is that? How do we fix this so we can use ghc-6.10. Looks like a real bug, I just created a ticket: http://hackage.haskell.org/trac/ghc/ticket/3207 Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Writing a compiler in Hakell
On 06/05/2009 07:31, Luke Palmer wrote: On Wed, May 6, 2009 at 12:07 AM, Rouan van Dalen rvda...@yahoo.co.uk mailto:rvda...@yahoo.co.uk wrote: Hi everyone. I am designing my own programming language. I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction? I know about Happy. Is that a good tool to use? I don't like Happy. Using a parser generator is like admitting defeat, when we have no defeat to admit. I would recommend a parser combinator library like Parsec (or if you like building things from the ground up, ReadP). There are distinct advantages to using a parser generator over parsing combinators. For example, you get a static guarantee that your language is unambiguous and doesn't need backtracking. (and we like static guarantees!) I seem to recall there are parsing combinators that generate LR parsing tables at runtime, which might be a good compromise though. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell Arrows Applications
Hello, I'm interested to the concept of arrows in Haskell, however, I couldn't find a real application or example using this new technology in a real world application. All what I found are just academic examples and other people developing new specific libraries using arrows.Could someone, please, give me a reference to one of the real applications that uses arrows. Thank you for all Hannousse. -- View this message in context: http://www.nabble.com/Haskell-Arrows-Applications-tp23388417p23388417.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Writing a compiler in Hakell
Dear Rouan, on http://www.cs.uu.nl/wiki/HUT/WebHome you will find a collection of tools which may help you to construct a compiler. As an example you will find a Tiger compiler constructed with the uulib tools and the uuagc attribute grammar system. Tiger is the language used in the book series by Andrew Apple. Not that Tiger is a great language, but the compiler contains an instance of all the things that have to be done when writing a compiler. Once you like these tools you may take a look at the UHC compiler, which actually is a series of compilers, starting from a small language, which is than gradually extended, both with new language concepts and with new aspects, such as code generation, new forms of types etc. Here you will also see that writing a compiler for a language like Haskell is not a small endeavour. You said you wanted to write a compiler in Haskell, but you did not say what language you want to compile? This sounds a bit strange: I have chosen my tool, but now I am going to decide what to use it for? With respect to your question about the + operator. There are many answers to this question; but it depends on what language you are compiling, with which goal in mind etc. It makes a big difference whether you are compiling a language like Perl into some byte-code language which is to be interpreted in which case your aproach looks reasaonable, or a special purpose language describing finite state machines into code for an embedded system in which case your approach does not work out. Doaitse Swierstra On 6 mei 2009, at 08:07, Rouan van Dalen wrote: Hi everyone. I am designing my own programming language. I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction? I know about Happy. Is that a good tool to use? The compiler is intended for serious use and I would like it to be very efficient, maybe competing with compilers written in C. It should also be very easy to extend as the languoge grows. Are there any good books that you can recommend on compiler construction in general and specific to haskell? On another note, how is the operator + implemented in haskell? is there a primitve (say #+) that is wrapped by the haskell operator +? Maybe something like: (+) :: a - a - a v1 + v2 = #+ v1 v2 Thanks in advance Rouan. ___ 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] Current status of Annotations
Hello, I've been reading about Annotations [1] as implemented during last years Summer of Code, and about some earlier ideas [3] [2]. It seems though that these annotations have never been merged into HEAD [4]. Could anyone elaborate on the current status of this proposal? Has there been any further work or discussion about this subject that I haven't been able to dig up? - Tom Lokhorst [1] http://hackage.haskell.org/trac/ghc/wiki/Annotations [2] http://www.haskell.org/pipermail/haskell-prime/2006-November/001893.html [3] http://hackage.haskell.org/trac/haskell-prime/ticket/88 [4] http://www.haskell.org/pipermail/haskell-cafe/2008-September/047293.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Reply to
On Wednesday 06 May 2009 20:42:38 Daniel Fischer wrote: Indeed. I have reply, reply-to-all and reply-to-list one click or one key combination away, and as far as I know those features are present in almost all mail clients since several years, so ease of replying to list shouldn't be an issue. On the other hand, I do not want messages intended to be private communications to end up on the list, which would happen more easily with munged headers. So, count me in the leave-reply-to-alone camp. There is a lot of combinations that can occur when replying to a message on a mailing list. **Situation 1**: Parent Message Header: From: par...@email.com To: mailingl...@mailinglist.com To reply to this, I could either use the following recipients: Reply method 1 (This happens when I choose Reply or Reply to mailing list with kmail) To: mailingl...@mailinglist.com Reply method 2 (Have to set recipients manually with this) To: mailingl...@mailinglist.com To: par...@email.com Reply method 3 (This happens when I choose Reply to all with kmail) To: mailingl...@mailinglist.com CC: par...@email.com Reply method 4 (Have to set recipients manually with this) To: par...@email.com CC: mailingl...@mailinglist.com Reply method 5 (This happens when I choose Reply to author with kmail) To: par...@email.com **Situation 2** *Parent Message Header*: From: par...@email.com To: grand-par...@email.com CC: mailingl...@mailinglist.com And to reply to this, I could use any of the following: Reply method 1 (This happens when I choose Reply or Reply to mailing list with kmail) To: mailingl...@mailinglist.com Reply method 2 (This happens when I choose Reply to all with kmail) To: mailingl...@mailinglist.com CC: par...@email.com CC: grand-par...@email.com Reply method 3 (Have to set recipients manually with this) To: par...@email.com CC: mailingl...@mailinglist.com Reply method 4 (Have to set recipients manually with this) To: par...@email.com To: mailingl...@mailinglist.com Reply method 5 (Have to set recipients manually with this) To: mailingl...@mailinglist.com CC: par...@email.com Reply method 5 (Have to set recipients manually with this) To: par...@email.com CC: mailingl...@mailinglist.com CC: par...@email.com Reply method 6 (This happens when I choose Reply to author with kmail) To: par...@email.com -- I'm not sure about your mail client, but replying to lists doesn't seem that simple to me with kmail. The only situations I really understand is the reply to author methods (method 5 in situation 1 and method 6 in situation 2). The others I don't really know what difference it makes. Eg: - If you send to only the mailing list, does it break the message thread? (it seems like sometimes it does, sometimes it doesn't) - Do you use To for the mailing list or for the parent? - Do you ever include the grand-parent in the recipient list? - What's the difference between To and CC? - Does the mailing list do some kind of processing of the email headings sent (I don't get how kmail managed to know your message was in reply to Magnus Therning's message, since you didn't include him as a recipient) - Is kmail's mailing list management completely bonkers (eg what is the difference between Reply and Reply to mailing list)? And don't get me started on whether to use html or plain text in messages! (seen both pretty often here) Sometimes I feel I have missed some vital webpage somewhere that answers all this, and I'm just some clueless moron who can't work email yet :( If anyone knows of such a page, could you let me know of it? Google only gives very basic articles when searching for using mailing lists. Anyway, I can't see why we still use mailing lists when we have reddit, which has all the good parts of mailing lists (nested messages), while it also: - is much simpler to use - allows voting up/down of good/inaccurate messages - allows voting up/down of interesting/boring topics - has a good web interface (mail-archive.com doesn't even come close) - uses markdown (no more html vs plain text problems) - allows messages to be edited after being sent - has rss feeds for article comments, and sub reddit topics - sends notifications when someone replies to one of your comments - and more! :P ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Current status of Annotations
Annotations are indeed implemented and in the HEAD. Looking at [1], the writeup looks historically skewed, rather than being a crisp writeup of what is actually there. I wonder if Max or Tristan might improve the situation (after the Haskell workshop deadline)? As it happens Tristan's Haskell Workshop submission makes essential use of annotations. Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On | Behalf Of Tom Lokhorst | Sent: 06 May 2009 15:53 | To: Haskell Cafe | Subject: [Haskell-cafe] Current status of Annotations | | Hello, | | I've been reading about Annotations [1] as implemented during last | years Summer of Code, and about some earlier ideas [3] [2]. It seems | though that these annotations have never been merged into HEAD [4]. | | Could anyone elaborate on the current status of this proposal? Has | there been any further work or discussion about this subject that I | haven't been able to dig up? | | - Tom Lokhorst | | [1] http://hackage.haskell.org/trac/ghc/wiki/Annotations | [2] http://www.haskell.org/pipermail/haskell-prime/2006-November/001893.html | [3] http://hackage.haskell.org/trac/haskell-prime/ticket/88 | [4] http://www.haskell.org/pipermail/haskell-cafe/2008-September/047293.html | ___ | Haskell-Cafe mailing list | Haskell-Cafe@haskell.org | http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Arrows Applications
On 07:33 Wed 06 May , Hannousse wrote: Hello, I'm interested to the concept of arrows in Haskell, however, I couldn't find a real application or example using this new technology in a real world application. All what I found are just academic examples and other people developing new specific libraries using arrows.Could someone, please, give me a reference to one of the real applications that uses arrows. Hi. HXT, the Haskell XML Toolbox [1], uses Arrows to define filters and modifications of XML trees. A structure called ListArrow can return several results, the Arrow combinators allow them to be used together in a clean way. There are Arrows that carry mutable state and perform IO, too. Also see the wiki page [2] and Hackage documentation [3]. It took me a while to understand what really goes on, but worked quite well then. Steffen [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hxt [2] http://haskell.org/haskellwiki/HXT [3] http://www.fh-wedel.de/~si/HXmlToolbox/hdoc/index.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Unfold fusion
Hello, I'm trying to prove the unfold fusion law, as given in the chapter Origami Programming in The Fun of Programming. unfold is defined like this: unfold p f g b = if p b then [] else (f b):unfold p f g (g b) And the law states: unfold p f g . h = unfold p' f' g' with p' = p.h f' = f.h h.g' = g.h Foremost I don't really see why one would want to fuse h into the unfold. h is executed once, at the beginning and is never needed again. Can someone give me an example? So, this is what I got so far: unfold p f g.h = (\b - if p b then [] else (f b): unfold p f g (g b).h = if p (h b) then [] else (f (h b)) : unfold p f g (g (h b)) = if p' b then [] else f' b: unfold p f g (h (g' b)) not very much. I kinda see why it works after I unfold some more, but I can't really prove it. I suspect I need some technique I haven't learned yet. I've heard about fixpoint induction, that looks promising, but Google knows very little about it. I hope somebody can give me some hints. Regards, Adrian PGP.sig Description: Signierter Teil der Nachricht ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Reply to
Hi David, - Do you use To for the mailing list or for the parent? - Do you ever include the grand-parent in the recipient list? I use whatever my mail client does when I hit list-reply :-) For me (using mutt), that means to include any recipients and senders from the original message (so mailing list, parent and grand-parent in your example), unless the sender of the message I'm replying to has set the Mail-Followup-To header. My client sets the Mail-Followup-To properly to include all recipients and include myself when I am not subscribed to the list, and exclude myself when I am subscribed to the list. This is the only proper solution, since you can't guess from the addresses alone if someone is subscribed to the list and should thus be included or not. - What's the difference between To and CC? Just a matter of style I guess, functionally they are the same AFAIK. - If you send to only the mailing list, does it break the message thread? (it seems like sometimes it does, sometimes it doesn't) - Does the mailing list do some kind of processing of the email headings sent (I don't get how kmail managed to know your message was in reply to Magnus Therning's message, since you didn't include him as a recipient) These two questions are the same: This is handled by email clients entirely. They set the In-Reply-To header, which refers to the message ID of the replied-to message, for proper threading. Alternatively, some clients (can) use the subject for guessing threads, but the mailing list doesn't handle this in any way (it doesn't have any info that the recipients don't have either). - Is kmail's mailing list management completely bonkers (eg what is the difference between Reply and Reply to mailing list)? Dunno, but it seems so from your example. And don't get me started on whether to use html or plain text in messages! (seen both pretty often here) As long as messages have a decent text/plain part, feel free to use anything as far as I'm concerned (flash, anyone? :-p) Anyway, I can't see why we still use mailing lists when we have reddit, which has all the good parts of mailing lists (nested messages), while it also: Hmm, what's this reddit thing? *googles* At first glance, the reddit frontpage looks very crowded and incapable of conveying information to me... At second glance, it looks like some kind of giant forum with random topics and links to other forums/news sites/blogs? There's probably some way to organize threads belonging to a single topic that becomes evident when you login? - is much simpler to use Can't say, never used it... - allows voting up/down of good/inaccurate messages - allows voting up/down of interesting/boring topics That's cool for when you're reading a topic back (ie would be nice on email archives) but not really useful for new questions and messages (which is what our mailing lists are usually about, right?). - has a good web interface (mail-archive.com doesn't even come close) Nice, but does it have a non-web-interface? The only way I can actually manage all email traffic coming my way from a couple dozen mailing lists, is because mutt is so darn efficient when it comes to reading and processing mail. I would't want to do all that in a webinterface. - uses markdown (no more html vs plain text problems) That's cool :-) Though you can also just write markdown in plain text email, looks pretty as well :-p - allows messages to be edited after being sent You can always just reply with corrections. Editing messages after writing them only makes things confusing (since you probably won't be able to edit them before someone has read them...). - has rss feeds for article comments, and sub reddit topics Aren't RSS feeds just invented to turn the normal pull information flow of a website to a sortof push flow (or rather, to automate the polling of a website for new info). The cool thing about email is that it's push by design! - sends notifications when someone replies to one of your comments Like, via email? :-p Seriously though, I guess something like reddit has some merit, but I see that mostly for archival and/or discussions that have a longer lasting value. A lot of traffic on mailing lists is useful for as long as the question that's asked is unsolved and after that it's done. Also, no webinterface is not a substitute for a decent mail client, especially a heavily customized one. If you're serious about using reddit for haskell discussions, could you perhaps enlighten us with how that would work? I've been browsing a bit more, and reddit really looks like a collection of links to articles and topics, not like an actual discussion medium? Gr. Matthijs signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] calling a variable length parameter lambda expression
isn't doLam just id with an Ord restriction there? On Wed, May 6, 2009 at 5:55 AM, Victor Nazarov asviraspossi...@gmail.com wrote: On Tue, May 5, 2009 at 8:49 PM, Nico Rolle nro...@web.de wrote: Hi everyone. I have a problem. A function is recieving a lambda expression like this: (\ x y - x y) or like this (\ x y z a - (x y) (z a) my problem is now i know i have a list filled with the parameters for the lambda expression. but how can i call that expression? [parameters] is my list of parameters for the lambda expression. lambda_ex is my lambda expression is there a function wich can do smth like that? lambda _ex (unfold_parameters parameters) Why not: lam1 = \[x, y] - x y lam2 = \[x, y, z, a] - (x y) (z a) doLam :: Ord a = ([a] - Bool) - [a] - Bool doLam lam params = lam params So, this will work fine: doLam lam1 [1, 2] doLam lam2 [1,2,3,4] -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] calling a variable length parameter lambda expression
super nice. best solution for me so far. big thanks. regards 2009/5/6 Victor Nazarov asviraspossi...@gmail.com: On Tue, May 5, 2009 at 8:49 PM, Nico Rolle nro...@web.de wrote: Hi everyone. I have a problem. A function is recieving a lambda expression like this: (\ x y - x y) or like this (\ x y z a - (x y) (z a) my problem is now i know i have a list filled with the parameters for the lambda expression. but how can i call that expression? [parameters] is my list of parameters for the lambda expression. lambda_ex is my lambda expression is there a function wich can do smth like that? lambda _ex (unfold_parameters parameters) Why not: lam1 = \[x, y] - x y lam2 = \[x, y, z, a] - (x y) (z a) doLam :: Ord a = ([a] - Bool) - [a] - Bool doLam lam params = lam params So, this will work fine: doLam lam1 [1, 2] doLam lam2 [1,2,3,4] -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] calling a variable length parameter lambda expression
Keep in mind that using lists for your parameters means you lose static guarantees that you've passed the correct number of arguments to a function (so you could crash at runtime if you pass too few or too many parameters to a function). On Wed, May 6, 2009 at 11:41 AM, Nico Rolle nro...@web.de wrote: super nice. best solution for me so far. big thanks. regards 2009/5/6 Victor Nazarov asviraspossi...@gmail.com: On Tue, May 5, 2009 at 8:49 PM, Nico Rolle nro...@web.de wrote: Hi everyone. I have a problem. A function is recieving a lambda expression like this: (\ x y - x y) or like this (\ x y z a - (x y) (z a) my problem is now i know i have a list filled with the parameters for the lambda expression. but how can i call that expression? [parameters] is my list of parameters for the lambda expression. lambda_ex is my lambda expression is there a function wich can do smth like that? lambda _ex (unfold_parameters parameters) Why not: lam1 = \[x, y] - x y lam2 = \[x, y, z, a] - (x y) (z a) doLam :: Ord a = ([a] - Bool) - [a] - Bool doLam lam params = lam params So, this will work fine: doLam lam1 [1, 2] doLam lam2 [1,2,3,4] -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Unfold fusion
Adrian Neumann schrieb: Hello, I'm trying to prove the unfold fusion law, as given in the chapter Origami Programming in The Fun of Programming. unfold is defined like this: unfold p f g b = if p b then [] else (f b):unfold p f g (g b) And the law states: unfold p f g . h = unfold p' f' g' with p' = p.h f' = f.h h.g' = g.h Foremost I don't really see why one would want to fuse h into the unfold. h is executed once, at the beginning and is never needed again. Can someone give me an example? Maybe you should read the euqation from the other direction. Then the h becomes fused out and is called only once instead of many times. But you can only do this if you can factor out h from p', f' and g'. So, this is what I got so far: unfold p f g.h = (\b - if p b then [] else (f b): unfold p f g (g b).h = if p (h b) then [] else (f (h b)) : unfold p f g (g (h b)) = if p' b then [] else f' b: unfold p f g (h (g' b)) not very much. I kinda see why it works after I unfold some more, but I can't really prove it. I suspect I need some technique I haven't learned yet. I've heard about fixpoint induction, that looks promising, but Google knows very little about it. I hope somebody can give me some hints. Regards, Adrian Regards, Martin. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Unfold fusion
On 6 May 2009, at 19:27, Adrian Neumann wrote: Hello, I'm trying to prove the unfold fusion law, as given in the chapter Origami Programming in The Fun of Programming. unfold is defined like this: unfold p f g b = if p b then [] else (f b):unfold p f g (g b) And the law states: unfold p f g . h = unfold p' f' g' with p' = p.h f' = f.h h.g' = g.h Foremost I don't really see why one would want to fuse h into the unfold. h is executed once, at the beginning and is never needed again. Can someone give me an example? So, this is what I got so far: unfold p f g.h = (\b - if p b then [] else (f b): unfold p f g (g b).h = if p (h b) then [] else (f (h b)) : unfold p f g (g (h b)) = if p' b then [] else f' b: unfold p f g (h (g' b)) = if p' b then [] else f' b : (unfold p f g . h) g' b = if p' b then [] else f' b : unfold p' f' g' (g' b) -- NB! = unfoldr p' f' g' b This proof is actually biting itself on the tail; however, you can make it work, for example, like this: (A_n) take n ((unfold p f g . h) b) = take n (unfold p' f' g' b) Now, A_0 is obvious (take 0 whatever = []), and A_n follows from A_{n-1} by the previous argument. By induction, A_n holds for all n. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] beginner question: assigning local variable to a function
hi why does this don't work? test = let a = () in 1 `a` 2 regards ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] beginner question: assigning local variable to a function
On May 6, 2009, at 12:18 , Nico Rolle wrote: why does this don't work? test = let a = () in 1 `a` 2 Works fine here once I correct your indentation (the in needs to be indented at least as far as the l in let). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon universityKF8NH PGP.sig Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] beginner question: assigning local variable to a function
Oh sorry guys was rlly a stupid indentation mistake next time i'll post the error message too thanks regards 2009/5/6 Brandon S. Allbery KF8NH allb...@ece.cmu.edu: On May 6, 2009, at 12:18 , Nico Rolle wrote: why does this don't work? test = let a = () in 1 `a` 2 Works fine here once I correct your indentation (the in needs to be indented at least as far as the l in let). -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Getting WriterT log lazily
Magnus Therning wrote: Martijn van Steenbergen wrote: Otherwise, you can use unsafeInterleaveIO: no unsafePerformIO or seq needed, but there's still unsafe in that name there. This works for me: ... Thanks, that does indeed work, but it still requires that unsafe there so I'm hesitant replacing the call to threadDelay with something more complicated, where it isn't obviously safe. Sorry for the late reply, but I'd like to piggy-back on this. It's my understanding that unsafeInterleaveIO is only unsafe insofar as it makes the IO lazy and so the IO may be performed later or never at all (if its return value is never wanted) and is therefore no less safe than, say, generating a list of IO actions as was suggested by an earlier reply. It seems to me that its unsafeness is of a completely different nature than unsafePerformIO... am I missing something? steve ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell IO problem
On Wed, May 6, 2009 at 4:27 PM, applebiz89 applebi...@hotmail.com wrote: main :: IO() do putStr Hi there! what is your name: fanName = getLine do putStr 1 = Insert film, 2 = Become a Fan, 3 = The number of fans of a film, 4 = Film released in a year: input = getLine read input :: Int (if input == 1 then main x = insertFilm [] else if input == 2 then main x = becomeFan [] else if input == 3 then main x = numberOfFans []) // I thought using the if statement would work, but now I cant think how to gather the needed input for the function they have chosen? Well, here input is a String. Type of read is read :: (Read a) = String - a i.e. If a is an instance of the read class, read will be able to produce a value of type a given a String. So you have to do something like x = read input :: Int read input will not destructively convert the type of input to int Alsom I think case x of will be better than if x = 1... --- Ashok `ScriptDevil` Gautham ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Reply to
On Thursday 07 May 2009 01:28:36 Matthijs Kooijman wrote: Hi David, - Do you use To for the mailing list or for the parent? - Do you ever include the grand-parent in the recipient list? I use whatever my mail client does when I hit list-reply :-) For me (using mutt), that means to include any recipients and senders from the original message (so mailing list, parent and grand-parent in your example), unless the sender of the message I'm replying to has set the Mail-Followup-To header. My client sets the Mail-Followup-To properly to include all recipients and include myself when I am not subscribed to the list, and exclude myself when I am subscribed to the list. This is the only proper solution, since you can't guess from the addresses alone if someone is subscribed to the list and should thus be included or not. - What's the difference between To and CC? Just a matter of style I guess, functionally they are the same AFAIK. - If you send to only the mailing list, does it break the message thread? (it seems like sometimes it does, sometimes it doesn't) - Does the mailing list do some kind of processing of the email headings sent (I don't get how kmail managed to know your message was in reply to Magnus Therning's message, since you didn't include him as a recipient) These two questions are the same: This is handled by email clients entirely. They set the In-Reply-To header, which refers to the message ID of the replied-to message, for proper threading. Alternatively, some clients (can) use the subject for guessing threads, but the mailing list doesn't handle this in any way (it doesn't have any info that the recipients don't have either). - Is kmail's mailing list management completely bonkers (eg what is the difference between Reply and Reply to mailing list)? Dunno, but it seems so from your example. And don't get me started on whether to use html or plain text in messages! (seen both pretty often here) As long as messages have a decent text/plain part, feel free to use anything as far as I'm concerned (flash, anyone? :-p) Thanks for those answers, that really cleared up alot of my misconceptions. I think I was assuming the mailing list did a lot more than it actually does. Anyway, I can't see why we still use mailing lists when we have reddit, which has all the good parts of mailing lists (nested messages), while it also: Hmm, what's this reddit thing? *googles* Sorry, I should have put more about reddit in my original post :S At first glance, the reddit frontpage looks very crowded and incapable of conveying information to me... Reddit is divided into different groups called subreddits. Eg there is a pics one, politics one, economics on and so on. When you go to reddit.com, you get all the topics posted to the most popular 10 or so subreddits (if you register you can customize this though). That's why it appeared crowded :) If you want to only see the topics from one subreddit, you go to www.reddit.com/r/subredditname . There exists two haskell reddits I know of, haskell and haskell-proposals, it is www.reddit.com/r/haskell (for the haskell subreddit). At second glance, it looks like some kind of giant forum with random topics and links to other forums/news sites/blogs? There's probably some way to organize threads belonging to a single topic that becomes evident when you login? That's the subreddits :) - is much simpler to use Can't say, never used it... Heh just my opinion... - allows voting up/down of good/inaccurate messages - allows voting up/down of interesting/boring topics That's cool for when you're reading a topic back (ie would be nice on email archives) but not really useful for new questions and messages (which is what our mailing lists are usually about, right?). You have three main ways of sorting the topics in a reddit (seen at the top of the screen): - whats hot: puts articles getting lots of upvotes recently up higher - new: puts more recent articles up higher - top: puts the highest voted articles for hour/day/week/month/year/all-time up higher For browsing, you would use top, and for reading new stuff, you would use new. Also, you can subscribe to the rss feed http://www.reddit.com/r/haskell/new.rss to get a link for every new discussion - has a good web interface (mail-archive.com doesn't even come close) Nice, but does it have a non-web-interface? The only way I can actually manage all email traffic coming my way from a couple dozen mailing lists, is because mutt is so darn efficient when it comes to reading and processing mail. I would't want to do all that in a webinterface. This managed mainly through being able to select what subreddits appear on the front page. It is also very efficient commenting, as no new window is opened when you choose to comment, just a new box appears below the comment you are replying to. However, I doubt that it could be as efficient as
Re: [Haskell-cafe] Reply to
Anyway, I can't see why we still use mailing lists when we have reddit, which has all the good parts of mailing lists (nested messages), while it also: Hmm, what's this reddit thing? *googles* Me too. Seems like this reddit thing is nothing but a mail list done wrong. I may be wrong, but it seems that I have to actually CLICK on all links I want to read, instead of just pressing spacebar in my mail client. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Reply to
Am Mittwoch 06 Mai 2009 16:57:16 schrieb David Miani: On Wednesday 06 May 2009 20:42:38 Daniel Fischer wrote: Indeed. I have reply, reply-to-all and reply-to-list one click or one key combination away, and as far as I know those features are present in almost all mail clients since several years, so ease of replying to list shouldn't be an issue. On the other hand, I do not want messages intended to be private communications to end up on the list, which would happen more easily with munged headers. So, count me in the leave-reply-to-alone camp. There is a lot of combinations that can occur when replying to a message on a mailing list. **Situation 1**: Parent Message Header: From: par...@email.com To: mailingl...@mailinglist.com To reply to this, I could either use the following recipients: Reply method 1 (This happens when I choose Reply or Reply to mailing list with kmail) To: mailingl...@mailinglist.com Yes, a bit surprising that Reply doesn't include par...@email.com among the recipients. Probably assumes that parent is subscribed to mailinglist. Methods 2 to 4 are equivalent for all practical purposes, unless you really know their differences and why you would choose any particular one, I'd say (well, except you may have filtering rules which would treat them differently, which probably wouldn't be very useful, because you never know if others would use Reply to mailing list, Reply or Reply to all). Reply method 2 (Have to set recipients manually with this) To: mailingl...@mailinglist.com To: par...@email.com Reply method 3 (This happens when I choose Reply to all with kmail) To: mailingl...@mailinglist.com CC: par...@email.com Reply method 4 (Have to set recipients manually with this) To: par...@email.com CC: mailingl...@mailinglist.com Reply method 5 (This happens when I choose Reply to author with kmail) To: par...@email.com **Situation 2** *Parent Message Header*: From: par...@email.com To: grand-par...@email.com CC: mailingl...@mailinglist.com And to reply to this, I could use any of the following: Reply method 1 (This happens when I choose Reply or Reply to mailing list with kmail) To: mailingl...@mailinglist.com Again somewhat surprising behaviour of Reply. Reply method 2 (This happens when I choose Reply to all with kmail) To: mailingl...@mailinglist.com CC: par...@email.com CC: grand-par...@email.com Clear, isn't it? Reply method 3 (Have to set recipients manually with this) To: par...@email.com CC: mailingl...@mailinglist.com Reply method 4 (Have to set recipients manually with this) To: par...@email.com To: mailingl...@mailinglist.com Reply method 5 (Have to set recipients manually with this) To: mailingl...@mailinglist.com CC: par...@email.com Again I don't know why one would pick any particular of these three, but special choices require individual treatment, I can fully understand that these are not among the default actions of a mail client. If you don't care about To/CC, it's easy in KMail, though, just type a (Reply to All), click delete on the To field with grandparent's address. If you care about To/CC, it's a few more clicks, but still easy. Reply method 5 (Have to set recipients manually with this) To: par...@email.com CC: mailingl...@mailinglist.com CC: par...@email.com Hit Reply to all and toggle To/CC if you really care (but again, I don't know why one would care). Reply method 6 (This happens when I choose Reply to author with kmail) To: par...@email.com Anything else would be a major WTF. Yes, there are many options but if you don't care about the difference between To and CC, all are easily obtained from the default reply modes. -- I'm not sure about your mail client, KMail (1.10.3) :-) but replying to lists doesn't seem that simple to me with kmail. Just type l (lowercase L) or click Reply to mailing list, and it will send only to the list (as given in the List-ID field). If you want to reply to multiple lists (cafe, ghc- users, beginners), you'd probably have to choose Reply to all and delete other recipients. The case of multiple lists is not incredibly simple, but seems simple enough to me (and I'm emphatically not a power user, as soon as anything internetty is involved). The only situations I really understand is the reply to author methods (method 5 in situation 1 and method 6 in situation 2). The others I don't really know what difference it makes. Eg: - If you send to only the mailing list, does it break the message thread? (it seems like sometimes it does, sometimes it doesn't) Shouldn't break the thread, can't remember that happening. - Do you use To for the mailing list or for the parent? I don't care, the message being delivered to both is what I'm interested in, and that's achieved either way. Whether there are differences in how the message is sent through the
Re: [Haskell-cafe] Reply to
Miguel Mitrofanov wrote: Anyway, I can't see why we still use mailing lists when we have reddit, which has all the good parts of mailing lists (nested messages), while it also: Hmm, what's this reddit thing? *googles* Me too. Seems like this reddit thing is nothing but a mail list done wrong. I may be wrong, but it seems that I have to actually CLICK on all links I want to read, instead of just pressing spacebar in my mail client. It's a nice source for links to interesting topics, I use it via an RSS reader. I wouldn't say it's a mailing list done wrong, I'd say it's more like slashdot, but without the moderation. /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] beginner question: assigning local variable to a function
Brandon S. Allbery KF8NH wrote: On May 6, 2009, at 12:18 , Nico Rolle wrote: why does this don't work? test = let a = () in 1 `a` 2 Works fine here once I correct your indentation (the in needs to be indented at least as far as the l in let). Really? For me it's enough to have in indented more then test, and one space is enough: test = let a = () in 1 `a` 2 /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
I've heard it's hard to contain a long-running Haskell application in a finite amount of memory, but this is probably not a problem if your web site sleeps 0.001% of the time (like XMonad), or you can restart it every once in a while without anyone noticing. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
fft1976: I've heard it's hard to contain a long-running Haskell application in a finite amount of memory, but this is probably not a problem if your Hmm. Gossip driven development? web site sleeps 0.001% of the time (like XMonad), or you can restart it every once in a while without anyone noticing. Keeping footprints small and stable isn't so hard. After all, we have wonderful heap profiling tools. I recommend the type-based heap profiler, in particular. Run your app for a week, and look at the heap graph. You'll know if things are ok. (Try this in C++ !) -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
Hello FFT, Wednesday, May 6, 2009, 11:59:53 PM, you wrote: I've heard it's hard to contain a long-running Haskell application in a finite amount of memory not exactly. you may alloc fixed pool of memory to application (say, 1gb) if you know that it never need more memory. but as far as you don't do it, memory usage grows with each major GC. ghc just don't provide any way to return memory to OS (there is a ticket on it, you can add yourself to CC list to vote for its resolution) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] setResourceLimit
On Tuesday, 05.05.09 at 22:48, Brandon S. Allbery KF8NH wrote: On May 5, 2009, at 04:52 , br...@lorf.org wrote: I have a long-lived multithreaded server process that needs to execute programs and interact with them via Handles. The programs could misbehave, like loop or hang, so I need to limit the real and CPU time they can take. An alternative is to forkProcess and have the child setResourceLimit and then executeFile. The documentation for forkProcess seems to say that Handle-based I/O won't work in the child process. I need to communicate with the program I'm running via its standard input and output. Does this mean forkProcess is out of the question? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
On Wed, May 6, 2009 at 1:01 PM, Don Stewart d...@galois.com wrote: fft1976: I've heard it's hard to contain a long-running Haskell application in a finite amount of memory, but this is probably not a problem if your Hmm. Gossip driven development? I don't mean to undermine your marketing efforts, but I don't think this is gossip driven. I know from experience that lambdabot tends to be leaky. Otherwise, lambdabot wouldn't be running on my server to begin with. And, even so, Cale monitors lambdabot to make sure it is not using too many resources (and I complain when/if I notice it). I have heard similar stories related to hpaste and happs. I have also experienced it with writing a forever loop in Haskell that did polling from channels. I would leave my app running for, say, 4 hours and it would be using tons of memory. web site sleeps 0.001% of the time (like XMonad), or you can restart it every once in a while without anyone noticing. Keeping footprints small and stable isn't so hard. After all, we have wonderful heap profiling tools. I recommend the type-based heap profiler, in particular. Run your app for a week, and look at the heap graph. You'll know if things are ok. (Try this in C++ !) In C++ we have valgrind right? But, yes, C++ has issues too with memory leaks. I think Java does as well. In fact, probably every programming language has issues here :) Garbage collectors are good at removing errors from freeing too soon and other manual memory management issues, but in my experience they actually cause an increase in space leaks by being conservative. I think it's fair to say that keeping the memory usage low of a long running Haskell app is hard, but that is a general issue not just a Haskell issue. It's hard in most languages. I think what we need to address this is more information about preventative measures. What programming styles cause the problem and which ones solve it. I would say that I lack confidence recommending anyone to use Haskell for long running processes because I don't understand well the problem of keeping the usage low. If it is a well documented problem with documented solutions (more than just profiling), then I would regain my confidence because I know the problem can be worked around reliably. Does this make sense? Maybe it's already well documented? In particular, we need expert Haskell programmers, such as Don, to write more about how they avoid space leaks in long running apps. Again, profiling is nice, but that's more of a tuning effort. Thanks, Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] setResourceLimit
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On May 6, 2009, at 16:18 , br...@lorf.org wrote: On Tuesday, 05.05.09 at 22:48, Brandon S. Allbery KF8NH wrote: On May 5, 2009, at 04:52 , br...@lorf.org wrote: I have a long-lived multithreaded server process that needs to execute programs and interact with them via Handles. The programs could misbehave, like loop or hang, so I need to limit the real and CPU time they can take. An alternative is to forkProcess and have the child setResourceLimit and then executeFile. The documentation for forkProcess seems to say that Handle-based I/O won't work in the child process. I need to communicate with the program I'm running via its standard input and output. Does this mean forkProcess is out of the question? No. What it means is that, if the child will continue to run in the same Haskell program after forkProcess-ing, any open Handles won't work right. You could fix this with handleToFd and fdToHandle, I suspect, but it's irrelevant because you're going to executeFile instead. - -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon universityKF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.10 (Darwin) iEYEARECAAYFAkoB8l4ACgkQIn7hlCsL25U4ZwCePdfbEmXc5n8OJc++jTafUQOX uc8An1XJlXAx5mqYBM5c/iLaGIihq00W =FFS9 -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Unfold fusion
On Wednesday 06 May 2009 11:27:08 am Adrian Neumann wrote: Hello, I'm trying to prove the unfold fusion law, as given in the chapter Origami Programming in The Fun of Programming. unfold is defined like this: unfold p f g b = if p b then [] else (f b):unfold p f g (g b) And the law states: unfold p f g . h = unfold p' f' g' with p' = p.h f' = f.h h.g' = g.h If you don't mind a more category theoretic tack, we can argue something like this: Lists of A are the terminal coalgebra for the functor L X = 1 + A*X. Defining them this way means that we get the unique existence of the above unfold function. Roughly, for any: ob : X - L X there exists a unique: unfold ob : X - [A] Such that: out . unfold ob = map (unfold ob) . ob where out : [A] - 1 + A*[A] is the coalgebra action of the list (observing either that it's null, or what the head and tail are), and map corresponds to the functor L (so we're mapping on the X part, not the A part). Coalgebra actions ob have type: ob : X - 1 + A*X and you can finesse that into three functions in something like Haskell: p : X - 2, f : X - A, g : X - X which is what your unfold at the start does. Now, we have: p' = p . h f' = f . h h . g' = g . h Suppose we combine things back into the single coalgebra actions. Then we have: ob : X - 1 + A*X ob' : X' - 1 + A*X' where ob corresponds to (p,f,g) and ob' corresponds to (p',f',g'). Now, the equations above tell us that with regard to these observation functions: ob' agrees with ob . h as far as left or right goes ob' agrees with ob . h as far as As go, when applicable map h . ob' agrees with ob . h as far as Xs go. All together this means: map h . ob' = ob . h Which means it's an L-coalgebra homomorphism. Such homomorphisms are arrows in the category of L-coalgebras, for which [A] is a terminal object (giving us the unique existence property of arrows to it from any other object). So, h : X' - X is an arrow in the L-coalgebra category. And, so are: unfold ob : X - [A] unfold ob' : X' - [A] Since this is a category: unfold ob . h : X' - [A] must also be an arrow. *However*, [A] being a terminal object means that for every object, there is a unique arrow from it to [A]. We appear to have two from X': unfold ob': X' - [A] unfold ob . h : X' - [A] So the uniqueness property tells us that these are the same arrow. Thus, unfold ob' = unfold ob . h unfold p' f' g' = unfold p f g . h and we're done. Hopefully that wasn't too verbose. Normally you'd have most of that covered by the time you got to proving the unfold fusion, but I wasn't sure how much of that part of the theory you'd read before. Another way you can go is to use coinduction and bisimulation (which can be ultimately explained in terms of the above primitives), which talks about making individual observations, which would go something like: If for all x: null (f x) = null (f' x) (if not null) head (f x) = head (f' x) tail (f x) = tail (f' x) (where equality on the tail is defined as being the same subsequent observations) then f and f' are the same function (by coinduction). If we look at the equations at the start: null . unfold p' f' g' = p' = p . h = null . unfold p f g . h head . unfold p' f' g' = f' = f . h = head . unfold p f g . h tail . unfold p' f' g' = unfold p' f' g' . g' (coinductive hypothesis?) = unfold p f g . h . g' = unfold p f g . g . h = tail . unfold p f g . h unfortunately it looks like I'm doing something wrong in that coinductive hypothesis step, by assuming that unfold p' f' g' = unfold p f g . h. However, I'm pretty sure that's how these sorts of coinductive proofs work, though I'm not familiar enough with presenting this angle to explain why you should allow it. Anyhow, if you believe the above, then we've established that all the observations you can make are equal, so our functions must be equal. Note, that it's somewhat important to have these coalgebraic/coinductive proof methods here. Miguel Mitrofanov gave you a proof that: take n . unfold p f g . h = take n . unfold p' f' g' for all n using induction. But, that is not exactly a proof that they are equal, but a proof that any finite amount of observation you can make of their output will be equal, and unfold can produce infinite objects. That may be good enough (for instance, in a total functional programming language extended with coinduction, only the inductive/recursive parts and single-step observation of coinductive values 'ought' to be subject to evaluation, so you can only make finite observations of any corecursively defined value, and the above 'take n'
Re: [Haskell-cafe] setResourceLimit
On Wednesday, 06.05.09 at 16:25, Brandon S. Allbery KF8NH wrote: No. What it means is that, if the child will continue to run in the same Haskell program after forkProcess-ing, any open Handles won't work right. You could fix this with handleToFd and fdToHandle, I suspect, but it's irrelevant because you're going to executeFile instead. I forkProcess. The parent gets the PID. The child does setResourceLimit, then executeFile, which is done with one of the execvs, which replaces the child process with the program I'm trying to communicate with. So now the program is resource limited and will probably quit if it takes too much CPU time. But the parent just has the child's PID. How is it communicating with the child? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
Jason Dagit wrote: I don't mean to undermine your marketing efforts, but I don't think this is gossip driven. I know from experience that lambdabot tends to be leaky. Otherwise, lambdabot wouldn't be running on my server to begin with. And, even so, Cale monitors lambdabot to make sure it is not using too many resources (and I complain when/if I notice it). I have heard similar stories related to hpaste and happs. I have also experienced it with writing a forever loop in Haskell that did polling from channels. I would leave my app running for, say, 4 hours and it would be using tons of memory. I think it's fair to say that keeping the memory usage low of a long running Haskell app is hard, but that is a general issue not just a Haskell issue. It's hard in most languages. I think what we need to address this is more information about preventative measures. What programming styles cause the problem and which ones solve it. I would say that I lack confidence recommending anyone to use Haskell for long running processes because I don't understand well the problem of keeping the usage low. If it is a well documented problem with documented solutions (more than just profiling), then I would regain my confidence because I know the problem can be worked around reliably. Does this make sense? Maybe it's already well documented? In particular, we need expert Haskell programmers, such as Don, to write more about how they avoid space leaks in long running apps. Again, profiling is nice, but that's more of a tuning effort. Mmm, interesting. Clearly I don't run anything for long enough to notice this effect. (I just had a look at a Haskell program I wrote myself which I happen to have running in the background right now. Process Explorer tells me it's used 4 hours of CPU time, and it's memory graph is still flat. It was reading 106 MB shortly after I started it, and it still says 106 MB now. OTOH, it's a fairly trivial program, so...) But if you're going to advocate more expert knowledge being diseminated, I certainly won't argue against that! :-D Export knowledge is something it seems difficult to have too much of... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] setResourceLimit
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On May 6, 2009, at 16:39 , br...@lorf.org wrote: On Wednesday, 06.05.09 at 16:25, Brandon S. Allbery KF8NH wrote: No. What it means is that, if the child will continue to run in the same Haskell program after forkProcess-ing, any open Handles won't work right. You could fix this with handleToFd and fdToHandle, I suspect, but it's irrelevant because you're going to executeFile instead. I forkProcess. The parent gets the PID. The child does setResourceLimit, then executeFile, which is done with one of the execvs, which replaces the child process with the program I'm trying to communicate with. So now the program is resource limited and will probably quit if it takes too much CPU time. But the parent just has the child's PID. How is it communicating with the child? Create pipes (System.Posix.IO.createPipe) before forkProcess. In the child, close stdin/stdout/stderr handles (which are unusable anyway) as appropriate and dupTo the write pipes to stdout and stderr and read pipe to stdin (again, as appropriate; remember that doing both stdin and stdout means you need to be careful to avoid data starvation deadlocks). In the parent you use fdToHandle to turn the other end of each pipe into a Handle that you can use as normal. You might want to study how to do this in C first, as the System.Posix calls are simple wrappers around the standard POSIX library routines. - -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon universityKF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.10 (Darwin) iEYEARECAAYFAkoB+cQACgkQIn7hlCsL25UtDwCfVzY1Qck/+/fvguMHGPVAefMy F7cAoMloJ/4AqKhTHQNtaVbHGhYwylls =5H08 -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Unfold fusion
On Wednesday 06 May 2009 4:26:15 pm Dan Doel wrote: unfortunately it looks like I'm doing something wrong in that coinductive hypothesis Sorry about the self-reply, but I realized where I went wrong. The principle of proof by coinduction for defining a function 'f' goes something like this (expressed all point-free like): if null . f = p' (and when not null) head . f = f' tail . f = f . g' then f = unfold p' f' g' now we have: null . (unfold p f g . h) = p . h = p' head . (unfold p f g . h) = f . h = f' tail . (unfold p f g . h) = unfold p f g . g . h = unfold p f g . h . g' = (unfold p f g . h) . g' now we have a system of equations for (unfold p f g . h) that fits the format, so by coinduction we have: unfold p f g . h = unfold p' f' g' And we're done. -- Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Current status of Annotations
I wrote a small section for the manual that will appear online (at http://www.haskell.org/ghc/docs/latest/html/users_guide/pragmas.html) when we release 6.12. I've updated the wiki page to reflect this and give some other helpful info (http://hackage.haskell.org/trac/ghc/wiki/Annotations). Cheers, Max 2009/5/6 Simon Peyton-Jones simo...@microsoft.com: Annotations are indeed implemented and in the HEAD. Looking at [1], the writeup looks historically skewed, rather than being a crisp writeup of what is actually there. I wonder if Max or Tristan might improve the situation (after the Haskell workshop deadline)? As it happens Tristan's Haskell Workshop submission makes essential use of annotations. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
dagit: In particular, we need expert Haskell programmers, such as Don, to write more about how they avoid space leaks in long running apps. Again, profiling is nice, but that's more of a tuning effort. I talk a bit about that in my LondonHUG talk: http://www.galois.com/blog/2009/04/27/engineering-large-projects-in-haskell-a-decade-of-fp-at-galois/ As I said earlier: stress test with heap profiling on (is one way to absolutely ensure you know what's going on). -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] instance Monad (Except err)
Hi, Martijn van Steenbergen wrote: Mr. McBride and mr. Paterson define in their Applicative paper: data Except e a = OK a | Failed e instance Monoid e = Applicative (Except e) where ... Sometimes I'd still like to use = on Excepts but this feels wrong somehow, because it doesn't use monoids nicely like the Applicative instance does. Are there any good reasons such a Monad instance shouldn't be defined? Does it violate any laws, for example? The problem is that one would like to define Failed e1 Failed e2 = Failed (e1 `mappend` e2) but then p q is no longer the same as p = const q which could be confusing. Tillmann ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Vector-like data structure
On Sun, 3 May 2009, Krzysztof Skrzętnicki wrote: Hi I'm looking for a data structure with following characteristics: 1. O(1) lookup 2. O(1) modification 3. amortized O(1) append 4. O(1) size query This roughly characterizes C++ vector class. I'm ready to implement it myself, but first I would like to ask if anyone knows package with similar data structure. If there are many, which one would you choose and why? If you want exchange with C and like packed elements then you can use Data.StorableVector.ST.___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
Jason Dagit wrote: I know from experience that lambdabot tends to be leaky. Otherwise, lambdabot wouldn't be running on my server to begin with. And, even so, Cale monitors lambdabot to make sure it is not using too many resources (and I complain when/if I notice it). I have heard similar stories related to hpaste and happs. FWIW, I have an internal HAppS application that's been running continuously since November last year, used daily, with stable memory usage. I have also experienced it with writing a forever loop in Haskell that did polling from channels. I would leave my app running for, say, 4 hours and it would be using tons of memory. If you posted an example of that, there are probably people who'd be interested in debugging it. I think it's fair to say that keeping the memory usage low of a long running Haskell app is hard, but that is a general issue not just a Haskell issue. It's hard in most languages. I don't agree with this. This should not be hard in language implementations with good garbage collectors, that don't have known limitations (this excludes e.g. conservative GC and reference-counting systems). In my experience, it's not hard to write stable long-running code in good implementations of languages like Haskell, Scheme, Common Lisp, or Java. I think what we need to address this is more information about preventative measures. What programming styles cause the problem and which ones solve it. I would say that I lack confidence recommending anyone to use Haskell for long running processes because I don't understand well the problem of keeping the usage low. If it is a well documented problem with documented solutions (more than just profiling), then I would regain my confidence because I know the problem can be worked around reliably. Does this make sense? Maybe it's already well documented? This doesn't completely make sense to me, in that either a program has a space leak, or it doesn't. If it does, you debug it and resolve it. If a leak really is due to a problem with the language implementation or standard libraries, then that should be identified and reported. There shouldn't be any deep mystery here. At the very least, it should be possible to point to the relevant trac tickets if there really is a problem. Anton ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] cabal parse problems
Hello, I am trying to cabalize a package (swish .. semantic web) but am running into parse error: vigalc...@ubuntu:~/FTP/Haskell/Swish-0.2.1$ runhaskell Setup.hs configure Setup.hs: swish.cabal:24: Parse of field 'exposed-modules' failed. vigalc...@ubuntu:~/FTP/Haskell/Swish-0.2.1$ Below: is a fragment from my .cabal file. Line #24 starts with Exposed-modules: . . . Data-Files: README Exposed-modules: Swish.HaskellRDF.BuiltInDatatypes, Swish.HaskellRDF.BuiltInMap, Swish.HaskellRDF.BuiltInMapTest, Swish.HaskellRDF.BuiltInRules, Swish.HaskellRDF.ClassRestrictionRule, Swish.HaskellRDF.ClassRestrictionRuleTest, Swish.HaskellRDF.Datatype, Swish.HaskellRDF.GraphClass, Swish.HaskellRDF.GraphMatch, Any ideas why I am getting parse error? Pretty vague error message! Kind regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal parse problems
sorrily nope, Brian ... Vasili On Wed, May 6, 2009 at 6:06 PM, br...@lorf.org wrote: On Wednesday, 06.05.09 at 18:05, Vasili I. Galchin wrote: Exposed-modules: Swish.HaskellRDF.BuiltInDatatypes, ... Swish.HaskellRDF.GraphMatch, Think it probably doesn't like that trailing comma. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
On Wed, May 6, 2009 at 2:28 PM, Don Stewart d...@galois.com wrote: dagit: In particular, we need expert Haskell programmers, such as Don, to write more about how they avoid space leaks in long running apps. Again, profiling is nice, but that's more of a tuning effort. I talk a bit about that in my LondonHUG talk: http://www.galois.com/blog/2009/04/27/engineering-large-projects-in-haskell-a-decade-of-fp-at-galois/ As I said earlier: stress test with heap profiling on (is one way to absolutely ensure you know what's going on). I wish I could have gone to the talk. I have a feeling the slides only tell part of the story. I did see these bullet points which I think are related: This one on Laziness: • Makes time and space reasoning harder! –Mostly harmless in practice – Stress testing tends to reveal retainers – Graphical profiling knocks it dead • Must be able to precisely enable/disable • Be careful with exceptions and mutation • whnf/rnf/! are your friends This one on performance: • Really precise performance requires expertise • Libraries are helping reify “oral traditions” about optimization • Still a lack of clarity about performance techniques in the broader Haskell community though The last bullet point makes me think you do agree with me :) I thought about it more since my last email, and I think what I want is something like the Effective C++ and Effective Java books, but for Haskell. A series of expert advice items with advice about when to use them. Real-World Haskell is a very good title, but I feel like it's at a different audience and level. Looking over Real-World haskell I see that some of these topics are discussed, which is really good. In particular, Chapter 25 would be valuable to anyone trying to find space leaks. There you discuss reduction to normal form, for example, and some strictness issues and how to control evaluation. While I'm thinking out loud, it would be very cool if someone wrote some articles, say for the monad reader, that follow the formula of the Effective C++ books. Write up the oral traditions of how to effectively use Haskell along with the dos/don'ts of each idiom. I think it could make a nice companion to the wisdom of Real-World Haskell. Have we made any tools yet that analyze haskell code and give warnings about styles and idioms that are prone to causing space leaks? For example, leaky folds are a well known problem. I know Neil Mitchel was working on some utilities to offer advice about Haskell source. Anyone know if his programs can detect potential space leaks? Thanks, Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
On Wed, May 6, 2009 at 4:12 PM, Jason Dagit da...@codersbase.com wrote: While I'm thinking out loud, it would be very cool if someone wrote some articles, say for the monad reader, that follow the formula of the Effective C++ books. The last couple of times I've wanted a book like that, I wrote the book myself. It's a very effective way to get the book you want, compared to wishing. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal parse problems
Am Donnerstag 07 Mai 2009 01:05:40 schrieb Vasili I. Galchin: Hello, I am trying to cabalize a package (swish .. semantic web) but am running into parse error: vigalc...@ubuntu:~/FTP/Haskell/Swish-0.2.1$ runhaskell Setup.hs configure Setup.hs: swish.cabal:24: Parse of field 'exposed-modules' failed. vigalc...@ubuntu:~/FTP/Haskell/Swish-0.2.1$ Below: is a fragment from my .cabal file. Line #24 starts with Exposed-modules: . . . Data-Files: README Exposed-modules: Swish.HaskellRDF.BuiltInDatatypes, Swish.HaskellRDF.BuiltInMap, Swish.HaskellRDF.BuiltInMapTest, Swish.HaskellRDF.BuiltInRules, Swish.HaskellRDF.ClassRestrictionRule, Swish.HaskellRDF.ClassRestrictionRuleTest, Swish.HaskellRDF.Datatype, Swish.HaskellRDF.GraphClass, Swish.HaskellRDF.GraphMatch, Any ideas why I am getting parse error? Pretty vague error message! Idea: The syntax of the value depends on the field. Field types include: token , filename , directory Either a sequence of one or more non-space non-comma characters, or a quoted string in Haskell 98 lexical syntax. Unless otherwise stated, relative filenames and directories are interpreted from the package root directory. Don't use commas. Kind regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
On Wed, May 6, 2009 at 3:54 PM, Anton van Straaten an...@appsolutions.com wrote: FWIW, I have an internal HAppS application that's been running continuously since November last year, used daily, with stable memory usage. Do you have advice about the way you wrote you app? Things you knowingly did to avoid space leaks? Maybe a blog about your HAppS app? I have also experienced it with writing a forever loop in Haskell that did polling from channels. I would leave my app running for, say, 4 hours and it would be using tons of memory. If you posted an example of that, there are probably people who'd be interested in debugging it. I'm not sure if I still have the source code or not. I did ask people at the time and the only thing I recall now was that I was told to make sure that I fully evaluate the thunks I create on each iteration of my forever loop. This was at least 2 years ago now. I don't know if I ever resolved it as it was just a toy benchmark anyway and I wasn't really happy with the results. I think it's fair to say that keeping the memory usage low of a long running Haskell app is hard, but that is a general issue not just a Haskell issue. It's hard in most languages. I don't agree with this. This should not be hard in language implementations with good garbage collectors, that don't have known limitations (this excludes e.g. conservative GC and reference-counting systems). In my experience, it's not hard to write stable long-running code in good implementations of languages like Haskell, Scheme, Common Lisp, or Java. There are certainly cases where no automatic garbage collector could know when it is safe to collect certain things. A quick google search for java space leaks turned up this article: http://www.ibm.com/developerworks/java/library/j-leaks/ I think wikipedia uses the term logical leak for the type of space leak I'm thinking of. The garbage collector thinks you care about an object but in fact, you want it to be freed. Yes, it's because of a bug, but these are bugs that tend to be subtle and tedious. I think what we need to address this is more information about preventative measures. What programming styles cause the problem and which ones solve it. I would say that I lack confidence recommending anyone to use Haskell for long running processes because I don't understand well the problem of keeping the usage low. If it is a well documented problem with documented solutions (more than just profiling), then I would regain my confidence because I know the problem can be worked around reliably. Does this make sense? Maybe it's already well documented? This doesn't completely make sense to me, in that either a program has a space leak, or it doesn't. If it does, you debug it and resolve it. If a leak really is due to a problem with the language implementation or standard libraries, then that should be identified and reported. There shouldn't be any deep mystery here. At the very least, it should be possible to point to the relevant trac tickets if there really is a problem. The ambiguity is me thinking of relative cost of finding/fixing these bugs. Testing for correctness is something we tend to automate very well. See unit testing for example. But, testing for space leaks is not something we have automated in my experience. Take Don's comment that you let it run for a while and then look at the profiling graph. How do you automate this and make it part of your automatic test suite? It seems like something that requires manual testing. So maybe you do some QA prior to releases? That sounds reasonable to me. The darcs team collects misbehaving repositories and has tools to automate the collection of statistics so that at regular intervals they can check the performance of darcs to make sure it's getting better or staying the same with each release (in practice I think these stats are collected by buildbots on each applied patch bundle). So then, at some point we must have a bag of tricks for dealing with these space leaks. I want to talk about those tricks. I'm not talking about bugs in a specific program, but instead about techniques and styles that are known to work well in practice. I hope that clarifies things a bit. Thanks, Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] WolframAlpha
Hello, http://blog.wolframalpha.com/2009/05/01/the-secret-behind-the-computational-engine-in-wolframalpha/ this is obviously a Wolfram Inc. blog so maybe not totally objective ... but here is a snippet that speaks in Haskell's favor: As a result, the five million lines of *Mathematica* code that make up Wolfram|Alpha are equivalent to many tens of millions of lines of code in a lower-level language like C, Java, or Python. * I am some what familiar with Mathematica and it's multi-paradigm nature (like F#, OCaml, etc.). In any case, I would like the Haskell community to view WolframAlpha as a challenge. For what is it worth I presently cabalizing Swish Based on my reading of WolframAlpha it is a semantic web ... i.e. formal knowledge representation! all Google results = http://www.google.com/search?q=WolframAlphaie=utf-8oe=utf-8aq=trls=com.ubuntu:en-US:unofficialclient=firefox-a Kind regards, Vasili * ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] WolframAlpha
From what I recall of Mathematica the language, it has more in common with Lisp than Haskell: it's symbolic, dynamically typed, etc. Allegedly Wolfram spent years on this; if it has any merit, duplicating it would be difficult. What I'd like to see most is WolframAlpha in action. At this point it is vaporware to me and for all I know this could be the beginning of a neverending charade of coming to a Interwebs near you Real Soon Now every few months for the next 10 years, like Duke Nukem Forever. Warren On Wed, May 6, 2009 at 5:01 PM, Vasili I. Galchin vigalc...@gmail.com wrote: Hello, http://blog.wolframalpha.com/2009/05/01/the-secret-behind-the-computational-engine-in-wolframalpha/ this is obviously a Wolfram Inc. blog so maybe not totally objective ... but here is a snippet that speaks in Haskell's favor: As a result, the five million lines of Mathematica code that make up Wolfram|Alpha are equivalent to many tens of millions of lines of code in a lower-level language like C, Java, or Python. I am some what familiar with Mathematica and it's multi-paradigm nature (like F#, OCaml, etc.). In any case, I would like the Haskell community to view WolframAlpha as a challenge. For what is it worth I presently cabalizing Swish Based on my reading of WolframAlpha it is a semantic web ... i.e. formal knowledge representation! all Google results = http://www.google.com/search?q=WolframAlphaie=utf-8oe=utf-8aq=trls=com.ubuntu:en-US:unofficialclient=firefox-a Kind regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal parse problems
are them some CLI switches I can enable in order to better determine what parse error is?? Kind regards, Vasili On Wed, May 6, 2009 at 6:12 PM, Vasili I. Galchin vigalc...@gmail.comwrote: sorrily nope, Brian ... Vasili On Wed, May 6, 2009 at 6:06 PM, br...@lorf.org wrote: On Wednesday, 06.05.09 at 18:05, Vasili I. Galchin wrote: Exposed-modules: Swish.HaskellRDF.BuiltInDatatypes, ... Swish.HaskellRDF.GraphMatch, Think it probably doesn't like that trailing comma. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal parse problems
I figured out myself ... even though the parse was allegedly was on line #24 .. it was below because I used as a separator '/' instead of '.'! Kind regards, Vasili On Wed, May 6, 2009 at 7:37 PM, Vasili I. Galchin vigalc...@gmail.comwrote: are them some CLI switches I can enable in order to better determine what parse error is?? Kind regards, Vasili On Wed, May 6, 2009 at 6:12 PM, Vasili I. Galchin vigalc...@gmail.comwrote: sorrily nope, Brian ... Vasili On Wed, May 6, 2009 at 6:06 PM, br...@lorf.org wrote: On Wednesday, 06.05.09 at 18:05, Vasili I. Galchin wrote: Exposed-modules: Swish.HaskellRDF.BuiltInDatatypes, ... Swish.HaskellRDF.GraphMatch, Think it probably doesn't like that trailing comma. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
Jason Dagit wrote: On Wed, May 6, 2009 at 3:54 PM, Anton van Straaten an...@appsolutions.com wrote: FWIW, I have an internal HAppS application that's been running continuously since November last year, used daily, with stable memory usage. Do you have advice about the way you wrote you app? Things you knowingly did to avoid space leaks? Maybe a blog about your HAppS app? The app is written for a client under NDA, so a blog about it would have to be annoyingly vague. But I don't think there's much mystery about why it doesn't leak: The app does simulations. Each simulation uses at least about 10MB of memory, more depending on parameters. Typically a few thousand simulations are run successively, and the results are aggregated and analyzed. The computation itself is purely functional - it takes some input parameters and produces results. The results are written to a file. Since each run of a set of simulations is essentially independent, there's not much risk of space leaks persisting across runs. No doubt the potential for encountering space leaks goes up as one writes less pure code, persist more things in memory, and depend on more libraries. My main point in mentioning my app is that long-running isn't really the issue - that's just a way of saying that an app has space leaks that are small enough not to be noticed until it's stressed. In my experience, it's not hard to write stable long-running code in good implementations of languages like Haskell, Scheme, Common Lisp, or Java. There are certainly cases where no automatic garbage collector could know when it is safe to collect certain things. If there are bugs in the user's program, sure - but that still doesn't make it hard to write applications that don't leak, given a decent GC. On the contrary, I'd say it's very easy, in the great majority of cases. A quick google search for java space leaks turned up this article: http://www.ibm.com/developerworks/java/library/j-leaks/ I think wikipedia uses the term logical leak for the type of space leak I'm thinking of. The garbage collector thinks you care about an object but in fact, you want it to be freed. Yes, it's because of a bug, but these are bugs that tend to be subtle and tedious. The example given in the IBM article is quite typical, but isn't subtle at all - it was simply an object being added to a table and never being removed. You can often find such bugs quite easily by searching the source tree, without touching a debugging tool. It's also possible to prevent them quite easily, with good coding practices (e.g. centralize uses of long-lived tables) and some simple code auditing practices. If you're dealing with code that's complex enough to involve the kinds of non-trivial mutually dependent references that you need in order to encounter truly subtle instances of these bugs, the increased difficulty of memory management comes with the territory, i.e. it's harder because the application is harder. The ambiguity is me thinking of relative cost of finding/fixing these bugs. To put this back into context, I was objecting to your having extended the space leak worrying to all GC'd languages. I'm saying that it isn't hard, using most decent language implementations, to avoid space leaks. For trivial cases such as the IBM example, it should be no harder in Haskell, either - possibly easier, since use of things like mutable tables is more controlled, and may be rarer. However, Haskell does theoretically introduce a new class of dangers for space leaks, I'm not denying that. Being pure and lazy introduces its own set of space leak risks. But on that front, I was disturbed by the vagueness of the claims about long-running apps. I haven't seen any solid justification for scaring people off about writing long-running apps in Haskell. If there is such a justification, it needs to be more clearly identified. Testing for correctness is something we tend to automate very well. How do you automate testing for performance under load? Space usage is a similar kind of dynamic issue, in general. So then, at some point we must have a bag of tricks for dealing with these space leaks. I want to talk about those tricks. I'm not talking about bugs in a specific program, but instead about techniques and styles that are known to work well in practice. OK. That's a bit different from FFT's original contention, hard to contain a long-running Haskell application in a finite amount of memory. For my own part, I'm at least as non-strict as Haskell, and that bag of tricks, for me, is a thunk that hasn't yet been forced. Anton ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
On Wed, May 6, 2009 at 8:20 PM, Anton van Straaten an...@appsolutions.com wrote: The app is written for a client under NDA, so a blog about it would have to be annoyingly vague. No doubt the potential for encountering space leaks goes up as one writes less pure code, persist more things in memory, and depend on more libraries. Exactly. I'm worried about, e.g. needing to use something as simple as a stream of prime numbers (see the recent thread about leaks there) My main point in mentioning my app is that long-running isn't really the issue - that's just a way of saying that an app has space leaks that are small enough not to be noticed until it's stressed. An internal web site with few benign users is one thing, but if it's an external web site, it might get stressed in ways different from your expected usage scenarios, if you know what I mean. To put this back into context, I was objecting to your having extended the space leak worrying to all GC'd languages. I agree. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)
FFT wrote: Anton van Straaten wrote: The app is written for a client under NDA, so a blog about it would have to be annoyingly vague. No doubt the potential for encountering space leaks goes up as one writes less pure code, persist more things in memory, and depend on more libraries. Exactly. I'm worried about, e.g. needing to use something as simple as a stream of prime numbers (see the recent thread about leaks there) The issues here are going to be the same in Haskell as in every other language. There's always a tradeoff between the memory of caching old results vs the time of recalculating them. At present no language's RTS/GC is smart enough to make that tradeoff for you, and so memoization must be done manually. There are some tricks to help make this easier (e.g. weak pointers), but the problem will always remain. The only thing that makes this perhaps trickier than in other languages is that, AFAIK/R, the reflection API to ask the RTS how it's feeling about memory at any given point isn't terribly portable (between Haskell compilers) or polished/pretty. Then again, the other GC languages I've dealt with aren't much better and are often worse. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] WolframAlpha
On Wed, 2009-05-06 at 17:13 -0700, Warren Henning wrote: What I'd like to see most is WolframAlpha in action. At this point it is vaporware to me and for all I know this could be the beginning of a neverending charade of coming to a Interwebs near you Real Soon Now every few months for the next 10 years, like Duke Nukem Forever. The website says May 2009 (this month), and I don't know of any previous announcements claiming to have a date. I'm buying this one. Jeff Wheeler ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe