Re: [Haskell-cafe] One-line haskell program with GHC

2008-01-19 Thread Sukit Tretriluxana
Thanks all. This really helps me a lot! On Jan 18, 2008 6:24 PM, Jonathan Cast <[EMAIL PROTECTED]> wrote: > On 18 Jan 2008, at 2:00 PM, Clifford Beshers wrote: > > 2008/1/18 Sukit Tretriluxana <[EMAIL PROTECTED]>: > > > Hi, > > > > I don't know if it's been asked before. I just wonder if GHC supp

Re: [Haskell-cafe] Basic binary IO

2008-01-19 Thread Don Stewart
jamie.love: > Hello all, > > I'm wondering if anyone has a reference to any binary IO and data > conversion tutorials. A good place to start looking is Data.Binary, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary > I'm playing around with generating a BMP file in haskel

Re: [Haskell-cafe] Basic binary IO

2008-01-19 Thread Brandon S. Allbery KF8NH
On Jan 20, 2008, at 2:26 , Jamie Love wrote: I'm wondering if anyone has a reference to any binary IO and data conversion tutorials. You want the binary package: http://hackage.haskell.org/cgi-bin/ hackage-scripts/package/binary-0.4.1 -- brandon s. allbery [solaris,freebsd,perl,pugs,hask

[Haskell-cafe] Basic binary IO

2008-01-19 Thread Jamie Love
Hello all, I'm wondering if anyone has a reference to any binary IO and data conversion tutorials. I'm playing around with generating a BMP file in haskell, and am a little stuck on the "best" way to go about the simple task of creating the BMP header. The header is "BM" + 4 bytes for file

Re: [Haskell-cafe] overlapping instance error -- need help using instance Monoid (Sum a) where a is a map of "money" values

2008-01-19 Thread David Menendez
On Jan 20, 2008 12:56 AM, Thomas Hartman <[EMAIL PROTECTED]> wrote: > The code below compiles as given, however if I uncomment the tSM > function I get the overlapping instance error mentioned in the subject > line. > > Can someone give me advice on how to do what I want to do? > > basically I wan

[Haskell-cafe] overlapping instance error -- need help using instance Monoid (Sum a) where a is a map of "money" values

2008-01-19 Thread Thomas Hartman
The code below compiles as given, however if I uncomment the tSM function I get the overlapping instance error mentioned in the subject line. Can someone give me advice on how to do what I want to do? basically I want to add, for example, (USD,1) and (USD,2) and (Euro,3) and get result fromList

Re: [Haskell-cafe] Re: 0/0 > 1 == False

2008-01-19 Thread Jonathan Cast
On 19 Jan 2008, at 2:52 AM, Kalman Noel wrote: Jonathan Cast wrote: On 12 Jan 2008, at 3:23 AM, Kalman Noel wrote: (2) lim a_n = ∞ [...] (2) means that the sequence does not converge, To a value in R. Again, inf is a perfectly well defined extended real number, and behaves like any

Re: [Haskell-cafe] Hangman game

2008-01-19 Thread Yitzchak Gale
Hi Ronald, Ronald Guida wrote: > I'm interested in learning how to program games. Since I have to start > somewhere, I decided to write a simple Hangman game. I'm wondering if > anyone can look at my code and give me some feedback. Lots of fun, thanks! And nicely written. One point is that whi

[Haskell-cafe] Re: Throwback of inferred types

2008-01-19 Thread Achim Schneider
"Peter Verswyvelen" <[EMAIL PROTECTED]> wrote: > The problem is that this only works when the complete source file > compiles correctly no? > ghc could just insert appropriate calls to error everywhere it can't compile, so you can choose whether to fix the bugs by lexical or operational ordering,

[Haskell-cafe] Hangman game

2008-01-19 Thread Ronald Guida
Hi, I'm interested in learning how to program games. Since I have to start somewhere, I decided to write a simple Hangman game. I'm wondering if anyone can look at my code and give me some feedback. Thank you. -- Hangman game module Main where import Data.Char import Data.List import Syst

Re: [Haskell-cafe] Throwback of inferred types

2008-01-19 Thread Jon Harrop
On Saturday 19 January 2008 18:11:13 Peter Verswyvelen wrote: > I would find it most useful to get type inference information on the fly, > even when not all of the code compiles correctly yet. Yes. Is this not provided by any development environments then? -- Dr Jon D Harrop, Flying Frog Consul

Re: [Haskell-cafe] Re: Re: Re: 0/0 > 1 == False

2008-01-19 Thread Kalman Noel
Ben Franksen wrote: > Kalman Noel wrote: > > Ben Franksen wrote: > >> Kalman Noel wrote: > >> > (2) means that the sequence does not converge, because you can > >> > always find a value that is /larger/ than what you hoped might > >> > be the limit. > >> Your definition of (2) i

Re: [Haskell-cafe] threads + IORefs = Segmentation fault?

2008-01-19 Thread Alfonso Acosta
On Jan 19, 2008 2:36 PM, David Roundy <[EMAIL PROTECTED]> wrote: > Using ghc 6.6, but I've since isolated the bug as being unrelated to the > IORefs and threading, it was in an FFI binding that somehow never died > until I was testing this new code. In case the you are creating a binding of haskel

Re: [Haskell-cafe] functional graphs

2008-01-19 Thread Benja Fallenstein
Hi, On Jan 19, 2008 6:05 PM, Thomas Hartman <[EMAIL PROTECTED]> wrote: > Do you just assume that every two nodes have an edge between them [...]? Since that's what "complete graph" means, I assume so =-) - Benja ___ Haskell-Cafe mailing list Haskell-Ca

Re: [Haskell-cafe] functional graphs

2008-01-19 Thread Benja Fallenstein
Hi Christian, On Jan 18, 2008 1:55 PM, Christian Maeder <[EMAIL PROTECTED]> wrote: > data CGraph a b = CGraph [a] (a -> a -> b) > > Can I define an instance for the fgl Graph class? > > I had no idea how to define empty (except using undefined). Well, presumably the function does not need to be d

RE: [Haskell-cafe] Throwback of inferred types

2008-01-19 Thread Peter Verswyvelen
The problem is that this only works when the complete source file compiles correctly no? I would find it most useful to get type inference information on the fly, even when not all of the code compiles correctly yet. > -Original Message- > From: [EMAIL PROTECTED] [mailto:haskell-cafe- > [

[Haskell-cafe] Re: Re: Re: 0/0 > 1 == False

2008-01-19 Thread Ben Franksen
Kalman Noel wrote: > Ben Franksen wrote: >> Kalman Noel wrote: >> > (2) lim a_n = ∞ > [...] >> > (2) means that the sequence does not converge, because you can >> > always find a value that is /larger/ than what you hoped might >> > be the limit. >> >> (2) usually rather me

RE: [Haskell-cafe] Throwback of inferred types

2008-01-19 Thread Peter Verswyvelen
Visual Haskell does that, but IMHO not as good as the F# plugin for Visual Studio. Currently I just use Emacs and Haskell Mode and the ":t" command, but this only works for top level functions (is this correct? Maybe some syntax exists to refer to an inner function?), so yeah, it would be really h

Re: [Haskell-cafe] Throwback of inferred types

2008-01-19 Thread gwern0
On 2008.01.19 17:30:50 +, Jon Harrop <[EMAIL PROTECTED]> scribbled 0.2K characters: > > Is it possible to get throwback of inferred types into Emacs or an IDE for > Haskell? > > -- > Dr Jon D Harrop, Flying Frog Consultancy Ltd. Sure. I once hacked together quite a while ago a little function

Re: [Haskell-cafe] First go at reactive programming

2008-01-19 Thread gwern0
On 2008.01.19 12:22:43 -0500, Steve Lihn <[EMAIL PROTECTED]> scribbled 1.5K characters: ... > I am asking this question in another thread. The problem is -- I've > got many modules compiled under 6.6, some with much agony. If I switch > to 6.8, I have to recompile them again. Two issues I image: >

[Haskell-cafe] Throwback of inferred types

2008-01-19 Thread Jon Harrop
Is it possible to get throwback of inferred types into Emacs or an IDE for Haskell? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] First go at reactive programming

2008-01-19 Thread Steve Lihn
> -- | @'forever' act@ repeats the action infinitely. > forever :: (Monad m) => m a -> m () > forever a = a >> forever a Great. The code compiled successfully by inserting this in various places. > I'm wondering how hard to try to get these libs to work with both 6.6 and > 6.8. My hope has

[Haskell-cafe] functional graphs

2008-01-19 Thread Thomas Hartman
I don't get where the graph edges (Node,Node) are specified. Do you just assume that every two nodes have an edge between them and calculate the edge label from the function? Also, is there a real world / motivating use for a graph defined this way? thomas. 2008/1/18, Christian Maeder <[EMAIL P

Re: [Haskell-cafe] Haskell-Support in Ohloh

2008-01-19 Thread Jeremy Apthorp
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 20/01/2008, Reinier Lamers wrote: > > Op 17-jan-2008, om 1:21 heeft Joachim Breitner het volgende geschreven: > > > > They explicitly write that they want haskell support, and the oldest > > open bug report on their page is about this: > > > > http

Re: [Haskell-cafe] First go at reactive programming

2008-01-19 Thread Conal Elliott
Thanks for the TypeCompose>=0.3 tip. I've fixed my local Reactive.cabal and will push at some point. Oh yeay -- I'd forgotten about the "deriving" change in 6.8 vs 6.6. Urg. I didn't realize that 'forever' isn't in 6.2. You can use the 6.8def: -- | @'forever' act@ repeats the action infinitely

Re: [Haskell-cafe] How best to make GHC 6.6 and 6.8 co-exist on one server/account

2008-01-19 Thread Duncan Coutts
On Sat, 2008-01-19 at 10:47 -0500, Steve Lihn wrote: > Hi, > It appears some of the latest hackages are moving towards 6.8 to take > advantage of the new features, while quite a few remains at 6.6. The > compatibility between the two versions has been problematic. I only > have 6.6 installed, but

Re: [Haskell-cafe] Re: need help for cabal-install

2008-01-19 Thread Duncan Coutts
On Sat, 2008-01-19 at 09:27 -0500, Steve Lihn wrote: > On Jan 19, 2008 9:18 AM, Duncan Coutts <[EMAIL PROTECTED]> wrote: > > > > > > > > I think you're just missing a "--user": > > > > > >$ cabal install --prefix=$HOME --user foo > > > > The prefix can also be set in the $HOME/.cabal/config fi

Re: [Haskell-cafe] Re: need help for cabal-install

2008-01-19 Thread Duncan Coutts
On Sat, 2008-01-19 at 09:30 -0500, Steve Lihn wrote: > Just tried to test drive another feature and got the nasty error: > > > cabal list > Stack space overflow: current size 8388608 bytes. > Use `+RTS -Ksize' to increase it. Oops, silly error on my part. darcs pull and it's fixed. Duncan

[Haskell-cafe] How best to make GHC 6.6 and 6.8 co-exist on one server/account

2008-01-19 Thread Steve Lihn
Hi, It appears some of the latest hackages are moving towards 6.8 to take advantage of the new features, while quite a few remains at 6.6. The compatibility between the two versions has been problematic. I only have 6.6 installed, but now thinking to add 6.8 to my account (so I can switch between t

Re: [Haskell-cafe] shootout using 6.6?

2008-01-19 Thread Richard Kelsall
Don Stewart wrote: ... Yay, constructor specialisation! http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&lang=all And it's nice to see GHC 6.8.2 is now nearly ten times faster than GCC for this benchmark : http://shootout.alioth.debian.org/gp4/benchmark.php?test=thre

Re: [Haskell-cafe] Re: need help for cabal-install

2008-01-19 Thread Steve Lihn
Just tried to test drive another feature and got the nasty error: > cabal list Stack space overflow: current size 8388608 bytes. Use `+RTS -Ksize' to increase it. On Jan 19, 2008 9:27 AM, Steve Lihn <[EMAIL PROTECTED]> wrote: > On Jan 19, 2008 9:18 AM, Duncan Coutts <[EMAIL PROTECTED]> wrote: >

Re: [Haskell-cafe] Re: need help for cabal-install

2008-01-19 Thread Steve Lihn
On Jan 19, 2008 9:18 AM, Duncan Coutts <[EMAIL PROTECTED]> wrote: > > > > > I think you're just missing a "--user": > > > >$ cabal install --prefix=$HOME --user foo > > The prefix can also be set in the $HOME/.cabal/config file. > Syntax? Something like: prefix: /path/to/my/ghc ? > BTW, In th

Re: [Haskell-cafe] Re: need help for cabal-install

2008-01-19 Thread Duncan Coutts
On Fri, 2008-01-18 at 23:44 -0500, Chris Ball wrote: > Hi Steve, > >> Now with "cabal install", I can not figure out where to specify the >> --prefix. Cabal always complains "failed to install package". > > I think you're just missing a "--user": > >$ cabal install --prefix=$HOME --

Re: [Haskell-cafe] First go at reactive programming

2008-01-19 Thread Steve Lihn
Reactive-0.3 seems to have a dependency on TypeCompose-0.3. Earlier version does not work (for lack of Data.Pair). This probably should be specified in Cabal file. I aslo fixed all the LANGUAGE problems and now encountered the following error in TypeCompose: [4 of 9] Compiling Control.Compose (

Re: [Haskell-cafe] Haskell-Support in Ohloh

2008-01-19 Thread Reinier Lamers
Op 17-jan-2008, om 1:21 heeft Joachim Breitner het volgende geschreven: They explicitly write that they want haskell support, and the oldest open bug report on their page is about this: http://labs.ohloh.net/ohcount/ticket/205 So if anyone feels like programming some ruby (I guess they want i

Re: [Haskell-cafe] threads + IORefs = Segmentation fault?

2008-01-19 Thread Lennart Augustsson
You should use an MVar if you want it to be thread safe. On Jan 19, 2008 1:36 PM, David Roundy <[EMAIL PROTECTED]> wrote: > Using ghc 6.6, but I've since isolated the bug as being unrelated to the > IORefs and threading, it was in an FFI binding that somehow never died > until I was testing this

Re: [Haskell-cafe] threads + IORefs = Segmentation fault?

2008-01-19 Thread David Roundy
Using ghc 6.6, but I've since isolated the bug as being unrelated to the IORefs and threading, it was in an FFI binding that somehow never died until I was testing this new code. David On Sat, Jan 19, 2008 at 01:27:47PM +0100, Peter Verswyvelen wrote: > Hi David, > > Which version of GHC are you

[Haskell-cafe] Re: threads + IORefs = Segmentation fault?

2008-01-19 Thread Achim Schneider
David Roundy <[EMAIL PROTECTED]> wrote: > {-# NOINLINE _progressData #-} > _progressData :: IORef (Map String ProgressData) > _progressData = unsafePerformIO $ newIORef empty > > updateProgressData :: String > -> (ProgressData -> ProgressData) > -> IO () > updateProgressData k f = w

Re: [Haskell-cafe] threads + IORefs = Segmentation fault?

2008-01-19 Thread Peter Verswyvelen
Hi David, Which version of GHC are you using? I tried to recompile some GHC 6.6.1 progs using GHC 6.8.2 and I also got segfaults. I haven't figured out yet if this is because my changes to make it work with GHC 6.8.2 are incorrect, or if this is an issue with 6.8.2. Cheers, Peter On Fri, 2008-

Re: [Haskell-cafe] Re: Re: 0/0 > 1 == False

2008-01-19 Thread Kalman Noel
Ben Franksen wrote: > Kalman Noel wrote: > > (2) lim a_n = ∞ [...] > > (2) means that the sequence does not converge, because you can > > always find a value that is /larger/ than what you hoped might > > be the limit. > > (2) usually rather mean that for each positive limi