[Haskell-cafe] Cabal + yi + alex problem.

2008-07-30 Thread Yann Golanski
I cannot seem to be able to install yi via cabal install.  The error I
get is as follows.  I suspect alex is not installed in the correct
place.  

; sudo cabal install yi
Resolving dependencies...
Downloading yi-0.4.3...
Configuring yi-0.4.3...
cabal: alex version =2.0.1  3 is required but it could not be found.
cabal: Error: some packages failed to install:
yi-0.4.3 failed during the configure step. The exception was:
exit: ExitFailure 1
; sudo cabal install alex
Resolving dependencies...
Downloading alex-2.2...
[1 of 1] Compiling Main ( Setup.lhs, dist/setup/Main.o )
Linking dist/setup/setup ...
Warning: defaultUserHooks in Setup script is deprecated.
Configuring alex-2.2...
Warning: No 'build-type' specified. If you do not need a custom Setup.hs
or
./configure script then use 'build-type: Simple'.
Preprocessing executables for alex-2.2...
Building alex-2.2...
[...]
Linking dist/build/alex/alex ...
Installing: /home/yann/.cabal/bin
; sudo cabal install yi
Resolving dependencies...
'yi-0.4.3' is cached.
Configuring yi-0.4.3...
cabal: alex version =2.0.1  3 is required but it could not be found.
cabal: Error: some packages failed to install:
yi-0.4.3 failed during the configure step. The exception was:
exit: ExitFailure 1


-- 
[EMAIL PROTECTED] -= H+ =- www.kierun.org
   PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318


pgpKLe5vZlfvS.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal + yi + alex problem.

2008-07-30 Thread Yann Golanski
Quoth Austin Seipp on Wed, Jul 30, 2008 at 03:45:49 -0500
 Excerpts from Yann Golanski's message of Wed Jul 30 02:34:05 -0500 2008:
  I cannot seem to be able to install yi via cabal install.  The error I
  get is as follows.  I suspect alex is not installed in the correct
  place.  
  ...
 
 Hi,
 
 cabal-install will put installed binaries in $HOME/.cabal/bin by
 default as far as I can tell, you should move the binary somewhere in
 your $PATH if you want cabal-install to pick it up for installing yi.

Well, that indeed sorted that one.  But still no luck:

; sudo cabal install yi
Resolving dependencies...
'yi-0.4.3' is cached.
Configuring yi-0.4.3...
Preprocessing library yi-0.4.3...
Preprocessing executables for yi-0.4.3...
Building yi-0.4.3...

Yi/UI/Vty.hs:42:7:
Could not find module `Graphics.Vty':
  Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
yi-0.4.3 failed during the building phase. The exception was:
exit: ExitFailure 1

-- 
[EMAIL PROTECTED] -= H+ =- www.kierun.org
   PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318


pgpPeH72jqpSQ.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal + yi + alex problem.

2008-07-30 Thread Yann Golanski
Quoth Nicolas Pouillard on Wed, Jul 30, 2008 at 11:06:43 +0200
 Excerpts from Yann Golanski's message of Wed Jul 30 10:59:35 +0200 2008:
  ; sudo cabal install yi
  Resolving dependencies...
  'yi-0.4.3' is cached.
  Configuring yi-0.4.3...
  Preprocessing library yi-0.4.3...
  Preprocessing executables for yi-0.4.3...
  Building yi-0.4.3...
  
  Yi/UI/Vty.hs:42:7:
  Could not find module `Graphics.Vty':
Use -v to see a list of the files searched for.
  cabal: Error: some packages failed to install:
  yi-0.4.3 failed during the building phase. The exception was:
  exit: ExitFailure 1
  
 
 Can you try the vty flag:
 
 $ sudo cabal install yi -fvty

Sadly, I get the same error as before.

What debugging output would you need?

-- 
[EMAIL PROTECTED] -= H+ =- www.kierun.org
   PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318


pgpIbgGSwobZH.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Rotating backdrop (aka learning Haskell)

2008-06-03 Thread Yann Golanski
First version is available at:
  http://www.kierun.org/backdropper-1.0.tbz2
It is minimal but does the trick of randomly rotating backgrounds.

Features to add are only rotate during work hours, making sure that all
images are shown within a day and a nice GUI. 

Criticism welcome.

-- 
[EMAIL PROTECTED] -= H+ =- www.kierun.org
   PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318


pgp1DQpdVc35O.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Images and GUIs in Haskell

2008-06-02 Thread Yann Golanski
Quoth Achim Schneider on Sun, Jun 01, 2008 at 04:09:10 +0200
 I would go for GL(U(T)), as it's as good for 2d primitives as SDL will
 ever be, has excellent cross-platform support and allows you to go 3d
 if you want to. There's also some very decent event handling.

You can use R as well. http://www.r-project.org/

-- 
[EMAIL PROTECTED] -= H+ =- www.kierun.org
   PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318


pgpUxe2kMb6IX.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What's NaN?

2008-05-28 Thread Yann Golanski
Quoth PR Stanley on Wed, May 28, 2008 at 08:04:44 +0100
 Hello
 Why does sqrt (-16) return NaN? What is NaN?

NaN stands for Not a Number. 

See the complex library for how to have complex numbers.

-- 
[EMAIL PROTECTED] -= H+ =- www.kierun.org
   PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318


pgpzsKbaJOQdu.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Rotating backdrop (aka learning Haskell)

2008-05-21 Thread Yann Golanski
Quoth Derek Elkins on Tue, May 20, 2008 at 11:45:57 -0500
 On Tue, 2008-05-20 at 10:55 +0200, Ketil Malde wrote:
  Yann Golanski [EMAIL PROTECTED] writes:
  
   1- Get a list out of a file:  I managed to do that using the following:
  
   parseImageFile :: FilePath - IO [String]
   parseImageFile file = do inpStr - readFile file
return $ filter (/=) (breaks (=='\n') inpStr)
  
   Nice, simple and I understand what it is doing.  
  
  Can be improved:
  
breaks (=='\n') == lines  -- easier to read, no?
filter (/=) == filter (not . null)  -- more polymorphic, not important 
  here
do x - expr1==  expr1 = return . expr2 
   return $ expr2 x  -- i.e. readFile f = return . filter 
  (not.null) . lines
 
 do x - expr1; return $ expr2 x 
 == expr1 = return . expr2
 == liftM expr2 expr1 -- or fmap (a.k.a. $) if you like
 
 So,
 liftM (filter (not . null) . lines) readFile
 alternatively,
 filter (not . null) . lines $ readFile

I'm sorry, this is a little beyond me.  Could you elaborate a little
more on what this actually does?

-- 
[EMAIL PROTECTED] -= H+ =- www.kierun.org
   PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318


pgpRApk90uNyx.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Rotating backdrop (aka learning Haskell)

2008-05-20 Thread Yann Golanski
To help me learn Haskell, I decided on a simple (AH!) problem: given a
list of images, display a random one as my desktop backdrop.  After some
time, change the image.  Simple?  

What I actually want to do is a little more specific: Read a list of
images (one per line) from a file.  Given that a working day is about 8
hours, I want to see all the images during the day.  So, the time
between changes should be (nbr_of_images) / (8 * 60 * 60) seconds.  Of
course, if the file changes (I add or remove any number of images) this
need to change and be recalculated.  Clearly, I want some interaction
with a pseudo-random number generator.

Because this is a learning exercise, I want to have a pretty GUI for
this.  Three buttons: Exit (which quits the application), Reset
(re-reads the file whether it changed or not) and Next (display the next
image).  Then I want a counter and a progress bar telling me when the
next change will occur. 

1- Get a list out of a file:  I managed to do that using the following:

parseImageFile :: FilePath - IO [String]
parseImageFile file = do inpStr - readFile file
 return $ filter (/=) (breaks (=='\n') inpStr)

Nice, simple and I understand what it is doing.  

2- Get a random element from a list and remove it:  Okay, this I
understand less well.  I looked at the solutions of problems 23 and 20
in http://www.haskell.org/haskellwiki/99_questions so there is a
skeleton there.   However, my list is IO [String] Hum, monads.

Any pointers as to how to do that?

3- Wait and do something later How, I have no idea how to do that!
Help?

4- I guess that progress bars and updating text will be somewhere in the
GUI (I chose wxHaskell)...  Again, no idea where.

5- How do you call an external program in Haskell?  Either xv or
Esetroot will do the job of displaying the image.  Is there a Haskell
native way to do that?

Once this is done and I have commented to the code, I will be happy to
put it onto the wiki as a teaching aid.

Thanks.

-- 
[EMAIL PROTECTED] -= H+ =- www.kierun.org
   PGP:   009D 7287 C4A7 FD4F 1680  06E4 F751 7006 9DE2 6318


pgpKXqHHbxvtL.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe