Re: [Haskell] ANNOUNCE: HsUnix 1.0.1 - Haskell for Unix Shell Scripting

2004-02-09 Thread Volker Wysk
> > "VW" == Volker Wysk <[EMAIL PROTECTED]> writes:
>
> VW> I'm pleased to announce the first release of the
> VW> HsUnix library. It enables you to do things easily
> VW> in Haskell which are typically done by the
> VW> shell. Thus Haskell can be used to write shell
> VW> scripts.
>
> Thanks, sounds great. :)  Though the tarball I just
> downloaded only seems to contain HsUnixArgs.hs.  Perhaps
> something went wrong with it?

The tarball was corrupted. I've reuploaded it. It should be fine now. I've
gut idea how this could happen.

bye,
Volker

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: HsUnix 1.0.1 - Haskell for Unix Shell Scripting

2004-02-09 Thread Tomasz Zielonka
On Sun, Feb 08, 2004 at 09:36:16PM +0100, Volker Wysk wrote:
> Features
> 
> 
> Command Line Arguments Parser
> HsUnix has facilities for managing command line arguments, which are
> (hopefully) easier to use than the GHC library GetOpt. Command line
> arguments are described in lists of properties. HsUnix builds on top
> of GetOpt, but hides it completely. Command line arguments handling
> has been added because GetOpt was found to be too cumbersome.

I found GetOpt to be convenient when used properly. I would be
interested to hear your comment on my article:
  http://tinyurl.com/23ya4

> Error Handling
> Error handling is one thing which is done much more thoroughly in
> HsUnix than in shells. Failed programs won't be silently ignored.
> Dynamic exceptions are used for error handling. Non zero exit codes
> are thrown as exceptions.

Most sh derivaties have -e set option, which causes the shell to (taken
from FreeBSD sh man page):

  -e errexit
Exit immediately if any untested command fails in non-interactive
mode.  The exit status of a command is considered to be explic-
itly tested if the command is used to control an if, elif, while,
or until; or if the command is the left hand operand of an ``&&''
or ``||'' operator.

I use it almost always in my shell scripts.

Best regards,
Tom

-- 
.signature: Too many levels of symbolic links
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] LDTA 2004 - Call for Participation

2004-02-09 Thread jas
Apologies if you receive multiple copies of this message.

  **
  ***   Fourth Workshop on   ***
  ***Language Descriptions, Tools and Applications   ***
  ***   LDTA 2004***
  ******
  ***Satellite event of ETAPS 2004   ***
  ******
  ***   In Co-Operation with ACM SIGPLAN ***
  ******
  ***APRIL, 3, 2004  ***
  ***   BARCELONA, SPAIN ***
  ******
  *** http://www.di.uminho.pt/LDTA04 ***
  **


--> Deadline for early registration: February, 15

  The ETAPS online registration form is available at

 http://www.lsi.upc.es/etaps04/Registration/registration-frame.html


- The LDTA 2004 Preliminary Program is available at
   
http://www.cs.lth.se/Research/LDTA2004/


- Invited speaker: Jim Cordy, Queen's University, Canada

   Title of the talk: TXL - A Language for Programming Language Tools and 
Applications


___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] KDevelop & Haskell

2004-02-09 Thread Gour
Peter Robinson ([EMAIL PROTECTED]) wrote:

> The last update was made in September and I didn't have much time to work on 
> it since then but I expect to have a working updated version at the latest by 
> the end of February, it isn't really much work. 

I'm glad to hear that.

> > When tried KDevelop rc1, I got the error that "language plugin is not
> > found" and on KDevelop forum it is stated that it won't/isn't included in
> > final release.
> Well the plugin _is_ included in the 3.0 release (libkdevhaskellsupport.*)
> but it is deactivated due to stability reasons. 

How it can be activated?

> You can expect the basic support working pretty soon more advanced features 
> might take a little longer, any help is welcome.

Great! Any idea if it would be possible to use HaRe refactorer with KVim 
embedded in KDevelop?

Sincerely,
Gour

-- 
Gour
[EMAIL PROTECTED]
Registered Linux User #278493

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: HsUnix 1.0.1 - Haskell for Unix Shell Scripting

2004-02-09 Thread Andrew Pimlott
On Mon, Feb 09, 2004 at 12:49:28PM +0100, Tomasz Zielonka wrote:
> On Sun, Feb 08, 2004 at 09:36:16PM +0100, Volker Wysk wrote:
> > Error Handling
> > Error handling is one thing which is done much more thoroughly in
> > HsUnix than in shells. Failed programs won't be silently ignored.
> > Dynamic exceptions are used for error handling. Non zero exit codes
> > are thrown as exceptions.
> 
> Most sh derivaties have -e set option, which causes the shell to (taken
> from FreeBSD sh man page):
> 
>   -e errexit
> Exit immediately if any untested command fails in non-interactive
> mode.

It doesn't work.

#!/bin/sh -e
cat nosuchfile | echo hello

This script will exit with status 0 (success).  If you think about
how traditional unix shells are implemented, you will see that they
can't get this right.  (Which proves the non-existence of reliable
non-trivial shell scripts!)

I have my own half-finished shell-in-Haskell that handles this.  I
would be interested to know whether HsUnix does.

Andrew
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] vim syntax files for GHC-style .lhs, .hs + cpp

2004-02-09 Thread Ian Lynagh
On Mon, Feb 09, 2004 at 12:56:43PM +1100, Donald Bruce Stewart wrote:
> Hey all,
> 
>  -
> Vim syntax highlighting for GHC-style .lhs and .hs + cpp
>  -
> 
> Rather than let this just sit on my hd, I'm making them available.
> 
> ftp://ftp.cse.unsw.edu.au/pub/users/dons/vim/
> 
> These are vim syntax files for the tex-style (not the bird-feet style)
> literate Haskell used in much of GHC, and for normal Haskell with -cpp
> preprocessor sprinkles. The directories should go in your ~/.vim/
> folder.

I've put mine here: http://urchin.cipe/~ian/vim/

They also use a simple heuristic to guess whether the non-Haskell stuff
should be treated as TeX or just text, and cope with the Bird style. We
really should send a best solution off to the vim guys to replace what's
currently there.


Thanks
Ian

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: HsUnix 1.0.1 - Haskell for Unix Shell Scripting

2004-02-09 Thread Tomasz Zielonka
On Mon, Feb 09, 2004 at 11:07:39AM -0500, Andrew Pimlott wrote:
> >   -e errexit
> > Exit immediately if any untested command fails in non-interactive
> > mode.
> 
> It doesn't work.

Well, it works as much as it can... better something than nothing.

> #!/bin/sh -e
> cat nosuchfile | echo hello

Yes, I forgot about this issue.

> I have my own half-finished shell-in-Haskell that handles this.  I
> would be interested to know whether HsUnix does.

So would I.

> Andrew

Best regards,
Tomasz

-- 
.signature: Too many levels of symbolic links
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] vim syntax files for GHC-style .lhs, .hs + cpp

2004-02-09 Thread Ian Lynagh
On Mon, Feb 09, 2004 at 04:20:59PM +, Ian Lynagh wrote:
> 
> I've put mine here: http://urchin.cipe/~ian/vim/

Or, more usefully, http://urchin.earth.li/~ian/vim/


Ian

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: HsUnix 1.0.1 - Haskell for Unix Shell Scripting

2004-02-09 Thread Volker Wysk
> On Mon, Feb 09, 2004 at 12:49:28PM +0100, Tomasz Zielonka wrote:
> #!/bin/sh -e
> cat nosuchfile | echo hello
>
> This script will exit with status 0 (success).  If you think about
> how traditional unix shells are implemented, you will see that they
> can't get this right.  (Which proves the non-existence of reliable
> non-trivial shell scripts!)
>
> I have my own half-finished shell-in-Haskell that handles this.  I
> would be interested to know whether HsUnix does.

The equivalent HsUnix script looks like this:

  import HsUnix

  main = mainwrapper $
 call (execp "cat" ["nosuchfile"] -|- execp "echo" ["hello"])

This happens to work right. The error is reported via a dynamic exception:

  ~/src/hsunix/build $ ./test2
  cat: nosuchfilehello
  : No such file or directory
  Process error. process status = Exited (ExitFailure 1)

However, when using pipes, the exitcode of only one of the involved
processes can be monitored. The other ones will be silently ignored. If
the second process would fail in the above pipe, rather than the first
one, no error would be reported. In this case, you could use "-|=" instead
of "-|-". Then the second process would be monitored.


Bye,
Volker

-- 
Volker Wysk <[EMAIL PROTECTED]>
http://www.volker-wysk.de

___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: HsUnix 1.0.1 - Haskell for Unix Shell Scripting

2004-02-09 Thread Andrew Pimlott
On Mon, Feb 09, 2004 at 07:16:09PM +0100, Volker Wysk wrote:
>   main = mainwrapper $
>  call (execp "cat" ["nosuchfile"] -|- execp "echo" ["hello"])
> 
> This happens to work right. The error is reported via a dynamic exception:
> 
>   ~/src/hsunix/build $ ./test2
>   cat: nosuchfilehello
>   : No such file or directory
>   Process error. process status = Exited (ExitFailure 1)
> 
> However, when using pipes, the exitcode of only one of the involved
> processes can be monitored.

Let me give my frank opinion that, even though it's how shell
scripts have always worked, this should be considered broken.  It is
rather a pain to fix, as you can't implement it in the usual
straightforward way.  You have to fork all subprocesses from the
main process, and do extra work to share the pipes.  If you don't
want to use filehandles extravagantly, you have to do additional
work.  I essentially wrote a mini-OS layer that wraps all fork,
pipe, and open calls, and tries (in a fairly dumb but usually
effective way) to allocate filehandles efficiently.  I can share if
you'd like.  (I found this exercise gave great insight into the
"worse is better" philosophy.)

If you don't change this behavior, at least document it prominently
as a robustness sink!  :-)

Andrew
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] vim syntax files for GHC-style .lhs, .hs + cpp

2004-02-09 Thread Donald Bruce Stewart
igloo:
> On Mon, Feb 09, 2004 at 12:56:43PM +1100, Donald Bruce Stewart wrote:
> > Hey all,
> > 
> >  -
> > Vim syntax highlighting for GHC-style .lhs and .hs + cpp
> >  -
> > 
> > Rather than let this just sit on my hd, I'm making them available.
> > 
> > ftp://ftp.cse.unsw.edu.au/pub/users/dons/vim/
> > 
> > These are vim syntax files for the tex-style (not the bird-feet style)
> > literate Haskell used in much of GHC, and for normal Haskell with -cpp
> > preprocessor sprinkles. The directories should go in your ~/.vim/
> > folder.
> 
> I've put mine here: http://urchin.cipe/~ian/vim/
> 
> They also use a simple heuristic to guess whether the non-Haskell stuff
> should be treated as TeX or just text, and cope with the Bird style. We
> really should send a best solution off to the vim guys to replace what's
> currently there.

Yes. I propose we combine them.

I'm too busy at the moment, but if someone out there wants to combine
the two, to create an uber-haskell.vim syntax highlighting that works
for .hs, .lhs (both tex and bird), .hsc and all with -cpp annotations,
this should be quite feasible, with Ian's and my code as a start.

They should work with anything you find in $fptools.

-- Don
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] ANNOUNCE: HsUnix 1.0.1 - Haskell for Unix ShellScripting

2004-02-09 Thread andrew cooke

wouldn't it be nicer to have
- mainwrapper and call combined
- helper fucntions defined for execp "cat" etc

i haven't downloaded your package, but the syntax as it is looks very
verbose.  i know it's a small point, but shells have to support a compact
syntax (or is the idea only to support "shell scripts" and not provide a
shell? - i was assuming you'd start ghci in a window and load this module
automatically when you open an xterm...)

andrew

Volker Wysk said:
> The equivalent HsUnix script looks like this:
>
>   import HsUnix
>
>   main = mainwrapper $
>  call (execp "cat" ["nosuchfile"] -|- execp "echo" ["hello"])

-- 
personal web site: http://www.acooke.org/andrew
personal mail list: http://www.acooke.org/andrew/compute.html
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] newbie question

2004-02-09 Thread Lee Render
is "HaskellScript" still working?
I tried mucking around with this lately using the
latest version of Hugs but the example scripts seemed
broken.


__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell