Re: [Haskell-cafe] Project Euler: request for comments

2011-08-27 Thread Daniel Fischer
On Saturday 27 August 2011, 02:34:24, Oscar Picasso wrote: > Hi, > > I order to improve my Haskell skills I started (again) to solve the > project euler problems with this language. > I am now at problem 11 and would really appreciate any comment about > my code in order to make it more elegant or

Re: [Haskell-cafe] bitSize

2011-08-27 Thread Andrew Coppin
On 26/08/2011 10:51 PM, Steve Schafer wrote: On Fri, 26 Aug 2011 20:30:02 +0100, you wrote: You wouldn't want to know how many bits you need to store on disk to reliably recreate the value? I can't say that I have cared about that sort of thing in a very long time. Bits are rather cheap these

Re: [Haskell-cafe] Project Euler: request for comments

2011-08-27 Thread Oscar Picasso
Daniel, There are included as gists on the link provided. After your remark, I looked at the generated html code in my blog. The gists are actually displayed by running a javascript. Maybe your browser settings don't allow to display them. If so, you can also look directly at the gists: pb 01: ht

Re: [Haskell-cafe] Project Euler: request for comments

2011-08-27 Thread Daniel Fischer
On Saturday 27 August 2011, 16:03:46, Oscar Picasso wrote: > Daniel, > > There are included as gists on the link provided. After your remark, I > looked at the generated html code in my blog. The gists are actually > displayed by running a javascript. > Maybe your browser settings don't allow to d

Re: [Haskell-cafe] Project Euler: request for comments

2011-08-27 Thread Oscar Picasso
Daniel, Thank you very much for your comments, there are very useful, indeed. As a side note, my domain name is not oscarpicasso.com. It was already taken by someone else so I decided to use opicasso.com Oscar On Sat, Aug 27, 2011 at 11:05 AM, Daniel Fischer wrote: > On Saturday 27 August 2011,

Re: [Haskell-cafe] Project Euler: request for comments

2011-08-27 Thread Daniel Fischer
On Saturday 27 August 2011, 17:31:41, Oscar Picasso wrote: > As a side note, my domain name is not oscarpicasso.com. It was already > taken by someone else so I decided to use opicasso.com Oh, yeah, it was that I allowed, misremembered the domain name.

Re: [Haskell-cafe] bitSize

2011-08-27 Thread Steve Schafer
On Sat, 27 Aug 2011 11:57:57 +0100, you wrote: >I meant if you're trying to *implement* serialisation. The Bits class >allows you to access bits one by one, but surely you'd want some way to >know how many bits you need to keep? For fixed-size types (e.g., Int), I might use a simple byte-for-by

[Haskell-cafe] HJavaScript: representing build-in global function.

2011-08-27 Thread Станислав Черничкин
Hi Cafe! Does someone know how to represent js build-in global function (such as parseInt(), parseFloat(), eval()) with HJavaScript? Perhaps JConst: JCall (JConst "parseInt") (JString "123")? -- Sincerely, Stanislav Chernichkin. ___ Haskell-Cafe mailin

Re: [Haskell-cafe] Ambiguous module name `System.Directory'

2011-08-27 Thread Michael Snoyman
One other solution on this one: upgrade system-fileio. The newest version does not contain any conflicting names. As a side point, system-fileio (and system-filepath, which it depends upon) are both excellent packages, I use them all the time at work. Michael On Sat, Aug 27, 2011 at 12:44 AM, Al

[Haskell-cafe] Modules and a main function

2011-08-27 Thread michael rice
W/r/t the code below, would somebody please explain the sense of having a main function in a module that is not named Main.hs? Michael From: http://www.haskell.org/haskellwiki/State_Monad module StateGame where   import Control.Monad.State   -- Example use of State monad -- Passes

Re: [Haskell-cafe] Modules and a main function

2011-08-27 Thread Brandon Allbery
On Sat, Aug 27, 2011 at 15:31, michael rice wrote: > W/r/t the code below, would somebody please explain the sense of having a > main function in a module that is not named Main.hs? > It's embedded test code; you can build a test program for the StateGame monad by using the --main-is parameter t

Re: [Haskell-cafe] bitSize

2011-08-27 Thread Brandon Allbery
On Sat, Aug 27, 2011 at 06:57, Andrew Coppin wrote: > On 26/08/2011 10:51 PM, Steve Schafer wrote: > >> On Fri, 26 Aug 2011 20:30:02 +0100, you wrote: >> >>> You wouldn't want to know how many bits you need to store on disk to >>> reliably recreate the value? >>> >> >> I can't say that I have care

Re: [Haskell-cafe] Modules and a main function

2011-08-27 Thread michael rice
I'm not sure how to do that. Please demonstrate. Michael From: Brandon Allbery To: michael rice Cc: "haskell-cafe@haskell.org" Sent: Saturday, August 27, 2011 3:53 PM Subject: Re: [Haskell-cafe] Modules and a main function On Sat, Aug 27, 2011 at 15:31, mich

Re: [Haskell-cafe] Modules and a main function

2011-08-27 Thread Brandon Allbery
On Sat, Aug 27, 2011 at 16:24, michael rice wrote: > I'm not sure how to do that. Please demonstrate. > If you just compile it normally you have an unexported binding called "main" which is effectively (and actually, when compiled with optimization) discarded. If you do ghc --make --main-i

Re: [Haskell-cafe] Modules and a main function

2011-08-27 Thread Daniel Fischer
On Saturday 27 August 2011, 22:24:03, michael rice wrote: > I'm not sure how to do that. Please demonstrate. > > Michael ghc -O -main-is StateGame --make StateGame more generally, ghc -O -main-is Foo.bar --make Foo if the desired main is function bar in module Foo. ___

Re: [Haskell-cafe] Modules and a main function

2011-08-27 Thread michael rice
Thanks all. I was trying to use --main-is. I even man-ed ghc and thought I saw a double dash there. As they say, believing is seeing. Michael From: Daniel Fischer To: haskell-cafe@haskell.org; michael rice Sent: Saturday, August 27, 2011 4:39 PM Subject: Re:

[Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-27 Thread aditya siram
Hi all, I would like for the GHCI interpreter to save its environment before reloading a file and allowed the user to revert back to that state if the compilation was unsuccessful. Many times I've changed files, loaded them, hit a compilation error and needed, for example, the inferred type signat

Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-27 Thread David Virebayre
2011/8/27 aditya siram : > Hi all, > I would like for the GHCI interpreter to save its environment before > reloading a file and allowed the user to revert back to that state if the > compilation was unsuccessful. That would be awesome. I would like this too. David. _

Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-27 Thread Daniel Fischer
On Saturday 27 August 2011, 23:10:17, David Virebayre wrote: > 2011/8/27 aditya siram : > > Hi all, > > I would like for the GHCI interpreter to save its environment before > > reloading a file and allowed the user to revert back to that state if > > the compilation was unsuccessful. > > That woul

Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-27 Thread Daniel Patterson
That doesn't look very promising :( On Aug 27, 2011, at 5:31 PM, Daniel Fischer wrote: > On Saturday 27 August 2011, 23:10:17, David Virebayre wrote: >> 2011/8/27 aditya siram : >>> Hi all, >>> I would like for the GHCI interpreter to save its environment before >>> reloading a file and allowed t

Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-27 Thread aditya siram
http://www.youtube.com/watch?v=Y_exermAXkU&t=0m6s -deech On Sat, Aug 27, 2011 at 4:56 PM, Daniel Patterson wrote: > That doesn't look very promising :( > > On Aug 27, 2011, at 5:31 PM, Daniel Fischer wrote: > > > On Saturday 27 August 2011, 23:10:17, David Virebayre wrote: > >> 2011/8/27 aditya

Re: [Haskell-cafe] Project Euler: request for comments

2011-08-27 Thread KC
Think of the simplest version of the problem that isn't totally trivial. e.g. A one dimensional list of numbers. What would you do? Note: you only want to touch each element once. The 2 dimensional case could be handled by putting into lists: rows, columns, major diagonals, and minor diagonals.

[Haskell-cafe] GHC API question

2011-08-27 Thread Chris Smith
I'm using the GHC API in GHC 7.2, and running into some problems. For background, I have working code that uses compileExpr to get a value from a dynamically loaded module. However, I'd like to do some profiling, and it appears that compileExpr doesn't work from executables that are built with pr

Re: [Haskell-cafe] Ambiguous module name `System.Directory'

2011-08-27 Thread informationen
Thanks, that's a good idea. One other solution on this one: upgrade system-fileio. The newest version does not contain any conflicting names. As a side point, system-fileio (and system-filepath, which it depends upon) are both excellent packages, I use them all the time at work. Michael On Sa