Re: [Haskell-cafe] Tetris

2007-11-20 Thread Jules Bean

Andrew Coppin wrote:
GLUT and GLX will also work, and at least the former has a Haskell 
binding.
  


As far as I'm aware, GLUT isn't available for Windows. (Or rather, I 
tried it once, and it wasn't happy at all. And after some Google 
searching, I found it's not around any more.)


As far as I'm aware, all GL implementations come with a GLUT implementation.

It doesn't give you a very sophisticated UI - hardly anything beyond the 
ability to open new windows - but it does work, it's simple, and it's 
cross platform.


Jules
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] SingHaskell 2007, November 28 2007

2007-11-20 Thread Don Stewart
Tom.Schrijvers:
> 
> We're pleased to invite you to SingHaskell:
> 
> What is SingHaskell?
> 
> Sing(apore)Haskell is a Haskell (and related languages) meeting in 
> Singapore. The meeting is organized by Tom Schrijvers and Martin Sulzmann 
> and will be hosted by the National University of Singapore.
> 
> Date and location
> 
> Sing(apore)Haskell takes place on Wed 28 Nov 2007 (right before APLAS'07 
> http://flint.cs.yale.edu/aplas2007/). The meeting will be held somewhere 
> on the National University of Singapore campus (details will follow 
> shortly).
> 
> Let Tom or Martin know if you are interested in coming. Either to attend 
> the meeting or even give a talk.
> 
> For more information and tentaive talks:
> http://taichi.ddns.comp.nus.edu.sg/taichiwiki/SingHaskell2007
> 
> Best regards,
> 
> Martin Sulzmann and Tom Schrijvers

Awesome! Now visible from haskell.org's front page, and the user groups
collection.

http://haskell.org/haskellwiki/User_groups

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] SingHaskell 2007, November 28 2007

2007-11-20 Thread Tom Schrijvers


We're pleased to invite you to SingHaskell:

What is SingHaskell?

Sing(apore)Haskell is a Haskell (and related languages) meeting in 
Singapore. The meeting is organized by Tom Schrijvers and Martin Sulzmann 
and will be hosted by the National University of Singapore.


Date and location

Sing(apore)Haskell takes place on Wed 28 Nov 2007 (right before APLAS'07 
http://flint.cs.yale.edu/aplas2007/). The meeting will be held somewhere 
on the National University of Singapore campus (details will follow 
shortly).


Let Tom or Martin know if you are interested in coming. Either to attend 
the meeting or even give a talk.


For more information and tentaive talks:
http://taichi.ddns.comp.nus.edu.sg/taichiwiki/SingHaskell2007

Best regards,

Martin Sulzmann and Tom Schrijvers

--
Tom Schrijvers

Department of Computer Science
K.U. Leuven
Celestijnenlaan 200A
B-3001 Heverlee
Belgium

tel: +32 16 327544
e-mail: [EMAIL PROTECTED]
url: http://www.cs.kuleuven.be/~toms/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskell] recursive deriving

2007-11-20 Thread Don Stewart
duncan.coutts:
> On Tue, 2007-11-20 at 19:18 -0500, Alex Jacobson wrote:
> > When you want automated deriving of show/read etc., you need all the 
> > components of your type also to be instances of show/read but you won't 
> > want to *require* them to be automatically generated verions.
> > 
> > Standalone deriving does the wrong thing here.  Standalone deriving 
> > should not cause an overlapping instance error if someone derives an 
> > instance manually.  Instead, the manually derived instance should be 
> > treated as more specific and win out.
> > 
> > The other part of this problem is that you can't do automatic recursive 
> > deriving and this results in a ridiculous amount of boilerplate.  I know 
> > some people have a theory that they want to avoid accidentally creating 
> > instances for things that shouldn't have them, but the solution to that 
> > is probably to add some declaration for types that prohibits automatic 
> > deriving for those types.  The 99% case is that automatic deriving is ok.
> > 
> > Proposed syntax:
> > 
> >derive instance Show T recursively
> >data T = T no-deriving (Ord,Eq)
> 
> I would expect that if the data constructor for T is not exported then
> standalone deriving should not work. However this appears not to be the
> case which breaks module abstraction.
> 
> Foo.hs:
> module Foo ( T, t ) where
> data T = T
> t = T
> 
> Bar.hs:
> import Foo
> deriving instance Eq T
> 
> $ ghci Bar.hs -XStandaloneDeriving
> [1 of 2] Compiling Bar  ( Bar.hs, interpreted )
> [2 of 2] Compiling Main ( Baz.hs, interpreted )
> Ok, modules loaded: Bar, Main.
> *Main> t == t
> True
> 
> You could write that Eq instance by hand since they do not have access
> to the T constructor, then StandaloneDeriving should not be able to so
> either. I think it's a design flaw in standalone deriving.
> 
> Does anyone else agree? Should we file a bug report?

Yes, this seems wrong.

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How to abort a computation within Continuation Monad?

2007-11-20 Thread Derek Elkins
On Tue, 2007-11-20 at 13:22 +0200, Gleb Alexeyev wrote:
> Dimitry Golubovsky wrote:
> 
> > If I have
> > 
> > callCC $ \exit -> do
> >   foo
> > ...
> > 
> > I cannot jump to `exit' from within foo unless `exit' is given to foo
> > as an argument.
> > 
>   As Derek Elkins has written, one of the options is to use delimited 
> continuations, see 
> http://research.microsoft.com/~simonpj/papers/control/ for Haskell 
> implementation.

I made no such suggestion.

I simply suggested using instead of
callCC f = Cont (\k -> runCont (f (\a -> Cont $ \_ -> k a)) k)
with 
control f = Cont (\k -> runCont (f (\a -> Cont $ \_ -> k a)) id)

abort is then simply 
abort = control . const . return

callCC is obviously just 
callCC f = control (\k -> f k >>= k)

If you didn't want to "break abstraction" like this, you can implement
this in terms of just callCC awkwardly.  To do so requires having a
top-level continuation and is exactly what is below.

The above and below is (part of) why I prefer control.

> 
> But in this case Cont may be enough. If you don't like passing `exit' 
> explicitly, you can put in into Reader monad. This is the idea:
> 
> 
> import Control.Monad.Cont
> import Control.Monad.Reader
> 
> type Abortable r a = ReaderT (r -> Cont r r) (Cont r) a
> 
> runAbortable :: Abortable a a -> a
> runAbortable m = runCont (callCC $ \exit -> runReaderT m exit) id
> 
> abort :: r -> Abortable r a
> abort x = do
>exit <- ask
>lift (exit x)
>undefined -- this hack is needed to make abort polymorphic
> 
> test a b c = do
>x <- if a then abort "a" else return 1
>y <- if b then abort "b" else return False
>z <- foo c   -- calling foo without explicit abort continuation
>return $ show (x, y, z)
>where foo True = abort "c"
>  foo False = return 5.39
> 
> run m = putStrLn (runAbortable m)
> 
> main = do run (test False False False)
>run (test False False True)
>run (test False True False)
>run (test True False False)
> 
> --
> 
> This implementation is a bit hackish, since it uses undefined to make 
> abort polymorphic in return type. You can use rank-2 types to avoid it, 
> see http://www.vex.net/~trebla/tmp/ContMonad.lhs by Albert C. Lai.
> 
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best way to format a number

2007-11-20 Thread Shachaf Ben-Kiki
On Nov 20, 2007 7:07 PM, Don Stewart <[EMAIL PROTECTED]> wrote:
> You can work around it for now with:
>
> Prelude Text.Printf> printf "%02d\n" 3 >> return ()
> 03

It may be simpler to specify the type explicitly:

Prelude Text.Printf> printf "%02d\n" 3 :: IO ()
03

Shachaf
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best way to format a number

2007-11-20 Thread Don Stewart
briqueabraque:
> Hi,
> 
> I would like to get a string for a number
> using always 2 digits (i.e., 75 would be
> "75", 3 would became "03"). What is the
> best way to do that? I tried
> 
> printf "%02d\n" 3
> 
> which gives me the correct string, but
> ghci always ends that call with a
> 
> *** Exception: Prelude.undefined
> 
> message. What else should I try? Can
> Text.PrettyPrint do that?
> 

It's to do with ghci's defaulting. This is fixed in ghc 6.8:

Prelude Text.Printf> printf "%02d\n" 3
03

You can work around it for now with:

Prelude Text.Printf> printf "%02d\n" 3 >> return ()  
03

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Best way to format a number

2007-11-20 Thread Maurí­cio

Hi,

I would like to get a string for a number
using always 2 digits (i.e., 75 would be
"75", 3 would became "03"). What is the
best way to do that? I tried

printf "%02d\n" 3

which gives me the correct string, but
ghci always ends that call with a

*** Exception: Prelude.undefined

message. What else should I try? Can
Text.PrettyPrint do that?

Thanks,
Maurício

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Conal Elliott
Moreover, functional programming makes it easy to have much more state than
imperative programming, namely state over *continuous* time.  The temporally
discrete time imposed by the imperative model is pretty puny in comparison.
Continuous (or "resolution-independent") time has the same advantages as
continuous space: resource-adaptive, scalable, transformable.

On Nov 20, 2007 4:11 PM, Lennart Augustsson <[EMAIL PROTECTED]> wrote:

> I implemented Tetris in LML long before Haskell existed.
> It was text based, but looked good with a custom font. :)
>
> Haskell has no problem with state, it's just explicit.
>
>   -- Lennart
>
> On Nov 19, 2007 9:25 PM, Andrew Coppin <[EMAIL PROTECTED]>
> wrote:
>
> > If you were going to implement Tetris in Haskell, how would you do it?
> >
> > (For that matter, has anybody already *done* it? It would probably make
> > a nice example program...)
> >
> > I'm particularly interested to know
> >
> > 1. How exactly would you do the graphical components? (Presumably
> > there's some deep trickery with Gtk2hs that can draw free-form stuff
> > like this.)
> >
> > 2. How do you implement a program that is fundamentally about state
> > mutation in a programming language which abhors state mutation?
> >
> > ___
> > Haskell-Cafe mailing list
> > Haskell-Cafe@haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Tetris

2007-11-20 Thread Gwern Branwen
On Nov 20, 2007 4:14 PM, Radosław Grzanka <[EMAIL PROTECTED]> wrote:
> 2007/11/20, Gwern Branwen <[EMAIL PROTECTED]>:
>
> > On Nov 20, 2007 10:41 AM, nick ralabate <[EMAIL PROTECTED]> wrote:
> > > Speaking of Tetris and Space Invaders, you might be interested in this 
> > > project:
> > >
> > > http://www.geocities.jp/takascience/haskell/monadius_en.html
> > >
> > > It's a clone of Gradius written in Haskell.
> > >
> > >
> > > -Nick
> >
> > It's a fun enough game under Wine, but has anyone managed to get it to
> > compile under Linux? I tried but couldn't, and the associated makefile
> > seems to be very Windows-specific.
>
> I have prepare quick patch that removes audio from Monadius so it
> compiles on Linux and is playable (this is quick and dirty patch).
>
> Cheers,
>
>   Radek.

That patch works fine for me. I am actually very grateful you sent
that because I had just started trying to do the same thing. :)

It's a pretty fun game, I think, and not at all what people think when
they think of Haskell programs. I think it'd be good to fix it up and
make it portable so that way Hackage can add a Game category. Right
now I'm looking at lemmih's SDL-mixer binding
 to see if I can
hack something up, but if anyone else wants to do it or has any
suggestions, they're more than welcome.

---

On a side-note, if anyone was seeing any initialization crashes while
trying out the Shu-thing game, try adding a call to
'getArgsAndInitialize' in main; worked for me.

--
gwern
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] gtk2hs problem

2007-11-20 Thread Duncan Coutts
On Tue, 2007-11-20 at 15:18 -0800, Gregory Propf wrote:
> I'm using the Gtk.timeoutAddFull function to do the animation.

Are you using the threaded rts? Are you linking the program with
-threaded?

Are you doing the drawing directly in the timeout function or just
invalidating the window/widget and letting it get redrawn?

See for example the cairo clock demo which animates the hands of the
clock every second:

timeoutAdd (widgetQueueDraw window >> return True) 1000

In general it is much better to only ever draw to a window or widget
during that widget's expose event.

Duncan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: [Haskell] recursive deriving

2007-11-20 Thread Duncan Coutts
On Tue, 2007-11-20 at 19:18 -0500, Alex Jacobson wrote:
> When you want automated deriving of show/read etc., you need all the 
> components of your type also to be instances of show/read but you won't 
> want to *require* them to be automatically generated verions.
> 
> Standalone deriving does the wrong thing here.  Standalone deriving 
> should not cause an overlapping instance error if someone derives an 
> instance manually.  Instead, the manually derived instance should be 
> treated as more specific and win out.
> 
> The other part of this problem is that you can't do automatic recursive 
> deriving and this results in a ridiculous amount of boilerplate.  I know 
> some people have a theory that they want to avoid accidentally creating 
> instances for things that shouldn't have them, but the solution to that 
> is probably to add some declaration for types that prohibits automatic 
> deriving for those types.  The 99% case is that automatic deriving is ok.
> 
> Proposed syntax:
> 
>derive instance Show T recursively
>data T = T no-deriving (Ord,Eq)

I would expect that if the data constructor for T is not exported then
standalone deriving should not work. However this appears not to be the
case which breaks module abstraction.

Foo.hs:
module Foo ( T, t ) where
data T = T
t = T

Bar.hs:
import Foo
deriving instance Eq T

$ ghci Bar.hs -XStandaloneDeriving
[1 of 2] Compiling Bar  ( Bar.hs, interpreted )
[2 of 2] Compiling Main ( Baz.hs, interpreted )
Ok, modules loaded: Bar, Main.
*Main> t == t
True

You could write that Eq instance by hand since they do not have access
to the T constructor, then StandaloneDeriving should not be able to so
either. I think it's a design flaw in standalone deriving.

Does anyone else agree? Should we file a bug report?

Duncan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] timeout and waitForProcess

2007-11-20 Thread Bryan O'Sullivan

Tim Bauer wrote:

Does anyone know if the new System.Timeout.timeout combinator can wakeup from
System.Process.waitForProcess?


No, this is expected behaviour per the documentation:

"The technique works very well for computations executing inside of the 
Haskell runtime system, but it doesn't work at all for non-Haskell code. 
Foreign function calls, for example, cannot be timed out with this 
combinator simply because an arbitrary C function cannot receive 
asynchronous exceptions."


In principle, this FFI restriction could be partly lifted on POSIX 
systems, at least for some library calls, by use of thread cancellation. 
 However, the thread cancellation rules are sufficiently subtle that I 
have never heard of anyone actually using this facility.  I wouldn't 
want to be trying to write or maintain this code, though.


http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] timeout and waitForProcess

2007-11-20 Thread Tim Bauer

Does anyone know if the new System.Timeout.timeout combinator can wakeup from
System.Process.waitForProcess? I have not been able to make this work, and
it appears as though the timeout exception is thrown only after
waitForProcess returns normally (if it ever does). I am using Windows and
GHC 6.8.1.

import Control.Concurrent
import System.IO
import System.IO.Error(isEOFError)
import System.Process(runInteractiveProcess,
  waitForProcess,
  ProcessHandle)
import System.Timeout(timeout)

halfSecond = 50

example = timeout halfSecond sleepy

sleepy = do
  (inp,out,err,pid) <- runInteractiveProcess "sleep.exe" ["10"] Nothing
Nothing
  forkOS (ioGobbler out)
  forkOS (ioGobbler err)
  waitForProcess pid  -- CAN timeout INTERRUPT THIS?
  return "PROCESS FINISHED"

ioGobbler :: Handle -> IO ()
ioGobbler h = catch (ioDiscarder h) eofHandler

ioDiscarder :: Handle -> IO ()
ioDiscarder h = do hGetChar h >> ioDiscarder h

eofHandler :: IOError -> IO ()
eofHandler e | isEOFError e   = return ()
 | otherwise  = ioError e


Executing `example' from ghci will spawn (sleep.exe 10) which sleeps for 10
seconds. The timeout should happen in half a second (giving the thread time
to get blocked into waitForProcess). However, instead, things block for ten
seconds (until sleep.exe exits and waitForProcess returns normally).

While a workaround is to spin and sleep with the getProcessExitCode and
threadDelay, it seems like an inappropriate hack. The documentation for
timeout lists some functions that are interruptible, but is not mean to be a
complete list.

Thanks all,
- Tim

-- 
View this message in context: 
http://www.nabble.com/timeout-and-waitForProcess-tf4847280.html#a13868823
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Lennart Augustsson
I implemented Tetris in LML long before Haskell existed.
It was text based, but looked good with a custom font. :)

Haskell has no problem with state, it's just explicit.

  -- Lennart

On Nov 19, 2007 9:25 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote:

> If you were going to implement Tetris in Haskell, how would you do it?
>
> (For that matter, has anybody already *done* it? It would probably make
> a nice example program...)
>
> I'm particularly interested to know
>
> 1. How exactly would you do the graphical components? (Presumably
> there's some deep trickery with Gtk2hs that can draw free-form stuff
> like this.)
>
> 2. How do you implement a program that is fundamentally about state
> mutation in a programming language which abhors state mutation?
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] gtk2hs problem

2007-11-20 Thread Stefan O'Rear
On Tue, Nov 20, 2007 at 03:18:03PM -0800, Gregory Propf wrote:
> I've written a small program using the gtk2hs library and it crashes at 
> unpredictable times with X windows errors like the one below.  I looked for 
> the messages online and found various people talking about buggy gtk 
> libraries but no clear solutions.  I don't know a lot about X windows or what 
> these errors mean.  Has anyone else had this problem or know what to do?  The 
> program is a simple implementation of the Conway Life game.  It doesn't have 
> very much going on except that the main window is an animation showing the 
> evolution of the game.  I tried running with the --sync option as it said and 
> you get an almost immediate error like "Xlib: unexpected async reply 
> (sequence 0x1652)!".  Even these are not predictable and often come after 
> several screen updates.  I'm using the Gtk.timeoutAddFull function to do the 
> animation.  Note that the error_code, request_code, etc.. changes with each 
> crash.  It's as though it picks a random error code each time.  I've compiled 
> with both
>  ghc 6.4.2 and 6.6.1 and gtk2hs 0.9.12 and 0.9.12.1.  I've tried various 
> combinations of -O flags as well.  Same problem every time.
> 
> A typical crash message
> ---
> The program 'hlh' received an X Window System error.
> This probably reflects a bug in the program.
> The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
>   (Details: serial 236321 error_code 9 request_code 62 minor_code 0)
>   (Note to programmers: normally, X errors are reported asynchronously;
>that is, you will receive the error a while after causing it.
>To debug your program, run it with the --sync command line
>option to change this behavior. You can then get a meaningful
>backtrace from your debugger if you break on the gdk_x_error() function.)

What happens if you run 'gdb ./hlh', 'b gdk_x_error', 'run --sync' ?

(Are the backtraces consistent?)

Stefan


signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] gtk2hs problem

2007-11-20 Thread Gregory Propf
I've written a small program using the gtk2hs library and it crashes at 
unpredictable times with X windows errors like the one below.  I looked for the 
messages online and found various people talking about buggy gtk libraries but 
no clear solutions.  I don't know a lot about X windows or what these errors 
mean.  Has anyone else had this problem or know what to do?  The program is a 
simple implementation of the Conway Life game.  It doesn't have very much going 
on except that the main window is an animation showing the evolution of the 
game.  I tried running with the --sync option as it said and you get an almost 
immediate error like "Xlib: unexpected async reply (sequence 0x1652)!".  Even 
these are not predictable and often come after several screen updates.  I'm 
using the Gtk.timeoutAddFull function to do the animation.  Note that the 
error_code, request_code, etc.. changes with each crash.  It's as though it 
picks a random error code each time.  I've compiled with both
 ghc 6.4.2 and 6.6.1 and gtk2hs 0.9.12 and 0.9.12.1.  I've tried various 
combinations of -O flags as well.  Same problem every time.



A typical crash message
---
The program 'hlh' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
  (Details: serial 236321 error_code 9 request_code 62 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
  
   
-
Never miss a thing.   Make Yahoo your homepage.___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Thomas Schilling
On Tue, 2007-11-20 at 12:03 -0800, Keith Fahlgren wrote:
> On 11/20/07 7:35 AM, Thomas Schilling wrote:
> > On Tue, 2007-11-20 at 16:00 +0100, Ketil Malde wrote:
> >> Thomas Schilling <[EMAIL PROTECTED]> writes:
> >>
> >> I can all to easily imagine a situation where any documentation is
> >> riddled with a plethora of notes, questions, answers, comments etc,
> >> with nobody to clean up the mess every now and then.  For user-edited
> >> documentation, a wiki seems a much better fit - where each author 
> >> make some effort to leave pages as self-contained consistent
> >> documents.
> > 
> > Hm.  The GHC user's guide currently is generated from a DocBook
> > (XML-based) language, but when I extended the Cabal documentation (which
> > also is DocBook) I wasn't very impressed by DocBook.  It isn't
> > particularly well-documented 
> 
> Hi,
> 
> [Disclosure: I'm a large part of O'Reilly's re-adoption of DocBook internally
> and a member of the OASIS DocBook SubCommittee for Publishers]
> 
> I'm particularly surprised by this last sentence on the lack of documentation,
> as the DocBook standard has a definitive, comprehensive, freely available 
> manual
> at http://www.docbook.org/tdg/en/html/docbook.html that I've always found very
> usable. Were there particular things that you missed?

Right.  I should have been more specific.  I certainly like the idea of
Docbook.  But in an open source project documentation is written in
small parts and by many different people.  I personally didn't care to
read a whole book just to be able write a few pages of documentation.
Thus I tried to use it as a reference.  This worked reasonably well, but
could have been a way more comfortable experience.  Some quick-access /
lookup table, would have been nicer.  Maybe also a little more pretty
than gray and standard link blue.  (Even the W3C specs look rather
nice.)

My point is, for a casual editor trying to write or edit DocBook
documents based on this book is rather tedious.  I think my Emacs mode
didn't do as nice completion as it should have (based on DTD and
everything.)

> 
> > and editing raw XML is never fun, even with
> > the right Emacs mode.  One could hope that a standard format would come
> > with many tools, but I didn't get the impression that the tools are
> > great, either.  
> 
> The state of GUI XML editors has advanced significantly over the last year 
> with
> the continued work on both XXE (http://www.xmlmind.com/xmleditor/) and 
> oXygen's
> latest release (http://www.oxygenxml.com/docbook_editor.html), for example. 
> That
> said, there are not as many tools for editing DocBook XML as HTML, for 
> example.

The latter is not available for free (only trial).  The former seems to
be free for non-commercial use.  I haven't tried either (*Java Runtime
rant elided*).  The real problem remains:  Even if you were to install a
special program to (reasonably) edit a DocBook file, we still don't have
the immediacy of a Wiki.  

> > Using DocBook, however, has some nice advantages.  For example, the
> > possibility to generate documentation in different formats.  Something
> > more easily accessible (from the internet) would certainly be much more
> > convenient, though.  It would be nice, though, to preserve semantic
> > markup.  Aren't there some usable web-based WYSIWYG editors that edit
> > XML rather than HTML? 
> 
> Not that I've found. I'd be delighted to hear about possibilities. 

There seem to be some.  But I could only find commercial ones.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Exposed module still hidden, why?

2007-11-20 Thread Greg Fitzgerald
>> Why does GHC still think the package is hidden?
> You need to add "directory" to the Build-Depends instruction in the cabal
file

Thanks Olivier.  Haddock now builds with this list for 'build-depends':

base>=1.0, haskell98>=1.0, directory>=1.0, process>=1.0, containers>=0.1,
array>=0.1, pretty>=1.0

The 'build' step also requires Happy and Alex to be installed, which are not
mentioned in the cabal file.

Thanks,
Greg
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Tetris

2007-11-20 Thread Radosław Grzanka
2007/11/20, Gwern Branwen <[EMAIL PROTECTED]>:
> On Nov 20, 2007 10:41 AM, nick ralabate <[EMAIL PROTECTED]> wrote:
> > Speaking of Tetris and Space Invaders, you might be interested in this 
> > project:
> >
> > http://www.geocities.jp/takascience/haskell/monadius_en.html
> >
> > It's a clone of Gradius written in Haskell.
> >
> >
> > -Nick
>
> It's a fun enough game under Wine, but has anyone managed to get it to
> compile under Linux? I tried but couldn't, and the associated makefile
> seems to be very Windows-specific.

I have prepare quick patch that removes audio from Monadius so it
compiles on Linux and is playable (this is quick and dirty patch).

Cheers,
  Radek.


-- 
Codeside: http://codeside.org/
Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/


monadius_patch.gz
Description: GNU Zip compressed data
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Radosław Grzanka
2007/11/20, Bit Connor <[EMAIL PROTECTED]>:
> > As far as I'm aware, GLUT isn't available for Windows. (Or rather, I
> > tried it once, and it wasn't happy at all. And after some Google
> > searching, I found it's not around any more.)
>
> GLUT should work fine on windows, but another alternative is SDL,
> which works on Windows, GNU/Linux, and Mac
>
> The haskell bindings are here:
>
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SDL-0.5.1

Last time I checked it I couldn't compile it. But I see the version
number has gone up much since that! Cool. I will give it a shot!

Thanks,
  Radek.

-- 
Codeside: http://codeside.org/
Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] -O2 bug in GHC 6.8.1?

2007-11-20 Thread Brad Clow
On Nov 21, 2007 1:32 AM, Ian Lynagh <[EMAIL PROTECTED]> wrote:

> I can't reproduce this. Can you please tell us what platform you are on
> (e.g. x86_64 Linux) and what gcc --version says?

Mac OS X 10.4.11

$ gcc --version
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367)

> Also, where did your GHC come from, e.g. bindists from the download
> page, self-compiled?

>From the GHC download page
(http://haskell.org/ghc/dist/6.8.1/maeder/ghc-6.8.1-i386-apple-darwin.tar.bz2)

> Also, as Christian says, it's best to file a bug report so that the
> problem doesn't get forgotten about.

No problem, thanks for the quick response.

Regards
brad

-- 
www.scoodi.com
Contribute things you don't need and find things you do, all within
your local community.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Andrew Coppin

Duncan Coutts wrote:

I would like to compare this to the GNOME development platform. It has
Gtk+ at it's hart but GNOME releases are not synchronised with Gtk+
releases. The GNOME development platform consists of a collection of
standard packages. The collection is released on a time-based schedule,
not a feature-based one. It puts a QA stamp on specific versions of its
constituent packages that are known to work together. It has a procedure
for getting packages included which include standards of API design and
documentation. There is an infrastructure for maintaining, testing and
releasing this platform.

This is a model I think we should consider seriously.
  


Mmm, I like it...

The only question would be "who gets to spend their time doing the QA 
job?" Perhaps we could automate it at least to some extent?


Certainly this seems like a nice conceptual model to follow. We have the 
compiler, and we have a set of pluggable libraries. Sounds good to me...


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Sillyness in the standard libs.

2007-11-20 Thread Andrew Coppin

Aaron Denney wrote:

On 2007-11-19, Andrew Coppin <[EMAIL PROTECTED]> wrote:
  

As I understand it, it's widely recognised that Haskell's current
numeric class hierachy is broken (or at best, not very well chosen), but 
nobody came up with a better suggestion yet.



Oh, there are /lots/ of suggestions.  Perhaps too many.  But this is
one area that could really be improved by the use of ATs or MPTCs with
fundeps, and that's stalled some of the concrete proposals, as what
exactly is happening for Haskell' isn't too clear.
  


Er, yes... what *he* said.

(I understand there are a couple of similar proposals that have gone 
nowhere because it's not clear what the best design choice is. E.g., 
there ought to be some generalisation of the words and lines functions, 
but there isn't, because nobody can decide on the best generalisation to 
pick.)


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Exposed module still hidden, why?

2007-11-20 Thread Olivier Boudry
On 11/20/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote:
>
> Using GHC 6.8.1 on Windows XP, after having used ghc-pkg to expose '
> directory-1.0.0.0', I am getting an error when I build haddock that says
> the package is hidden.  When I type "ghc-pkg list", the package is not in
> parenthesis.  Typing "ghc -v" says that it is using the file from
> "C:\ghc\ghc- 6.8.1\package.conf".  That package.conf file has the
> 'exposed' set to True for that file.  Why does GHC still think the package
> is hidden?



Hi Greg,

You need to add "directory" to the Build-Depends instruction in the cabal
file. The base package has been split into separate modules in 6.8.1.

Build-Depends: base, directory

Look at this: http://groups.google.com/group/fa.haskell/msg/17a78c120ae26514

Cheers,

Olivier.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Bit Connor
> As far as I'm aware, GLUT isn't available for Windows. (Or rather, I
> tried it once, and it wasn't happy at all. And after some Google
> searching, I found it's not around any more.)

GLUT should work fine on windows, but another alternative is SDL,
which works on Windows, GNU/Linux, and Mac

The haskell bindings are here:

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SDL-0.5.1
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Andrew Coppin

Brandon S. Allbery KF8NH wrote:


On Nov 20, 2007, at 5:45 , Bulat Ziganshin wrote:


it can be made easy and automatic by just publishing "number of
downloads" on hackage


So if I download all 4 HTML libs to try to figure out which one fits 
best, I mod all four up?  Seems wrong to me.


Also seems to have a tendancy to make older libs look "better" than 
newer ones. (They will have been downloaded more just because they've 
been there longer.)


I think download stats would be nice, but having a way for users to 
comment (and manually select a rating) would be nice too. Why not do all 
of them? :-D


(Oh yeah - somebody still needs to write the code...)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Tetris

2007-11-20 Thread Radosław Grzanka
Hi

> It's a fun enough game under Wine, but has anyone managed to get it to
> compile under Linux? I tried but couldn't, and the associated makefile
> seems to be very Windows-specific.


It's not makefile that is specific but c file for Audio: stub.c

It compiles without problem:

ghc --make Main.hs

(remember to install glut bindings -  libghc6-glut-dev on ubuntu)

but it fails on linking. If you browse the source and disable audio
then it should link.

Cheers,
  Radek.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Andrew Coppin

Stefan O'Rear wrote:

On Tue, Nov 20, 2007 at 07:27:48PM +, Andrew Coppin wrote:
  
(Nitpick: Don't you need Gtk2hs in order to *use* OpenGL? I mean, you have 
to open a window to render into somehow, and that's outside the OpenGL 
standard...)



You need *something*, but it need not be Gtk.


Correct. That's when I meant to say.


GLUT and GLX will also work, and at least the former has a Haskell binding.
  


As far as I'm aware, GLUT isn't available for Windows. (Or rather, I 
tried it once, and it wasn't happy at all. And after some Google 
searching, I found it's not around any more.)


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Fwd: [Haskell-cafe] Fun with Cabal on Windows! [Stream fusion for Hackage]]

2007-11-20 Thread Andrew Coppin

Duncan Coutts wrote:

On Mon, 2007-11-19 at 19:40 -0600, J. Garrett Morris wrote:
  

Reproduced on mine too, I think I always have added that to the PATH as well.
  

Same here, I've also always had to add gcc-lib to the PATH.



I've pushed what I think is a fix. It now works for me on windows.

Mind you it always did for me because it was finding ld.exe from mingw's
path. Sigh.

Can someone grab Cabal HEAD and make sure it works for them too please.
  


Just tested this with Duncan over IRC. Seems to be working just fine in 
Cabal HEAD and GHC 6.8.1. Finds ld.exe just fine, no PATH twiddling 
required.


Nice work.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Tetris

2007-11-20 Thread Gwern Branwen
On Nov 20, 2007 10:41 AM, nick ralabate <[EMAIL PROTECTED]> wrote:
> Speaking of Tetris and Space Invaders, you might be interested in this 
> project:
>
> http://www.geocities.jp/takascience/haskell/monadius_en.html
>
> It's a clone of Gradius written in Haskell.
>
>
> -Nick

It's a fun enough game under Wine, but has anyone managed to get it to
compile under Linux? I tried but couldn't, and the associated makefile
seems to be very Windows-specific.

--
gwern
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Keith Fahlgren
On 11/20/07 7:35 AM, Thomas Schilling wrote:
> On Tue, 2007-11-20 at 16:00 +0100, Ketil Malde wrote:
>> Thomas Schilling <[EMAIL PROTECTED]> writes:
>>
>> I can all to easily imagine a situation where any documentation is
>> riddled with a plethora of notes, questions, answers, comments etc,
>> with nobody to clean up the mess every now and then.  For user-edited
>> documentation, a wiki seems a much better fit - where each author 
>> make some effort to leave pages as self-contained consistent
>> documents.
> 
> Hm.  The GHC user's guide currently is generated from a DocBook
> (XML-based) language, but when I extended the Cabal documentation (which
> also is DocBook) I wasn't very impressed by DocBook.  It isn't
> particularly well-documented 

Hi,

[Disclosure: I'm a large part of O'Reilly's re-adoption of DocBook internally
and a member of the OASIS DocBook SubCommittee for Publishers]

I'm particularly surprised by this last sentence on the lack of documentation,
as the DocBook standard has a definitive, comprehensive, freely available manual
at http://www.docbook.org/tdg/en/html/docbook.html that I've always found very
usable. Were there particular things that you missed?

> and editing raw XML is never fun, even with
> the right Emacs mode.  One could hope that a standard format would come
> with many tools, but I didn't get the impression that the tools are
> great, either.  

The state of GUI XML editors has advanced significantly over the last year with
the continued work on both XXE (http://www.xmlmind.com/xmleditor/) and oXygen's
latest release (http://www.oxygenxml.com/docbook_editor.html), for example. That
said, there are not as many tools for editing DocBook XML as HTML, for example.

> Using DocBook, however, has some nice advantages.  For example, the
> possibility to generate documentation in different formats.  Something
> more easily accessible (from the internet) would certainly be much more
> convenient, though.  It would be nice, though, to preserve semantic
> markup.  Aren't there some usable web-based WYSIWYG editors that edit
> XML rather than HTML? 

Not that I've found. I'd be delighted to hear about possibilities. Most
web-based attempts start with the desire of writing in a plain-text wiki
language and getting to XML. These seem to always fail on complex markup
(tables, nested lists, code with internal markup).

> Do we need more features from DocBook for GHC or the libraries, or both?

I'd be delighted to help anyone interested in extending GHC's docs to allow the
sort of flexible commenting system Simon has outlined. Please don't hesitate to
contact me directly.


Regards,
Keith
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Stefan O'Rear
On Tue, Nov 20, 2007 at 07:27:48PM +, Andrew Coppin wrote:
> (Nitpick: Don't you need Gtk2hs in order to *use* OpenGL? I mean, you have 
> to open a window to render into somehow, and that's outside the OpenGL 
> standard...)

You need *something*, but it need not be Gtk.  GLUT and GLX will also
work, and at least the former has a Haskell binding.

Stefan


signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Radosław Grzanka
Hi,

> (Nitpick: Don't you need Gtk2hs in order to *use* OpenGL? I mean, you
> have to open a window to render into somehow, and that's outside the
> OpenGL standard...)

You have GLUT library for just that:

http://www.haskell.org/ghc/docs/latest/html/libraries/GLUT-2.1.1.1/Graphics-UI-GLUT.html

Cheers,
  Radek.

-- 
Codeside: http://codeside.org/
Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Andrew Coppin

Don Stewart wrote:

andrewcoppin:
  

If you were going to implement Tetris in Haskell, how would you do it?

(For that matter, has anybody already *done* it? It would probably make 
a nice example program...)



http://haskell.org/haskellwiki/Applications_and_libraries/Games

ASCII tetris
http://web.comlab.ox.ac.uk/oucl/work/ian.lynagh/Hetris/

OpenGL or Gtk2Hs seem the best options.
  


OK, well I'll have a go at seeing if I can put something together with 
Gtk2hs.


(Nitpick: Don't you need Gtk2hs in order to *use* OpenGL? I mean, you 
have to open a window to render into somehow, and that's outside the 
OpenGL standard...)


2. How do you implement a program that is fundamentally about state 
mutation in a programming language which abhors state mutation?



Its not clear games are fundamentally about mutation, anymore than, say,
window managers are. State we do with monads.
  


Hmm. On reflection, Tetris is probably a poor example of this. It has a 
fairly small, simple state that you can easily manipulate purely 
functionally. But if you imagine, say, an FPS game, where you have 
(possibly multiple) players running around, NPCs running after them, 
possibly a nontrivial physics engine, possibly a nontrivial AI system, 
possibly nontrivial scripted sequences happening... how do you *do* all 
that in Haskell?



Check the thesis on Frag for a pure approach, or just use StateT IO.
  


Indeed, Frag is interesting because it conclusively demonstrates that 
this can be done in Haskell (by doing it!) However, all the material 
I've read about it is unfortunately utterly incomprehensible. I still 
have no idea how it is possible to build such a highly interactive 
system in a language which strongly discourages interactivity...


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Andrew Coppin

Jeremy Shaw wrote:

http://haskell-tetris.pbwiki.com/Main
  
A minimal openGL haskell tetris clone:


Neat! I shall have to give this a try...

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a > million element list)

2007-11-20 Thread Bertram Felgenhauer
[note, the thread is almost a month old]

Bernie Pope wrote:
>
> On 23/10/2007, at 8:09 AM, Thomas Hartman wrote:
>>
>> (Prelude sort, which I think is mergesort, just blew the stack.)
>
> GHC uses a "bottom up" merge sort these days.
>
> It starts off by creating a list of singletons, then it repeatedly merges 
> adjacent pairs of lists until there
> is only one list left.
>
> I was teaching sorting to my first year students, and I also bumped into 
> the stack overflow at one million elements, using GHC's merge sort.

I think I got to the bottom of this.

Consider the following snippet:

   sort $ (take (10^6) [1..])

The argument of the sort is a list with 10^6 unevaluated elements,
[a=1, b=1+a, c=1+b, d=1+c, ...]. Now it turns out that merge sort as
implemented in the base library compares the two last elements of the
list first. This causes the evaluation of an expression that is
approximately 10^6 applications of (+) deep. And that's where you
get the stack overflow. [1]

Thomas Hartman's example is of a similar nature, it also produces a list
of unevaluated terms where each term depends on the value of the previous
one.

The modification that I proposed in
  http://www.haskell.org/pipermail/haskell-cafe/2007-October/033617.html

has the effect of comparing the first two elements first. I actually
believe that this is a reasonable change, because it's more likely to
work out fine. But it'll produce a stack overflow on

  sort $ (reverse (take (10^6) [1..]))

instead, which doesn't cause problems currently. The root problem is
the creation of deep unevaluated expressions.

Bertram

[1] Note that  sort [1..10^6]  works just fine because  [1..10^6]
produces a list of fully evaluated values, as it compares each
list element to the upper bound when it is generated.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: user error when using Text.Regex.PCRE

2007-11-20 Thread Don Stewart
haskell:
> Thank you very much for the error report.  I have tracked down the cause.
> 
> You are searching against an empty Bytestring.  This is now represented by
> 
> > -- | /O(1)/ The empty 'ByteString'
> > empty :: ByteString
> > empty = PS nullForeignPtr 0 0
> 
> And while the useAsCString and useAsCStringLen functions never reveal the null
> pointer, the current library uses unsafeUseAsCStringLen, which returns the 
> null
> pointer.
> 
> And this is getting caught by a null pointer check resulting in your crash.  I
> will post a fix later tonight, and announce it.

Right, empty bytestrings are represented as a nullPtr and a 0 length
field.  When you use unsafeUseAs* operations, this pointer is passed to
a C function as is, without copying.

The side condition is that the C function should accept NULL as a
0-length string, which the pcre code evidently doesn't, so its unsafe to
use unsafeUseAsCStringLen here,

I'll add some more explanatory text about the side conditions that need
to hold for this use to be safe, and advise not using unsafe things :)

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Don Stewart
jeremy.shaw:
> At Mon, 19 Nov 2007 21:25:23 +,
> Andrew Coppin wrote:
> > 
> > If you were going to implement Tetris in Haskell, how would you do it?
> > 
> > (For that matter, has anybody already *done* it? It would probably make 
> > a nice example program...)
> 
> A minimal openGL haskell tetris clone:
> 
> http://haskell-tetris.pbwiki.com/Main
> 

Cool! Hadn't seen this.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Don Stewart
jon:
> On Monday 19 November 2007 22:12, Don Stewart wrote:
> > Check the thesis on Frag for a pure approach, or just use StateT IO.
> 
> Has Frag been fixed to work on x86-64?

Not that I'm aware of -- it lacks a game head maintainer
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Jeremy Shaw
At Mon, 19 Nov 2007 21:25:23 +,
Andrew Coppin wrote:
> 
> If you were going to implement Tetris in Haskell, how would you do it?
> 
> (For that matter, has anybody already *done* it? It would probably make 
> a nice example program...)

A minimal openGL haskell tetris clone:

http://haskell-tetris.pbwiki.com/Main

j.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] More accessible papers

2007-11-20 Thread Jeremy Shaw
At Mon, 19 Nov 2007 19:57:14 +,
Neil Mitchell wrote:

> All these PDF's are produced from a standard Latex class file.  For
> all my papers I have the original source .tex files. I suspect
> you'll have more luck going from the original .tex rather than the
> PDF.

I would be especially neat if there was some way to embed the .tex
source in the .pdf, so that you could later extract the source from
the .pdf and rebuild it. This is probably not officially supported by
.pdf, but I bet it can be done. Perhaps by creating a hidden section
and a bit of javascript. Ideally you would just add:

\usepackage{embedsource} 

into your .tex and it would automatically do it for you.


j.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] -O2 bug in GHC 6.8.1?

2007-11-20 Thread Bertram Felgenhauer
Brad Clow wrote:
> I upgraded from GHC 6.6.1 to 6.8.1 and around that time I noticed that
> the output from an app I am working on changed. I have distilled the
> code down to the following example that produces different output
> depending on whether it is compiled with -O2 or not:
[...]

I've created a bug report for this, see

   http://hackage.haskell.org/trac/ghc/ticket/1910

regards,

Bertram
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Bulat Ziganshin
Hello brad,

Monday, November 19, 2007, 9:25:40 PM, you wrote:

> practical projects. the "batteries included" approach does imply
> choosing preferred solutions when more than one library is available,
> this can also be difficult. that said, i think haskell would pick up a
> lot of new coders if it was obvious that the functionality they were
> looking for came out of the base libs.

it's interesting that i've proposed rather close thing to the Haskell'
Standard committee. look at 
http://www.nabble.com/Standard-libraries-t4810359.html


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] -O2 bug in GHC 6.8.1?

2007-11-20 Thread Bertram Felgenhauer
Ian Lynagh wrote:
> 
> Hi Brad,
> 
> On Tue, Nov 20, 2007 at 09:50:02PM +1000, Brad Clow wrote:
> > 
> > $ ./test
> > 23
> > 24
> 
> I can't reproduce this. Can you please tell us what platform you are on
> (e.g. x86_64 Linux) and what gcc --version says?

I see a bug that only affects x86_32.

The native code generator (compiler/nativeGen/PprMach.hs) generates a
simple fistp instruction for converting floats or doubles to int. with
the usual default rounding mode (round) that means numbers between n+1/2
and n are rounded up instead of truncated. (relevant Code:

pprInstr g@(GDTOI src dst) 
   = pprG g (hcat [gtab, text "subl $4, %esp ; ", 
   gpush src 0, gsemi, text "fistpl 0(%esp) ; popl ", 
   pprReg I32 dst])

)

What's missing is the FPU control word manipulation to set the
rounding mode appropriately, say

pprinstr g@(GDTOI src dst)
   = pprG g (hcat [gtab, gpush src 0,
   text " ; subl $4, %esp ; fstcw 0(%esp) ; movl $0xC00, ",
   reg, text " ; orl 0(%esp), ", reg,
   text " ; pushl ", reg,
   text " ; fldcw 0(%esp) ; fistpl 0(%esp) ; popl ", reg,
   text " ; addl $4, %esp"])
   where
 reg = pprReg I32 dst

For reference, see 
http://www.eglibc.org/cgi-bin/viewcvs.cgi/fsf/glibc-2_3-branch/libc/sysdeps/i386/fpu/s_truncf.S?rev=10&sortby=date&view=markup

HTH,

Bertram
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Laurent Deniau

Andrew Coppin wrote:
> 2. How do you implement a program that is fundamentally about state 
mutation in a programming language which abhors state mutation?


Haskell taught me one thing (at least). The World is not mutating but it 
is moving. Physics shows that no movement (no time) means no World (in 
fact it means that you can't know if the World exists or not, which is 
the same).


You can take the (discrete) analogy of a (time) *sequence* of pictures 
which builds a movie. The pictures are immutable and so is the movie, 
but looking quickly at the pictures makes the movie looking like a 
mutable picture. Everything here is about (time) sequence, not mutability.


It is the same about Monad. Monad are not about side effects nor 
mutability, but about sequencing. It uses the principle of causality 
that one need to apply a function to its arguments before it returns a 
result (and encapsulates this behavior in an object). Note that it says 
nothing about lazy or eager evaluation, since the result can be either a 
value or an (lazy) expression which evaluates to the value. What this 
latter expression captures is the sequence of evaluation to perform to 
get the value. Again, everything here is about sequence, not mutability.


Mutability is an (apparent) optimization. Creating a new state from the 
previous state in the (time) sequence has a cost (note the functional 
nature of this transition). Since a big part of this process can be 
shared to reduce this cost, namely creating the storage / structure / 
value / whatever of the state, one can think to reuse as much as 
possible. In the movie analogy, this optimization is called mpeg 
compression which only encodes the changes between images in the 
sequence. The Haskell compiler can also do this kind of optimization as 
soon as it doesn't change the observable behavior of the program. This 
means that a Haskell program can have/deal with mutable states resulting 
from an optimization. This mutability is explicit within the IO Monad 
since it is the standard way to communicate with the computer World.


So the only (required) mutable states in the game are related to the IO, 
not to the game states as one might think. But the encapsulation of 
these states inside some monads may let the compiler do some 
optimization for you.


my 2 cents of Euro.

a+, ld.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Bryan O'Sullivan

Krzysztof Kościuszkiewicz wrote:


I would advocate using a comment system that is similar to the one
at http://djangobook.com/.


That's an appealing idea, but the devil lies in the details.

I wrote just such a comment system for  draft chapters of our book, and 
it's seen a lot of use.


However, what I do is add ID tags to the DocBook source, and the XSLT 
processor passes those through to the final HTML.  This isn't easily 
generalised to other tools, as each needs its own approach.


An alternative is to embed identifiers in the generated HTML, but this 
is brittle in its own way.  Few people generate HTML by hand, and most 
tools that do so have a habit of making huge changes to the output 
structure in response to minor user edits.  Stably identifying chunks of 
text across multiple versions of a document is thus somewhat fiddly.


http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] -O2 bug in GHC 6.8.1?

2007-11-20 Thread Josef Svenningsson
On Nov 20, 2007 4:32 PM, Ian Lynagh <[EMAIL PROTECTED]> wrote:
>
> Hi Brad,
>
> On Tue, Nov 20, 2007 at 09:50:02PM +1000, Brad Clow wrote:
> >
> > $ ./test
> > 23
> > 24
>
> I can't reproduce this. Can you please tell us what platform you are on
> (e.g. x86_64 Linux) and what gcc --version says?
>
> Also, where did your GHC come from, e.g. bindists from the download
> page, self-compiled?
>
I can also reproduce this on an Ubuntu machine with a self-compiled
ghc. gcc is 4.1.2.

Cheers,

Josef
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Yampa Arcade: source code available?

2007-11-20 Thread Thomas Hartman
I was able to compile and play space invaders on linux. 

Hours of fun for the whole family :)

thomas.





Peter Verswyvelen <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
11/20/2007 06:46 AM
Please respond to
[EMAIL PROTECTED]


To
Don Stewart <[EMAIL PROTECTED]>
cc
Haskell-Cafe 
Subject
Re: [Haskell-cafe] The Yampa Arcade: source code available?






Thanks for the feedback. Unfortunatly the Space Invaders game uses HGL, 
which is not supported on Windows anymore. Is it supported on Linux?

Frag does compile and run on Windows using GHC 6.6.1, so that might be a 
better starting point.

What is the current consensus regarding (A)FRP? Is it a dead end? Are 
approaches like Modelica better suited for the job?

>From the point of view of a veteran assembly/C++ game hacker like myself, 
it is funny to see that the same problems popup when doing "reactive 
programming" in a pure language like Haskell or an imperative language 
like C++... Recursive dependencies are problematic, be it with signals in 
FRP or with objects in C++. In videogames using an imperative language, 
this is often solved by just adding a global "single frame" delay between 
what is read and what is written. Ugly, but works in many cases. Or a 
third object is introduced that breaks the recursive dependency between 
the two problematic objects. If I'm correct, when switching from FRP to 
AFRP signals (type Signal a = Time -> a) are no first class values 
anymore, only signal functions (type SF a b = Signal a -> Signal b) are 
first class. Furthermore the handling of recursive dependencies/feedback 
is done solely in a loop arrow. 

I must say it is frustratring. I finally got to understand FRP from the 
SOE book, only to find out that it is not really the way to go ;-) Now I'm 
trying to grasp AFRP. It is incredibly interesting stuff, but for a 
not-so-abstract-thinking-average programmer like me, it is not an obvious 
task. Maybe *using* AFRP is easier than understanding the inner details...

Maybe it would be a good idea for the community if someone (maybe me, if I 
find the time ;-) to write a very very simple game using AFRP and GHC 
6.8.1? Even simpler than the Space Invaders game (which does not work 
anymore anyway), but which does show dynamic collections and switching? 
Maybe like Andrew Coppin mentioned, a very simple Tetris clone? Of course, 
this is not legal, Tetris is copyrighted, but maybe for tutorial purposes 
it can be allowed :)

Don Stewart wrote: 
sk:
 
On 19.11.2007, at 19:54, Peter Verswyvelen wrote:
 
I can find the paper, but is the source code for that Space 
Invaders alike game also available somewhere?
 
it's included here: http://haskell.org/yampa/afrp-0.4-src.tgz

btw, does anybody know what's the current state of affairs with yampa/ 
afrp? is the framework still developed further?
 

Can we get this uploaded to hackage? 

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



---

This e-mail may contain confidential and/or privileged information. If you 
are not the intended recipient (or have received this e-mail in error) 
please notify the sender immediately and destroy this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Brandon S. Allbery KF8NH


On Nov 20, 2007, at 5:45 , Bulat Ziganshin wrote:


Hello Brandon,

Tuesday, November 20, 2007, 1:15:34 AM, you wrote:


The ability to "vote" on packages might be interesting here.  If
there's 4 HTML libraries and one of them gets lots of votes, it's
probably the one to look at first.


it can be made easy and automatic by just publishing "number of
downloads" on hackage


So if I download all 4 HTML libs to try to figure out which one fits  
best, I mod all four up?  Seems wrong to me.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: Important bug fix for regex-pcre ByteStrings.

2007-11-20 Thread ChrisK
Greetings,

There are new version 0.82 and 0.93 of regex-posix.  If you use regex-posix with
Data.ByteString then you should upgrade to obtain a fix for a crash error.

There are new version of regex-pcre available on hackage and the two darcs
repositories:
http://darcs.haskell.org/packages/regex-pcre/ for "stable" version 0.82
and
http://darcs.haskell.org/packages/regex-unstable/regex-pcre/ for "unstable"
version 0.93

The new version regex-pcre-0.82 replaces the broken version 0.81
The new version regex-pcre-0.93 replaces the broken version 0.92

I apologize for the error.  I took the address of the ByteString to give to the
pcre library by using unsafeUseAsCStringLen.  I had not appreciated that this
can return a null pointer for an empty ByteString.  My code caught this null
pointer and reported it, however, and so a good error message sent in by a user
allowed me to quickly find and hopefully fix it.

For version 0.92 the error also applied to Lazy ByteStrings.

In case anyone is curious, the fixed code checks the pointer returned by
unsafeUseAsCStringLen and replaces a null pointer to a non-null pointer to a
private private bytestring "myEmpty" with the length set to 0 by "trim":

> {-# INLINE asCStringLen #-}
> asCStringLen :: ByteString -> (CStringLen -> IO a) -> IO a
> asCStringLen s op = B.unsafeUseAsCStringLen s checked
>   where checked cs@(ptr,_) | ptr == nullPtr = B.unsafeUseAsCStringLen myEmpty 
> (op . trim)
>| otherwise = op cs
> myEmpty = B.pack [0]
> trim (ptr,_) = (ptr,0)

This fix is motivated by desiring to ensure asCStringLen never passes a null
pointer to "op" and that no memory copy operations are used.

The safe "useAsCString(Len)" do not appear capable of returning a null pointer.
Only "unsafeUseAsCString(Len)" on an empty bytestring might return a null 
pointer.

-- 
Chris

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: fixpoint 0.1

2007-11-20 Thread Bertram Felgenhauer
[redirecting from [EMAIL PROTECTED]
apfelmus wrote:
[...]
> I wonder whether a multi parameter type class without fundeps/associated 
> types would be better.
>
>   class Fixpoint f t where
> inject  :: f t -> t
> project ::   t -> f t
>
[...]
> Interestingly, this even gives slightly shorter type signatures
>
>   cata :: Fixpoint f t => (f s -> s) -> t -> s
>   size :: (Fixpoint f t, Foldable f) => t -> Int

size can't be used now though, because there is no way to infer f.

Bertram
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] -O2 bug in GHC 6.8.1?

2007-11-20 Thread Olivier Boudry
On 11/20/07, Ian Lynagh <[EMAIL PROTECTED]> wrote:
>
>
> Hi Brad,
>
> I can't reproduce this. Can you please tell us what platform you are on
> (e.g. x86_64 Linux) and what gcc --version says?
>
> Also, where did your GHC come from, e.g. bindists from the download
> page, self-compiled?
>
> Also, as Christian says, it's best to file a bug report so that the
> problem doesn't get forgotten about.
>
>
> Thanks
> Ian
>
>
Hi Ian,

For info I can reproduce Brad's bug using ghc-6.8.1 (distributed binaries)
on Windows XP.

C:\Temp>ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.8.1

C:\Temp>bugo2.exe
23
24

Cheers,

Olivier.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Tetris

2007-11-20 Thread nick ralabate
Speaking of Tetris and Space Invaders, you might be interested in this project:

http://www.geocities.jp/takascience/haskell/monadius_en.html

It's a clone of Gradius written in Haskell.


-Nick
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Thomas Schilling
On Tue, 2007-11-20 at 16:00 +0100, Ketil Malde wrote:
> Thomas Schilling <[EMAIL PROTECTED]> writes:
> 
> >> I would advocate using a comment system that is similar to the one
> >> at http://djangobook.com/. 
> 
> > I'm pretty sure Brian O'Sullivan has written a Haskell implementation of
> > this for the Real World Haskell book.
> 
> While the technology is there (or will be), I worry if this is the
> right solution for something else than soliciting comments on a
> (fixed, non-editable) text.
> 
> I can all to easily imagine a situation where any documentation is
> riddled with a plethora of notes, questions, answers, comments etc,
> with nobody to clean up the mess every now and then.  For user-edited
> documentation, a wiki seems a much better fit - where each author 
> make some effort to leave pages as self-contained consistent
> documents.

Hm.  The GHC user's guide currently is generated from a DocBook
(XML-based) language, but when I extended the Cabal documentation (which
also is DocBook) I wasn't very impressed by DocBook.  It isn't
particularly well-documented and editing raw XML is never fun, even with
the right Emacs mode.  One could hope that a standard format would come
with many tools, but I didn't get the impression that the tools are
great, either.  They're also not easy to set up.  (On Mac OS I had to
manually add a symlink to fix a script.  Installation only worked with
fink, not with Macports.  I wouldn't be surprised if it were even harder
to set up on Windows.  Ubuntu worked fine, though.) 

Using DocBook, however, has some nice advantages.  For example, the
possibility to generate documentation in different formats.  Something
more easily accessible (from the internet) would certainly be much more
convenient, though.  It would be nice, though, to preserve semantic
markup.  Aren't there some usable web-based WYSIWYG editors that edit
XML rather than HTML?  Also, it should be possible to have branches in
this wiki-system, so that you can associate it with a particular
release, but still update when necessary.  (I.e., just linking to a
particular version is not sufficient.)
 
Does anyone know of a system that comes close to those requirements?

Do we need more features from DocBook for GHC or the libraries, or both?



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Fun with Cabal on Windows! [Stream fusion for Hackage]

2007-11-20 Thread Olivier Boudry
On 11/19/07, Andrew Coppin <[EMAIL PROTECTED]> wrote:
>
> Well, I just tried to install this, and as per usual, Cabal has having
> none of it.
>
> C:\fusion\> runhaskell Setup configure
> Configuring stream-fusion-0.1.1...
> Setup: ld is required but it could not be found.
>

Hi Andrew,

I had the same problem with ghc-6.8.1 and solved it by adding C:\ghc\ghc-
6.8.1\gcc-lib to my PATH variable in environment variables. A copy of
ld.exeis in this directory.

In ghc-6.6.1, ld.exe was in the same place and it was working out of the box
for me. I don't understand why it is not found any more with ghc-6.8.1.

Cheers,

Olivier.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] -O2 bug in GHC 6.8.1?

2007-11-20 Thread Ian Lynagh

Hi Brad,

On Tue, Nov 20, 2007 at 09:50:02PM +1000, Brad Clow wrote:
> 
> $ ./test
> 23
> 24

I can't reproduce this. Can you please tell us what platform you are on
(e.g. x86_64 Linux) and what gcc --version says?

Also, where did your GHC come from, e.g. bindists from the download
page, self-compiled?

Also, as Christian says, it's best to file a bug report so that the
problem doesn't get forgotten about.


Thanks
Ian

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: [Haskell] Recruiting functional programmers

2007-11-20 Thread Mattias Bengtsson

> Interested in recruiting Haskell programmers from Chalmers/Gothenburg
> university? As an experiment, I am planning a recruitment event here in
> December-see www.jobs-in-fp.org for how to take part.
>

Just checked my calendar and all according to Murphy's law this had to be
the weekend when i'm in Stuttgart on vacation.
Will there be more events if this one turns out successful?

/Mattias

-- 



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: user error when using Text.Regex.PCRE

2007-11-20 Thread Olivier Boudry
On Nov 20, 2007 9:36 AM, ChrisK <[EMAIL PROTECTED]> wrote:

> Thank you very much for the error report.  I have tracked down the cause.
>
> You are searching against an empty Bytestring.  This is now represented by
>
> > -- | /O(1)/ The empty 'ByteString'
> > empty :: ByteString
> > empty = PS nullForeignPtr 0 0
>
> And while the useAsCString and useAsCStringLen functions never reveal the
> null
> pointer, the current library uses unsafeUseAsCStringLen, which returns the
> null
> pointer.
>
> And this is getting caught by a null pointer check resulting in your
> crash.  I
> will post a fix later tonight, and announce it.
>
> Which regex-prce version are you using?  Perhaps from hackage?  I want to
> prioritize the version you need fixed.
>
> The earlier repository holds up to version 0.81 at
> http://darcs.haskell.org/packages/regex-pcre/
> The newer repository holds up to version 0.92 at
>
> http://darcs.haskell.org/packages/regex-unstable/regex-pcre/regex-pcre.cabal
>
> Out of further curiosity:
>
> Which version of the pcre library does it use?
> And what version of ghc?
> Which version of Data.ByteString?
>
> Cheers,
>  Chris Kuklewicz
>


Hi Chris,

I'm using ghc-6.8.1, regex-pcre-0.92, bytestring-0.9.0.1 and libpcre-7.4.

Using your information, I might be able to workaround the problem by
filtering out empty bytestrings before applying the next regex.

Thanks for your reply,

Olivier.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Mathieu Boespflug
> > 2. How do you implement a program that is fundamentally about state
> > mutation in a programming language which abhors state mutation?
>
> Its not clear games are fundamentally about mutation, anymore than, say,
> window managers are. State we do with monads.

Indeed. Ignoring the concept of a monad for the moment, you could
think of your tetris engine as a function mapping a stream of user
inputs to a stream of resulting states. ie

data Action = None | Rotate | Left | Right | Down
data State = ...

tetris :: [Action] -> [State]
tetris = scanl step

step :: State -> Action -> State
step = ...

where State would probably model the playing grid and where all the
squares are, including the current position of the falling piece.
Remember that scanl has signature equivalent to

scanl :: (s -> a -> s) -> s -> [a] -> [s]

Given some function f on states, an (infinite) list of actions and an
initial state, it will return an (infinite) list of states determined
by f and the list of actions.

The list of inputs from the user can be gotten using the 'getContents'
function, for instance. The 'tetris' function will yield new states
only as new inputs from the user are available; that's the magic of
lazyness. So you could then take this list of states and display each
to the user, as they become available. Your 'main' function would look
something like:

main = do s <- getContents
   lets actions = parseActions s
   mapM_ drawTetrisGrid (tetris actions)

where drawTetrisGrid renders a state to the screen:

drawTetrisGrid :: State -> IO ()

Some people think getContents is evil, for reasons I won't go into, in
which case another solution would probably involve a monad looking
like StateT IO, as Dons suggests. Either way, it really isn't a
problem to implement tetris in a functional style, and Haskell is
certainly up to the task!

Hope this helps,

Mathieu
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Ketil Malde
Thomas Schilling <[EMAIL PROTECTED]> writes:

>> I would advocate using a comment system that is similar to the one
>> at http://djangobook.com/. 

> I'm pretty sure Brian O'Sullivan has written a Haskell implementation of
> this for the Real World Haskell book.

While the technology is there (or will be), I worry if this is the
right solution for something else than soliciting comments on a
(fixed, non-editable) text.

I can all to easily imagine a situation where any documentation is
riddled with a plethora of notes, questions, answers, comments etc,
with nobody to clean up the mess every now and then.  For user-edited
documentation, a wiki seems a much better fit - where each author 
make some effort to leave pages as self-contained consistent
documents.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Knot tying vs monads

2007-11-20 Thread apfelmus

ChrisK wrote:

 The data dependency is circular.


Yes and no. The input and outputs pairs are dependent on each other, but 
the integer doesn't depend on the string. Thus, I'm pretty sure that


  (Int, String) -> (Int, String)

can be refactored into

  Int -> (Int, String -> String)

This is related to attribute grammars, I finally found the reference

  Designing and Implementing Combinator Languages.
  S. Doaitse Swierstra, Pablo R. Azero Alcocer, João Saraiva
  http://people.cs.uu.nl/doaitse/Papers/1999/AFP3.pdf

I'd even add  after  to the result of the functions in order to avoid 
the O(n^2) degenerate case.



In any case, I prefer Wadler's combinators. With  line  being more rigid 
than  Brk ,  nest  and  group  basically factor the monolithic  Blk 
which makes more laws and available and hence gives a more elegant 
implementation.



Regards,
apfelmus

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: user error when using Text.Regex.PCRE

2007-11-20 Thread ChrisK
Thank you very much for the error report.  I have tracked down the cause.

You are searching against an empty Bytestring.  This is now represented by

> -- | /O(1)/ The empty 'ByteString'
> empty :: ByteString
> empty = PS nullForeignPtr 0 0

And while the useAsCString and useAsCStringLen functions never reveal the null
pointer, the current library uses unsafeUseAsCStringLen, which returns the null
pointer.

And this is getting caught by a null pointer check resulting in your crash.  I
will post a fix later tonight, and announce it.

Which regex-prce version are you using?  Perhaps from hackage?  I want to
prioritize the version you need fixed.

The earlier repository holds up to version 0.81 at
http://darcs.haskell.org/packages/regex-pcre/
The newer repository holds up to version 0.92 at
http://darcs.haskell.org/packages/regex-unstable/regex-pcre/regex-pcre.cabal

Out of further curiosity:

Which version of the pcre library does it use?
And what version of ghc?
Which version of Data.ByteString?

Cheers,
  Chris Kuklewicz

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: -O2 bug in GHC 6.8.1?

2007-11-20 Thread apfelmus

Christian Maeder wrote:

good bug! -O or -O2 is irrelevant but it works if compiled with -fvia-C

You (or someone else) should add it to
http://hackage.haskell.org/trac/ghc


I guess that this is related to

  http://thread.gmane.org/gmane.comp.lang.haskell.cafe/31675

Regards,
apfelmus

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Thomas Schilling
On Tue, 2007-11-20 at 12:33 +, Krzysztof Kościuszkiewicz wrote:
> On Tue, Nov 20, 2007 at 08:55:47AM +, Simon Peyton-Jones wrote:
> 
> > But we're just not sure how to do it:
> >
> > * What technology to use?
> >
> > * Matching up the note-adding technology with the existing
> > infrastructure - GHC's user manual starts as XML and is generated into
> > HTML by DocBook - In contrast, the library documentation is generated
> > by Haddock.
> 
> I would advocate using a comment system that is similar to the one
> at http://djangobook.com/. In terms of user manual comments might be
> attached to sections and paragraphs in the document. Haddock already
> generates HTML anchors for every type, variable and class, so these are
> good candidates to attach user comments to.

I'm pretty sure Brian O'Sullivan has written a Haskell implementation of
this for the Real World Haskell book.  I guess, they will publish the
source once the book is out.  Maybe the RWH guys can give some feedback
on how this works, they seem to have very similar goals.

/ Thomas

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: -O2 bug in GHC 6.8.1?

2007-11-20 Thread Christian Maeder
good bug! -O or -O2 is irrelevant but it works if compiled with -fvia-C

You (or someone else) should add it to
http://hackage.haskell.org/trac/ghc

Christian

Brad Clow wrote:
> I upgraded from GHC 6.6.1 to 6.8.1 and around that time I noticed that
> the output from an app I am working on changed. I have distilled the
> code down to the following example that produces different output
> depending on whether it is compiled with -O2 or not:
> 
> main = do
> let (T x) = read "T 3"
> print $ f x
> print $ g x
> 
> data T = T Int deriving (Read, Show)
> 
> f x = truncate $ 2000 / fromIntegral ((x * 25) + 10)
> 
> g :: Int -> Int
> g x = f x
> 
> Here is the transcript from a shell (example code is saved in test.hs):
> 
> $ ghc --make test.hs
> [1 of 1] Compiling Main ( test.hs, test.o )
> Linking test ...
> $ ./test
> 23
> 23
> $ rm test.hi test.o test
> $ ghc -O2 --make test.hs
> [1 of 1] Compiling Main ( test.hs, test.o )
> Linking test ...
> $ ./test
> 23
> 24
> 
> It is a little disconcerting that -O2 changes the output. :-)
> 
> Regards
> brad
> 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Vladimir Zlatanov
Yes, those are good points. Maybe adding functionality similar to plt's
planet http://planet.plt-scheme.org and
http://download.plt-scheme.org/doc/371/html/mzscheme/mzscheme-Z-H-5.html#node_sec_5.4

In plt scheme including a module, not present in the local repository
, but included via planet, resolves the module, including version, etc...,
downloads it from planet, and uses it appropriately. It makes following
various dependencies extremely easy. Updating with a new version is updating
the appropriate local module definitions.

I have no clue how it would be best to implement this for haskell, but it is
a very user friendly no hassle way to work, so I reckon worth investigating.
Cheers,
Vlado
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Krzysztof Kościuszkiewicz
On Tue, Nov 20, 2007 at 08:55:47AM +, Simon Peyton-Jones wrote:

> But we're just not sure how to do it:
>
> * What technology to use?
>
> * Matching up the note-adding technology with the existing
> infrastructure - GHC's user manual starts as XML and is generated into
> HTML by DocBook - In contrast, the library documentation is generated
> by Haddock.

I would advocate using a comment system that is similar to the one
at http://djangobook.com/. In terms of user manual comments might be
attached to sections and paragraphs in the document. Haddock already
generates HTML anchors for every type, variable and class, so these are
good candidates to attach user comments to.

> * Hardest of all: evolution.  Both GHC's user manual and library docs
> change every release.  Even material that doesn't change can get moved
> (e.g. section reorganisation).  We don't want to simply discard all
> user notes!  But it's hard to know how to keep them attached; after
> all they may no longer even be relevant.  They almost certainly don't
> belong in the source-code control system.

Comments in both html user guide and library docs could be easily
cross-referenced to specific parts of docbook/haskell source. The
remaining part (and I admit, labour intensive) would be to take the
notes into consideration while updating the documentation for the next
release. This doesn't happen too often (once a year? but if I'm wrong
please tell me) and I guess the whole point of accepting user's comments
is to improve the dock - that is to let writers address the issues in
the next version.

Now, examples illustrating use of library functions - that's a different
story...

Regards,
-- 
Krzysztof Kościuszkiewicz
Skype: dr.vee,  Gadu: 111851,  Jabber: [EMAIL PROTECTED]
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Knot tying vs monads

2007-11-20 Thread John D. Ramsdell
On Nov 19, 2007 11:42 AM, apfelmus <[EMAIL PROTECTED]> wrote:

> Thanks. The interesting case of nested blocks still needs to be
> specified, but with this description in mind and judging from the code,
> I guess it behaves as follows: either a block fits entirely on the
> remaining line (no line breaks inside), or it begins a new line.


Yeah, breakdist does not look inside a block when computing the break
distance.

> On the strictness annotations, my reasons for them are the usual ones,
> primarily to prevent memory leaks due to dragging, but a performance boost
> is always welcome.  At some point, I plan to profile the code with and
> without the annotations, and find out where they are needed.

That seems excessive. Can you really prove that this will prevent space
> leaks? I doubt that.


Ooh, I think I overstated my case.  I meant to say that for my application,
there are just a few data structures, such that if data traceable from them
is strictly evaluated, I'm pretty sure I will have no space leaks.
Currently it's just an intuition, but when the application is mature, I'll
profile and validate this intuition.  All I know is it was dog slow without
any annotations, and spaying them on the suspect data structures cured that
problem.  Only careful profiling will tell which of those annotations can be
removed.

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Johan Tibell
> I would like to compare this to the GNOME development platform. It has
> Gtk+ at it's hart but GNOME releases are not synchronised with Gtk+
> releases. The GNOME development platform consists of a collection of
> standard packages. The collection is released on a time-based schedule,
> not a feature-based one. It puts a QA stamp on specific versions of its
> constituent packages that are known to work together. It has a procedure
> for getting packages included which include standards of API design and
> documentation. There is an infrastructure for maintaining, testing and
> releasing this platform.
>
> This is a model I think we should consider seriously.

This sounds like something worth trying to me. I'm trying to think of
libraries I would definitely see in such collection of libraries.
bytestring jumps to mind immediately. A fast and stable HTTP package
based on bytestring that supports developing web servers would be very
nice too (I'll work more on this when I have time). The idea is
basically that you implement a function of type:

myApp :: Application

where

type Environ = Map ByteString ByteString
type Headers = [(ByteString, ByteString)]
type Application = Environ -> IO (Headers, ByteString)

or something along those lines (i.e. a stream of user data is missing
in the above example). The point is that I want to be able to do:

import Network.WAI.Server (simpleServer)

main = simpleServer myApp

and have it just work. Sorry for the ramble. :)

Cheers,

Johan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Knot tying vs monads

2007-11-20 Thread John D. Ramsdell
Chris,

You answer was quite a bit more than I expected for a simple style
question.  Thanks.

On Nov 19, 2007 12:27 PM, ChrisK <[EMAIL PROTECTED]> wrote:

>  The data dependency is circular.


Yes, thus the need for the knot.  I gather your answer to my style question
is you prefer knot tying over monads for this particular problem.

By the way, it seems that the second line of your code was garbled, but it's
easy to figure out what you meant.

John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Duncan Coutts
On Mon, 2007-11-19 at 10:25 -0800, brad clawsie wrote:
> i would categorize myself as a purely practical programmer. i enjoy
> using haskell for various practical tasks and it has served me
> reliably. one issue i have with the library support for practical
> problem domains is the half-finished state of many fundamental
> codebases such as networking and database support. 


So far I am pretty happy with the progress we've been making with
hackage. It has massively increased the number of packages that are
easily available. Most of our problems with it are down to it being
successful so we now need more infrastructure to do searching and help
users gauge stability, whether packages work in various circumstances
etc. I think these mostly have technical solutions.


That said, I think there is a place for a Haskell development platform.
This should not be confused with GHC, though GHC obviously takes central
place in our standard tool chain. Managing GHC releases has become
increasingly difficult so we should continue the trend to reduce the
size of GHC releases and not try to synchronise them with the release of
every other part of our tool chain.

I would like to compare this to the GNOME development platform. It has
Gtk+ at it's hart but GNOME releases are not synchronised with Gtk+
releases. The GNOME development platform consists of a collection of
standard packages. The collection is released on a time-based schedule,
not a feature-based one. It puts a QA stamp on specific versions of its
constituent packages that are known to work together. It has a procedure
for getting packages included which include standards of API design and
documentation. There is an infrastructure for maintaining, testing and
releasing this platform.

This is a model I think we should consider seriously.

Duncan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] -O2 bug in GHC 6.8.1?

2007-11-20 Thread Brad Clow
I upgraded from GHC 6.6.1 to 6.8.1 and around that time I noticed that
the output from an app I am working on changed. I have distilled the
code down to the following example that produces different output
depending on whether it is compiled with -O2 or not:

main = do
let (T x) = read "T 3"
print $ f x
print $ g x

data T = T Int deriving (Read, Show)

f x = truncate $ 2000 / fromIntegral ((x * 25) + 10)

g :: Int -> Int
g x = f x

Here is the transcript from a shell (example code is saved in test.hs):

$ ghc --make test.hs
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...
$ ./test
23
23
$ rm test.hi test.o test
$ ghc -O2 --make test.hs
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...
$ ./test
23
24

It is a little disconcerting that -O2 changes the output. :-)

Regards
brad

-- 
www.scoodi.com
Contribute things you don't need and find things you do, all within
your local community.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Yampa Arcade: source code available?

2007-11-20 Thread Peter Verswyvelen
Thanks for the feedback. Unfortunatly the Space Invaders game uses HGL, 
which is not supported on Windows anymore. Is it supported on Linux?


Frag does compile and run on Windows using GHC 6.6.1, so that might be a 
better starting point.


What is the current consensus regarding (A)FRP? Is it a dead end? Are 
approaches like Modelica  better 
suited for the job?


From the point of view of a veteran assembly/C++ game hacker like 
myself, it is funny to see that the same problems popup when doing 
"reactive programming" in a pure language like Haskell or an imperative 
language like C++... Recursive dependencies are problematic, be it with 
signals in FRP or with objects in C++. In videogames using an imperative 
language, this is often solved by just adding a global "single frame" 
delay between what is read and what is written. Ugly, but works in many 
cases. Or a third object is introduced that breaks the recursive 
dependency between the two problematic objects. If I'm correct, when 
switching from FRP to AFRP signals (type Signal a = Time -> a) are no 
first class values anymore, only signal functions (type SF a b = Signal 
a -> Signal b) are first class. Furthermore the handling of recursive 
dependencies/feedback is done solely in a loop arrow.


I must say it is frustratring. I finally got to understand FRP from the 
SOE book, only to find out that it is not really the way to go ;-) Now 
I'm trying to grasp AFRP. It is incredibly interesting stuff, but for a 
not-so-abstract-thinking-average programmer like me, it is not an 
obvious task. Maybe *using* AFRP is easier than understanding the inner 
details...


Maybe it would be a good idea for the community if someone (maybe me, if 
I find the time ;-) to write a very very simple game using AFRP and GHC 
6.8.1? Even simpler than the Space Invaders game (which does not work 
anymore anyway), but which does show dynamic collections and switching? 
Maybe like Andrew Coppin mentioned, a very simple Tetris clone? Of 
course, this is not legal, Tetris is copyrighted, but maybe for tutorial 
purposes it can be allowed :)


Don Stewart wrote:

sk:
  

On 19.11.2007, at 19:54, Peter Verswyvelen wrote:

I can find the paper, but is the source code for that Space  
Invaders alike game also available somewhere?
  

it's included here: http://haskell.org/yampa/afrp-0.4-src.tgz

btw, does anybody know what's the current state of affairs with yampa/ 
afrp? is the framework still developed further?



Can we get this uploaded to hackage? 


-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


  


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Duncan Coutts
On Tue, 2007-11-20 at 13:45 +0300, Bulat Ziganshin wrote:
> Hello Brandon,
> 
> Tuesday, November 20, 2007, 1:15:34 AM, you wrote:
> 
> >>> The ability to "vote" on packages might be interesting here.  If
> >>> there's 4 HTML libraries and one of them gets lots of votes, it's
> >>> probably the one to look at first.
> 
> it can be made easy and automatic by just publishing "number of
> downloads" on hackage
> 
> what hackage developers will say?

Yes please! Please contribute the feature.

Grab the hackage code from:

http://darcs.haskell.org/hackage-scripts/

Send patches to the cabal-devel mailing list. Everyone is most welcome
to subscribe too.

Another thing I'd like to see coming out of this discussion is some
feature requests filed in the hackage trac with a summary of some of our
conclusions:

http://hackage.haskell.org/trac/hackage/

Duncan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Duncan Coutts
On Mon, 2007-11-19 at 21:49 -0800, Bryan O'Sullivan wrote:
> Neil Mitchell wrote:
> 
> >> - The packages seem to be of quite variable quality. Some are excellent,
> >> some are rather poor (or just not maintained any more).
> > 
> > The problem is that only one person gets to comment on the quality of
> > a library, the author, who is about the least objective person.
> 
> Not necessarily.  CPAN has a nice voting system for packages, which is 
> quite widely used.
> 
> Another useful proxy for quality that CPAN is missing is download 
> statistics.  The maintainers handwave about this being due to the wide 
> geographic distribution of mirrors, but  I think that any download 
> statistics would be better than none.

I'd like to see hackage maintain download stats and have cabal-install
report build success and failures (with build logs) along with basic
config info like versions of deps, platform, compiler etc.

This could make a great distributed testing system.

> Clearly, we can do both of these things with Hackage, and I think they'd 
> be very useful (particularly the voting).  Another small but useful 
> thing that Hackage is missing is a notion of how fresh a package is. 
> You have to hand-construct an URL to get a directory listing from Apache 
> to find out how old a particular release a tarball is.

Yes, I would like to see activity info for each package. What I'd really
like to see is each package linking to it's darcs repo and generating an
activity graph using dons's darcs-graph program. Though I'd also like to
annotate the graph with marks for each release.

Duncan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: How to abort a computation within Continuation Monad?

2007-11-20 Thread Gleb Alexeyev

Dimitry Golubovsky wrote:


If I have

callCC $ \exit -> do
  foo
...

I cannot jump to `exit' from within foo unless `exit' is given to foo
as an argument.

 As Derek Elkins has written, one of the options is to use delimited 
continuations, see 
http://research.microsoft.com/~simonpj/papers/control/ for Haskell 
implementation.


But in this case Cont may be enough. If you don't like passing `exit' 
explicitly, you can put in into Reader monad. This is the idea:



import Control.Monad.Cont
import Control.Monad.Reader

type Abortable r a = ReaderT (r -> Cont r r) (Cont r) a

runAbortable :: Abortable a a -> a
runAbortable m = runCont (callCC $ \exit -> runReaderT m exit) id

abort :: r -> Abortable r a
abort x = do
  exit <- ask
  lift (exit x)
  undefined -- this hack is needed to make abort polymorphic

test a b c = do
  x <- if a then abort "a" else return 1
  y <- if b then abort "b" else return False
  z <- foo c   -- calling foo without explicit abort continuation
  return $ show (x, y, z)
  where foo True = abort "c"
foo False = return 5.39

run m = putStrLn (runAbortable m)

main = do run (test False False False)
  run (test False False True)
  run (test False True False)
  run (test True False False)

--

This implementation is a bit hackish, since it uses undefined to make 
abort polymorphic in return type. You can use rank-2 types to avoid it, 
see http://www.vex.net/~trebla/tmp/ContMonad.lhs by Albert C. Lai.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tetris

2007-11-20 Thread Jon Harrop
On Monday 19 November 2007 22:12, Don Stewart wrote:
> Check the thesis on Frag for a pure approach, or just use StateT IO.

Has Frag been fixed to work on x86-64?

-- 
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/mailman/listinfo/haskell-cafe


Re[2]: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Bulat Ziganshin
Hello Brandon,

Tuesday, November 20, 2007, 1:15:34 AM, you wrote:

>>> The ability to "vote" on packages might be interesting here.  If
>>> there's 4 HTML libraries and one of them gets lots of votes, it's
>>> probably the one to look at first.

it can be made easy and automatic by just publishing "number of
downloads" on hackage

what hackage developers will say?



-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re[2]: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Bulat Ziganshin
Hello Andrew,

Monday, November 19, 2007, 10:47:49 PM, you wrote:

> - (And, since I'm on Windows, I can't seem to get anything to install
> with Cabal...)

with ghc 6.4/6.6 and their built-in Cabal version, i never seen
problems. sorry, can't say anything about 6.8 and new Cabal

-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Fun with Cabal on Windows! [Stream fusion for Hackage]

2007-11-20 Thread Radosław Grzanka
Hi,

I have same problem.

> Hm, this actually is supposed to work.  Could you please re-run this
> procedure with the original path and with maximum verbosity?  I.e.:
>
>   > runhaskell Setup configure -v3

Here is the problem:

D:\private\haskell\MaybeT-0.1.0>runghc Setup.hs configure -v3
Configuring MaybeT-0.1.0...
Creating dist (and its parents)
C:\ghc\ghc-6.8.1\bin\ghc.exe --numeric-version
looking for package tool: ghc-pkg near compiler in C:\ghc\ghc-6.8.1\bin
found package tool in C:\ghc\ghc-6.8.1\bin\ghc-pkg.exe
C:\ghc\ghc-6.8.1\bin\ghc-pkg.exe --version
Setup.hs: ld is required but it could not be found.

I took a liberty of filing this in bug report for cabal.
http://hackage.haskell.org/trac/hackage/ticket/182

Thanks,
  Radek.

-- 
Codeside: http://codeside.org/
Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Translations and Haskell

2007-11-20 Thread Duncan Coutts
On Mon, 2007-11-19 at 23:18 -0200, Felipe Lessa wrote:
> Hello,
> 
> I'd like to start a project using Gtk2Hs and one thing is concerning
> me: what's the current approach on writing portable and translatable
> GUI programs in Haskell?

For the simple case of translating strings in a .glade UI, glade
provides a method for that. For translating strings generated by your
own code you need something else, like Jeremy's suggestion.

Duncan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] RFC: demanding lazy instances of Data.Binary

2007-11-20 Thread Duncan Coutts
On Mon, 2007-11-19 at 20:06 -0600, Nicolas Frisby wrote:
> In light of this discussion, I think the "fully spine-strict list
> instance does more good than bad" argument is starting to sound like a
> premature optimization. Consequently, using a newtype to treat the
> necessarily lazy instances as special cases is an inappropriate
> bandaid. 

I agree.

> My current opinion: If Data.Binary makes both a fully strict list
> instance (not []) and a fully lazy list instance (this would be the
> default for []) available, then that will also make available all of
> the other intermediate strictness. I'll elaborate that a bit. If the
> user defines a function appSpecificSplit :: MyDataType -> [StrictList
> a], then the user can control the compactness and laziness of the
> serialisation by tuning that splitting function. Niel's 255 schema
> fits as one particular case, the split255 :: [a] -> [StrictList a]
> function. I would hesitate to hard code a number of elements, since it
> certainly depends on the application and only exposing it as a
> parameter maximizes the reusability of the code. 

Fully lazy is the wrong default here I think. But fully strict is also
not right. What would fit best with the style of the rest of the
Data.Binary library is to be lazy in a lumpy way. This can give
excellent performance where as being fully lazy cannot (because the
chunk size becomes far too small which increases the overhead).

Has anyone actually said they want the list serialisation to be fully
lazy? Is there a need for anything more than just not being fully
strict? If there is, I don't see it. If it really is needed it can be
added just by flushing after serialising each element.

> "Reaching for the sky" idea: Does the Put "monad" offer enough
> information for an instance to be able to recognize when it has filled
> a lazy bytestring's first chunk? It could cater its strictness ( i.e.
> vary how much of the spine is forced before any output is generated)
> in order to best line up with the chunks of lazy bytestring it is
> producing. This might be trying to fit too much into the interface.
> And it might even make Put an actual monad ;) 

That is something I've considered. Serialise just as much of the list as
is necessary to fill the remainder of a chunk. Actually we'd always fill
just slightly more than a chunk because we don't know how big each list
element will be, we only know when we've gone over.

Duncan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] RFC: demanding lazy instances of Data.Binary

2007-11-20 Thread Duncan Coutts
On Mon, 2007-11-19 at 20:22 -0600, Nicolas Frisby wrote:
> On Nov 19, 2007 4:16 PM, Duncan Coutts <[EMAIL PROTECTED]> wrote:
> >
> > On Mon, 2007-11-19 at 13:39 -0800, Don Stewart wrote:
> > > nicolas.frisby:
> 
> *snip*
> 
> > > >
> > > >1) The fact that serialisation is fully strict for 32760 bytes but 
> > > > not for
> > > >32761 makes the direct application of strictCheck intractable. Do 
> > > > you have
> > > >any ideas how to circumvent that?
> >
> > Test using a much smaller chunk size. I'd test sizes from 1 to something
> > like one more than the machine word size.
> >
> 
> Let me clarify "circumvent that." strictCheck uses a bounded search
> starting at 1 and proceeds to some limit. The Binary instance used in
> the example was the fully lazy one for lists: a get/putWord8 for each
> constructor. Even so, it was effectively spine-strict up to 32k bytes
> (which was 32k elements b/c of the use of unit) because (I think that)
> the first chunk of the lazy bytestring wasn't being generated by
> encode until it was full. If you asked strictCheck to go from 1 to
> 32k, I don't think it would finish. So by circumvent, I mean: How can
> we apply the essential ideas of strictCheck when our chunks are so
> big?

We don't. We test it with a variety of small chunk sizes. That is the
sensible thing to do.

> Obviously, the iterative search cannot just proceed by one
> element at a time; but then we lose the obvious meaning of "add one
> more _|_. I don't see an obvious candidate for how to alter the
> _|_-ridden test vector generation. Moreover, it's "proposed output" is
> wrong when considered from the Big Chunks perspective--we don't
> necessarily want Chitil's least strictness.

Indeed. As I've said, Data.Binary is lazy but in a chunky way where
within each chunk it is strict.

> > Sequences are like spine strict lists. Sets are strict in as much as the
> > element type's (==) function is strict.
> >
> Let me refine how I posed that question. A predicate: if you enter
> "Package.fromList [1..]" at the ghci prompt and you get no
> intermediate results, then that was a "strict type." 

Right, because (==) for Int is strict, and Set.fromList uses (==) on
each element. Sorry, I was just being pedantic by saying that it depends
on the strictness of (==).

> I'm assuming that if the Show instance doesn't produce intermediate
> results, then the serialisation technique can't handle intermediate
> results (i.e. chunking) either--at least not in a general enough way
> to include it in a library.

So if you did this test with my proposed list instance (and you somehow
slowed your computer right down so you could see what was going on)
you'd see it wait a sec, then print out 32k of serialised list elements,
then wait again and emit another chunk. So lazy, but in strict chunks.

Duncan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: expanded standard lib

2007-11-20 Thread apfelmus

Simon Peyton-Jones wrote:

| > the php documentation has "user contributed notes" where people can leave
| > sniplets of useful code as comments, eg
|
| > http://www.php.net/manual/en/introduction.php
|
| > I think this is a very nice feature.
|
| I would love to have this on haskell, especially because the
| documentation often lack example(s)

We've discussed this a couple of times at GHC HQ, at least in relation to GHC's
user manual and library documentation.  It's a *great* idea, because it
allows everyone to improve the documentation.

But we're just not sure how to do it:

* What technology to use?

* Matching up the note-adding technology with the existing infrastructure
- GHC's user manual starts as XML and is generated into HTML by DocBook
- In contrast, the library documentation is generated by Haddock.

* Hardest of all: evolution.  Both GHC's user manual and library docs
change every release.  Even material that doesn't change can get
moved (e.g. section reorganisation).  We don't want to simply discard all
user notes!  But it's hard to know how to keep them attached; after all
they may no longer even be relevant.  They almost certainly don't belong
in the source-code control system.


If someone out there knows solutions to these challenges, and would like
to help implement them, we'd love to hear from you.  Accurate documentation,
with rich cross-links (e.g. to source code), and opportunities for the
community to elaborate it, is a real challenge for a language the size of
Haskell and its libraries.


What technology to use, that's the *key* question. If we forget 
everything what we currently can do with a computer and instead imagine 
what we could do, the answer would probably be:


The documentation / source code can be edited directly while viewing it 
(i.e. Wiki + WYSIWYG). Moreover, it's possible to attach lots of 
Post-It® notes to sections / paragraphs / sentences with scribbled 
comments / questions / remarks about content / administrative tasks. 
Those notes can be hidden to get a clean view. A wiki is rather 
centralized, so a form of decentralization / version control à la darcs 
is needed, at least for some parts like the source code. Last but not 
least, there's a tension between quality and "editable by everyone", so 
some form of access control is mandatory and further means to ensure 
quality are needed, that's the hard part.


The above ideal is entirely realizable, just not with existing 
technology like web-browsers / text editors . For instance, it's 
desirable to be able to edit source / haddock with a text editor like 
right now. But one would also like to edit it right in the (generalized) 
web-browser. Ideally, one could just pipe the underlying document 
through a lens


  data Lens s a = Lens { get :: s -> a; set :: a -> (s -> s); }

  text:: Lens HaskellDocument ASCII
  browser :: Lens HaskellDocument Html

so that the edits in the view are reflected in the document. (Same for 
IDEs or GUIs or whatever).



Regards,
apfelmus

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Bayley, Alistair
> | > the php documentation has "user contributed notes"
> | > http://www.php.net/manual/en/introduction.php
> | > I think this is a very nice feature.
> 
> 
> * Hardest of all: evolution.  Both GHC's user manual and 
> library docs change every release.  Even material that 
> doesn't change can get moved (e.g. section reorganisation).  
> We don't want to simply discard all user notes!


Just for comparison: PostgreSQL's site has a similar feature
(http://www.postgresql.org/docs/manuals/). However, they don't appear to
migrate user notes between documentation versions e.g.

  these pages from 8.1 have comments:
  http://www.postgresql.org/docs/8.1/interactive/rules.html
  http://www.postgresql.org/docs/8.1/interactive/user-manag.html

  the equivalent pages from 8.0 have no/different comments:
  http://www.postgresql.org/docs/8.0/interactive/rules.html
  http://www.postgresql.org/docs/8.0/interactive/user-manag.html

So that could be a starting point, but it does seem a bit
unsatisfactory.

Alistair
*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HTTP actions & proxy server

2007-11-20 Thread Jim Burton

Thank you, that's perfect.

Jim 

stefan kersten-2 wrote:
> 
> On 16.11.2007, at 13:55, Jim Burton wrote:
>> The docs say "Should be of the form http://host:port, host,  
>> host:port, or
>> http://host"; but none of the variations work. Any ideas where I  
>> might find
>> an example of code that does this?
> 
> this works for me (modulo error handling):
> 
> simpleHTTP' :: Request -> IO (Result Response)
> simpleHTTP' req = do
>  proxy <- catch
>  (getEnv "HTTP_PROXY" >>= return . (flip Proxy Nothing))
>  (\_ -> return NoProxy)
>  (_, resp) <- browse (setProxy proxy >> request req)
>  return (Right resp)
> 
> i.e. run the request in the browser monad.
> 
> 
> 
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 

-- 
View this message in context: 
http://www.nabble.com/HTTP-actions---proxy-server-tf4815272.html#a13853610
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Radosław Grzanka
Hi,

> * Hardest of all: evolution.  Both GHC's user manual and library docs change 
> every release.  Even material that doesn't change can get moved (e.g. section 
> reorganisation).  We don't want to simply discard all user notes!  But it's 
> hard to know how to keep them attached; after all they may no longer even be 
> relevant.  They almost certainly don't belong in the source-code control 
> system.

Just random idea: Voting for notes (vote for 'inaccurate',
'deprecated' etc.)? Something along the lines of social sites like
digg.com or others? The comments which gets to some threshold could be
simply hidden by default because probably they are inaccurate or
deprecated? And then clean up bot comes once in a while etc. etc.

Ofcourse this would work for online docs only.

Thanks,
  Radek.

-- 
Codeside: http://codeside.org/
Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Mikhail Gusarov
Simon Peyton-Jones <[EMAIL PROTECTED]> writes:

> * Hardest of all: evolution.  Both GHC's user manual and library docs
> change every release.  Even material that doesn't change can get moved
> (e.g. section reorganisation).  We don't want to simply discard all
> user notes!  But it's hard to know how to keep them attached; after
> all they may no longer even be relevant.  They almost certainly don't
> belong in the source-code control system.

I've had a discussion with AltLinux team members, which are trying to
solve the similar problem: they need to mark user-provided content in
their wiki as "obsolete" as the time passes.

Solution we've found so far looks like this:

- Author of comment may change it anytime.

- Every comment has 'added/modified for version X.Y' tag, which is
  changed to the current version when author changes the comment
  (probably just saying "still valid for new version" in interface).

This scheme may be too restrictive and can be relaxed, so not only
author may change the comments, but other users too.

-- 
JID: [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Simon Peyton-Jones
| > the php documentation has "user contributed notes" where people can leave
| > sniplets of useful code as comments, eg
|
| > http://www.php.net/manual/en/introduction.php
|
| > I think this is a very nice feature.
|
| I would love to have this on haskell, especially because the
| documentation often lack example(s)

We've discussed this a couple of times at GHC HQ, at least in relation to GHC's 
user manual and library documentation.  It's a *great* idea, because it allows 
everyone to improve the documentation.

But we're just not sure how to do it:

* What technology to use?

* Matching up the note-adding technology with the existing infrastructure
- GHC's user manual starts as XML and is generated into HTML by DocBook
- In contrast, the library documentation is generated by Haddock.

* Hardest of all: evolution.  Both GHC's user manual and library docs change 
every release.  Even material that doesn't change can get moved (e.g. section 
reorganisation).  We don't want to simply discard all user notes!  But it's 
hard to know how to keep them attached; after all they may no longer even be 
relevant.  They almost certainly don't belong in the source-code control system.


If someone out there knows solutions to these challenges, and would like to 
help implement them, we'd love to hear from you.  Accurate documentation, with 
rich cross-links (e.g. to source code), and opportunities for the community to 
elaborate it, is a real challenge for a language the size of Haskell and its 
libraries.

Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] More accessible papers

2007-11-20 Thread Ketil Malde
Peter Verswyvelen <[EMAIL PROTECTED]> writes:

> Most research papers have the same layout: two columns per A4
> page. They mostly come as PDF or PS.

I think it is (more and more) common these days for journals to
publish an HTML version on their web site.  Otherwise I'd suggest
e-mailing the author and asking for a single-column version (or
whatever you need), or at least LaTeX sources or other editable
version. 

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Brandon S. Allbery KF8NH


On Nov 20, 2007, at 3:25 , Ketil Malde wrote:


"Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> writes:



Only up to a point; not all programs written using such libraries are
necessarily going to end up on hackage.  (Consider the code written
by the financials folks that have been mentioned here various times;


I don't see that as a problem -- if you don't contribute, you don't
get to vote.


Well, except it's not the person who has been disenfranchised who is  
losing here; it's the folks who might benefit from their experience  
using it.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] expanded standard lib

2007-11-20 Thread Ketil Malde
"Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> writes:

>> Kind of like Google PageRank for libraries.

Yes.

> Only up to a point; not all programs written using such libraries are
> necessarily going to end up on hackage.  (Consider the code written
> by the financials folks that have been mentioned here various times;

I don't see that as a problem -- if you don't contribute, you don't
get to vote.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe