[Haskell-cafe] Building Yi (and wider Cabal stuff)

2007-06-16 Thread Michael T. Richter
I'm trying to build Yi (from the darcs repository) to take a look at it.
The README that comes with it says "it's a standard Cabal project so do
what you normally do" (paraphrased slightly).  The problem is that I'm
not a cabal user just yet and have no idea where to go from here.  Just
throwing caution to the wind and typing "make" built a setup program
which was then executed and failed complaining about not having
yi-lib0.3 (which I kind of thought the project should be building for
me) and such.  Editing the config.mk (which has some options left almost
entirely undocumented) got me a step farther (specifically giving it a
prefix that actually existed), but then had it choking out that it
couldn't find the vty library -- even when I specifically told it to
build the gtk version.

Is there some painfully obvious thing I'm missing in trying to build
this?  And is it something that's applicable in the broader Cabal world
or is it just this project?  Compiling GHC (which is a lot bigger and
more complex, I'd have guessed) was painless in comparison, so I'm kind
of in the dark here.

-- 
Michael T. Richter <[EMAIL PROTECTED]> (GoogleTalk:
[EMAIL PROTECTED])
If there's one thing that computers do well, it's to make the same
mistake uncountable times at inhuman speed. (Peter Coffee)


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: Re[2]: [Haskell-cafe] IDE?

2007-06-16 Thread PeterV
Indeed, that's what I forgot to mention, Resharper in Visual Studio 2005
does that for C#, IntelliJ & Eclipse for Java. You rarely need compilation,
its syntax checker runs inplace and incrementally and shows you the errors
and warning in the right margin. That saves you a lot of time. 

For Haskell, the Eclipse plugin should do something like that, at least
every time you save. http://eclipsefp.sourceforge.net But I never got it to
work with GHC (only GHCI/Hugs), I tried on 3 different machines (on
Windows). 

I also guess this should not be too difficult to implement in Emacs... for
someone how knows Emacs that is. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Christopher Lane
Hinson
Sent: Sunday, June 17, 2007 12:15 AM
To: haskell-cafe@haskell.org
Subject: Re: Re[2]: [Haskell-cafe] IDE?


While we're on the topic of IDE features.

I wish to have an editor that ran GHC[I] every few seconds or so, and 
underlined sites of syntax errors in red.  This would save me a lot of 
back-and-forth.  If an editor did this, I would switch (from kate) in a 
heartbeat.

This has been mentioned before in only one place that I can find:

http://compilers.iecc.com/comparch/article/99-09-067

Yeah, I could do it myself.

--Lane
___
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] IDE?

2007-06-16 Thread Gour
On Sat, 16 Jun 2007 19:16:11 +0200
Marc Weber <[EMAIL PROTECTED]> wrote:

> This is what shim tries to do.
> I've added a link to the wiki IDE page.

Is some (more) support for vim in shim planned?


Sincerely,
Gour



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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Michael T. Richter
On Sat, 2007-16-06 at 00:24 +0200, Marc Weber wrote:

> > - syntax highlighting
> Many editors do support this. (JEdit, vim, emacs, kedit,..)


With the caveat that syntax highlighting is broken out of the box in
vim.  It works fine for plain .hs files but breaks -- and badly -- for
latex-literate .lhs files.  I'm sure you can go hacking around to find
the problem and fix it, but it really is an entry barrier if you're not
already a vim addict.

-- 
Michael T. Richter <[EMAIL PROTECTED]> (GoogleTalk:
[EMAIL PROTECTED])
All really first class designers are both artists, engineers, and men of
a powerful and intolerant temper, quick to resist the least modification
of the plans, energetic in fighting the least infringement upon what
they regard as their own sphere of action. (Nevil Shute)


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Efficient signal processing

2007-06-16 Thread Donald Bruce Stewart
simonmarhaskell:
> Henning Thielemann wrote:
> 
> >The program is compiled with GHC-6.4 and option -O2, CPU clock 1.7 GHz.
> 
> ByteString is much faster with GHC 6.6, IIRC.  We optimised the 
> representation of ForeignPtr, and ByteString takes advantage of that.  I 
> recommend upgrading.

Yes, a 2x speedup isn't uncommon. ByteString is even faster with the GHC
head, branch, given the cranked up rules and constructor specialisation.

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Donnchadh Ó Donnabháin

  Hi Peter,

I'm also just starting to learn Haskell and tried the eclipsefp
eclipse plugin [1] (since my day job is java development). It seems a
little basic at the moment, but judging from this blog [2] it seems to
have a lot of potential. In fact part of the project seems to be to
allow the development of eclipse plugins written in haskell, which
could allow the possibility of integrating some of the tools listed on
the haskell wiki with it.

I also tried eclipsedarcs [3] for darcs repository access but it only
really seems to work with local repositories.

  Donnchadh

[1] http://eclipsefp.sourceforge.net/haskell/index.html
[2] http://cohatoe.blogspot.com/
[3] http://eclipsedarcs.org/doku.php
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] IDE?

2007-06-16 Thread Claus Reinke
I wish to have an editor that ran GHC[I] every few seconds or so, and 
underlined sites of syntax errors in red.  This would save me a lot of 
back-and-forth.  If an editor did this, I would switch (from kate) in a 
heartbeat.


in vim, that's called quickfix mode, and vim is certainly not the only
editor to provide such a feature. you need to specify the format of
GHC error messages, and how to call GHCi, then ':make' will call
GHCi on the current file, store and parse any error messages, and
provide them in a quickfix window (:help quickfix). from each error,
you can jump directly to the corresponding source location, or you
can jump through the list or errors, with the current error message
shown in the quickfix window.

http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix

i wouldn't recommend running that kind of check automatically at
arbitrary moments in your editing process, but you can if you want, 
using autocommands (:help :autocmd), and since the list of error 
locations is available (:help getqflist()), you could highlight them 
directly in the source as well if you wanted to..


claus

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


Re: [Haskell-cafe] Xlib: problem creating a window with override_redirect set

2007-06-16 Thread Andrea Rossato
On Sat, Jun 16, 2007 at 11:39:51PM +0200, Andrea Rossato wrote:
> On Sat, Jun 16, 2007 at 07:03:24PM +0200, Andrea Rossato wrote:
> > Hi,
> > 
> > I'm trying, without success, to create a window with the attribute
> > override_redirect set to True (this way the window manager should not
> > take care of it). Obviously with Xlib (X11-1.2.2).
> 
> 
> just for the sake of documentation, this is the solution I've been able to
> find thans to the help of the guys of the xmonad comunity.

I was thinking about the quality of the documentation I have left
behind.

by the way, the bottom line is that I was trying to manipulate a
foreign structure (from the Xlib) getting it out of where it belongs
with this trick by the means of allocaSetWindowAttributes:

attributes <- allocaSetWindowAttributes (\s -> return $ s )

attributes resulted garbage but the compiler did not complain.

the right thing to do is to manipulate it from within the place where
it was possible for the two of you to meet:
window <- allocaSetWindowAttributes $
\attributes -> do
and do what ever you want to do.

I don't know if now it is clearer than before, but hopefully that
could be that case for someone searching for xlib and
overright_redirect.
hopefully.
andrea
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] IDE?

2007-06-16 Thread Stefan O'Rear
On Sat, Jun 16, 2007 at 06:14:38PM -0400, Christopher Lane Hinson wrote:
> 
> While we're on the topic of IDE features.
> 
> I wish to have an editor that ran GHC[I] every few seconds or so, and 
> underlined sites of syntax errors in red.  This would save me a lot of 
> back-and-forth.  If an editor did this, I would switch (from kate) in a 
> heartbeat.
> 
> This has been mentioned before in only one place that I can find:
> 
> http://compilers.iecc.com/comparch/article/99-09-067
> 
> Yeah, I could do it myself.

Shim *almost* does this; it has a key command to run GHC and highlight
all the syntax and type errors, on mouseover displaying the error
message.  Someone experienced with Emacs could probably set up the
automation easily...

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


Re: Re[2]: [Haskell-cafe] IDE?

2007-06-16 Thread Christopher Lane Hinson


While we're on the topic of IDE features.

I wish to have an editor that ran GHC[I] every few seconds or so, and 
underlined sites of syntax errors in red.  This would save me a lot of 
back-and-forth.  If an editor did this, I would switch (from kate) in a 
heartbeat.


This has been mentioned before in only one place that I can find:

http://compilers.iecc.com/comparch/article/99-09-067

Yeah, I could do it myself.

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


Re: [Haskell-cafe] Xlib: problem creating a window with override_redirect set

2007-06-16 Thread Andrea Rossato
On Sat, Jun 16, 2007 at 07:03:24PM +0200, Andrea Rossato wrote:
> Hi,
> 
> I'm trying, without success, to create a window with the attribute
> override_redirect set to True (this way the window manager should not
> take care of it). Obviously with Xlib (X11-1.2.2).


just for the sake of documentation, this is the solution I've been able to
find thans to the help of the guys of the xmonad comunity.

thanks for your kind attentions.

andrea

the bits:

module Main where

import Graphics.X11.Xlib
import Graphics.X11.Xlib.Misc

import Control.Concurrent
import Data.Bits

main = test

test = do
  dpy   <- openDisplay ""
  let dflt = defaultScreen dpy
  rootw  <- rootWindow dpy dflt
  win <- mkUnmanagedWindow dpy (defaultScreenOfDisplay dpy) rootw 0 0 100 100 
0x00
  mapWindow dpy win
  sync dpy True
  threadDelay $ 2 * 100

mkUnmanagedWindow dpy scr rw x y h w bgcolor = do
  let visual = defaultVisualOfScreen scr
  attrmask = cWBackPixel 
 .|. cWOverrideRedirect
  window <- allocaSetWindowAttributes $ 
\attributes -> do
  set_background_pixel attributes bgcolor
  set_override_redirect attributes True
  createWindow dpy rw x y w h 0 (defaultDepthOfScreen scr)
  inputOutput visual attrmask attributes
  return window
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re[4]: [Haskell-cafe] IDE?

2007-06-16 Thread Bulat Ziganshin
Hello Peter,

Sunday, June 17, 2007, 12:34:43 AM, you wrote:

> nowadays have with Visual Studio 2005 and Resharper for doing
> compilation, code-documentation-tips, code-completion, refactoring,
> navigation, debugging, boiler plate code generation, is amazing.

with emacs/vim you will get compilation and error positioning, code
templates, names completion, navigation. refactoring area isn't really
developed in Haskell land, although Pragmatica has such tools

there is less need in debugging. also, Haskell uses very small amount
of syntax sugar. don't know how documenting works in today IDEs, i
just add "-- |..." before every function :)

try to use WinHugs together with editor, it's very friendly
environment. this summer successor of WinHugs with GHC support will be
developed: http://neilmitchell.blogspot.com/2007/04/soc-guihaskell.html .

as one already said, GHC HEAD now includes imperative debugger

so, there is no "one size fits all", but everyone compose his own IDE
from tools one need :)  in 90's i've seen packages that installed
bunch of software required to live in FIDO. may be, it's a time to
develop Haskell "IDE" installer?


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Jon Harrop
On Saturday 16 June 2007 21:34:43 Peter Verswyvelen wrote:
> That's just my point. Although I have no practical experience with Haskell
> (besides writing a simple L-System using HOpenGL), from what I've read
> Haskell is indeed much better than typical OO languages... So it *deserves*
> an easy entry level IDE that will get many many more people started with
> it. Like Concurrent Clean has, although their IDE is also far from perfect
> (e.g. they don't have multi-level undo, sigh)

I'm quite surprised by this. I have found Visual Studio to be very slow and 
buggy in comparison.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] IDE?

2007-06-16 Thread Peter Verswyvelen
That's just my point. Although I have no practical experience with Haskell 
(besides writing a simple L-System using HOpenGL), from what I've read Haskell 
is indeed much better than typical OO languages... So it *deserves* an easy 
entry level IDE that will get many many more people started with it. Like 
Concurrent Clean has, although their IDE is also far from perfect (e.g. they 
don't have multi-level undo, sigh)

Anyway, it seems many people use Emacs for their Haskell edit/compile/run 
cycle. I've used Emacs on IBM OS/2 a long time ago so I guess I can get back 
into it. But man, was I happy back then when I could switch over to Visual 
Studio... The productivity I nowadays have with Visual Studio 2005 and 
Resharper for doing compilation, code-documentation-tips, code-completion, 
refactoring, navigation, debugging, boiler plate code generation, is amazing. 
Some of my colleagues still use Emacs, and maybe they are not using it 
correctly, but at first sight their development is much much slower.

>From this cafe talk I now know such an IDE for Haskell does not exist. So I 
>won't search any further for a great IDE before starting to do some real 
>Haskell programming, because my L-Systems experiment was a lot of fun!

So I just installed XEmacs with the latest Haskell mode. I'll go from here... 
If that doesn't work, Notepad++ and GHCI/GHC in a command prompt also works, 
although it does make me feel I'm back in the eighties.

Thanks for all the help folks!

>- Oorspronkelijk bericht -
>Van: Bulat Ziganshin [mailto:[EMAIL PROTECTED]
>Verzonden: zaterdag, juni 16, 2007 08:50 PM
>Aan: [EMAIL PROTECTED]
>CC: haskell-cafe@haskell.org
>Onderwerp: Re[2]: [Haskell-cafe] IDE?
>
>Hello bf3,
>
>Saturday, June 16, 2007, 3:23:40 PM, you wrote:
>
>> The point I wanted to make is, that I can't find an
>> easy-to-install-ready-to-use-and-rock-n-roll IDE for Windows that comes with
>> all or most of those features. I mean something like Borland TurboPascal
>
>it's well-known trap. haskell is an order of magnitude better than
>widespread OOP languages. why it's not used by everyone? just due to
>shortage on libs, training and - yes - IDEs. "programming" in Delphi
>in many cases need just clicking here and there
>
>so, you got something, you lost something
>
>ps: i use editor which supports only syntax highlighting. it's very
>like working in tp 3.0 or quickc 1.0 - are you had such experience? :)
>
>
>
>--
>Best regards,
> Bulatmailto:[EMAIL PROTECTED]
>
>
>


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


Re: [Haskell-cafe] hSetBuffering woes

2007-06-16 Thread Eric

Bryan O'Sullivan wrote:

Eric wrote:

I've converted to lazy bytestrings. After reading in the bytes from a 
network connection I want to save them to a file but now the 
appendFile function blocks:


Well, yes.  It's presumably waiting for data from the network 
connection, because it wants to write out the entire ByteString, and 
whoever you're receiving data from hasn't closed the connection.


If you stepped back and stated the more general problem you are trying 
to solve, we could help you more effectively.


I'm writing  a simple HTTP server and am trying to implement the POST 
method.


E.

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


Re: [Haskell-cafe] hSetBuffering woes

2007-06-16 Thread Bryan O'Sullivan

Eric wrote:

I've converted to lazy bytestrings. After reading in the bytes from a 
network connection I want to save them to a file but now the appendFile 
function blocks:


Well, yes.  It's presumably waiting for data from the network 
connection, because it wants to write out the entire ByteString, and 
whoever you're receiving data from hasn't closed the connection.


If you stepped back and stated the more general problem you are trying 
to solve, we could help you more effectively.


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


Re: [Haskell-cafe] hSetBuffering woes

2007-06-16 Thread Eric

Bryan O'Sullivan wrote:

Eric wrote:

I tried to turn off buffering with the command hSetBuffering (from 
System.IO) but my app still blocks on hGetContents (from 
Data.ByteString). Does anyone know what's happening?


The hGetContents function can't behave the way you want, because it's 
defined to return the entire rest of the input stream.


If you want to stick with strict ByteStrings, use hGetNonBlocking 
instead, but you'll need to block between reads of the handle 
yourself, using System.IO.hWaitForInput.


Otherwise, use lazy ByteStrings.  That version of hGetContents will 
lazily yield chunks that are as big as can be read without blocking as 
they arrive (up to a limit of 64KB), and will hWaitForInput for you.




I've converted to lazy bytestrings. After reading in the bytes from a 
network connection I want to save them to a file but now the appendFile 
function blocks:


import Data.ByteString.Lazy as LazyBits(ByteString, empty, hGetContents, 
writeFile, appendFile)

...
LazyBits.appendFile filepath bits -- this blocks now!


How can I fix this?

E.

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


Re[2]: [Haskell-cafe] IDE?

2007-06-16 Thread Bulat Ziganshin
Hello bf3,

Saturday, June 16, 2007, 3:23:40 PM, you wrote:

> The point I wanted to make is, that I can't find an
> easy-to-install-ready-to-use-and-rock-n-roll IDE for Windows that comes with
> all or most of those features. I mean something like Borland TurboPascal

it's well-known trap. haskell is an order of magnitude better than
widespread OOP languages. why it's not used by everyone? just due to
shortage on libs, training and - yes - IDEs. "programming" in Delphi
in many cases need just clicking here and there

so, you got something, you lost something

ps: i use editor which supports only syntax highlighting. it's very
like working in tp 3.0 or quickc 1.0 - are you had such experience? :)



-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] hSetBuffering woes

2007-06-16 Thread Bryan O'Sullivan

Eric wrote:

I tried to turn off buffering with the command hSetBuffering (from 
System.IO) but my app still blocks on hGetContents (from 
Data.ByteString). Does anyone know what's happening?


The hGetContents function can't behave the way you want, because it's 
defined to return the entire rest of the input stream.


If you want to stick with strict ByteStrings, use hGetNonBlocking 
instead, but you'll need to block between reads of the handle yourself, 
using System.IO.hWaitForInput.


Otherwise, use lazy ByteStrings.  That version of hGetContents will 
lazily yield chunks that are as big as can be read without blocking as 
they arrive (up to a limit of 64KB), and will hWaitForInput for you.


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


[Haskell-cafe] Re: Darcs on Solaris x86

2007-06-16 Thread Ian Lynagh
On Fri, Jun 15, 2007 at 12:40:40PM +0200, Christian Maeder wrote:
> 
> Download the new binary dist:
> http://www.informatik.uni-bremen.de/agbkb/forschung/formal_methods/CoFI/hets/pc-solaris/versions/new-ghc-6.6.1-i386-unknown-solaris2.tar.bz2
> 
> Ian, could you replace
> http://www.haskell.org/ghc/dist/6.6.1/ghc-6.6.1-i386-unknown-solaris2.tar.bz2
> ?

Thanks Christian, done!


Ian

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Marc Weber
> both emacs and vim can pass buffer segments and editing
> session information to external (haskell) code, working as
> text or file transformers, and both emacs and vim can be
> controlled by such external code.
This is what shim tries to do.
I've added a link to the wiki IDE page.

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread John Melesky

On Jun 16, 2007, at 11:10 AM, Andrew Coppin wrote:
Give it a go. Start out with the Emacs tutorial [1] so that you  
have your feet
on solid ground, then jump to the Emacs tour [2] to whet your  
appetite to the

breadths of features that Emacs provides.


It's a text-mode editor. quod erat demonstrandum.


It works in a terminal, yeah, but it's had an operable GUI (a few,  
really) for a very long time. It has icons, buttons, menus, and all  
that jazz.


Here are some screenshots of ECB (Emacs Code Browser), for example:  
http://ecb.sourceforge.net/screenshots/index.html


People write games in emacs (e.g. http://ulf.epplejasper.de/ 
EmacsBubblesScreenshots.html ).


There used to be a full graphical web browser in emacs (images and  
everything), though it looks like it may have fallen by the wayside.


And tetris comes installed.

I'm an OSX user, so i use Aquamacs, but i have to assume that these  
aged innovations have made it to the Windows platform as well.



I mean, yeah, it edits text, but it's not just a text-mode editor.

-joh



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


[Haskell-cafe] Xlib: problem creating a window with override_redirect set

2007-06-16 Thread Andrea Rossato
Hi,

I'm trying, without success, to create a window with the attribute
override_redirect set to True (this way the window manager should not
take care of it). Obviously with Xlib (X11-1.2.2).

No meter how I try I seem not to be able to get there. 

In test1 I try with the correct method (createWindow), but I get an
error message:
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  1 (X_CreateWindow)
  Serial number of failed request:  7
  Current serial number in output stream:  9


With test2 I can open the window, but I'm not able to set that
attribute.

Any help would be greatly appreciated.

TIA.
Andrea

the example code:

module Main where
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Misc
import Graphics.X11.Xlib.Extras
import Control.Concurrent
import Data.Bits

main = test2

test1 = do
  dpy   <- openDisplay ""
  let dflt = defaultScreen dpy
  rootw  <- rootWindow dpy dflt
  win <- mkWindow dpy (defaultScreenOfDisplay dpy) rootw 0 0 100 100
  mapWindow dpy win
  sync dpy True
  threadDelay $ 2 * 100

mkWindow dpy scr rw x y h w = do
  let attrmask = cWOverrideRedirect
  visual = defaultVisualOfScreen scr
  attributes <- allocaSetWindowAttributes (\s -> return $ s )
  set_override_redirect attributes True
  window <- createWindow dpy rw 
 x y -- x, y
 w h -- width, height
 1   -- border_width
 1  
 inputOutput
 visual
 attrmask
 attributes
  putStrLn "Done!"
  return window

test2 = do
  dpy   <- openDisplay ""
  let dflt = defaultScreen dpy
  rootw  <- rootWindow dpy dflt
  win <- createSimpleWindow dpy rootw 0 0 100 100 1 0x00 0xFF
  mapWindow dpy win
  sync dpy True
  threadDelay $ 2 * 100

  wa <- getWindowAttributes dpy win
  allocaXEvent $ \ev -> do
 setEventType ev configureNotify
 setConfigureEvent ev win win
   100 100 20 20 1 win True
 sendEvent dpy win False cWOverrideRedirect ev
 --nextEvent dpy ev
 getEvent ev
  sync dpy True
  a <- getWindowAttributes dpy win
  putStrLn $ show (wa_override_redirect a)



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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread David House
Andrew Coppin writes:
 > >  > Personally, I really hate text-mode editors. (I won't even go into how
 > >  > many times I've had to reboot Linux just to get *out* of Vi!)
 > >
 > > 'Z Z' is the command to quit vi, right?
 > >   
 > 
 > Sometimes. Sometimes it just types "zz" in the document. It depends on 
 > the alignment of the planets.

Ah, then you're in the wrong mode. Press ESC first.

 > It's a text-mode editor.

With graphical support.

 >  quod erat demonstrandum.

Please don't be so quick to jump to conclusions like that.

 > Since it only operates in text-mode, it cannot possibly provide things 
 > like clickable fold points,

http://www.emacswiki.org/cgi-bin/wiki/CategoryOutline

I'm not sure any of those supply _clickable_ points, but there's no reason in
principle it couldn't be done. Emacs users just feel that using the keyboard is
quicker.

 > or a side-bar containing a bunch of icons representing the objects in the
 > current file,

Speedbar:

http://cedet.sourceforge.net/speedbar.shtml
http://www.emacswiki.org/cgi-bin/wiki/SpeedBar
http://cedet.sourceforge.net/speedbar-multi-2.jpg -- screenshot
http://jdee.sunsite.dk/jdedoc/html/jde-ug/images/speedbar1.gif -- screenshot

Not sure about integration with haskell-mode, but there's no reason this
couldn't be done in Emacs.

 > or a spell checker,

Flyspell:

http://www.emacswiki.org/cgi-bin/wiki/FlySpell
http://prog.vub.ac.be/~cderoove/geekery/emacslatex/flyspell_menu.png -- 
screenshot

 > or an interactive debugger,

As previously mentioned, debugging in Haskell hasn't really reached maturity
yet, but there's an Emacs interface to gdb:

http://www.emacswiki.org/cgi-bin/wiki/GdbMode
http://www.inet.net.nz/~nickrob/gdb-ui.png -- screenshot

 > or any of those other features that require a GUI. 

Perhaps you ought to revise your opinions on what constitutes a GUI.

(By the way, all those screenshots above show Emacs with horrible fonts that
haven't been anti-aliased. By checking out the unicode-2 branch of Emacs, which
will be merged into the trunk before Emacs 23, you can easily get XFT support. I
wouldn't live without it.)

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Marc Weber
>  > Personally, I really hate text-mode editors. (I won't even go into how
>  > many times I've had to reboot Linux just to get *out* of Vi!)

One bad experience and you have never given anyone/what a chance to proof you 
wrong ;)
Perhaps take 10 seconds, fire up vim again and read the splash screen
which tells you

  type  :q   to exit
  type  :help  orfor on-line help
~ type  :help version7   for version info

how to exit vim again. I have to admit that I didn't crasp what to do
either the first time.
So let me tell you that
  :q
means you have to type the : to get the command line 
and  means you have to press the return key.

The second option is using Ctrl-z to but vim into background (when
running it within bash).. Then it's killed automatically when you exit
bash.

I don't want to tell you that you have to use vim.
I want to show you that you don't have to be afraid when opening it
again (by accident)

There are some reasons why vim has been reader's choice 2005 (linux
journal).

I can't you tell much about emacs. I've chosen to learn vim because I
don't have to press that many Meta and Ctrl - keys (which would have
made my fingers hurt plenty) and because of the movement commands I
couldn't find in emacs.

If you are interested you can drop me an email and I can show you some
of the IDE features I've written for vim.

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Mattias Bengtsson
On Sat, 2007-06-16 at 17:10 +0100, Andrew Coppin wrote:
> It's a text-mode editor. quod erat demonstrandum.
> 
> Since it only operates in text-mode, it cannot possibly provide things 
> like clickable fold points, or a side-bar containing a bunch of icons 
> representing the objects in the current file, or a spell checker, or an 
> interactive debugger, or any of those other features that require a GUI. 
> (I am *really* not a fan of ASCII art "graphical" user interfaces.)

Emacs has had a real GUI for many years. (At least since '98 when i
started using it).


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hSetBuffering woes

2007-06-16 Thread Tomasz Zielonka
On Sat, Jun 16, 2007 at 04:17:39PM +0100, Eric wrote:
> import Network
> import System.IO
> import Data.ByteString as Bits(ByteString,  hGetContents)
> 
> soc <- listenOn $ PortNumber 2007
> (hdl, host, port) <- accept soc
> hSetBuffering hdl No Buffering;
> bs <- Bits.hGetContents hdl;  -- blocks here despite previous line

I think it's because you are using the strict ByteString module version.
Its hGetContents just has to the whole input. Try with
Data.ByteString.Lazy.

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Andrew Coppin

David House wrote:

Andrew Coppin writes:
 > > Why not contribute an afternoon's hacking?
 > 
 > 1. I'm not good enough.


How do you intend to remedy that, apart from by writing Haskell code? Start
small, fix small typos or bugs, and build it up from there. Seriously, just give
it a go, I doubt any of your patches will be rejected out of hand. Rather,
you'll get comments on your coding style which will help you become a better
programmer. 
  


I used to have these delusions that "open source" would mean that one 
day I would be helping people develop actual software, rather than just 
tinkering on my own.


Of course, back then the problem was that all "real world" software is 
written in C or C++ (or both), and these are amoung the tiny number of 
computer languages that I have repeatedly *failed* to learn. (Typially 
it takes me a day or two to learn a new language. There are very few 
that I actually *failed* to learn.)


And then I discovered Haskell. If programming languages were weapons of 
war, programming in BASIC would be equivilent to telling somebody they 
look fat, C would be like throwing pebbles at them, Java would be like 
throwing a grenade, Eiffel would be like using an AK-47, and Haskell 
would be a large thermonuclear warhead. (!) Quite simply, all lesser 
languages pale into insignificance before the almighty power of Haskell.


Finally I thought I would be able to do great things. After all, in 
Haskell, every concievable problem can be solved in 3 lines of code or 
less. (Sometimes A LOT less.)


And then I had a look at the source code for GHC, and I was shocked. The 
program is *thousands* of lines long - despite being written in Haskell, 
the most powerful programming language that has ever existed. Now 
considering that even the hardest problems that mortal minds can 
comprehend can be solved in a page of code or less, it instantly follows 
that any problem that requires *more* than 1 page of Haskell code must 
be complex beyond the powers of mortal comprehension. And by induction, 
any task that requires *hundreds* let alone *thousands* of lines of code 
must be comprehensible only by the greatest minds in all of humanity.


Obviously, I am not such a mind. It's nice to think that one day I will 
be... but let's be real here. It's not going to happen.


I realised then that trying to do anything with the GHC source code was 
a hopeless endevour. Indeed, most Haskell programs I look at are a 
similar picture...



 > Personally, I really hate text-mode editors. (I won't even go into how
 > many times I've had to reboot Linux just to get *out* of Vi!)

'Z Z' is the command to quit vi, right?
  


Sometimes. Sometimes it just types "zz" in the document. It depends on 
the alignment of the planets.


(Of course, now I know about "virtual terminals", I've learned how to 
switch to another terminal so I can look up the PID for Vi, and then I 
can kill it that way. None of which helps me edit files in any way... I 
really hate it when Vi is the only editor I have access to!)



 > What I would *really* like is a nice big IDE... but it seems there isn't
 > one for Haskell. :-(

This was my attitude, too, for a long time when I started to learn Haskell. I'd
only heard that Emacs was hard to get used to, hard to use, and somewhat
old-fashioned. Seeing as there was nothing better, I decided to spend a weekend
learning Emacs and count it as a life skill, as my productivity was sure to
increase. What did I find out? Well, the first of those complaints is true,
there's no doubting that, but the second isn't really and the third most
certainly not. It might not be the most conformist of editors but that doesn't
make it old-fashioned, nor arcane, nor irrelevant.

Give it a go. Start out with the Emacs tutorial [1] so that you have your feet
on solid ground, then jump to the Emacs tour [2] to whet your appetite to the
breadths of features that Emacs provides.
  


It's a text-mode editor. quod erat demonstrandum.

Since it only operates in text-mode, it cannot possibly provide things 
like clickable fold points, or a side-bar containing a bunch of icons 
representing the objects in the current file, or a spell checker, or an 
interactive debugger, or any of those other features that require a GUI. 
(I am *really* not a fan of ASCII art "graphical" user interfaces.)


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


Re: [Haskell-cafe] embedded build language?

2007-06-16 Thread Tomasz Zielonka
On Fri, Jun 15, 2007 at 02:13:18PM -0700, Greg Fitzgerald wrote:
> Tomek,
> 
> >If you want to see the code I will try to release it
> I'm very interested.
> 

It seems I started rewriting this from scratch at home, so I can easily
release it. Here is the darcs repo:
http://www.uncurry.com/repos/HBuild/
It contains only the build engine stuff, and I think it's just as it
should be. There is no license yet, but I can quickly fix that.

Example of use:

$ ./Example repeat37.txt
  building a.txt
  building repeat37.txt
$ ./Example b.txt repeat37.txt
  building b.txt
$ rm a.txt
$ ./Example b.txt repeat37.txt
  building a.txt
rebuilding b.txt
rebuilding repeat37.txt
$ touch a.txt
$ ./Example b.txt repeat37.txt
rebuilding b.txt
rebuilding repeat37.txt

You will see it's really simple. I can think about some improvements and
optimisations, but first let's see if anybody likes the general idea.

I will be very grateful for any comments.

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Claus Reinke

However, one of the reasons that Emacs is so great is the absolute wealth of
libraries available for it. It's been aroud a long time and people like it a lot
so there's pretty much an Emacs Lisp library to integrate _any_ tool, to help
editing _any_ kind of source/configuration file etc. It would take many
lifetimes to replicate this in a different language.


see also the history section in Luke Gorrie's Distel paper:

   http://fresh.homeunix.net/~luke/distel/distel-euc.pdf

   This was followed by Ermacs, a concurrent
   Emacs clone written completely in Erlang. Ermacs
   is fairly complete – it has major modes for
   Erlang and Scheme programming, a built-in Erlang
   shell, and support for efficiently editing large
   files. However, once the core editor was complete,
   it was obvious that GNU Emacs has an incredibly
   large set of wonderful features, and that extending
   Ermacs to include “enough” of them was
   completely out of the question.
   The lessons learned from Ermacs lead to Distel,..

how is Yi going to avoid that trap?


I've thought a little about writing a Haskell -> Elisp compiler, so that people
could contribute to Emacs by writing Haskell, but I've got doubts about its
feasibility.


Luke's Distel seems to have been very successful for
erlang <-> emacs interaction, enabling erlang modes for emacs
to be written in erlang, with tools that actually understand
erlang. this seems to suggest that easy communication with
some good-haskell-system-api-based haskell code might
be a promising equivalent?

   http://fresh.homeunix.net/~luke/distel/

both emacs and vim can pass buffer segments and editing
session information to external (haskell) code, working as
text or file transformers, and both emacs and vim can be
controlled by such external code. so haskellers can already
use haskell to extend emacs/vim functionality, it just isn't
very convenient when it goes beyond transforming text.

i would much prefer if vim exposed a standard ffi, instead
of all those specific bindings to popular scripting languages
and tools, but even without a proper ffi, haskell code
cooperating with vim script can already be written. and
similarly for emacs, i suspect.

so it may just be a matter of doing less of the ide work in
elisp/vimscript, and of introducing an explicit interface
for inter-process communication between the editor frontend
and some haskell-system-api-based backend.

claus

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread David House
Andrew Coppin writes:
 > > Why not contribute an afternoon's hacking?
 > >   
 > 
 > 1. I'm not good enough.

How do you intend to remedy that, apart from by writing Haskell code? Start
small, fix small typos or bugs, and build it up from there. Seriously, just give
it a go, I doubt any of your patches will be rejected out of hand. Rather,
you'll get comments on your coding style which will help you become a better
programmer. 

 > Personally, I really hate text-mode editors. (I won't even go into how
 > many times I've had to reboot Linux just to get *out* of Vi!)

'Z Z' is the command to quit vi, right?

 > What I would *really* like is a nice big IDE... but it seems there isn't
 > one for Haskell. :-(

This was my attitude, too, for a long time when I started to learn Haskell. I'd
only heard that Emacs was hard to get used to, hard to use, and somewhat
old-fashioned. Seeing as there was nothing better, I decided to spend a weekend
learning Emacs and count it as a life skill, as my productivity was sure to
increase. What did I find out? Well, the first of those complaints is true,
there's no doubting that, but the second isn't really and the third most
certainly not. It might not be the most conformist of editors but that doesn't
make it old-fashioned, nor arcane, nor irrelevant.

Give it a go. Start out with the Emacs tutorial [1] so that you have your feet
on solid ground, then jump to the Emacs tour [2] to whet your appetite to the
breadths of features that Emacs provides.

[1]: Use C-h t (hold Ctrl, press h, then let go of both and press t) inside
Emacs
[2]: http://www.gnu.org/software/emacs/tour/

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


Re: [Haskell-cafe] hSetBuffering woes

2007-06-16 Thread Eric

David House wrote:

Eric writes:
 > I tried to turn off buffering with the command hSetBuffering (from 
 > System.IO) but my app still blocks on hGetContents (from 
 > Data.ByteString). Does anyone know what's happening?


I very much doubt anyone will be able to help you unless you include some code
for us all to look at.

  

import Network
import System.IO
import Data.ByteString as Bits(ByteString,  hGetContents)

soc <- listenOn $ PortNumber 2007
(hdl, host, port) <- accept soc
hSetBuffering hdl No Buffering;
bs <- Bits.hGetContents hdl;  -- blocks here despite previous line

E.

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


Re: [Haskell-cafe] Literate Priority Queue, plus question

2007-06-16 Thread Thorkil Naur
Hello,

On Saturday 16 June 2007 14:53, Michael T. Richter wrote:
> I'm trying my hand at making an improved, more efficient, Sieve of
> Eratosthenes implementation based on Melissa O'Neil's paper
> (http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf) to augment the
> inefficient not-Sieve I've documented at
> http://en.literateprograms.org/Sieve_of_Eratosthenes_(Haskell).  
> ... 

Surely you know this already, but to make absolutely sure: There was a lot of 
discussion on this subject on this mailing list a while back. Melissa 
O'Neill's own entry into this is 

  http://www.haskell.org/pipermail/haskell-cafe/2007-February/022666.html

as far as I can tell and you can go both forwards and backwards from there.

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


Re: [Haskell-cafe] Re: Literate Priority Queue, plus question

2007-06-16 Thread Andrew Coppin

apfelmus wrote:

 Lazy skew heaps are thoroughly explained in

C. Okasaski. Fun with binary heap trees.
In: The Fun of Programming. Palgrave. 2003.
http://www.palgrave.com/pdfs/0333992857.pdf
  


Extremely cool stuff, that. I love it when people write material like 
this...


Unfortunately, so many documents about Haskell are too hard to 
comprehend. :-(


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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Andrew Coppin
David House wrote:
> Andrew Coppin writes:
>  > Dude... somebody should write the world's next killer editor in Haskell, 
>  > just to show how awsome Haskell is!
>
> Yi [1] does exist, with roughly this aim.

Yes, I've read about Yi once or twice. And yet, I still find myself
puzzled as to what it actually *is*, what it's meant to do, what's
supposed to be good about it, and how to actually obtain it so I can
even try it out.

> Why not contribute an afternoon's hacking?
>   

1. I'm not good enough.

2. I'll never be able to find my way around the source code.

> However, one of the reasons that Emacs is so great is the absolute wealth of
> libraries available for it. It's been aroud a long time and people like it a 
> lot
> so there's pretty much an Emacs Lisp library to integrate _any_ tool, to help
> editing _any_ kind of source/configuration file etc. It would take many
> lifetimes to replicate this in a different language.
>   

"Emacs? That's not a text editor - it's an *operating system*!"

Personally, I really hate text-mode editors. (I won't even go into how
many times I've had to reboot Linux just to get *out* of Vi!) What I
want is something more friendly. Currently my tool of choice is SciTE -
but it's an absolute pain to configure. (1. There is no GUI. You must
edit the config file manually. 2. The documentation is very minimal.)
It's also not particularly flexible.

What I would *really* like is a nice big IDE... but it seems there isn't
one for Haskell. :-(

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


Re: [Haskell-cafe] hSetBuffering woes

2007-06-16 Thread David House
Eric writes:
 > I tried to turn off buffering with the command hSetBuffering (from 
 > System.IO) but my app still blocks on hGetContents (from 
 > Data.ByteString). Does anyone know what's happening?

I very much doubt anyone will be able to help you unless you include some code
for us all to look at.

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


[Haskell-cafe] hSetBuffering woes

2007-06-16 Thread Eric

Hi all,

I tried to turn off buffering with the command hSetBuffering (from 
System.IO) but my app still blocks on hGetContents (from 
Data.ByteString). Does anyone know what's happening?


E.

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread David House
Andrew Coppin writes:
 > Dude... somebody should write the world's next killer editor in Haskell, 
 > just to show how awsome Haskell is!

Yi [1] does exist, with roughly this aim. Why not contribute an afternoon's
hacking?

[1]: http://haskell.org/haskellwiki/Yi

However, one of the reasons that Emacs is so great is the absolute wealth of
libraries available for it. It's been aroud a long time and people like it a lot
so there's pretty much an Emacs Lisp library to integrate _any_ tool, to help
editing _any_ kind of source/configuration file etc. It would take many
lifetimes to replicate this in a different language.

I've thought a little about writing a Haskell → Elisp compiler, so that people
could contribute to Emacs by writing Haskell, but I've got doubts about its
feasibility.

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


[Haskell-cafe] Re: Literate Priority Queue, plus question

2007-06-16 Thread apfelmus
Michael T. Richter wrote:
> I'm trying my hand at making an improved, more efficient, Sieve of
> Eratosthenes implementation based on Melissa O'Neil's paper
> (http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf) to augment the
> inefficient not-Sieve I've documented at
> http://en.literateprograms.org/Sieve_of_Eratosthenes_(Haskell).
> [...]
> While I was explaining the code of my priority queue,
> I spotted something odd: although the queue is structured,
> essentially, as a binary tree (Branch key value leftNode
> rightNode), I could see no operations at all that ever put anything in
> the right node.
> [...]
> Am I missing something obvious?  If so, what is it?  

You're right, it's a serious bug. The last line should read

   link (Branch k a  x y) z = Branch k a  y (union x z)

The crucial point about priority queues is of course that they run in
logarithmic time and this property needs a proof. In other words,
explaining an implementation of priority queues without proving that it
fulfills this requirement is rather pointless. Lazy skew heaps are
thoroughly explained in

C. Okasaski. Fun with binary heap trees.
In: The Fun of Programming. Palgrave. 2003.
http://www.palgrave.com/pdfs/0333992857.pdf

but the proof, while simple in practice, may require too much
"machinery" (persistence + amortisation + lazy eval) to be reproduced on
the literate programming wiki.

> If not, should I just bite the bullet and change my priority queue
> implementation into a sorted list or is there a way to actually
> use a binary tree there?

To some extend, this would be pointless as well because that would make
the Eratosthenes' Sieve inefficient again. It's much easier to stick
with the old version then.

Regards,
apfelmus

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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Andrew Coppin

David House wrote:

Switching to Emacs will never be an easy task (I think the quote is "A learning
curve you can use as a plumb line"), but once you have, I very much doubt you'll
ever want to go back to anything else. :) The Emacs tour [1] (newer beta version
also available [2]) give a quick flavour of why you might fall in love with
Emacs.
  


Dude... somebody should write the world's next killer editor in Haskell, 
just to show how awsome Haskell is!


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


Re[2]: [Haskell-cafe] Haskell record extension?

2007-06-16 Thread Bulat Ziganshin
Hello bf3,

Saturday, June 16, 2007, 3:24:06 PM, you wrote:
> However, I never understood why Haskell doesn't permit the same name for a
> function acting on different types, even without using type classes. Must be
> some deeper reason for it (currying?)

i guess because it makes type inference problematic. imagine 10
overloaded functions used together:

func = a.b.c.d.e.f.g.h.i.j

it will create 2^10 variants to check and make error messages very
verbose (or non-informative). with type classes, you give common name
to all the type variants you want to overload. at least, this
simplifies error messages :)

-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


RE: [Haskell-cafe] IDE?

2007-06-16 Thread David House
[EMAIL PROTECTED] writes:
 > The point I wanted to make is, that I can't find an
 > easy-to-install-ready-to-use-and-rock-n-roll IDE for Windows that comes with
 > all or most of those features. I mean something like Borland TurboPascal
 > from the 80's, Visual Studio 2005, IntelliJ IDEA or Eclipse.

Would you rather have a different editor for every language, and be forced to
learn new editor paradigms, keyboard shortcuts, tools and so on, or have one
editor for every language? This is one of Emacs's greatest strengths, IMO: it
can handle _everything_.

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


[Haskell-cafe] Literate Priority Queue, plus question

2007-06-16 Thread Michael T. Richter
I'm trying my hand at making an improved, more efficient, Sieve of
Eratosthenes implementation based on Melissa O'Neil's paper
(http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf) to augment the
inefficient not-Sieve I've documented at
http://en.literateprograms.org/Sieve_of_Eratosthenes_(Haskell).  To get
the most efficient version that she outlines in her paper, I've had to
implement a priority queue.  Being a lazy^Wsmart programmer, I hunted
for an implementation of a priority queue and found one at
http://www.haskell.org/haskellwiki/Haskell_Quiz/Astar/Solution_Dolio
which I promptly nicked and modified to suit the interface Melissa's
code requires.  I then documented it exhaustively.  The output of this
can be found at http://en.literateprograms.org/Priority_Queue_(Haskell).
(I'd appreciate any vetting people could make -- I did some minimal
testing of my own, but some more experienced eyes will likely spot edge
cases I'm not able to at this point.)

The vetting, however, isn't my main point.  My main point is the
priority queue as found on the Haskell Wiki.  While I was explaining the
code of my priority queue, I spotted something odd: although the queue
is structured, essentially, as a binary tree (Branch key value leftNode
rightNode), I could see no operations at all that ever put anything in
the right node.  Ever.  At all.  Thinking this was because of the weird
interface I put on the priority queue, I went back to look at the place
I stole it from.  There, too, I could see no operations at all that put
anything into the right node.  This bothers me a bit (to put it mildly)
because it seems I'm carrying around this one data element that's
perpetually set to "Nil" and that I'm basically now having my "priority
queue" devolve, in effect, into a sorted list.

Am I missing something obvious?  If so, what is it?  If not, should I
just bite the bullet and change my priority queue implementation into a
sorted list or is there a way to actually use a binary tree there?

-- 
Michael T. Richter <[EMAIL PROTECTED]> (GoogleTalk:
[EMAIL PROTECTED])
Theory is knowledge that doesn't work. Practice is when everything works
and you don't know why. (Hermann Hesse)


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Sneaking haskell in the workplace -- cleaning csv files

2007-06-16 Thread Jim Burton

Tomasz Zielonka wrote:


I guess you've tried to convince Oracle to produce the right format in
the first place, so there would be no need for post-processing...?


We don't control that job or the first db.



I wonder what would you get if you set the delimiter to be a newline ;-)


eek! ;-)


Best regards
Tomek



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


Re: [Haskell-cafe] IDE?

2007-06-16 Thread Claus Reinke

Sorry I should have mentioned that I actually did all those searches you
provided, and read the wiki. 


ok, then it is a different story, needing different answers:-) in particular,
you have found tools doing all the things you asked for, but they either 
had issues (please report them, to the tool authors/maintainers, or here),

or did not provide some features you need (again, specific questions
might turn up hidden features/tools, or influence further development).
or they have just not been integrated.


I've tried VIM, Emacs, asked Rhinosoft for an evaluation (which I did not
get), tried the Eclipse plugin (can't get it to work on 3 PCs I tried),
tried Visual Haskell (incomplete, sometimes crashes or hangs Visual Studio),
an briefly looked at other alpha-level solutions. 


yes, that Rhinosoft entry was a surprise, until i noticed the date;), and 
the simple fact that there are so many options, all with their own issues,

pros&cons, can be off-putting. probably best to choose one, and take
it all the way it can go.

here's an idea for an adventurous soul: perhaps someone who hasn't
yet committed to any specific ide/editor could do a survey of available 
haskell development tools (well, okay, at least the editing/ide side of

that), state of the art, pros&cons, selection advice, etc?

Currently I'm using "Notepad++", which just does basic syntax 
highlighting but is usable out of the box for a Windows programmer.


that suggests to me that following either the emacs or the vim route
should give you a substantial improvement - the feature equivalent
should work out of the box, and simple addons should cover more
of your feature requests. as others have pointed out, both require
an investment in learning, and using either might be addictive (and
they stay with you into the next great thing/platform/language).

to complement the emacs tour link, and since this question comes
up so often,-) a tour of a few vim features, adapted for haskell:

http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/Vim/vim.html


The point I wanted to make is, that I can't find an
easy-to-install-ready-to-use-and-rock-n-roll IDE for Windows 
that comes with all or most of those features. 


well, it would be nice to have a standard integrated release of the
major tools, preferable all behind a graphically and ergonomically
well-designed front, but with limited resources and free availability,
functionality comes first (although the Hat folks have tried to collect
and integrate all the various haskell debugging options, for example).

occasionally, there has been talk of a 'haskell cd', where the issue
is not the medium of distribution, but the coordination, testing and
integration of releases for the various tools, libs, and docs. that
hasn't happened yet (it would be a lot of work for someone, and
by the time they finished, development would have moved on), 
but it might still be a worthwhile thing to try, especially given the

growing number of haskell users, tools, and libraries..

as far as gui frontends are concerned, there is an ongoing google
summer of code project; will be interesting to see how far that gets:

http://neilmitchell.blogspot.com/2007/04/soc-guihaskell.html

claus

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


Re: [Haskell-cafe] Memo + IORef

2007-06-16 Thread David House
Tony Morris writes:
 > Yes, but where does the IORef live? Wouldn't I have to pass it back and
 > forth between invocations? If not, where do I get the IORef from on
 > subsequent invocations? Got a short example?

That's where the unsafePerformIO comes in. With unsafePerformIO and IORefs, you
can have global mutable variables:

{-# NOINLINE #-}
memo :: IORef Int
memo = unsafePerformIO (newIORef Nothing)

f = unsafePerformIO $ do
  ref <- readIORef memo
  case ref of
Just val -> return val
Nothing  -> let val = complexCalculation
in writeIORef memo val >> return val

Something like that. If f took an argument then you'd probably use a IORef Map
or IORef IntMap or something in place of IORef Int. Be careful to:

1) Not break referential transparency. I.e. in my example, f will always return
the same value, how ever many times you call it. It's possible to break this
property using this trick.

2) Not use polymorphic references, as they lead to type unsafety [1].

3) Always use the {-# NOINLINE #-} pragma on any IORefs you create this way.

[1]: 
http://haskell.org/ghc/docs/latest/html/libraries/base/System-IO-Unsafe.html#v%3AunsafePerformIO

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


Re: [Haskell-cafe] Sneaking haskell in the workplace -- cleaning csv files

2007-06-16 Thread Tomasz Zielonka
On Sat, Jun 16, 2007 at 12:08:22PM +0100, Jim Burton wrote:
> Tomasz Zielonka wrote:
> >It would be easier to experiment if you could provide us with an
> >example input file. If you are worried about revealing sensitive
> >information, you can change all characters other then newline,
> >~ and , to "A"s, for example. An accompanying output file, for checking
> >correctness, would be even nicer.
>
> Hi Tomasz, I can do that but they do essentially look like the example 
> above, except with 10 - 30 columns, more data in each column, and more 
> rows, maybe this side of a million. They are produced by an Oracle 
> export which escapes the delimiter (often a tilde) from within the cols. 
> The output file should have exactly one row per line, with extra 
> newlines replaced by a string given as a param (it might be a space or a 
> html tag -- I only just remembered this and my initial effort doesn't do 
> it).

I guess you've tried to convince Oracle to produce the right format in
the first place, so there would be no need for post-processing...?

I wonder what would you get if you set the delimiter to be a newline ;-)

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


