Re: Help with propositional formulas

2003-07-21 Thread Graham Klyne
There's a 'powerset' thread on this list [1][2] starting 4th June which I think contains some of the answers you seek. Read and you shall learn! #g -- [1] List archive: http://www.haskell.org/pipermail/haskell-cafe/ [2] Powerset thread starts:

lazy Printing question

2003-07-21 Thread AJ
Hi everyone, I have written the following program to find magic numbers i.e. integers 'n' such that both (n+1) and (n/2+1) are perfect squares. -- Program to find magic numbers Import IO main :: IO () main = do print (filter magicP sqs) sqs :: [Int] sqs = [x*x | x -

segfault in haskell!

2003-07-21 Thread David Roundy
I've managed to get a segfault in haskell! And without even using the FFI... actually my code uses the FFI, but the changes that triggered the segfault don't involve that, they just use Text.Regex. The code that triggers the segfault is the function produced by: filetype_function :: IO (FilePath

How to catch an exception

2003-07-21 Thread Bayley, Alistair
Trying to get the hang of exceptions... I would expect this program: module Main where import Control.Exception hiding (GHC.Prelude.catch) temp :: IO () temp = do putStrLn line 1 ioError (AssertionFailed my temp) handler :: Exception - IO () handler e = putStrLn (exception: ++

Re: How to catch an exception

2003-07-21 Thread Ross Paterson
On Mon, Jul 21, 2003 at 02:12:02PM +0100, Bayley, Alistair wrote: module Main where import Control.Exception hiding (GHC.Prelude.catch) This hiding clause is illegal. But anyway what you want is import Prelude hiding (catch) import Control.Exception Prelude.catch only catches Haskell 98

Re: lazy Printing question

2003-07-21 Thread Alastair Reid
If I try to run the program (compiled using GHC 6), it calculates all members of the list and then prints the whole list in the end. Since Haskell is 'lazy' I was expecting behaviour similar to HUGS where it prints the numbers as it finds them. Does this behaviour have something to do with

Ignoring ExitExceptions

2003-07-21 Thread Tim Jolly
I'm looking for a way to return an arbitrary exit code to the OS. The standard `exitWith' function does the job, but unfortunately it also has the side-effect of reporting an exception (I'm using GHC 6.0, with Control.Exception imported for other purposes). When a fatal error occurs, my program