[Haskell-cafe] Data.Map add only if not exist and return true if added

2008-12-09 Thread John Ky
Hi, I'm looking for a function for Data.Map that will insert a new key and value into the map if the key doesn't already exist in the map. When the key already exists, I don't want the value updated in the map. Additionally, I want to know whether the key/value was inserted or not so that I can

Re: [Haskell-cafe] Data.Map add only if not exist and return true if added

2008-12-09 Thread Arthur van Leeuwen
On 9 dec 2008, at 09:11, John Ky wrote: Hi, I'm looking for a function for Data.Map that will insert a new key and value into the map if the key doesn't already exist in the map. When the key already exists, I don't want the value updated in the map. Additionally, I want to know

Re: [Haskell-cafe] How to define Show [MyType] ?

2008-12-09 Thread Wouter Swierstra
The biggest wart is that view is not a total function; the compiler needs to be extra careful to only call it on types that are instances of View. I wonder if there is a good way to solve this problem? The usual way to solve this is to define a data type corresponding to all the types in

Re: [Haskell-cafe] How to define Show [MyType] ?

2008-12-09 Thread Ryan Ingram
Interesting. But from a practical point of view (I know, irrelevant! *grin*), it's very tempting to piggyback the entirety of the typeclass feature on a simple technique like this. It also gives you the benefit that functions like this: manyConstraints :: (Show a, Eq a, Data a) = a - Bool end

Re: [Haskell-cafe] Cabal: defaultMainNoRead and source file location

2008-12-09 Thread Duncan Coutts
On Mon, 2008-12-08 at 14:49 -0200, Mauricio wrote: Hi, I've just seen this from Distribution.ModuleName (ghc 6.10): toFilePath $ ( simple A.B.C ) to which ghci answers: A.B.C. Shouldn't it say A/B/C? You're using it wrong. A 'simple' module name should have no '.' in it. Instead use

[Haskell-cafe] Exact parsing of decimal numbers

2008-12-09 Thread Emil Axelsson
Hello, I don't know enough about the RealFrac class to answer this myself: Can I be sure that Numeric.readFloat :: ReadS Rational never exhibits any rounding errors? Thanks, / Emil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] ANNOUNCE: haskell-src-exts 0.4.4

2008-12-09 Thread Duncan Coutts
On Thu, 2008-12-04 at 19:04 +0100, Niklas Broberg wrote: Fellow Haskelleers, it is my pleasure to announce the new release of the haskell-src-exts package, version 0.4.4: So when will we simply declare that haskell-src-exts is the new haskell-src? :-) That implementation is widely

Re: [Haskell-cafe] Exact parsing of decimal numbers

2008-12-09 Thread Lennart Augustsson
Yes. On Tue, Dec 9, 2008 at 1:54 PM, Emil Axelsson [EMAIL PROTECTED] wrote: Hello, I don't know enough about the RealFrac class to answer this myself: Can I be sure that Numeric.readFloat :: ReadS Rational never exhibits any rounding errors? Thanks, / Emil

Re: [Haskell-cafe] Building/installing haskelldb and friends with ghc 6.10.1

2008-12-09 Thread Duncan Coutts
On Sat, 2008-12-06 at 23:32 +0100, Laurent Giroud wrote: Hi everyone, I have been trying to install haskelldb in the last few days and encountered a number of hurdles which raised a few questions and for which I'd appreciate some insight and advice. Note that I am posting here because

Re: [Haskell-cafe] Origins of '$'

2008-12-09 Thread Arnar Birgisson
On Mon, Dec 8, 2008 at 23:10, Dan Piponi [EMAIL PROTECTED] wrote: More generally, all of Tarski's high school algebra axioms carry over to types. You can see the axioms here: http://math.bu.edu/people/kayeats/papers/saga_paper4.ps That proves type theory is child's play :-) Ah, the power of a

[Haskell-cafe] Timber mailing list