RE: [Haskell-cafe] Haskell record extension?

2007-06-16 Thread bf3
Thanks. Yes I read this is syntactic sugar, and I actually like that
approach; it automatically "encapsulates" the data fileds by functions,
which from an OO programmers point of view, is a good thing. I'm doing my
best to get rid of that OO view though, which is not easy after 15 years of
OO and 10 years of imperative programming ;-)

However, I never understood why Haskell doesn't permit the same name for a
function acting on different types, even without using type classes. Must be
some deeper reason for it (currying?)

Now the type class approach is interesting; it's like saying "any type that
has an XXX field"... 

Lot's of typing, but IMHO it's worth it because it abstracts the concept of
a field. I read some papers that some extensions got proposed to treat
"fields" as first class values, so one could just do "get X (Vector2 1 2)".
Did something like that make it into GHC?

So the example becomes:

module Main where

-- "Vector" is a rather stupid example, because Haskell has tuples

data Vector2 = Vector2 Float Float
data Vector3 = Vector3 Float Float Float

class HasX v where
  getX :: v -> Float
  setX :: v -> Float -> v

class HasY v where
  getY :: v -> Float
  setY :: v -> Float -> v

class HasZ v where
  getZ :: v -> Float
  setZ :: v -> Float -> v

instance HasX Vector2 where 
getX (Vector2 x y) = x
setX (Vector2 x y) value =  Vector2 value y

instance HasY Vector2 where 
getY (Vector2 x y) = y
setY (Vector2 x y) value = Vector2 x value

instance HasX Vector3 where 
getX (Vector3 x y z) = x
setX (Vector3 x y z) value = Vector3 value y z

instance HasY Vector3 where 
getY (Vector3 x y z) = y
setY (Vector3 x y z) value = Vector3 x value z

instance HasZ Vector3 where 
getZ (Vector3 x y z) = z
setZ (Vector3 x y z) value = Vector3 x y value

test v x = getY (setX v x)

main = print $ test (Vector2 1 2) 3

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Johnson
Sent: Saturday, June 16, 2007 12:51 AM
To: Andrew Coppin
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Haskell record extension?

Andrew Coppin wrote:
> [EMAIL PROTECTED] wrote:
>> I'm learning Haskell.
>> I was surprised that the following example did not compile:
>>
>> data Vector2 = Vector2 { x :: Float, y :: Float }
>> data Vector3 = Vector3 { x :: Float, y :: Float, z :: Float }
>>
>> error: "Multiple declarations of `Main.x'"
>>
>
> AFAIK, GHC doesn't implement any fix for this. (I've been wrong before 
> tho...)
This is a feature, not a bug.  Haskell in general does not let you give 
two functions the same name (which is what you want to do).  This is 
true of all functions, not just the ones implicitly defined here.  Your 
"Vector2" type is pure syntactic sugar for:

data Vector2 = Vector2 Float Float
x, y :: Vector2 -> Float
x (Vector2 v _) = v
y (Vector2 _ v) = v

So now you also want

x (Vector3 v _ _) = v
   etc etc.

And no, you can't do that because "x" on its own might refer to either 
version, and its not clear which one you want.

Paul.
___
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] IDE?

2007-06-16 Thread bf3
Sorry I should have mentioned that I actually did all those searches you
provided, and read the wiki. I've been searching the internet for 6 months
now. I'm a professional software developer with 20 years of experience. I
actually (co-)developed integrated IDEs for visual programming languages,
type inferers, some refactoring tools, a version control system, some
compilers and linkers, and some commercial videogames for Commodore 64,
Amiga, PC, XBOX, PS2 and PS3. Now that I get to learn Haskell, I noticed
that I've always programmed in a horribly ugly, imperative/OO way ;) So I'm
not really a rookie, although I'm indeed a complete Haskell newby :)

I've tried VIM, Emacs, asked Rhinosoft for an evaluation (which I did not
get), tried the Eclipse plugin (can't get it to work on 3 PCs I tried),
tried Visual Haskell (incomplete, sometimes crashes or hangs Visual Studio),
an briefly looked at other alpha-level solutions. Currently I'm using
"Notepad++", which just does basic syntax highlighting but is usable out of
the box for a Windows programmer.

The point I wanted to make is, that I can't find an
easy-to-install-ready-to-use-and-rock-n-roll IDE for Windows that comes with
all or most of those features. I mean something like Borland TurboPascal
from the 80's, Visual Studio 2005, IntelliJ IDEA or Eclipse. I know that
people with a UNIX background have a completely different point of view on
this (they like separate tools they can fully configure). 

IMHO Haskell - although old - has a lot of potential that is rather
difficult to reach for "spoiled MTV generation inpatient plug-and-play
Windows programmers"... The people from Microsoft seem to understand that;
they made an excellent Visual Studio plugin for their F# research language.
Although far from perfect, this plugin works better for me than say Visual
Haskell. As I know most of the .NET framework, F# is still an option me, but
I'm tackling Haskell first, as it is pure and lazy (and I am the latter but
not the former ;-)

Cheers,
Peter

BTW: I also looked at UNICODE editor support (like Fortress), so it would
bring Haskell a step closer to mathematical notation (all Haskell books
already use UNICODE for their Haskell examples). Yes, this is also on the
wiki, but again, I fail to do something practical. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Claus Reinke
Sent: Saturday, June 16, 2007 1:18 AM
To: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] IDE?


> I've searched the internet for an Haskell IDE that supports the following:

my first reaction was: he can't be serious, not that again!-) however, i
tried to find the info by the "obvious" means, and found that to be a rather
sobering experience.

a simple google search does give rather a few relevant answers, but there
are entries on haskell.org that i've just had difficulty finding again, even
though i knew they were there.

i still can't help feeling that using google *and* haskell.org's own search
should have given some more results than the poster seems to be aware
of, but it also seems obvious that we have some serious barriers to finding
such info at the moment:

- external search engines are currently banned from indexing the wiki,
where much useful haskell info resides, so one does need to use
the internal search as well, to find wiki content.

perhaps the haskell.org main page should emphasise that and also
repeat the call for volunteers to fix the issue (there was something
like a consensus to try moving the dynamic parts of the wiki to a
distinguishable prefix, and banning search engines only from
that particular part; but someone needs to implement that and
monitor the effects).

- the current organisation of wiki indexing seems suboptimal. ide
related content used to be easier to find, but is now somewhat
spread out. debugging tools seem to have disappeared completely
from the most likely indexes (instead one finds some debug libs)?

the most "obvious" wiki pages are often not uptodate/complete,
the most "obvious" index headings do not lead to "important"
entries quickly (or at all). information is sometimes spread out
over several similar pages/index groups. all of which means that
information might be difficult to find, and finding a partial source
of information will miss out on much of the available info.

in best Prolog tradition, perhaps you could say where you've searched,
and someone (i'm calling all of you active haskell.org wiki volunteers:-)
might find a way to put a link to the info right where people are looking?-)

> - syntax highlighting
> - quick navigation (goto symbol, goto instance, find usages, etc)
> - code completion

http://www.google.com/search?q=haskell+ide

http://www.haskell.org/haskellwiki/Applications_and_libraries/Program_develo
pment
(i would have expected to see th

Re: [Haskell-cafe] Memo + IORef

2007-06-16 Thread Benja Fallenstein

Hi Tony,

2007/6/16, Tony Morris <[EMAIL PROTECTED]>:

I was told on #haskell (IRC) the other day that it is possible to write
a general memoisation table using IORef and unsafePerformIO. I can't
think of how this can be achieved without writing to a file, since a
function cannot hold state between invocations. What am I missing?


You create a single IORef for the function (via unsafePerformIO), for
example like this:

memoTable :: Map Int Int
memoTable = unsafePerformIO $ newIORef Map.empty

memoizedFactorial n = unsafePerformIO $ do
   tbl <- readIORef memoTable
   if (n `Map.member` tbl) then return (tbl Map.! n) else do
   let r = if n == 0 then 1 else n * memoizedFactorial (n-1)
   writeIORef memoTable $ Map.insert n r tbl
   return r

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


Re: [Haskell-cafe] Sneaking haskell in the workplace -- cleaning csv files

2007-06-16 Thread Jim Burton

Tomasz Zielonka wrote:

On Fri, Jun 15, 2007 at 11:31:36PM +0100, Jim Burton wrote:
I think that would only work if there was one column per line...I didn't 
make it clear that as well as being comma separated, the delimiter is 
around each column, of which there are several on a line so if the 
delimiter is ~ a file might look like:


~sdlkfj~, ~dsdkjf~ #eo row1
~sdf
dfkj~, ~dfsd~  #eo row 2


It would be easier to experiment if you could provide us with an
example input file. If you are worried about revealing sensitive
information, you can change all characters other then newline,
~ and , to "A"s, for example. An accompanying output file, for checking
correctness, would be even nicer.

Hi Tomasz, I can do that but they do essentially look like the example 
above, except with 10 - 30 columns, more data in each column, and more 
rows, maybe this side of a million. They are produced by an Oracle 
export which escapes the delimiter (often a tilde) from within the cols. 
The output file should have exactly one row per line, with extra 
newlines replaced by a string given as a param (it might be a space or a 
html tag -- I only just remembered this and my initial effort doesn't do 
it).


Thanks,

Jim


Best regards
Tomek



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


Re: [Haskell-cafe] Template haskell problem - solved

2007-06-16 Thread Marc Weber
>   und n = AppE (VarE (mkName "show")) (SigE (VarE (mkName 
> "undefined")) (ForallT [n] [] (VarT n))) -- undefined :: typePara

using ForallT [] [] (... works fine.

So this seems to be a th [| |] parser issue? I'll move this to the ghc
mailinglist.

(Thanks to Heffalump on #haskell)

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


[Haskell-cafe] Memo + IORef

2007-06-16 Thread Tony Morris
I was told on #haskell (IRC) the other day that it is possible to write
a general memoisation table using IORef and unsafePerformIO. I can't
think of how this can be achieved without writing to a file, since a
function cannot hold state between invocations. What am I missing?

-- 
Tony Morris
http://tmorris.net/




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


Re: [Haskell-cafe] Haskell record extension?

2007-06-16 Thread Bulat Ziganshin
Hello bf3,

Saturday, June 16, 2007, 1:24:58 AM, you wrote:

> I read multiple papers with proposals to fix this, but does GHC implement
> any of these?

no, but hugs implements one of these proposals: see "7.2  Extensible records: 
Trex"
in http://cvs.haskell.org/Hugs/pages/hugsman/exts.html

(hugs manual contains more information, see "comprehensive manual" on
http://cvs.haskell.org/Hugs/pages/documentation.htm )


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


[Haskell-cafe] lists with mixed types

2007-06-16 Thread oleg

Anatoly Yakovenko wrote:

> but what i really want to do is just do
> map func [1, 2.0]
> [1, "2.0"]
>
> I understand that this is impossible in haskell, 

If you use a heterogeneous list, it is possible. The HList paper
describes such examples.
http://homepages.cwi.nl/~ralf/HList/

> but why cant the
> compiler generate the Foo and Bar data types for me and just require
> that i have a func defined for Int -> Int and Float -> String?

It can. One can write something like
lst = (1::Int) `eCons` True `eCons` 'a' `eCons` eNil
the result is a true Haskell list of the type 
[Either Int (Either Bool Char)]
and the contents
[Left 1, Right (Left True), Right (Right 'a')]

Haskell figures out the union (Either) type automatically. Using a
function like hOccurs one can `downcast' from that union type to a
specific type (Int or Char) so one does not need to care about the
number and amount of Left and Right...

In more detail, this is described in Section 5.5 of
http://homepages.cwi.nl/~ralf/OOHaskell

and code at
http://darcs.haskell.org/OOHaskell/ShapesEither.hs


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


[Haskell-cafe] Re: practicality of typeful programming

2007-06-16 Thread oleg

Daniil Elovkov wrote:
> I've recently asked some questions here about some little type hackery
> implementing an embedded dsl. But now I wonder if it's worth the
> effort at all...

Yes it is. Typed embedded DSL are quite useful and widely used. For
example, Lava (high-level hardware description language) uses phantom
types to prevent the designer from building meaningless circuits
(e.g., connecting a Bool and an Int wires).
http://citeseer.ist.psu.edu/69503.html

There are other such hardware design languages which profitably use
types (which ought to be popularized more). Using types can decrease
the amount of error checking in the implementation.

I highly recommend the following _very_ good thesis on this
topic:
Morten Rhiger
Higher-Order Program Generation
http://www.brics.dk/DS/01/4/index.html

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


Re: [Haskell-cafe] Sneaking haskell in the workplace -- cleaning csv files

2007-06-16 Thread Donn Cave
Quoth Tomasz Zielonka <[EMAIL PROTECTED]>:
| On Fri, Jun 15, 2007 at 11:31:36PM +0100, Jim Burton wrote:
| > I think that would only work if there was one column per line...I didn't 
| > make it clear that as well as being comma separated, the delimiter is 
| > around each column, of which there are several on a line so if the 
| > delimiter is ~ a file might look like:
| > 
| > ~sdlkfj~, ~dsdkjf~ #eo row1
| > ~sdf
| > dfkj~, ~dfsd~  #eo row 2
|
| It would be easier to experiment if you could provide us with an
| example input file. If you are worried about revealing sensitive
| information, you can change all characters other then newline,
| ~ and , to "A"s, for example. An accompanying output file, for checking
| correctness, would be even nicer.

Yes, especially if there's anyone else as little acquainted with CSV
files as I am!

I have never bothered to learn to work with multiple lines in sed, but
from what I gather so far, the following awk would do it --

   awk '{ if (/~$/) print; else printf "%s", $0 }'

(literal separator for legibility.)  I know we're not exactly looking
for an awk or sed solution here, but thought it might add some context
to the exercise anyway.

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


Re: [Haskell-cafe] This is an interesting place to showcase Haskell.

2007-06-16 Thread Michael T. Richter
On Fri, 2007-15-06 at 22:23 -0700, Dan Weston wrote:

> I realize in hindsight that my wording could have been a little less 
> flippant. Thanks for contributing to that website.


I'm Happy to hear that.  Now if you could point out where you were
offensive I'll even understand.  :)  (Or did you think I was the
original author of the Sieve thing?  If so, don't worry.  I wasn't.  I'm
the author of the current version, though.)

I've decided to use that site as my own place to hammer out my Haskell
issues.  I'm familiar with a lot of languages represented there, so I'll
take a look at what other people do in those and write Haskell
equivalents.  I'll then post the URLs here and have you kind people put
me in my place for how awful my code is.  ;)


> Now pardon me while I enter a shame spiral to atone for my needless 
> hostility...


Umm...  Sure.  Whatever.  Just let me know when you come out of the
spiral so that I can understand why you entered it, OK?

-- 
Michael T. Richter <[EMAIL PROTECTED]> (GoogleTalk:
[EMAIL PROTECTED])
All really first class designers are both artists, engineers, and men of
a powerful and intolerant temper, quick to resist the least modification
of the plans, energetic in fighting the least infringement upon what
they regard as their own sphere of action. (Nevil Shute)
<><>

signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe