Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Donn Cave
Quoth Henning Thielemann , > On Fri, 27 Mar 2009, Donn Cave wrote: > >> Quoth Jonathan Cast , >> >>> An `error' is any condition where the correct response is for the >>> programmer to change the source code :) >> >> That's a broad category, that overlaps with conditions where there >> are one or m

[Haskell-cafe] Parallel term reduction---solution

2009-03-27 Thread John D. Ramsdell
On February 1, I sent a message to this list asking for advice on how to write a parallel term reduction system. I now have a semi-explicit parallelised version of a term reduction system that makes effective use of multiple CPUs. The enclosed code describes the solution, even though its performa

[Haskell-cafe] Re: Darcs - dependencies between repositories (aka forests)

2009-03-27 Thread Simon Michael
I assume cabal install darcs isn't what you're looking for.. can you give a real-world example ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Definition of "tail recursive" wrt Folds

2009-03-27 Thread Ben Franksen
Mark Spezzano wrote: > Just looking at the definitions for foldr and foldl I see that foldl is > (apparently) tail recursive while foldr is not. > > Why? > > Is it because foldl defers calling itself until last whereas foldr > evaluates itself as it runs? > > What, strictly speaking, is the defi

[Haskell-cafe] Re: Haddock GSoC project

2009-03-27 Thread Isaac Dupree
Okay, I've written a draft Haddock-GSOC application: would any of you like to review it / suggest how it could be improved? (or should I just submit it to Google?) I'm particularly wondering whether my proposed time-line seems realistic. -Isaac * What is the goal of the project you propose

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Robert Greayer
Henning Thielemann wrote: > The usual example against clear separation of exceptions and errors is the > web server which catches 'error's in order to keep running. > However, the web server starts its parts as threads, and whenever one thread > runs into an 'error', it is terminated, just lik

[Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread John Lato
> > Message: 8 > Date: Fri, 27 Mar 2009 10:41:05 -0700 > From: Jonathan Cast > Subject: Re: [Haskell-cafe] Re: Exception handling in numeric >        computations > To: Gregory Petrosyan > Cc: haskell-cafe@haskell.org > Message-ID: <1238175665.20367.12.ca...@jcchost> > Content-Type: text/plain; c

[Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread John Lato
> From: Donn Cave > Quoth John Lato , > >> An exception is caused by some sort of interaction with the run-time >> system (frequently a hardware issue).  The programmer typically can't >> check for these in advance, but can only attempt to recover after >> they've happened. >> >> An error is some

[Haskell-cafe] Haxr doesn't compile from cabal (HTTP > 4000 breaks it)

2009-03-27 Thread Henning Thielemann
Most breakage caused by new HTTP package is due to the renaming from Response to Response_String and Request to Request_String. I think it was not a good idea to do that. There could have well be two types named Response from different modules, one with a type parameter and the other one with

Re: [Haskell-cafe] Really need some help understanding a solution

2009-03-27 Thread Luke Palmer
On Fri, Mar 27, 2009 at 7:03 PM, Henning Thielemann < lemm...@henning-thielemann.de> wrote: > > On Thu, 26 Mar 2009, wren ng thornton wrote: > > Thomas Hartman wrote: >> >>> Luke, does your explanation to Guenther have anything to do with >>> coinduction? -- the property that a producer gives a l

[Haskell-cafe] Re: is there any reason why Language.C.Syntax.AST.CTranslUnit doesn't derive show?

2009-03-27 Thread Anatoly Yakovenko
ah, i am guessing its because you can use Data.Generics.gshow to do the same thing. Seems like that library will come in handy when manipulating the AST, pretty cool stuff. On Fri, Mar 27, 2009 at 5:53 PM, Anatoly Yakovenko wrote: > is there any reason why Language.C.Syntax.AST.CTranslUnit doesn

Re: [Haskell-cafe] Really need some help understanding a solution

2009-03-27 Thread Henning Thielemann
On Thu, 26 Mar 2009, wren ng thornton wrote: Thomas Hartman wrote: Luke, does your explanation to Guenther have anything to do with coinduction? -- the property that a producer gives a little bit of output at each step of recursion, which a consumer can than crunch in a lazy way? It has more

Re: [Haskell-cafe] Re: Use unsafePerformIO to catch Exception?

2009-03-27 Thread Henning Thielemann
On Fri, 27 Mar 2009, Jason Dusek wrote: 2009/03/27 John Lato : I could follow the rest of this, but I don't understand why 'head' is necessary.  Couldn't you always replace it with a case statement, with undefined on [] if necessary? How would that be any different from head? The psychol

[Haskell-cafe] is there any reason why Language.C.Syntax.AST.CTranslUnit doesn't derive show?

2009-03-27 Thread Anatoly Yakovenko
is there any reason why Language.C.Syntax.AST.CTranslUnit doesn't derive show? I would like to look at the data structure it generates. It's a lot easier to experiment it when i can write a template C file, print out the AST and then modify that data structure directly, instead of trying to grok

Re: [Haskell-cafe] Conditional compilation

2009-03-27 Thread Henning Thielemann
On Fri, 27 Mar 2009, Robin Green wrote: I am writing some code for citation support in gitit, and all the #ifdefs I'm using to do conditional compilation are a bit tiresome. I live well without CPP in Haskell. When I need conditional compilation I create two directories with modules of the s

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Henning Thielemann
On Fri, 27 Mar 2009, Donn Cave wrote: Quoth Jonathan Cast , An `error' is any condition where the correct response is for the programmer to change the source code :) That's a broad category, that overlaps with conditions where there are one or more correct responses for the original program

Re: [Haskell-cafe] Use unsafePerformIO to catch Exception?

2009-03-27 Thread Duncan Coutts
On Fri, 2009-03-27 at 12:26 +0100, Henning Thielemann wrote: > On Thu, 26 Mar 2009, wren ng thornton wrote: > > > Functions like uncons and viewL are nicer (because they're safe), but they > > can have overhead because they're unnecessarily complete (e.g. the Maybe > > wrapper can be avoided if

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Henning Thielemann
On Thu, 26 Mar 2009, John Lato wrote: Henning T., FYI your constant advocacy has gotten at least one person around to this view. I'm glad that it is not (only) perceived as annoyance. :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http:/

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Henning Thielemann
Jonathan Cast schrieb: >> i.e., that application's >> file decoding result should be an Either type that anticipates that >> the file encoding may be invalid. > > This is pretty standard, I thought. Do people write Haskell file input > methods that are undefined (`throw exceptions') on invalid i

Re: [Haskell-cafe] Internationalization of Haskell code

2009-03-27 Thread Felipe Lessa
On Sat, Mar 28, 2009 at 12:20:04AM +0200, Vasyl Pasternak wrote: > In my blog http://progandprog.blogspot.com/2009/03/i18n-and-haskell.html, > I've described > process of internationalization Haskell programms using GNU GetText. I > wrote hgettext tool and > Text.I18N.GetText library to help with i

[Haskell-cafe] Re: The infamous evil monomorphism restriction (was: A bit of a shock - Memoizing functions)

2009-03-27 Thread Peter Verswyvelen
I kind a mention this because it might be easy for a polymorphic CAF to do memoization so its value gets computed maximum once per type, e.g (quick and dirty code follows) import Data.Typeable import Data.IORef import qualified Data.IntMap as M import System.IO.Unsafe

[Haskell-cafe] The infamous evil monomorphism restriction (was: A bit of a shock - Memoizing functions)

2009-03-27 Thread Peter Verswyvelen
>From a previous email in the beginners list I more or less understood that the monomorphism restriction will not exist anymore in Haskell Prime. Is this correct? On Fri, Mar 27, 2009 at 10:32 PM, Jonathan Cast wrote: > On Fri, 2009-03-27 at 14:26 -0700, Kirk Martinez wrote: > > Your powersOfTwo

Re: [Haskell-cafe] Internationalization of Haskell code

2009-03-27 Thread minh thu
2009/3/28 Henning Thielemann : > > On Sat, 28 Mar 2009, Vasyl Pasternak wrote: > >> In my blog http://progandprog.blogspot.com/2009/03/i18n-and-haskell.html, >> I've described >> process of internationalization Haskell programms using GNU GetText. I >> wrote hgettext tool and >> Text.I18N.GetText l

Re: [Haskell-cafe] Internationalization of Haskell code

2009-03-27 Thread Henning Thielemann
On Sat, 28 Mar 2009, Vasyl Pasternak wrote: In my blog http://progandprog.blogspot.com/2009/03/i18n-and-haskell.html, I've described process of internationalization Haskell programms using GNU GetText. I wrote hgettext tool and Text.I18N.GetText library to help with internationalization (latest

Re: [Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread Martijn van Steenbergen
Kirk Martinez wrote: It seems there is a very close correspondence between data structures and functions in Haskell. Your powersOfTwo function, since it gets memoized automatically (is this the case for all functions of zero arguments?), seems exactly like a data structure. This harks back to

[Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread Gü?nther Schmidt
Hi Dan, yep, I've come across that one too and wouldn't you know it, the by now infamous Luke Palmer has left an interesting insight on that blog too :). So I reckon here the cycle closes. Günther Dan Piponi schrieb: 2009/3/27 Kirk Martinez : I wonder: does the converse exist? Haskell d

[Haskell-cafe] Re: toSelem takes no format parameter

2009-03-27 Thread Sterling Clover
If you have a type that requires a format string, the proper place to pass that string in is not the toSElem method. Rather, one should construct a ToSElem instance that wraps the item in an (STSH . STShow) constructor. The item itself then should be made an instance of StringTemplateShows,

Re: [Haskell-cafe] A bit of a shock - Memoizing functions

2009-03-27 Thread Jeremy Shaw
Hello, I've seen it done explicitly as is shown in the code below. 'f' in 'longest' is the function which is being memoized by the 'dp'. It's pretty slick, IMO. (not sure where this code came from. Also I may have broken it, but you get the idea): module Diff where import Data.Array -- * Dynam

Re: [Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread Dan Piponi
2009/3/27 Kirk Martinez : > I wonder: does the converse exist? Haskell data constructors which are > really functions? How and for what might one use those? You might enjoy reading about the use of tries for memoisation. Conal Elliott explains nicely how you can an isomorphism between certain t

[Haskell-cafe] Internationalization of Haskell code

2009-03-27 Thread Vasyl Pasternak
In my blog http://progandprog.blogspot.com/2009/03/i18n-and-haskell.html, I've described process of internationalization Haskell programms using GNU GetText. I wrote hgettext tool and Text.I18N.GetText library to help with internationalization (latest sources on http://hgettext.googlecode.com/files

Re: [Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread David Menendez
2009/3/27 Kirk Martinez : > It seems there is a very close correspondence between data structures and > functions in Haskell.  Your powersOfTwo function, since it gets memoized > automatically (is this the case for all functions of zero arguments?), seems > exactly like a data structure. That's be

Re: [Haskell-cafe] Re: Use unsafePerformIO to catch Exception?

2009-03-27 Thread John Lato
On Fri, Mar 27, 2009 at 9:51 PM, Jason Dusek wrote: > 2009/03/27 John Lato : >> From: Jules Bean >> > wren ng thornton wrote: >> > > The type of head should not be [a] -> a + Error, it should >> > > be (a:[a]) -> a. With the latter type the compiler can >> > > ensure the precondition will be prov

Re: [Haskell-cafe] wxHaskell

2009-03-27 Thread Tsunkiet Man
Oh yes, it works. I'm sorry for not noticing how this application works. Now I really wonder how I can implement that into winHugs and other GUI's =) Thank you for your response. 2009/3/27 Henk-Jan van Tuyl > On Fri, 27 Mar 2009 19:35:05 +0100, Tsunkiet Man > wrote: > > Hello, >> >> I've jus

Re: [Haskell-cafe] Re: Use unsafePerformIO to catch Exception?

2009-03-27 Thread Jason Dusek
2009/03/27 John Lato : > From: Jules Bean > > wren ng thornton wrote: > > > The type of head should not be [a] -> a + Error, it should > > > be (a:[a]) -> a. With the latter type the compiler can > > > ensure the precondition will be proved before calling > > > head, thus eliminating erroneous cal

Re: [Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread Jonathan Cast
On Fri, 2009-03-27 at 14:26 -0700, Kirk Martinez wrote: > Your powersOfTwo function, since it gets memoized automatically (is > this the case for all functions of zero arguments?), It is the case for all functions which have zero arguments *at the time they are presented to the code generator*. T

[Haskell-cafe] Re: Use unsafePerformIO to catch Exception?

2009-03-27 Thread John Lato
> From: Jules Bean > wren ng thornton wrote: >> The type of head should not be [a] -> a + Error, it should be (a:[a]) -> >> a. With the latter type the compiler can ensure the precondition will be >> proved before calling head, thus eliminating erroneous calls. > > Yes, but you know and I know tha

Re: [Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread Kirk Martinez
It seems there is a very close correspondence between data structures and functions in Haskell. Your powersOfTwo function, since it gets memoized automatically (is this the case for all functions of zero arguments?), seems exactly like a data structure. This harks back to my Scheme days when we l

Re: [Haskell-cafe] want to upgrade to 6.10.1 ghc

2009-03-27 Thread Jochem Berndsen
Vasili I. Galchin wrote: > I am running Ubuntu Linux. I have forgotten what is the preferred > means of upgrading. Download the source and compile it using my current > compiler .. 6.8.2? I would recommend to download the binary distribution for your architecture, unpack it and install it. http://

[Haskell-cafe] Re: A bit of a shock - Memoizing functions

2009-03-27 Thread GüŸnther Schmidt
Hi Bulat, that is so cool! Günther Bulat Ziganshin schrieb: Hello Gü?nther, Friday, March 27, 2009, 11:30:41 PM, you wrote: Some of the memoizing functions, they actually "remember" stuff *between* calls? what i've seen in haskell - functions relying on lazy datastructures that ensure com

[Haskell-cafe] want to upgrade to 6.10.1 ghc

2009-03-27 Thread Vasili I. Galchin
Hello, I am running Ubuntu Linux. I have forgotten what is the preferred means of upgrading. Download the source and compile it using my current compiler .. 6.8.2? Regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.h

Re: [Haskell-cafe] A bit of a shock - Memoizing functions

2009-03-27 Thread Bulat Ziganshin
Hello Gü?nther, Friday, March 27, 2009, 11:30:41 PM, you wrote: > Some of the memoizing functions, they actually "remember" stuff > *between* calls? what i've seen in haskell - functions relying on lazy datastructures that ensure computation on first usage so this looks exactly like as memoizing

[Haskell-cafe] A bit of a shock - Memoizing functions

2009-03-27 Thread Gü?nther Schmidt
Hi, um, well, I'm not even sure if I have correctly understood this. Some of the memoizing functions, they actually "remember" stuff *between* calls? Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/list

Re: [Haskell-cafe] wxHaskell

2009-03-27 Thread Henk-Jan van Tuyl
On Fri, 27 Mar 2009 19:35:05 +0100, Tsunkiet Man wrote: Hello, I've just installed wxHaskell as follow: - Download wxHaskell from the following page: http://haskell.org/haskellwiki/WxHaskell/Download and downloaded the binairy version for Windows XP. - Registered using the batch file pro

[Haskell-cafe] ANN: HackMail 0.0 -- Procmail + Monads = Awesome!

2009-03-27 Thread Joe Fredette
I'm happy to announce my very second Hackage upload!* HackMail is a Procmail-alike, though it doesn't (yet) support promail syntax. It dynamically loads a haskell source file (literate or vanilla, eithers okay) and then sits as a daemon watching a directory for new emails. The source file cont

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Donn Cave
Quoth Jonathan Cast , > An `error' is any condition where the correct response is for the > programmer to change the source code :) That's a broad category, that overlaps with conditions where there are one or more correct responses for the original program as well. If I throw exceptions within

[Haskell-cafe] wxHaskell

2009-03-27 Thread Tsunkiet Man
Hello, I've just installed wxHaskell as follow: - Download wxHaskell from the following page: http://haskell.org/haskellwiki/WxHaskell/Download and downloaded the binairy version for Windows XP. - Registered using the batch file provided. Now I have this small program from my education page that

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Jonathan Cast
On Fri, 2009-03-27 at 20:38 +0300, Gregory Petrosyan wrote: > On Fri, Mar 27, 2009 at 7:31 PM, Donn Cave wrote: > > Quoth John Lato , > > > >> An exception is caused by some sort of interaction with the run-time > >> system (frequently a hardware issue). The programmer typically can't > >> check

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Gregory Petrosyan
On Fri, Mar 27, 2009 at 7:31 PM, Donn Cave wrote: > Quoth John Lato , > >> An exception is caused by some sort of interaction with the run-time >> system (frequently a hardware issue). The programmer typically can't >> check for these in advance, but can only attempt to recover after >> they've h

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Jonathan Cast
On Fri, 2009-03-27 at 09:31 -0700, Donn Cave wrote: > Quoth John Lato , > > > An exception is caused by some sort of interaction with the run-time > > system (frequently a hardware issue). The programmer typically can't > > check for these in advance, but can only attempt to recover after > > the

Re: [Haskell-cafe] about Haskell code written to be "too smart"

2009-03-27 Thread Claus Reinke
Continuing our adventures into stylistic and semantic differences:-) Can you write this analysis on the wiki? Hmm, we tried that in the past, and I haven't seen any indication that people search for those things, let alone find them (one particular example I recalled I still haven't been able

[Haskell-cafe] Darcs - dependencies between repositories (aka forests)

2009-03-27 Thread Peter Verswyvelen
With Cabal we have this nice dependency system: when you install a package, it installs missing but requires packages. How do you solve this with Darcs? I hate it that I must manually figure out the dependencies, and then do a "darcs get" on them individually. __

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Donn Cave
Quoth John Lato , > An exception is caused by some sort of interaction with the run-time > system (frequently a hardware issue). The programmer typically can't > check for these in advance, but can only attempt to recover after > they've happened. > > An error is some sort of bug that should be f

[Haskell-cafe] Arch Linux now provides more than 1000 Haskell libraries and apps

2009-03-27 Thread Don Stewart
A small milestone in the packaging business: http://archhaskell.wordpress.com/2009/03/27/arch-haskell-news-mar-14-2009-1000-haskell-packages/ More than 1000 Haskell packages packaged up for Arch Linux. Hackage now has 1163 (+41) Haskell packages, of which 1007 (+33) have been natively packaged f

Re: [Haskell-cafe] Conditional compilation

2009-03-27 Thread Sean Leather
Hi Robin, On Fri, Mar 27, 2009 at 16:13, Robin Green wrote: > Suppose you have the requirement that a certain feature of your > software be disable-able at compile time, to avoid having to pull in > certain dependencies (which may not be available on all platforms). > Disabling a feature may enta

[Haskell-cafe] Conditional compilation

2009-03-27 Thread Robin Green
I am writing some code for citation support in gitit, and all the #ifdefs I'm using to do conditional compilation are a bit tiresome. Suppose you have the requirement that a certain feature of your software be disable-able at compile time, to avoid having to pull in certain dependencies (which may

Re: [Haskell-cafe] typeOf for polymorphic value

2009-03-27 Thread Lennart Augustsson
Oleg, You rock! And you're a star! So you must be a rock star. :) Thanks! -- Lennart On Thu, Mar 26, 2009 at 5:33 AM, wrote: > >> Does anyone know of a trick to accomplish `typeOf id'? >> Using something else than TypeRep as the representation, of course. > > Yes. The analysis of polymorph

Re: [Haskell-cafe] Re: Really need some help understanding a solution

2009-03-27 Thread Peter Verswyvelen
How do you plan to consume the running sums of these data? How many different keys do you have? If all pure stuff fails, you can always revert to imperative techniques, using a mutable arrayor something :) On Fri, Mar 2

Re: [Haskell-cafe] ANNOUNCE: wxAsteroids 1.0

2009-03-27 Thread Henk-Jan van Tuyl
On Thu, 26 Mar 2009 20:41:57 +0100, Henk-Jan van Tuyl wrote: Your space ship enters an asteroid belt, try to avoid collisions! wxAsteroids is a game demonstrating the wxHaskell GUI. More about this at: http://www.haskell.org/haskellwiki/wxAsteroids Maybe I should add more informationn t

[Haskell-cafe] Re: Really need some help understanding a solution

2009-03-27 Thread GüŸnther Schmidt
Guys, I appreciate the contribution but I'm now more confused than ever :) On the Co-Induction-whatever thingy: Thanks, that's certainly something interesting and I'll try to find out more about it. But it looks like none of all the proposals offers a true solution, at least none from start

Re: [Haskell-cafe] typeOf for polymorphic value

2009-03-27 Thread Roland Zumkeller
Hi Lennart, This is not a real solution, but maybe helpful. The hint package (wrapping the ghc API) has its typeOf: cabal install hint > import Language.Haskell.Interpreter > runInterpreter (typeOf "\\x -> x") Right "t -> t" Best, Roland On Wed, Mar 25, 2009 at 7:33 PM, Lennart Augustsson w

[Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Jonathan Cast
On Fri, 2009-03-27 at 12:24 +, Chris Kuklewicz wrote: > Jonathan Cast wrote: > > Sure. Which also points out that the original safeDiv wasn't actually > > safe, since there's no guarantee of what evaluate will do with x and y. > > (Actually, there's not much guarantee of what evaluate does any

[Haskell-cafe] Re: about Haskell code written to be "too smart"

2009-03-27 Thread Achim Schneider
Colin Adams wrote: > 2009/3/27 Achim Schneider : > > wren ng thornton wrote: > > > >> Colin Adams wrote: > >> > A reference to a research paper is fine to show where the ideas > >> > came from, but that is not where the library documentation > >> > should be. > >> > >> Yeah, that's bad. 'Documen

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread John Lato
On Fri, Mar 27, 2009 at 10:01 AM, Gregory Petrosyan wrote: > Thanks a lot for the answer! > > On Thu, Mar 26, 2009 at 4:36 PM, John Lato wrote: >> Languages with checked exceptions usually use them for two purposes: >> >> 1.  Exceptional conditions - disk full, CPU on fire, etc. >> 2.  Error hand

[Haskell-cafe] toSelem takes no format parameter

2009-03-27 Thread Kemps-Benedix Torsten
Sterling, the toSElem function of ToSElem does not take a parameter that allows specification of e.g. the locale that shall be used for rendering a specific attribute. If one wants to change this, one also has to change setAttribute and the like. Do you have any plans to extend HStringTempla

[Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Chris Kuklewicz
Jonathan Cast wrote: Sure. Which also points out that the original safeDiv wasn't actually safe, since there's no guarantee of what evaluate will do with x and y. (Actually, there's not much guarantee of what evaluate does anyway --- just that any errors in e's definition get turned into excepti

Re: [Haskell-cafe] Use unsafePerformIO to catch Exception?

2009-03-27 Thread Jules Bean
wren ng thornton wrote: The type of head should not be [a] -> a + Error, it should be (a:[a]) -> a. With the latter type the compiler can ensure the precondition will be proved before calling head, thus eliminating erroneous calls. Yes, but you know and I know that's not haskell. I'm talking

Re: [Haskell-cafe] Use unsafePerformIO to catch Exception?

2009-03-27 Thread Henning Thielemann
On Thu, 26 Mar 2009, wren ng thornton wrote: Functions like uncons and viewL are nicer (because they're safe), but they can have overhead because they're unnecessarily complete (e.g. the Maybe wrapper can be avoided if we know a-priori that Just will be the constructor used). If you know, i

Re: [Haskell-cafe] Grouping - Map / Reduce

2009-03-27 Thread jean-christophe mincke
Hello What do you think of this? There is perhaps a recursive call that should be made tail recursive but it seems to work. The 'group' function takes the list of pairs as input and outputs a list of maps from key to sums. The nth element of the list of maps corresponds to the grouping applied

Re: [Haskell-cafe] Re: Exception handling in numeric computations

2009-03-27 Thread Gregory Petrosyan
Thanks a lot for the answer! On Thu, Mar 26, 2009 at 4:36 PM, John Lato wrote: > Languages with checked exceptions usually use them for two purposes: > > 1. Exceptional conditions - disk full, CPU on fire, etc. > 2. Error handling - invalid arguments to a function, attempt to > invert non-inver

Re: [Haskell-cafe] Grouping - Map / Reduce

2009-03-27 Thread Peter Verswyvelen
Well, this approach has the problem that the running sum of key k blocks until a new value for that k arrives in the input stream. If you wanted to know the sum of the values of each key after you got nelements in the input stream, we could change the valuesWithKey inner function into: runningSums

Re: [Haskell-cafe] Re: about Haskell code written to be "too smart"

2009-03-27 Thread Colin Adams
2009/3/27 Achim Schneider : > wren ng thornton wrote: > >> Colin Adams wrote: >> > 2009/3/25 wren ng thornton : >> > when I look up the Haddock-generated documentation for a function, I >> > DON'T appreciate it if that is in the form of a hyperlink to a >> > research paper. >> > And that occurs in

Re: [Haskell-cafe] ANN: FallingBlocks 0.1

2009-03-27 Thread Don Stewart
bwsanders: > Hello, > > I just uploaded fallingblocks to Hackage. It is another Tetris clone, but it > uses SDL, and I thought there could be more SDL examples. > > Any and all comments and suggestions will be extremely appreciated! > > There is a darcs repo at > http://patch-tag.com/publicrep