2008-12-09 Thread ryah dahl
Is there a user mailing list for the Timber language? (http://www.timber-lang.org/) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] FFI, TH or GHCI, foreign bindings and the linker(s)

2008-12-09 Thread Andrea Rossato
For later reference: I created a minimal test case to illustrate the issue and moved to the (hopefully) more appropriate glasgow-haskell-users list: http://www.haskell.org/pipermail/glasgow-haskell-users/2008-December/016312.html cheers, andrea On Sun, Dec 07, 2008 at 07:08:28PM +0100, Andrea

[Haskell-cafe] Re: problems with hs-plugins load-eval (possible bug)

2008-12-09 Thread Alberto G. Corona
The duplicate definition error appears when I compile Main.hs and execute it. But when I run it with runghc the behaviour is different. It works well: runghc Main.hs 3 Any idea? is this a bug of hs-plugins? it is just something expected?? 2008/12/6 Alberto G. Corona [EMAIL PROTECTED] I have

Re: [Haskell-cafe] Origins of '$'

2008-12-09 Thread Hans Aberg
On 8 Dec 2008, at 23:15, Joachim Breitner wrote: Am Montag, den 08.12.2008, 15:59 -0600 schrieb Nathan Bloomfield: Slightly off topic, but the A^B notation for hom-sets also makes the natural isomorphism we call currying expressable as A^(BxC) = (A^B) ^C. So A^(B+C) = A^B × A^C ? Oh,

[Haskell-cafe] scanr producer?

2008-12-09 Thread Louis Wasserman
Is there a change in strictness with the following transformation? It seems like scanr should be a good consumer and a good producer, intuitively. scanrFB :: (a - b - b) - b - [a] - (b - c - c) - c - c scanrFB f x ls c n = snd (foldr (\ x (b, bs) - let b' = f x b in (b', b' `c` bs)) (x, n) ls)

[Haskell-cafe] a haskell_proposals subreddit

2008-12-09 Thread Jason Dusek
There is a subreddit for people to propose libraries: http://www.reddit.com/r/haskell_proposals/ The idea being, that Web 2.0 will help us to allocate our collective talents more efficiently when it comes to extensions (and perhaps clue us in when our pet project is something

Re: [Haskell-cafe] Re: ANNOUNCE: haskell-src-exts 0.4.4

2008-12-09 Thread Niklas Broberg
Are SrcSpan's on the TODO list? Seeing how this is the first I hear of them, I can't say that they have been, but they could be. :-) Could you give me a rundown on what usecases you'd need SrcSpans for, and where HSE currently fails you in this regard? Cheers, /Niklas

Re: [Haskell-cafe] Re: ANNOUNCE: haskell-src-exts 0.4.4

2008-12-09 Thread Niklas Broberg
Apart from this, HSE now also parses any unrecognized pragma in option (e.g. LANGUAGE), declaration (e.g. RULES) or expression (e.g. SCC) position, allowing user-customized pragmas. Unrecognized pragmas in other positions will (unfortunately) give a parse error. If this ever means a problem

Re: [Haskell-cafe] Building/installing haskelldb and friends with ghc 6.10.1

2008-12-09 Thread Laurent Giroud
Hi Duncan, thanks a lot for your answers. however, haskell-hdbc insists on depending on version 1.0.1. That's because the haskelldb-hdbc depends on exactly HDBC ==1.0.1 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskelldb-hdbc I haven't been able so far to find what

Re: [Haskell-cafe] ANNOUNCE: haskell-src-exts 0.4.4

2008-12-09 Thread Niklas Broberg
(CC libraries) So when will we simply declare that haskell-src-exts is the new haskell-src? :-) I talked about this with Ross Paterson at one point, and his main objection (which I very much agree with) was that haskell-src-exts doesn't let you *optionally* handle extensions, so in some cases

[Haskell-cafe] Does ghc use Language.Haskell.*?

2008-12-09 Thread Maurí­cio
Hi, I've just coded a small utility to prettyprint my code, based on Language.Haskell.Parser and friends. Much to my surprise it wasn't able to parse itself, complaining about a non-ASC character (í). Why can ghc read the program, but not the standard library parser? Does ghc use something

[Haskell-cafe] File name encodings

2008-12-09 Thread Günther Schmidt
Hi, how can I convert a file name with for example umlauts (ü, ä ... ) into UTF8, or some other format that I can actually use it? Günther -- On a German Win XP ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] File name encodings

2008-12-09 Thread Don Stewart
redcom: Hi, how can I convert a file name with for example umlauts (ü, ä ... ) into UTF8, or some other format that I can actually use it? Günther Using the utf8-string package to encode the file name string. e.g. x - readFile (encode ኃይሌ ገብረሥላሴ)

Re: [Haskell-cafe] Does ghc use Language.Haskell.*?

2008-12-09 Thread Brandon S. Allbery KF8NH
On 2008 Dec 9, at 20:21, Maurí cio wrote: Why can ghc read the program, but not the standard library parser? Does ghc use something else? Is it possible to use whatever ghc uses to build a prettyprinter? Language.Haskell is known to be incomplete. The haskell-src-exts package on

Re: [Haskell-cafe] File name encodings

2008-12-09 Thread Don Stewart
dons: redcom: Hi, how can I convert a file name with for example umlauts (ü, ä ... ) into UTF8, or some other format that I can actually use it? Günther Using the utf8-string package to encode the file name string. e.g. x - readFile (encode ኃይሌ ገብረሥላሴ)

Re: [Haskell-cafe] File name encodings

2008-12-09 Thread Don Stewart
Oh, perhaps you want to 'decode' the string that dirOpenDialog returns. redcom: Hi Don, must be doing something wrong. The messed up string originates from calling Graphics.UI.WX.dirOpenDialog and selecting a directory with Umlauts. The encode function doesn't seem to help here as

[Haskell-cafe] Haskell project proposals reddit

2008-12-09 Thread Don Stewart
I'd like to echo Jason's remarks earlier. http://www.reddit.com/r/haskell_proposals/ We've tried for a couple of years now to efficiently track 'wanted libraries' for the community, but never with much success. In particular, two approaches have been tried: * a wiki page * the

[Haskell-cafe] Re: Haskell project proposals reddit

2008-12-09 Thread Benjamin L . Russell
On Tue, 9 Dec 2008 20:34:20 -0800, Don Stewart [EMAIL PROTECTED] wrote: I'd like to echo Jason's remarks earlier. http://www.reddit.com/r/haskell_proposals/ We've tried for a couple of years now to efficiently track 'wanted libraries' for the community, but never with much success. In