Re: Green Card and Exceptions

2003-06-13 Thread Alastair Reid
On Friday 13 June 2003 3:37 am, Matthew Donadio wrote:
 Hi all,

 I have a couple of questions about Green Card and exceptions.

 [...]

 This definition works, but it ignores the return code from the library
 function.  The various return codes are from an enum defined in a header
 file.  I would like to throw a Haskell exception (one of the
 ArithExceptions defined in Control.Exception) depending on the value of
 rc.

The %fail statements (described in the last few paragraphs of 
http://www.haskell.org/greencard/downloads/greencard-latest/type-sig.html) 
consist of two C expressions.  For example:

%fail {f == NULL} {errstring(errno)}

The first is a test for failure.
The second is an expression which returns a C string.

If the test expression fails, the string expression is evaluated and used to 
generate a UserError.

 If I have to create a
 DIS, can this be shared across several modules that all need the same
 functionality?

It would be nice to be able to write something like:

  %fail POSIX_FD(fd)

where POSIX_FD is something you defined elsewhere (e.g., it might test if its 
file-descriptor argument is -1).  GreenCard can't do this.


It would also be nice to be able to generate a different error instead of 
UserError.  We'd need to specify the type and the exception constructor so a 
plausible syntax would be:

  %fail {f == NULL} (UserError (string {errstring(errno)}))

[Detail: should it be a Haskell98  IOError constructor or a non-standard but 
widely implemented exception constructor?   Should it be a function or a 
constuctor?]

Again, GreenCard can't do that.


As GreenCard maintainer, I've got to ask:
- How many users of GreenCard are still out there?
- Are you developing new libraries or just maintaining the ones you've got?
- Is there a demand for new features?

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


chance to help out on the wiki

2003-06-13 Thread Isaac Jones
Greetings.

We added a page Fundamental Concepts to the wiki so that we might
have a very specific reference to pass along to people with questions,
and to add links to definitions throughout the wiki.

http://www.haskell.org/hawiki/FundamentalConcepts

A lot of concepts need to be filled in, and if you haven't
participated in the Wiki yet, now is a good time :) If you've never
used a wiki, you can read about it here:

http://www.haskell.org/hawiki/HelpForBeginners

You might model your explanations after a page I wrote for
PatternMatching which has:
- a reference to a tutorial
- a reference to the haskell report
- an explanation
- some examples

Feel free to extend and / or correct anything already there.

The front page of the wiki is here:

http://www.haskell.org/hawiki/FrontPage



peace,

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


Re: Green Card and Exceptions

2003-06-13 Thread Matthew Donadio
Alastair Reid wrote:
 The %fail statements (described in the last few paragraphs of
 http://www.haskell.org/greencard/downloads/greencard-latest/type-sig.html)
 consist of two C expressions.  For example:
 
 %fail {f == NULL} {errstring(errno)}
 
 The first is a test for failure.
 The second is an expression which returns a C string.
 
 If the test expression fails, the string expression is evaluated and used to
 generate a UserError.

OK, I think I misread the manual.  Sect 7.6 talks about functions with
side effects, so I assumed that the function had to have type (IO a) to
use %fail. 
 
 It would also be nice to be able to generate a different error instead of
 UserError.  We'd need to specify the type and the exception constructor so a
 plausible syntax would be:
 
   %fail {f == NULL} (UserError (string {errstring(errno)}))
 
 [Detail: should it be a Haskell98  IOError constructor or a non-standard but
 widely implemented exception constructor?   Should it be a function or a
 constuctor?]

In the case of what I am doing, I'm not sure if IOError really make
sense philosophically.  The failures I need are underflow, overflow,
loss of precision, etc.  Since IOError is a type synonym for
IOException, then perhaps accepting an Exception constructor is
appropriate.

To keep compatibility with old libraries it may be wise to keep %fail as
is, and have a new directive %throw that accepts an Exception
constructor, and uses either throw or throwIO.

On the other hand, now that I know that I can use %fail with pure
functions, I can make that work.
 
 As GreenCard maintainer, I've got to ask:
 - How many users of GreenCard are still out there?

New GreenCard user.  In my case, I need access to C land for typedefs
and macros.  I could write my own stubs, but GreenCard saves me this
step.

 - Are you developing new libraries or just maintaining the ones you've got?

New library.

 - Is there a demand for new features?

A more generic %fail mechanism?

Thanks for the response.

-- 
Matthew Donadio ([EMAIL PROTECTED])
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


please help

2003-06-13 Thread David Savimbi
From: David Jonas Savimbi
Johannesburg, South Africa
Email: [EMAIL PROTECTED]
june 13th, 2003.
Dear Sir,
It is my humble pleasure to write you this letter irrespective of the fact that you do 
not know me. However, I got your name through your country business directory here in 
my search for a reliable and trustworthy person that can assist me confidently.
My name is Mr.John Jonas Savimbi. I am the son of Late Dr. Jonas Savimbi from Angola. 
I am 29 years old and I have got two younger sisters of same blood. Our mother died 
almost a year ago. We are all fighting for political asylum in South Africa. We cannot 
find a home in Angola anymore because of the war that our late father fought with the 
government of Angola until he died in that war. The government of Angola is now mad at 
us because our late father also wanted to be president and caused the people to fight 
the war for him because he was the president of UNITA political movement of Angola.
So now we are in South Africa and we are suffering too much because we don't have 
money and the government of South Africa will not give jobs to asylum seekers. I am 
much concerned about my younger sisters who are finding it very difficult to manage in 
the situation. But I know that we should not suffer this way. I know that I must not 
let my younger sisters get into trouble because of money. So after consideration I am 
hereby begging for your assistance to help me to recover the sum of USD $29 Million 
which is my inheritance from my late mother. My late mother had taken this money with 
her to Spain in a diplomatic metal box marked (Precious Stones). Subsequently she 
lodged the metal box (As precious Stones) with a Securities and Valuables Protection 
company in Spain. I am supposed to be the beneficiary in the event of her death. 
However, all effort I made to go Spain to claim was refused by the Spainish embassy. 
And this was while it was still possible for me to travel. Now I cannot travel 
anywhere anymore. So in the situation that we are facing now, I must find somebody who 
can go to the Spain on my behalf.
I understand that I will have to transfer my beneficiary rights unto you. I am willing 
to do so in the hope that you are a God fearing person who will not abandon us after 
you have the money. So from the bottom of my heart I am giving you 20% of the all the 
money. Once we have enough to sustain us sufficiently, you may be come our fund 
manager and invest the rest wisely for us. If you will be kind to assist us, please 
inform me urgently.
Kind regards to you and your family.
Sincerely,

David Jonas savimbi


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


Testing was Re: main modules in GHC, deriving differences between GHC and Hugs

2003-06-13 Thread Matthew Donadio
(redirected to haskell-cafe)

Hal Daume III wrote:
 Yes, but there's a problem with this solution.  Namely, if Foo.hs takes a
 long time to compile, then you can't leverage having already created Foo.o
 and Foo.hi when making the Main.

Yeah, it's not perfect, but I think we just have different methodologies
for testing.

Typically, I do most of my development with ghci or hugs.  Each module
will have a single variable that represents the tests

tests :: [Bool]
tests = [ test1, test2, test3 ... ]

and then I define a variable called

test :: Bool
test = and tests

so I can just load a module and either evaluate tests or test to check
things out.  This generalizes to importing and testing several modules
at once (as long as I take care of name conflists).

This only works for simple modules, though.  For more complicated ones,
I have a pretty tester.  For example, my Haskell FFT library is
collection of mutually recursive modules.  I have a specialzed test
function for this that tests a range of lengths.  It looks someone like

main = testfft n1 n2

testfft n1 n2 = sequence $ map test1fft [n1..n2]

test1fft n = do putStr $ show n ++ :\t
putStr $ if ok then OK\n else ERROR\n
 where ok = and [ test1 n, test2 n, test3 n ]

This way I can compile the code, and run the executable as

ffttest 2 2048 | grep ERROR

and I am confident that I get full coverage of the algorithm.

I am always to hear about other methods of automated testing.

-- 
Matthew Donadio ([EMAIL PROTECTED])
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe


REPLY REQUIRED: Confirm subscription to group Intelligent Learning

2003-06-13 Thread Team domeus
Title: domeus










system message









Hello [EMAIL PROTECTED],


thanks for your interest in the group Intelligent Learning ([EMAIL PROTECTED])

If you would like to accept this invitation, please return this eMail by clicking on reply or subscribe via the Web.
Subscribe
If you are not interested in joining, please ignore this eMail and you will receive no further eMails from us.
The group owner sends the following welcome message:
-
Welcome to Intelligent Learning! Our systems and programs can help you to successfully optimize your professional potential in a changing world. To be able to progress efficiently in any area today, we promote new smart working and learning systems through new techniques, tools and methodologies (TTMs) in key Smart Learning Areas: Knowledge Management, Change Management, Quantitative Learning, Qualitative Learning, Skill Management and Business Intelligence. For more information visit our web www.amjsmartlearning.com [EMAIL PROTECTED]
-

If you would like to use the full range of features, just log in at http://uk.domeus.com using the following log-in information:

username: [EMAIL PROTECTED]
password: fetifak8

If your eMail address has been added to this list without your consent and you do not wish to receive eMails from Domeus,
please forward this message to: [EMAIL PROTECTED]


Best regards,
Your Domeus Team






 





gtk2hs

2003-06-13 Thread Christian Buschmann
Hi!
I tried to implement a simple counter with gtk2hs. To increase my 
counter I defined following event:

onClicked btn $ do si - textBufferGetStartIter tb
   ei - textBufferGetEndIter tb
   val - textBufferGetText tb si ei False
   textBufferSetText tb $ show $ (+1) $ read val
But now I don't want always read the textfield to get my counter-value, 
I would like to save the state of my increased value and would like to 
pass it to the next call of the function.
How can I do this?

thanks
  Christian


This is the complete code:

import Gtk

quitDialog :: IO Bool
quitDialog = .
main :: IO ()
main = do
   initGUI
   --main window
   win - windowNew
   onDelete win (\_-(quitDialog= (return . not )))
   onDestroy win mainQuit
   vb - vBoxNew True 5
   hb - hBoxNew True 5
   btn - buttonNewFromStock stockExecute
   btn2 - buttonNewFromStock stockQuit
   tv - textViewNew
   tb - textBufferNew Nothing
   textBufferSetText tb 0
   textViewSetEditable tv False
   textViewSetCursorVisible tv False
   textViewSetBuffer tv tb
   boxPackStartDefaults vb tv
   boxPackStartDefaults vb hb
   boxPackStartDefaults hb btn
   boxPackStartDefaults hb btn2
   hgf - onClicked btn $ do si - textBufferGetStartIter tb
 ei - textBufferGetEndIter tb
 val - textBufferGetText tb si ei False
 textBufferSetText tb $ show $ (+1) $ 
read val
   disconnect hgf
   onClicked btn2 $ do quit - quitDialog
   if quit then
  widgetDestroy win
  else return ()
   containerAdd win vb
   widgetShowAll win
   mainGUI

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