From rakdver@hotmail.com Sat Mar 1 21:10:39 2003 From: rakdver@hotmail.com (Zdenek Dvorak) Date: Sat, 01 Mar 2003 21:10:39 +0000 Subject: int to float problem Message-ID: Hello, [snip] >Try > >intToFloat :: Int -> Float >intToFloat n = fromInteger (toInteger n) [snip] >Use the Prelude function realToFrac. it sometimes happens to me that I must spend some time browsing prelude to devise somethink like this; it might be useful to have a library for this, that would define class Coerce a b where coerce :: a->b of course this cannot work without multiparametric type classes. Zdenek _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail From wferi@afavant.elte.hu Sat Mar 1 00:37:59 2003 From: wferi@afavant.elte.hu (Ferenc Wagner) Date: Sat, 01 Mar 2003 01:37:59 +0100 Subject: int to float problem In-Reply-To: <20030228194203.GA20201@denali.ccs.neu.edu> ("Mike T. Machenry"'s message of "Fri, 28 Feb 2003 14:42:03 -0500") References: <20030228194203.GA20201@denali.ccs.neu.edu> Message-ID: <3oadgfvs48.fsf@tba.elte.hu> "Mike T. Machenry" writes: > I recently desided I wanted a bunch function to return > float instead of Int. [...] I found fromInteger but it > didn't seem to work on the return value of the cardinality > function for instance. Try fromIntegral, which works for Int and Integer, too. Feri. From thenorio@home.se Sat Mar 1 21:53:24 2003 From: thenorio@home.se (Alexandre Weffort Thenorio) Date: Sat, 1 Mar 2003 22:53:24 +0100 Subject: How to catch and error message and how to make it create unix files instead of dos files?? Message-ID: <001a01c2e03c$fbbea4b0$0800a8c0@thenorio> This is a multi-part message in MIME format. ------=_NextPart_000_0017_01C2E045.5D369A60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am trying to write a small software to take info from one file and = write it into another file. The problem is that when I don't give any = input I get the normal haskell nosuchfile error message but I want to = give my own error message. I am a newbie, how can I do that? Also I need = the file that is gonna be created (A text file), to be created in UNIX = type and not as a DOS file type, how can I do that? I am using ghc to = compile on Windows. Here is the main code main :: IO() main =3D do args <- getArgs codes <- codes args conax <- readconax "conax.txt" makeIrdFile (lines codes) (lines conax) =20 --Read input file------------------------------------ codes :: [String] -> IO[Char] codes [] =3D return "" codes (x:xs) =3D do first <- readFile x return first =20 --Read Inbuilt file--------------------------------- readconax file =3D do list <- readFile file return list ------=_NextPart_000_0017_01C2E045.5D369A60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I am trying to write a small software = to take info=20 from one file and write it into another file. The problem is that when I = don't=20 give any input I get the normal haskell nosuchfile error message but I = want to=20 give my own error message. I am a newbie, how can I do that? Also I need = the=20 file that is gonna be created (A text file), to be created in UNIX type = and not=20 as a DOS file type, how can I do that? I am using ghc to compile on=20 Windows.
 
Here is the main code
 
main :: IO()
main =3D = do
 args <-=20 getArgs
 codes <- codes args
 conax <- readconax=20 "conax.txt"
 makeIrdFile (lines codes) (lines=20 conax)
  
 
--Read input=20 file------------------------------------
codes :: [String] ->=20 IO[Char]
codes [] =3D return ""
codes (x:xs) =3D do
 first = <-=20 readFile x
 return first
 
--Read Inbuilt=20 file---------------------------------
readconax file =3D = do
 list <-=20 readFile file
 return list
------=_NextPart_000_0017_01C2E045.5D369A60-- From hdaume@ISI.EDU Sun Mar 2 02:11:24 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Sat, 1 Mar 2003 18:11:24 -0800 (PST) Subject: How to catch and error message and how to make it create unix files instead of dos files?? In-Reply-To: <001a01c2e03c$fbbea4b0$0800a8c0@thenorio> Message-ID: Look at the functions try catch and bracket. -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Sat, 1 Mar 2003, Alexandre Weffort Thenorio wrote: > I am trying to write a small software to take info from one file and write it into another file. The problem is that when I don't give any input I get the normal haskell nosuchfile error message but I want to give my own error message. I am a newbie, how can I do that? Also I need the file that is gonna be created (A text file), to be created in UNIX type and not as a DOS file type, how can I do that? I am using ghc to compile on Windows. > > Here is the main code > > main :: IO() > main = do > args <- getArgs > codes <- codes args > conax <- readconax "conax.txt" > makeIrdFile (lines codes) (lines conax) > > > --Read input file------------------------------------ > codes :: [String] -> IO[Char] > codes [] = return "" > codes (x:xs) = do > first <- readFile x > return first > > --Read Inbuilt file--------------------------------- > readconax file = do > list <- readFile file > return list From utlbb@yahoo.com Sun Mar 2 07:35:03 2003 From: utlbb@yahoo.com (L BB) Date: Sat, 1 Mar 2003 23:35:03 -0800 (PST) Subject: How to make Parser explicitly "fail"? Message-ID: <20030302073503.40283.qmail@web20110.mail.yahoo.com> Hi, there. I am glad to join Haskell community. :) Here I have a question about Parser: how to make a parser explicitly "fail"? My question arises from the syntax below: ::= ::="define" ::=':' ::=identifier other than ::=()+ ::=a..z|A..Z Now I am thinking of writing a Parser for variable. My thought is: variable::Parser String variable = do s<-identifier if not (s=="define") then return s else --let parser fail I will be very happy if there is some mechanism to implement the "else" branch, for I have thought of it for long. :) __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ From jadrian@mat.uc.pt Sun Mar 2 11:28:00 2003 From: jadrian@mat.uc.pt (Jorge Adriano) Date: Sun, 2 Mar 2003 11:28:00 +0000 Subject: int to float problem In-Reply-To: <3oadgfvs48.fsf@tba.elte.hu> References: <20030228194203.GA20201@denali.ccs.neu.edu> <3oadgfvs48.fsf@tba.elte.hu> Message-ID: <200303021113.25922.jadrian@mat.uc.pt> --Boundary-00=_AreY+/Q9GP022GY Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > "Mike T. Machenry" writes: > > I recently desided I wanted a bunch function to return > > float instead of Int. [...] I found fromInteger but it > > didn't seem to work on the return value of the cardinality > > function for instance. > > Try fromIntegral, which works for Int and Integer, too. Casting an Integral value to a Fractional value to perform arithmetic=20 operations, is a very common need and I don't like adding fromIntegral=20 everywhere, so ended up writing a (very simple) module with generalized=20 arithmetic operators (see attachment). The =BB next to the operations indic= ate=20 a cast from an Integral to a Fractional value.=20 J.A. --Boundary-00=_AreY+/Q9GP022GY Content-Type: text/plain; charset="iso-8859-1"; name="CrossTypeOps.hs" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="CrossTypeOps.hs" module CrossTypeOps where =2D- Addition (+=AB) :: (Fractional a, Integral b)=3D> a -> b -> a (+=AB) x n =3D x+fromIntegral n (=BB+) :: (Integral a, Fractional b)=3D> a -> b -> b (=BB+) n x =3D fromIntegral n + x (=BB+=AB) :: (Integral a, Fractional b)=3D> a -> a -> b (=BB+=AB) m n =3D fromIntegral m+fromIntegral n =2D- Difference (-=AB) :: (Fractional a, Integral b)=3D> a -> b -> a (-=AB) x n =3D x-fromIntegral n (=BB-) :: (Integral a, Fractional b)=3D> a -> b -> b (=BB-) n x =3D fromIntegral n - x (=BB-=AB) :: (Integral a, Fractional b)=3D> a -> a -> b (=BB-=AB) m n =3D fromIntegral m-fromIntegral n =2D- Multiplication (*=AB) :: (Fractional a, Integral b)=3D> a -> b -> a (*=AB) x n =3D x*fromIntegral n (=BB*) :: (Integral a, Fractional b)=3D> a -> b -> b (=BB*) n x =3D fromIntegral n * x (=BB*=AB) :: (Integral a, Fractional b)=3D> a -> a -> b (=BB*=AB) m n =3D fromIntegral m*fromIntegral n =2D- Division=20 (/=AB) :: (Fractional a, Integral b)=3D> a -> b -> a (/=AB) x n =3D x / fromIntegral n (=BB/) :: (Integral a, Fractional b)=3D> a -> b -> b (=BB/) n x =3D fromIntegral n / x (=BB/=AB) :: (Integral a, Fractional b)=3D> a -> a -> b (=BB/=AB) m n =3D fromIntegral m / fromIntegral n =2D- Priorities infixl 6 +=AB, =BB+, =BB+=AB, -=AB, =BB-, =BB-=AB infixl 7 *=AB, =BB*, =BB*=AB, /=AB, =BB/, =BB/=AB --Boundary-00=_AreY+/Q9GP022GY-- From alethenorio@home.se Sun Mar 2 22:28:09 2003 From: alethenorio@home.se (Alexandre Weffort Thenorio) Date: Sun, 2 Mar 2003 23:28:09 +0100 Subject: How to catch and error message and how to make it create unix files instead of dos files?? References: Message-ID: <001301c2e10b$00b92a20$0800a8c0@thenorio> Thanks I actually have done that but couldn't understand how to use them. Can you give me an example on a function that reads a file and in case the file is not found you throw a string like "File not found" or so?? Best Regards NooK ----- Original Message ----- From: "Hal Daume III" To: "Alexandre Weffort Thenorio" Cc: Sent: Sunday, March 02, 2003 3:11 AM Subject: Re: How to catch and error message and how to make it create unix files instead of dos files?? > Look at the functions try catch and bracket. > > -- > Hal Daume III | hdaume@isi.edu > "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > > On Sat, 1 Mar 2003, Alexandre Weffort Thenorio wrote: > > > I am trying to write a small software to take info from one file and write it into another file. The problem is that when I don't give any input I get the normal haskell nosuchfile error message but I want to give my own error message. I am a newbie, how can I do that? Also I need the file that is gonna be created (A text file), to be created in UNIX type and not as a DOS file type, how can I do that? I am using ghc to compile on Windows. > > > > Here is the main code > > > > main :: IO() > > main = do > > args <- getArgs > > codes <- codes args > > conax <- readconax "conax.txt" > > makeIrdFile (lines codes) (lines conax) > > > > > > --Read input file------------------------------------ > > codes :: [String] -> IO[Char] > > codes [] = return "" > > codes (x:xs) = do > > first <- readFile x > > return first > > > > --Read Inbuilt file--------------------------------- > > readconax file = do > > list <- readFile file > > return list > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From hdaume@ISI.EDU Sun Mar 2 23:13:20 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Sun, 2 Mar 2003 15:13:20 -0800 (PST) Subject: How to catch and error message and how to make it create unix files instead of dos files?? In-Reply-To: <001301c2e10b$00b92a20$0800a8c0@thenorio> Message-ID: main = do v <- try $ readFile "foo" case v of Left _ -> putStrLn "an error occurred" Right t -> putStrLn t should work -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Sun, 2 Mar 2003, Alexandre Weffort Thenorio wrote: > Thanks I actually have done that but couldn't understand how to use them. > Can you give me an example on a function that reads a file and in case the > file is not found you throw a string like "File not found" or so?? > > Best Regards > > NooK > > ----- Original Message ----- > From: "Hal Daume III" > To: "Alexandre Weffort Thenorio" > Cc: > Sent: Sunday, March 02, 2003 3:11 AM > Subject: Re: How to catch and error message and how to make it create unix > files instead of dos files?? > > > > Look at the functions try catch and bracket. > > > > -- > > Hal Daume III | hdaume@isi.edu > > "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > > > > On Sat, 1 Mar 2003, Alexandre Weffort Thenorio wrote: > > > > > I am trying to write a small software to take info from one file and > write it into another file. The problem is that when I don't give any input > I get the normal haskell nosuchfile error message but I want to give my own > error message. I am a newbie, how can I do that? Also I need the file that > is gonna be created (A text file), to be created in UNIX type and not as a > DOS file type, how can I do that? I am using ghc to compile on Windows. > > > > > > Here is the main code > > > > > > main :: IO() > > > main = do > > > args <- getArgs > > > codes <- codes args > > > conax <- readconax "conax.txt" > > > makeIrdFile (lines codes) (lines conax) > > > > > > > > > --Read input file------------------------------------ > > > codes :: [String] -> IO[Char] > > > codes [] = return "" > > > codes (x:xs) = do > > > first <- readFile x > > > return first > > > > > > --Read Inbuilt file--------------------------------- > > > readconax file = do > > > list <- readFile file > > > return list > > > > _______________________________________________ > > Haskell mailing list > > Haskell@haskell.org > > http://www.haskell.org/mailman/listinfo/haskell > > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From alethenorio@home.se Sun Mar 2 23:35:47 2003 From: alethenorio@home.se (Alexandre Weffort Thenorio) Date: Mon, 3 Mar 2003 00:35:47 +0100 Subject: How to force UNIX text files as output instead of DOS text files?? Message-ID: <004801c2e114$73bd3350$0800a8c0@thenorio> This is a multi-part message in MIME format. ------=_NextPart_000_0045_01C2E11C.D5586870 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am working on a small program which writes a text file but I need this = file to be in UNIX format and as it is a Windows program I am compiling = it, the output file tends to be in DSO format. Is there anyway that I = can force it to create the file in UNIX format??? Best Regards NooK ------=_NextPart_000_0045_01C2E11C.D5586870 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I am working on a small program which = writes a text=20 file but I need this file to be in UNIX format and as it is a Windows = program I=20 am compiling it, the output file tends to be in DSO format. Is there = anyway that=20 I can force it to create the file in UNIX format???
 
Best Regards
 
NooK
------=_NextPart_000_0045_01C2E11C.D5586870-- From nick.name@inwind.it Mon Mar 3 00:21:09 2003 From: nick.name@inwind.it (Nick Name) Date: Mon, 3 Mar 2003 01:21:09 +0100 Subject: How to force UNIX text files as output instead of DOS text files?? In-Reply-To: <004801c2e114$73bd3350$0800a8c0@thenorio> References: <004801c2e114$73bd3350$0800a8c0@thenorio> Message-ID: <20030303012109.55b47670.nick.name@inwind.it> On Mon, 3 Mar 2003 00:35:47 +0100 "Alexandre Weffort Thenorio" wrote: > the output file tends to be in DSO format. Is there anyway that I can > force it to create the file in UNIX format??? I am not an expert on the subject, but ... maybe you just have to use a string constant named "newline" (maybe a function with an implicit argument of type (Dos|Unix)) instead of "\n". Vincenzo From glynn.clements@virgin.net Mon Mar 3 01:02:58 2003 From: glynn.clements@virgin.net (Glynn Clements) Date: Mon, 3 Mar 2003 01:02:58 +0000 Subject: How to force UNIX text files as output instead of DOS text files?? In-Reply-To: <004801c2e114$73bd3350$0800a8c0@thenorio> References: <004801c2e114$73bd3350$0800a8c0@thenorio> Message-ID: <15970.43458.993973.957415@cerise.nosuchdomain.co.uk> Alexandre Weffort Thenorio wrote: > I am working on a small program which writes a text file but I need this > file to be in UNIX format and as it is a Windows program I am compiling > it, the output file tends to be in DSO format. Is there anyway that I > can force it to create the file in UNIX format??? Use openFileEx, e.g.: import IOExts ... handle <- openFileEx filename (BinaryMode WriteMode) -- Glynn Clements From ketil@ii.uib.no Mon Mar 3 08:25:09 2003 From: ketil@ii.uib.no (Ketil Z. Malde) Date: 03 Mar 2003 09:25:09 +0100 Subject: int to float problem In-Reply-To: <20030228194203.GA20201@denali.ccs.neu.edu> References: <20030228194203.GA20201@denali.ccs.neu.edu> Message-ID: "Mike T. Machenry" writes: > I am having a problem. I recently desided I wanted a bunch function to return > float instead of Int. I changed their type and wrote a new function that > returned a float. I figured it'd be okay if all the others still returned > Int since it's trivial to convert Int to Float. Perhaps the other functions could be written with a more general type? (E.g. :: Num a => ... -> a) Try to remove the type declaration, and see what Hugs or GHCi :t has to say about it! -kzm -- If I haven't seen further, it is by standing in the footprints of giants From simonpj@microsoft.com Mon Mar 3 08:53:27 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Mon, 3 Mar 2003 08:53:27 -0000 Subject: fundeps for extended Monad definition Message-ID: | > The reason, which is thoroughly explained in Simon Peyton-Jones' | > message, is that the given type signature is wrong: it should read | > f1 :: (exists b. (C Int b) =3D> Int -> b) |=20 | Right. Simon pointed out that this is a pretty useless function, but not | entirely so, since the result of it is not of type 'forall b. b', but | rather of 'forall b. C Int b =3D> b'. Thus, if the C class has a function | which takes a 'b' as an argument, then this value does have use. I disagree. Can you give an example of its use? =20 Simon From alethenorio@home.se Mon Mar 3 09:33:17 2003 From: alethenorio@home.se (Alexandre Weffort Thenorio) Date: Mon, 3 Mar 2003 10:33:17 +0100 Subject: How to force UNIX text files as output instead of DOS text files?? References: <004801c2e114$73bd3350$0800a8c0@thenorio> <15970.43458.993973.957415@cerise.nosuchdomain.co.uk> Message-ID: <001801c2e167$ec05a830$0800a8c0@thenorio> Thanks a lot m8 but ghc says it can't the module IOExts when I try to compile, any suggestion??? Do I just use normal writeFile method to create the text file then?? Best Regards Alex ----- Original Message ----- From: "Glynn Clements" To: "Alexandre Weffort Thenorio" Cc: Sent: Monday, March 03, 2003 2:02 AM Subject: Re: How to force UNIX text files as output instead of DOS text files?? > > Alexandre Weffort Thenorio wrote: > > > I am working on a small program which writes a text file but I need this > > file to be in UNIX format and as it is a Windows program I am compiling > > it, the output file tends to be in DSO format. Is there anyway that I > > can force it to create the file in UNIX format??? > > Use openFileEx, e.g.: > > import IOExts > ... > handle <- openFileEx filename (BinaryMode WriteMode) > > -- > Glynn Clements > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From Leonid Bouriakovsky Mon Mar 3 09:51:55 2003 From: Leonid Bouriakovsky (Leonid Bouriakovsky) Date: Mon, 3 Mar 2003 12:51:55 +0300 Subject: How to make Parser explicitly "fail"? In-Reply-To: <20030302073503.40283.qmail@web20110.mail.yahoo.com> References: <20030302073503.40283.qmail@web20110.mail.yahoo.com> Message-ID: <1531013465786.20030303125155@mail.wplus.net> If you are using the ParseLib from the Hugs distribution, the function you are looking for is mzero: C:\Hugs98\lib\hugs\ParseLib.hs: instance MonadPlus Parser where -- mzero :: Parser a mzero = P (\inp -> []) -- mplus :: Parser a -> Parser a -> Parser a (P p) `mplus` (P q) = P (\inp -> (p inp ++ q inp)) For the explanations on how this function works and why it has such a name you can take a look at the following paper: Monadic parser combinators Graham Hutton and Erik Meijer. Technical Report NOTTCS-TR-96-4, Department of Computer Science, University of Nottingham, 1996. http://www.cs.nott.ac.uk/Department/Staff/gmh/bib.html#monparsing Regards, Leonid Bouriakovsky > Hi, there. I am glad to join Haskell community. :) > > Here I have a question about Parser: how to make a > parser explicitly "fail"? > > My question arises from the syntax below: > > ::= > ::="define" > ::=':' > ::=identifier other than > ::=()+ > ::=a..z|A..Z > > Now I am thinking of writing a Parser for variable. My > thought is: > > variable::Parser String > variable = do s<-identifier > if not (s=="define") then return s else > --let parser fail > > I will be very happy if there is some mechanism to > implement the "else" branch, for I have thought of it > for long. :) > > __________________________________________________ > Do you Yahoo!? > Yahoo! Tax Center - forms, calculators, tips, more > http://taxes.yahoo.com/ > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell From daanleijen@xs4all.nl Mon Mar 3 10:05:36 2003 From: daanleijen@xs4all.nl (Daan Leijen) Date: Mon, 03 Mar 2003 11:05:36 +0100 Subject: How to make Parser explicitly "fail"? In-Reply-To: <20030302073503.40283.qmail@web20110.mail.yahoo.com> References: <20030302073503.40283.qmail@web20110.mail.yahoo.com> Message-ID: > Now I am thinking of writing a Parser for variable. My > thought is: > > variable::Parser String > variable = do s<-identifier > if not (s=="define") then return s else > --let parser fail You forgot to tell which parser library you use. If you use ParseLib (or Parsec) you can use the monadic zero function "mzero". Now, if you are using Parsec, you can also use "fail :: String -> Parser a" to add some error message. > variable = do s<-identifier > when (s=="define") (fail "define is a keyword") > return s Or better: > variable = do s<-identifier when (s=="define") (unexpected "keyword") > return s > "variable" Or even better, use the standard "identifier" parser from the "ParsecToken" module to handle this for you automatically. The user guide describes this in detail: http://www.cs.uu.nl/~daan/parsec.html All the best, Daan. > I will be very happy if there is some mechanism to > implement the "else" branch, for I have thought of it > for long. :) > > __________________________________________________ > Do you Yahoo!? > Yahoo! Tax Center - forms, calculators, tips, more > http://taxes.yahoo.com/ > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > > From alethenorio@home.se Mon Mar 3 10:03:48 2003 From: alethenorio@home.se (Alexandre Weffort Thenorio) Date: Mon, 3 Mar 2003 11:03:48 +0100 Subject: How to force UNIX text files as output instead of DOS text files?? References: <004801c2e114$73bd3350$0800a8c0@thenorio> <15970.43458.993973.957415@cerise.nosuchdomain.co.uk> Message-ID: <003001c2e16c$2faefd30$0800a8c0@thenorio> OK I fixed the IOExts not found problem (-package lang) but my problem now is that I never worked with handles. How can I write the string to the file and so on?? Where can I find more info on handle data types?? Best Regards NooK ----- Original Message ----- From: "Glynn Clements" To: "Alexandre Weffort Thenorio" Cc: Sent: Monday, March 03, 2003 2:02 AM Subject: Re: How to force UNIX text files as output instead of DOS text files?? > > Alexandre Weffort Thenorio wrote: > > > I am working on a small program which writes a text file but I need this > > file to be in UNIX format and as it is a Windows program I am compiling > > it, the output file tends to be in DSO format. Is there anyway that I > > can force it to create the file in UNIX format??? > > Use openFileEx, e.g.: > > import IOExts > ... > handle <- openFileEx filename (BinaryMode WriteMode) > > -- > Glynn Clements > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From thenorio@home.se Sun Mar 2 23:03:31 2003 From: thenorio@home.se (Alexandre Weffort Thenorio) Date: Mon, 3 Mar 2003 00:03:31 +0100 Subject: How to force UNIX text files as output instead of DOS text files?? Message-ID: <002d01c2e10f$f50e4f70$0800a8c0@thenorio> This is a multi-part message in MIME format. ------=_NextPart_000_002A_01C2E118.5377F3B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am working on a small program which writes a text file but I need this = file to be in UNIX format and as it is a Windows program I am compiling = it, the output file tends to be in DSO format. Is there anyway that I = can force it to create the file in UNIX format??? Best Regards NooK ------=_NextPart_000_002A_01C2E118.5377F3B0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I am working on a small program which = writes a text=20 file but I need this file to be in UNIX format and as it is a Windows = program I=20 am compiling it, the output file tends to be in DSO format. Is there = anyway that=20 I can force it to create the file in UNIX format???
 
Best Regards
 
NooK
------=_NextPart_000_002A_01C2E118.5377F3B0-- From nick.name@inwind.it Mon Mar 3 12:34:51 2003 From: nick.name@inwind.it (Nick Name) Date: Mon, 3 Mar 2003 13:34:51 +0100 Subject: How to force UNIX text files as output instead of DOS text files?? In-Reply-To: <003001c2e16c$2faefd30$0800a8c0@thenorio> References: <004801c2e114$73bd3350$0800a8c0@thenorio> <15970.43458.993973.957415@cerise.nosuchdomain.co.uk> <003001c2e16c$2faefd30$0800a8c0@thenorio> Message-ID: <20030303133451.4bcd0ae1.nick.name@inwind.it> On Mon, 3 Mar 2003 11:03:48 +0100 "Alexandre Weffort Thenorio" wrote: > > OK I fixed the IOExts not found problem (-package lang) but my > problem now is that I never worked with handles. How can I write the > string to the file and so on?? Where can I find more info on handle > data types?? In the "IO" section of the prelude, http://www.zvon.org/other/haskell/Outputio/index.html Vincenzo From joe@isun.informatik.uni-leipzig.de Mon Mar 3 13:37:22 2003 From: joe@isun.informatik.uni-leipzig.de (Johannes Waldmann) Date: Mon, 3 Mar 2003 14:37:22 +0100 (MET) Subject: looking for Database Interface in Haskell Message-ID: Dear all, we want to access a (MySQL) data base, running on a linux server, from a Haskell program. We planned to use http://www.volker-wysk.de/mysql-hs/ but it depends on earlier versions of hdirect (0.17?) and ghc(-4?). I built hdirect-0.19 (?) (from the ghc CVS) but the Foreign interfaces seem to have changed a bit since mysql-hs-0.10.1 was written. Any hints on what direction to take? Thanks, -- -- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ -- -- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/207 -- From simonpj@microsoft.com Mon Mar 3 14:41:07 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Mon, 3 Mar 2003 14:41:07 -0000 Subject: The Revised Haskell 98 Report Message-ID: Folks I am holding in my hands the first copy of the Haskell 98 Report to roll = off the presses at Cambridge University Press. It looks great. And it = has a copyright notice that says "It is intended that this Report belong = to the entire Haskell community...", just as the online version does. It's in CUP's catalogue here: http://titles.cambridge.org/catalogue.asp?isbn=3D0521826144 Order your copy now (=A335)! Not only is a physical copy useful, but = CUP's agreement to the rather unique copyright terms deserves our = support. Simon From Steffen.Mazanek@UniBw-Muenchen.de Mon Mar 3 13:57:06 2003 From: Steffen.Mazanek@UniBw-Muenchen.de (Steffen Mazanek) Date: 03 Mar 2003 13:57:06 +0000 Subject: looking for Database Interface in Haskell In-Reply-To: References: Message-ID: <86smu4v9hp.fsf@pseiko.studfb.unibw-muenchen.de> Have a look here: http://haskell.cs.yale.edu/haskellDB/ From shae@ScannedInAvian.com Mon Mar 3 15:08:20 2003 From: shae@ScannedInAvian.com (Shae Matijs Erisson) Date: Mon, 03 Mar 2003 16:08:20 +0100 Subject: looking for Database Interface in Haskell In-Reply-To: (Johannes Waldmann's message of "Mon, 3 Mar 2003 14:37:22 +0100 (MET)") References: Message-ID: <87vfz0cwt7.fsf@thunderbird.webwitches.com> Johannes Waldmann writes: > Dear all, we want to access a (MySQL) data base, > running on a linux server, from a Haskell program. > We planned to use http://www.volker-wysk.de/mysql-hs/ > but it depends on earlier versions of hdirect (0.17?) and ghc(-4?). > I built hdirect-0.19 (?) (from the ghc CVS) but the Foreign interfaces > seem to have changed a bit since mysql-hs-0.10.1 was written. > Any hints on what direction to take? Thanks, Also, HToolkit has working but not yet stable support for both postgresql and mysql. I haven't tried the mysql interface myself, but I have tried the postgresql code. It works, but it does explode if you do something unexpected. http://sourceforge.net/projects/htoolkit/ -- Shae Matijs Erisson - 2 days older than RFC0226 #haskell on irc.freenode.net - We Put the Funk in Funktion From daanleijen@xs4all.nl Mon Mar 3 15:17:47 2003 From: daanleijen@xs4all.nl (Daan Leijen) Date: Mon, 03 Mar 2003 16:17:47 +0100 Subject: looking for Database Interface in Haskell In-Reply-To: <86smu4v9hp.fsf@pseiko.studfb.unibw-muenchen.de> References: <86smu4v9hp.fsf@pseiko.studfb.unibw-muenchen.de> Message-ID: On 03 Mar 2003 13:57:06 +0000, Steffen Mazanek wrote: >> Dear all, we want to access a (MySQL) data base, >> running on a linux server, from a Haskell program. > Have a look here: > http://haskell.cs.yale.edu/haskellDB/ A word of warning though from the author :-), HaskellDB is somewhat outdated at the moment and only works with TREX supported systems on windows ODBC databases. It is not so hard to give it a different backend (ie. mySQL) but it is harder to give it a non-TREX type system -- I have ideas about that though and I am planning an update after my thesis is finished, but untill that moment, I don't think it would fit your particular target very well. All the best, Daan. From Markus.Schnell@infineon.com Mon Mar 3 15:21:22 2003 From: Markus.Schnell@infineon.com (Markus.Schnell@infineon.com) Date: Mon, 3 Mar 2003 16:21:22 +0100 Subject: GUI for Windows Message-ID: What User Interface Library would you recommend for use under Windows? I tried FranTk but it crashes as soon as I run the display function (under hugs) and with ghc it won't even compile (I already tinkered with the makefiles, so finally I could make the package, but then the demos won't compile). Any ideas, suggestions? Markus From daanleijen@xs4all.nl Mon Mar 3 15:39:56 2003 From: daanleijen@xs4all.nl (Daan Leijen) Date: Mon, 03 Mar 2003 16:39:56 +0100 Subject: GUI for Windows In-Reply-To: References: Message-ID: On Mon, 3 Mar 2003 16:21:22 +0100, wrote: > What User Interface Library would you recommend for use under Windows? Unfortunately, there is no official GUI library for Haskell yet (but many people are working toward this goal at the haskell gui mailing list). At the moment, the best solution on windows (in my opionion) is to use the ObjectIO library that ships with GHC 5.04.2. You need to look at some examples to get started but it is pretty stable and useable. Unfortunately, it seems though that no one actively maintains it... Another solution could be the HTk library but I have no experience with it. Fortunately though, people are working on a good portable GUI solution for Haskell so I expect that over a few months the situation will be better. All the best, Daan. From A.Simon@ukc.ac.uk Mon Mar 3 15:47:10 2003 From: A.Simon@ukc.ac.uk (Axel Simon) Date: Mon, 3 Mar 2003 15:47:10 +0000 Subject: GUI for Windows In-Reply-To: References: Message-ID: <20030303154710.GG27616@myrtle.ukc.ac.uk> On Mon, Mar 03, 2003 at 04:21:22PM +0100, Markus.Schnell@infineon.com wrote: > What User Interface Library would you recommend for use under Windows? > I tried FranTk but it crashes as soon as I run the display function (under > hugs) > and with ghc it won't even compile (I already tinkered with the makefiles, > so > finally I could make the package, but then the demos won't compile). > > Any ideas, suggestions? There has been a lot of discussions about defining a common API for GUIs, you get an impression when you read the archives for gui@haskell.org. HToolkit+Ports+GIO tries to provide functionality that works with Gtk and Win32 as backend. In contrast, there is the more complete gtk2hs binding which uses Gtk 2.0 on Unix, Windows and Mac (more info from me). There is Object I/O wich is specific to Windows and comes with GHC. There are more options like HGL which is more for graphics AFAIK and higher-level approaches like Fudgets (not for Windows). There is no best way right now so it would be wrong to give a definite answer here. Hope this helps, Axel. From dskippy@ccs.neu.edu Mon Mar 3 15:52:20 2003 From: dskippy@ccs.neu.edu (Mike T. Machenry) Date: Mon, 3 Mar 2003 10:52:20 -0500 Subject: int to float problem In-Reply-To: <200303021113.25922.jadrian@mat.uc.pt> References: <20030228194203.GA20201@denali.ccs.neu.edu> <3oadgfvs48.fsf@tba.elte.hu> <200303021113.25922.jadrian@mat.uc.pt> Message-ID: <20030303155220.GA15028@thabit.ccs.neu.edu> Thank does sound like a pain, but it's better than putting fromIntegral all over my code. Why can't Haskell unify a an expected float with an infered int? It seems that this would make life alot easier. -mike On Sun, Mar 02, 2003 at 11:28:00AM +0000, Jorge Adriano wrote: > > > "Mike T. Machenry" writes: > > > I recently desided I wanted a bunch function to return > > > float instead of Int. [...] I found fromInteger but it > > > didn't seem to work on the return value of the cardinality > > > function for instance. > > > > Try fromIntegral, which works for Int and Integer, too. > > > Casting an Integral value to a Fractional value to perform arithmetic > operations, is a very common need and I don't like adding fromIntegral > everywhere, so ended up writing a (very simple) module with generalized > arithmetic operators (see attachment). The » next to the operations indicate > a cast from an Integral to a Fractional value. > > J.A. > > > module CrossTypeOps where > > > -- Addition > (+«) :: (Fractional a, Integral b)=> a -> b -> a > (+«) x n = x+fromIntegral n > > (»+) :: (Integral a, Fractional b)=> a -> b -> b > (»+) n x = fromIntegral n + x > > (»+«) :: (Integral a, Fractional b)=> a -> a -> b > (»+«) m n = fromIntegral m+fromIntegral n > > > -- Difference > (-«) :: (Fractional a, Integral b)=> a -> b -> a > (-«) x n = x-fromIntegral n > > (»-) :: (Integral a, Fractional b)=> a -> b -> b > (»-) n x = fromIntegral n - x > > (»-«) :: (Integral a, Fractional b)=> a -> a -> b > (»-«) m n = fromIntegral m-fromIntegral n > > > -- Multiplication > (*«) :: (Fractional a, Integral b)=> a -> b -> a > (*«) x n = x*fromIntegral n > > (»*) :: (Integral a, Fractional b)=> a -> b -> b > (»*) n x = fromIntegral n * x > > (»*«) :: (Integral a, Fractional b)=> a -> a -> b > (»*«) m n = fromIntegral m*fromIntegral n > > > -- Division > (/«) :: (Fractional a, Integral b)=> a -> b -> a > (/«) x n = x / fromIntegral n > > (»/) :: (Integral a, Fractional b)=> a -> b -> b > (»/) n x = fromIntegral n / x > > (»/«) :: (Integral a, Fractional b)=> a -> a -> b > (»/«) m n = fromIntegral m / fromIntegral n > > > -- Priorities > infixl 6 +«, »+, »+«, -«, »-, »-« > infixl 7 *«, »*, »*«, /«, »/, »/« > > > From luna@update.uu.se Mon Mar 3 16:00:08 2003 From: luna@update.uu.se (Daniel Luna) Date: Mon, 3 Mar 2003 17:00:08 +0100 (CET) Subject: Tutorial for literate Haskell Message-ID: I am planning to write a small project in Haskell and stumbled upon some text that mentioned literate Haskell. Is there any good tutorial on how to write literate Haskell? I know that I could take any tutorial on latex and use that, but that's not what I am after. What I want is more like a base document with header and footer done, and perhaps a couple of example files. With that as a base I could get a hint on what the correct idioms for literate Haskell are. If there is no such tutorial a few hints on how other persons write would be very welcome. (with that I mean: how to comment (what info is relevant), how much/little one should describe a function/module, and such stuff) #Luna -- Daniel Luna | Top reasons that I have a beard: luna@update.uu.se | a) Laziness. http://www.update.uu.se/~luna/ | b) I can. Don't look at my homepage (it stinks).| c) I can get away with it. From Steffen.Mazanek@UniBw-Muenchen.de Mon Mar 3 16:20:56 2003 From: Steffen.Mazanek@UniBw-Muenchen.de (Steffen Mazanek) Date: 03 Mar 2003 16:20:56 +0000 Subject: Tutorial for literate Haskell In-Reply-To: References: Message-ID: <864r6kbevr.fsf@pseiko.studfb.unibw-muenchen.de> Hello. I do Literate Programming this way: At first I define a Latex environment "code" as "verbatim" e.g. so: \newenvironment{code}{\footnotesize\verbatim}{\endverbatim\normalsize} This environment is understood by the Haskell compilers. All my modules are own documents concluded in the main tex-file with \input{...}. Alternatively I sometimes use lambdaTeX which typesets the code really nice (problem: latex2html doesn't understand it). Hope that will help. Ciao, Steffen From Markus.Schnell@infineon.com Mon Mar 3 16:46:18 2003 From: Markus.Schnell@infineon.com (Markus.Schnell@infineon.com) Date: Mon, 3 Mar 2003 17:46:18 +0100 Subject: AW: GUI for Windows Message-ID: Thanks, Axel, Daan, I will have a try with ObjectIO. (At least the examples work ;-)) Markus From m.p.donadio@ieee.org Mon Mar 3 17:10:28 2003 From: m.p.donadio@ieee.org (Matthew Donadio) Date: Mon, 3 Mar 2003 12:10:28 -0500 Subject: int to float problem Message-ID: <200303031210.AA617087468@snip.net> >Thank does sound like a pain, but it's better than putting fromIntegral >all over my code. Why can't Haskell unify a an expected float with an >infered int? It seems that this would make life alot easier. This is my biggest gripe with Haskell, at least for what I do. The numeric class system is good, but it assumes that the sub-classes are distict, where in fact integers are a proper subset of reals, which are a proper subset of complex numbers. Personally, I would like to see module level explicit coersion, similar to the way the default numeric type is handled. Something like: > module Blah where > coerce Int to Double > in mean with fromInt > mean :: [Double] -> Double > mean x = sum x / length x So, if the typesystem infers a Double, but finds an Int, the function would be rewritten as if it had been specified as > mean x = sum x / (fromInt.length) x If you want a global declaration then you could specify > coerce Int to Double > with fromInt --Matthew Donadio (m.p.donadio@ieee.org) From alethenorio@home.se Mon Mar 3 17:53:32 2003 From: alethenorio@home.se (Alexandre Weffort Thenorio) Date: Mon, 3 Mar 2003 18:53:32 +0100 Subject: How to force UNIX text files as output instead of DOS text files?? References: <004801c2e114$73bd3350$0800a8c0@thenorio> <15970.43458.993973.957415@cerise.nosuchdomain.co.uk> <003001c2e16c$2faefd30$0800a8c0@thenorio> <20030303133451.4bcd0ae1.nick.name@inwind.it> Message-ID: <002901c2e1ad$ce442740$0800a8c0@thenorio> Hi Great I got it working. Thanks a lot guys. My only problem now is when compiling. I am getting: hextodat.0(.text+0x34):fake: undefined reference to '_stginit_IOExts' Anybody can tell me what could be wrong?? I can run --make but when trying to compile with -o flag I get this error. Best Regards Alex ----- Original Message ----- From: "Nick Name" To: Sent: Monday, March 03, 2003 1:34 PM Subject: Re: How to force UNIX text files as output instead of DOS text files?? > On Mon, 3 Mar 2003 11:03:48 +0100 > "Alexandre Weffort Thenorio" wrote: > > > > > OK I fixed the IOExts not found problem (-package lang) but my > > problem now is that I never worked with handles. How can I write the > > string to the file and so on?? Where can I find more info on handle > > data types?? > > In the "IO" section of the prelude, > > http://www.zvon.org/other/haskell/Outputio/index.html > > Vincenzo > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From hdaume@ISI.EDU Mon Mar 3 18:38:24 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Mon, 3 Mar 2003 10:38:24 -0800 (PST) Subject: fundeps for extended Monad definition In-Reply-To: Message-ID: > | entirely so, since the result of it is not of type 'forall b. b', but > | rather of 'forall b. C Int b => b'. Thus, if the C class has a > function > | which takes a 'b' as an argument, then this value does have use. > > I disagree. Can you give an example of its use? I believe something along the lines of the following would work: > class C a b | a -> b where { foo :: b -> String } > instance C Int Int where { foo x = show (x+1) } > x :: forall b. C Int b => b > x = 5 (Supposing that the above definition were valid; i.e., we didn't get the type signature error, this reads that x has type "b" for all types "b" such that C Int b -- the fact that there is only one such type (due to the fun dep) is for us to know.) Then, we should be able to say: > foo x and get "6". >From a "translation to untyped core" perpective (*grin*), we essentially replace class constraints with dictionaries. The definition of C introduces a dictionary like the following (I'm not 100% familiar with MPTC dictionaries, but I assume they're just like normal dictionaries): > data CDict a b = CDict (b -> String) Then the instance will give us: > cIntIntDict :: CDict Int Int > cIntIntDict = CDict (\x -> show (x+1)) foo will become: > foo (CDict foo_f) x = foo_f x and if we apply this properly, we get: | foo cIntIntDict x | ==> (\ (CDict foo_f) x -> foo_f x) cIntIntDict x | ==> (\ (CDict foo_f) -> foo_f x) cIntIntDict | ==> (\x -> show (x+1)) x | ==> show (5+1) | ==> "6" or something like that? In fact, except for the type definition on x, this is actually a valid translation into typed core, I believe. The weird type on x is the only stumbling block, afaics. ...it is well known that I could be wrong though... - Hal From oleg@pobox.com Mon Mar 3 18:58:08 2003 From: oleg@pobox.com (oleg@pobox.com) Date: Mon, 3 Mar 2003 10:58:08 -0800 (PST) Subject: fundeps for extended Monad definition Message-ID: <200303031858.h23Iw8VW050709@adric.fnmoc.navy.mil> | > The reason, which is thoroughly explained in Simon Peyton-Jones' | > message, is that the given type signature is wrong: it should read | > f1 :: (exists b. (C Int b) => Int -> b) > Can you give an example of its use? Yes, I can. > class (Show a, Show b) => C a b | a -> b where > doit:: a -> b -> String > instance C Int Int where > doit a b = (show a) > instance C Bool Bool where > doit a b = if a then "everything" else "nothing" > newtype M a = M (forall b.(C a b) => b) > f :: Int -> M Int > f x = M undefined > g :: Bool -> M Bool > g x = M undefined > test1 a = case (f a) of > M b -> doit a b > test2 a = case (g a) of > M b -> doit a b I wonder if the Obfuscated Haskell contest has an entry for the most useless type (with no uses). However, if a type can be used for the contest, it is no longer the most useless. This makes one wonder if the rules of the contest implicitly contain the Russel paradox. From alethenorio@home.se Mon Mar 3 19:14:42 2003 From: alethenorio@home.se (Alexandre Weffort Thenorio) Date: Mon, 3 Mar 2003 20:14:42 +0100 Subject: How to force UNIX text files as output instead of DOS text files?? References: <004801c2e114$73bd3350$0800a8c0@thenorio><15970.43458.993973.957415@cerise.nosuchdomain.co.uk><003001c2e16c$2faefd30$0800a8c0@thenorio><20030303133451.4bcd0ae1.nick.name@inwind.it><002901c2e1ad$ce442740$0800a8c0@thenorio> <20030303191952.689cb43e.nils@ndecker.de> Message-ID: <004801c2e1b9$25021cd0$0800a8c0@thenorio> Thanks a lot m8. I got it. I was supplying it with --make but not with -o. Thanks again. I guess everything is fine now thanks to you guys.I wanna learn more about catching errors but that comes later when I finish this program. Best Regards Alex ----- Original Message ----- From: "Nils Decker" To: "Alexandre Weffort Thenorio" Sent: Monday, March 03, 2003 7:19 PM Subject: Re: How to force UNIX text files as output instead of DOS text files?? > "Alexandre Weffort Thenorio" wrote: > > Hi Great I got it working. Thanks a lot guys. My only problem now is > > when compiling. I am getting: > > > > hextodat.0(.text+0x34):fake: undefined reference to '_stginit_IOExts' > > > > Anybody can tell me what could be wrong?? I can run --make but when > > trying to compile with -o flag I get this error. > > AFAIK, you have to supply -package lang to the linker too when using seperate > compilation. > > > e.g: > ghc -package lang -o foo.o foo.hs > ghc -package lang -o foo foo.o ... > > Regards > Nils > > -- > Unix is user friendly - it's just picky about it's friends. > > Nils Decker > From b.i.mills@massey.ac.nz Mon Mar 3 20:09:08 2003 From: b.i.mills@massey.ac.nz (b.i.mills@massey.ac.nz) Date: Tue, 4 Mar 2003 09:09:08 +1300 Subject: Tutorial for literate Haskell Message-ID: <200303032009.h23K98S02898@it012687.massey.ac.nz> Yo, Steffen Mazanek wrote: > I do Literate Programming this way: > At first I define a Latex environment "code" as "verbatim" > e.g. so: \newenvironment{code}{\footnotesize\verbatim}{\endverbatim\normalsize} When I ran into the same question some time ago I tried that, but found that the \verbatim was interpreted to0 literally, so that the \end{code} does not terminate it. Could you give a complete short example that works for you? My own solution was to copy the definition of verbatim from the base files, and define code the same way in a separate style file. Regards, Bruce. From ka2_mail@yahoo.com Mon Mar 3 21:55:33 2003 From: ka2_mail@yahoo.com (Krasimir Angelov) Date: Mon, 3 Mar 2003 13:55:33 -0800 (PST) Subject: looking for Database Interface in Haskell In-Reply-To: <87vfz0cwt7.fsf@thunderbird.webwitches.com> Message-ID: <20030303215533.23218.qmail@web40511.mail.yahoo.com> Hi, Shae > Also, HToolkit has working but not yet stable > support for both postgresql and > mysql. I haven't tried the mysql interface myself, > but I have tried the > postgresql code. It works, but it does explode if > you do something unexpected. > http://sourceforge.net/projects/htoolkit/ Can you send me examples where the MySQL binding explode? I am interested of improving of the library. Best wishes, Krasimir __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ From oleg@pobox.com Mon Mar 3 22:14:49 2003 From: oleg@pobox.com (oleg@pobox.com) Date: Mon, 3 Mar 2003 14:14:49 -0800 (PST) Subject: First-class types Message-ID: <200303032214.h23MEnOg050925@adric.fnmoc.navy.mil> The following is a more flexible alternative to overloading. We essentially define a function on types and invoke it, seemingly at run time. No Dynamics or unsafe computations are employed. We only need existential types, multi-parameter classes and functional dependencies. The code also shows how to manipulate values which cannot be manipulated. As an example, we define a _function_ (not a method!) 'add' such that: Main> add True False 1 Main> add () (5::Int) 5 Main> add () (5::Float) 5.0 Main> add (4::Int) True 5 Main> add (10::Int) (5::Float) 15.0 The example works both in GHC and Hugs. The signature of add is quite revealing: forall b a2 a1. (Num b, Coerce a2 b, Coerce a1 b, D a1 a2 b) => a1 -> a2 -> b That is, 'add' is capable of adding any two _things_, provided they both can be "generalized" and "coerced" into a number. The "type function" D computes the generalization of two types -- in a manner we specify. The function add is actually quite simple: > add x y = let general_type = typeof x y > x' = coerce x general_type > y' = coerce y general_type > in x' + y' The function 'typeof' is also interesting. It has a type forall b a2 a1. (D a1 a2 b) => a1 -> a2 -> b Note that it returns 'b' forall b! In a sense, the function performs a type computation at run time. The code follows. We should note that we could have achieved the same effect by defining an appropriate class with the method 'add'. In our solution however, the acts of generalizing, coercion, and addition are all separated. If we later decide to subtract things rather than add them, we do not need to alter the class and all the instances. We merely need to introduce the subtraction function. This makes the maintenance of the code easier. The distinct characteristic of the following code is an indirect manipulation of an untouchable, existential value. We were able to force a value to be of a specific type without any means of accessing the value directly. > class Type a where > name :: a -> String > instance Type Bool where > name a = "Bool" > instance Type Int where > name a = "Int" > --instance Type Char where > -- name a = "Char" > instance Type () where > name a = "()" > instance Type Float where > name a = "Float" > -- Type generalization function: type -> type -> type > class (Type b) => D a1 a2 b | a1 a2-> b > instance D Bool Bool Int > instance D Int Bool Int > instance D Bool Int Int > instance D Int Int Int > instance D () Int Int > instance D Int () Int > instance D () () Int > instance D Int Float Float > instance D () Float Float > instance D Float Int Float > instance D Float Float Float > -- The coercion function > class Coerce a b where > coerce :: a -> b -> b > instance Coerce () Int where > coerce _ _ = 0 > instance Coerce () Float where > coerce _ _ = 0 > instance Coerce Int Int where > coerce = const > instance Coerce Float Float where > coerce = const > instance Coerce Int Float where > coerce x _ = fromInteger $ toInteger x > instance Coerce Bool Int where > coerce True _ = 1 > coerce False _ = 0 > newtype M a1 a2 = M (forall b.(D a1 a2 b) => b) > data M1 a1 a2 = M1 a1 a2 (M a1 a2) > typeof v1 v2 = case (M1 v1 v2 (M undefined)) of M1 _ _ (M y) -> y > typeof1 v1 v2 = case (M1 v1 v2 (M undefined)) of M1 _ _ y -> y > add x y = let general_type = typeof x y > x' = coerce x general_type > y' = coerce y general_type > in x' + y' From b.i.mills@massey.ac.nz Mon Mar 3 22:25:59 2003 From: b.i.mills@massey.ac.nz (b.i.mills@massey.ac.nz) Date: Tue, 4 Mar 2003 11:25:59 +1300 Subject: Tutorial for literate Haskell Message-ID: <200303032225.h23MPx403169@it012687.massey.ac.nz> Hi, Since I sent this to the haskell list in the first place, I'd better let everyone know that it all worked out. > Hmm, there were no problems in simply doing so. Ok, I've cut your example down a bit (just from a minimalist tendency). The complete modified code is ... \documentclass{report} \usepackage{verbatim} % vital \begin{document} \newenvironment{code}{\footnotesize\verbatim}{\endverbatim\normalsize} HaskellModule.lhs: Maybe some text... We call our module Foo, because this name is very meaningful. \begin{code} module Foo where \end{code} \end{document} Works just fine and seems robust. My original problem ... an over-developed tendency to go it alone? I was not using package verbatim, which does help, doesn't it. > I hope this will help. Yup, thanks. Bruce. From Sengan.Baring-Gould@nsc.com Mon Mar 3 18:38:14 2003 From: Sengan.Baring-Gould@nsc.com (Sengan.Baring-Gould@nsc.com) Date: Mon, 3 Mar 2003 13:38:14 -0500 Subject: Persistent data Message-ID: <20030303133814.6dfb4b99.senganb@ia.nsc.com> Is there some way to reduce the cost of garbage collection over large persistent datastructures without resorting to escaping to C to malloc memory outside the heap? The program I'm working is part database, which cannot discard information. The net result is that I see figures like 82.9% of the time taken by garbage collection. The heap profile looks like a charging capacitor: a linear increase (as expected) which is slowly dilated as time increases by the garbage collector thrashing memory. When I worked on the LOLITA natural language processor we solved the problem by moving a lot of the data out to C++, so that the heap only contains things soon to be freed. I know generational garbage collection is supposed to help, but it doesn't seem to. Is there a pure Haskell solution to this problem? Sengan From ketil@ii.uib.no Tue Mar 4 07:41:09 2003 From: ketil@ii.uib.no (Ketil Z. Malde) Date: 04 Mar 2003 08:41:09 +0100 Subject: int to float problem In-Reply-To: <200303031210.AA617087468@snip.net> References: <200303031210.AA617087468@snip.net> Message-ID: "Matthew Donadio" writes: >> Thank does sound like a pain, but it's better than putting fromIntegral >> all over my code. Why can't Haskell unify a an expected float with an >> infered int? It seems that this would make life alot easier. Personally, I think that one of the things that made my life easier with Haskell compared to C++, is the lack of implicit type cast/conversions/coercions. Now, obviously C++ does this in a quite byzantine way, it's possible that a simpler and better system exists. -kzm -- If I haven't seen further, it is by standing in the footprints of giants From simonpj@microsoft.com Tue Mar 4 09:05:48 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Tue, 4 Mar 2003 09:05:48 -0000 Subject: First-class types Message-ID: | The following is a more flexible alternative to overloading. We | essentially define a function on types and invoke it, seemingly at run | time. No Dynamics or unsafe computations are employed. We only need | existential types, multi-parameter classes and functional | dependencies. The code also shows how to manipulate values which | cannot be manipulated. Ingenious, but unnecessarily complicated. You don't need existential types at all. (See the code below, which is considerably simpler and, I fancy, a bit more efficient.) Also, I'm not sure why you make 'Type' (which is pretty much the Typable class in the Dynamic library) into a superclass of D; it's not used. The idea of using a value (which is never evaluated) as a proxy for a type is exactly what the Typable class does. Indeed, it is a really useful technique. The clever things about your solution are a) You avoid the nasty ambiguity trap that many such schemes fall into e.g. when you see (a + b) * (c-d), what is type are the=20 intermediate values (a+b) and (c-d). You drive the type of the result from the type of the arguments, which makes sense. (Albeit, if you you want to add two Floats and get an Int, you'll have to do a conversion at the end.) b) You separate the coercion stuff from the operations in a nice way. Simon =09 class D a1 a2 b | a1 a2-> b where typeof :: a1 -> a2 -> b =20 instance D Bool Bool Int instance D Int Bool Int instance D Bool Int Int instance D Int Int Int instance D () Int Int instance D Int () Int instance D () () Int instance D Int Float Float instance D () Float Float instance D Float Int Float instance D Float Float Float -- The coercion function class Coerce a b where coerce :: a -> b -> b =20 instance Coerce () Int where coerce _ _ =3D 0 instance Coerce () Float where coerce _ _ =3D 0 instance Coerce Int Int where coerce =3D const instance Coerce Float Float where coerce =3D const instance Coerce Int Float where coerce x _ =3D fromInteger $ toInteger x =20 instance Coerce Bool Int where coerce True _ =3D 1 coerce False _ =3D 0 add x y =3D let general_type =3D typeof x y x' =3D coerce x general_type y' =3D coerce y general_type in x' + y' From simonpj@microsoft.com Tue Mar 4 09:22:37 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Tue, 4 Mar 2003 09:22:37 -0000 Subject: fundeps for extended Monad definition Message-ID: | I believe something along the lines of the following would work: |=20 | > class C a b | a -> b where { foo :: b -> String } | > instance C Int Int where { foo x =3D show (x+1) } | > x :: forall b. C Int b =3D> b | > x =3D 5 |=20 | (Supposing that the above definition were valid; i.e., we didn't get the | type signature error, this reads that x has type "b" for all types | "b" such that C Int b -- the fact that there is only one such type (due to | the fun dep) is for us to know.) |=20 | Then, we should be able to say: |=20 | > foo x |=20 | and get "6". I understand that is what you would like, but I do not know how to achieve it in a reasonable way. (By "reasonable" I mean both in terms of a reasonably simple type inference algorithm, and in terms of a reasonable translation into a typed intermediate language. The latter is, in a sense, just an implementation matter, but I have found it to be an excellent sanity check.) Simon |=20 From simonpj@microsoft.com Tue Mar 4 09:26:08 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Tue, 4 Mar 2003 09:26:08 -0000 Subject: Persistent data Message-ID: GHC has a multi-generational garbage collector. If you have enough physical memory on your machine so that the GC isn't thrashing trying to find the 100 free bytes that remain, then you should find the database migrates to the oldest generation and stays there. If you use +RTS -Sstderr you'll see info about when GC happens, and which generation. There should be lots of young-gen collections for each old-gen one. You can increase the number of generations with a command-line flag to the runtime system (see the user manual). =20 Simon | -----Original Message----- | From: Sengan.Baring-Gould@nsc.com [mailto:Sengan.Baring-Gould@nsc.com] | Sent: 03 March 2003 18:38 | To: haskell@haskell.org | Subject: Persistent data |=20 | Is there some way to reduce the cost of garbage collection over large persistent | datastructures without resorting to escaping to C to malloc memory outside the | heap? |=20 | The program I'm working is part database, which cannot discard information. | The net result is that I see figures like 82.9% of the time taken by garbage | collection. The heap profile looks like a charging capacitor: a linear increase | (as expected) which is slowly dilated as time increases by the garbage collector | thrashing memory. |=20 | When I worked on the LOLITA natural language processor we solved the problem | by moving a lot of the data out to C++, so that the heap only contains things | soon to be freed. I know generational garbage collection is supposed to help, | but it doesn't seem to. Is there a pure Haskell solution to this problem? |=20 | Sengan |=20 | _______________________________________________ | Haskell mailing list | Haskell@haskell.org | http://www.haskell.org/mailman/listinfo/haskell From Markus.Schnell@infineon.com Tue Mar 4 15:00:53 2003 From: Markus.Schnell@infineon.com (Markus.Schnell@infineon.com) Date: Tue, 4 Mar 2003 16:00:53 +0100 Subject: Parsec: GHC /= Hugs? Message-ID: My program has a different behaviour under hugs and ghc. I wrote a very simple parser with Parsec and it parses a file quite easily - as long as I use hugs to run it. But when I compile it with ghc, the parse fails. (I'm currently working on WinNT with cygwin). Something else, but related: how do I avoid writing different Code for Hugs and ghc? For example, I had to hide "Word" in Hugs with > import Prelude hiding (Word) but was not allowed to do that with ghc. I ended up using "Wort". Why the difference? Markus From jmaessen@MIT.EDU Tue Mar 4 15:07:40 2003 From: jmaessen@MIT.EDU (Jan-Willem Maessen) Date: Tue, 04 Mar 2003 10:07:40 -0500 Subject: First-class types In-Reply-To: Your message of "Tue, 04 Mar 2003 09:05:48 GMT." Message-ID: <200303041507.KAA03045@cathedral-seven.mit.edu> Simon PJ replies: > Ingenious, but unnecessarily complicated. You don't need existential > types at all. > (See the code below, which is considerably simpler and, I fancy, a bit > more efficient.) Also, I'm not sure why you make 'Type' (which is > pretty much the Typable class in the Dynamic library) into a superclass > of D; it's not used. The idea of using a value (which is never > evaluated) as a proxy for a type is exactly what the Typable class does. > Indeed, it is a really useful technique. I agree. I like it when this sort of thing can be reduced to just a few lines of code. I suspect it is possible to turn "coerce" and/or "typeof" into some sort of "asTypeOf"-like operator and avoid the creation of undefined proxies for the result type. Indeed, perhaps we want a definition such as this (untested, but probably subtly wrong): > class (Coerce a1 b, Coerce a2 b) => D a1 a2 b | a1 a2 -> b where > lift2 :: (b -> b -> b) -> a1 -> a2 -> b > lift2 op = op' > where op' a b = op (coerce a) (coerce b) > > class Coerce a b where > coerce :: a -> b > > -- lots of instances here. > > add = lift2 (+) > sub = lift2 (-) In general, if D is being used only to define coercions on a binary operation, thenin my opinion the class method ought to be a coercion on a binary operation. But I had a couple of questions for the avid type-hackers out there, motivated by this example and by similar examples from my own tinkerings: 1) Coerce a a can be defined as coerce=id for all a. However, this may of course lead to overlap in the type structure, so we must write a separate instance definition for Coerce Int Int, Coerce Double Double, etc. if we want types to be decidable. I'd love for some clever person to solve this little difficulty. 2) When we define D a b c, we know that D b a c is also allowed. Again, decidability prevents us from asserting this directly. Again, a clever solution could save us a lot of code and even more debugging. I suspect this may be a marginally easier nut to crack than the previous one. So, type hackers, can you come up with a Byzantine set of classes which encode these restrictions nicely and decidably? -Jan-Willem Maessen [Note that I suspect that it maybe possible to *prove* that you can't, at least for case 1. If you're really ambitious, you might want to attack transitivity of coercion, too.] From Steffen.Mazanek@UniBw-Muenchen.de Mon Mar 3 21:59:11 2003 From: Steffen.Mazanek@UniBw-Muenchen.de (Steffen Mazanek) Date: 03 Mar 2003 21:59:11 +0000 Subject: Tutorial for literate Haskell In-Reply-To: <200303032009.h23K98S02898@it012687.massey.ac.nz> References: <200303032009.h23K98S02898@it012687.massey.ac.nz> Message-ID: <863cm4qfgw.fsf@pseiko.studfb.unibw-muenchen.de> Hi, > When I ran into the same question some time ago I tried that, > but found that the \verbatim was interpreted to0 literally, so > that the \end{code} does not terminate it. Could you give a > complete short example that works for you? > > My own solution was to copy the definition of verbatim from the > base files, and define code the same way in a separate style file. Hmm, there were no problems in simply doing so. MainFile.tex: \documentclass[12pt,oneside]{report} \usepackage[latin1]{inputenc} \usepackage{verbatim} \begin{document} \newenvironment{code}{\footnotesize\verbatim}{\endverbatim\normalsize} \begin{titlepage} ... \begin{document} ... \input{HaskellModule.lhs} ... HaskellModule.lhs: \chapter{The Module Foo} \label{Foo} Maybe some text... We call our module Foo, because this name is very meaningful. \begin{code} module Foo where \end{code} and so on Thats it. I hope this will help. Ciao, Steffen -- Steffen Mazanek Werner Heisenberg Weg 102 App. 232 85579 Neubiberg GPG key fingerprint: A165 227D B288 5E10 701D BF5F E91C 6B88 24C8 397D http://blackhole.pca.dfn.de:11371/pks/lookup?op=get&search=0x24C8397D From joe@isun.informatik.uni-leipzig.de Tue Mar 4 16:07:12 2003 From: joe@isun.informatik.uni-leipzig.de (Johannes Waldmann) Date: Tue, 4 Mar 2003 17:07:12 +0100 (MET) Subject: Parsec: GHC /= Hugs? In-Reply-To: Message-ID: On Tue, 4 Mar 2003 Markus.Schnell@infineon.com wrote: > My program has a different behaviour under hugs and ghc. > I wrote a very simple parser with Parsec and it parses a file quite easily - I once got bitten by this: "brackets is now called angles, while squares is now called brackets." see http://www.cs.uu.nl/~daan/parsec.html -- -- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ -- -- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/207 -- From hdaume@ISI.EDU Tue Mar 4 16:34:00 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Tue, 4 Mar 2003 08:34:00 -0800 (PST) Subject: big lambda in class declarations Message-ID: So the word on the street is that allowing big lambda makes type inference undecidable. This makes sense to me since allowing big lambda essentially allows you to program at the type level and thus of course you'll get undecidability. However, I'm having difficulty understanding where the undecidability sneaks in if you allow big lambda in class declarations. I suppose the cannonical example is when you want to write something like: > class Set s where { ... } > instance Set (/\ a. FiniteMap a ()) where { ... } but now you have to write: > data FMSet a = FMSet (FiniteMap a ()) > instance Set FMSet where { ... } The big lambda is of course equivalent to not applying type synonyms completely, somethign like: > type FM a = FiniteMap a () > instance Set FM where { ... } will of course also be rejected (since this would give us a way to do big lambda). Could some one help my intuition a bit here and explain to me how you could use big lambdas in class declarations to write programs? Thanks! - Hal -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume From diatchki@cse.ogi.edu Tue Mar 4 17:13:51 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Tue, 04 Mar 2003 09:13:51 -0800 Subject: Parsec: GHC /= Hugs? In-Reply-To: References: Message-ID: <3E64DECF.2080405@cse.ogi.edu> hi, Markus.Schnell@infineon.com wrote: > Something else, but related: how do I avoid writing different Code for Hugs > and ghc? > For example, I had to hide "Word" in Hugs with > ... you are not allowed to hide things that are not exported. hugs erroneously used to export Word (and other stuff) from the prelude. i am glad to say that this is not the case anymore (in the CVS version). actually when using the CVS hugs nearly all programs that run in GHC run in hugs as well (Haskell 98 anyways, but even a lot of the other stuff matches). if you find differences (for the haskell 98 part) you should identify which of the two you think is doing something wrong and report it as a bug. bye iavor -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From diatchki@cse.ogi.edu Tue Mar 4 18:01:55 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Tue, 04 Mar 2003 10:01:55 -0800 Subject: Persistant (as in on disk) data Message-ID: <3E64EA13.7080809@cse.ogi.edu> hello, a recent post reminded me of a feature i'd like. for all i know it is already implemenetd in GHC so pointers are welcome. i'd like to be able to dump data structures to disk, and later load them. currently i do that with Show/Read but it is very slow and it seems as a kind of "ovarloaded" use fo Show. and it doesn't work with circular structures. so i'm thinking something like "deriving Persistant". for functions perhaps the easiest thing is to leave it to the user to create the instances. perhaps: class Persistant t where save :: t -> String -> IO () load :: String -> IO t here the String is the name of the file where to store/load the data. so is there such a thing already, and if not would it be difficult to add to say GHC? bye iavor -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From dskippy@ccs.neu.edu Wed Mar 5 01:34:24 2003 From: dskippy@ccs.neu.edu (Mike T. Machenry) Date: Tue, 4 Mar 2003 20:34:24 -0500 Subject: compiling Message-ID: <20030305013424.GA19394@denali.ccs.neu.edu> I am having a problem compiling my code. Usually I run it with ghci -package data -fglashow-exts Main.hs Main declares a main function and imports all my other files. when I try to ghc it to compile I get that it can't find an interface file for each file in my project. How do I compile something? Also it can't find an interface for Data. How do I make an interface file for that? Thanks, -mike From m.p.donadio@ieee.org Wed Mar 5 02:26:27 2003 From: m.p.donadio@ieee.org (Matthew Donadio) Date: Tue, 04 Mar 2003 21:26:27 -0500 Subject: compiling References: <20030305013424.GA19394@denali.ccs.neu.edu> Message-ID: <3E656053.735A6A0F@ieee.org> "Mike T. Machenry" wrote: > I am having a problem compiling my code. Usually I run it with > ghci -package data -fglashow-exts Main.hs > > Main declares a main function and imports all my other files. > when I try to ghc it to compile I get that it can't find an interface file > for each file in my project. How do I compile something? Also it can't > find an interface for Data. How do I make an interface file for that? Read the ghc docs, but try ghc -o Main --make -package data -fglashow-exts Main.hs -- Matthew Donadio (m.p.donadio@ieee.org) From ajb@spamcop.net Wed Mar 5 06:13:39 2003 From: ajb@spamcop.net (Andrew J Bromage) Date: Wed, 5 Mar 2003 17:13:39 +1100 Subject: int to float problem In-Reply-To: <200303031210.AA617087468@snip.net> References: <200303031210.AA617087468@snip.net> Message-ID: <20030305061339.GA13273@smtp.alicorna.com> G'day all. On Mon, Mar 03, 2003 at 12:10:28PM -0500, Matthew Donadio wrote: > This is my biggest gripe with Haskell, at least for what I do. The > numeric class system is good, but it assumes that the sub-classes are > distict, where in fact integers are a proper subset of reals, which > are a proper subset of complex numbers. Haskell Integers are not a proper subset of Haskell Floats or Doubles. Haskell does not support real numbers. It's a similar problem with C/C++. The "long" type is almost never a proper subset of "float", but C will nevertheless happily convert it for you without you asking, potentially losing precision in the process. Cheers, Andrew Bromage From simonpj@microsoft.com Wed Mar 5 09:04:53 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Wed, 5 Mar 2003 09:04:53 -0000 Subject: big lambda in class declarations Message-ID: Big lambda is in terms. You mean a "lambda at the type level", which is usually written as a small lambda. Confusing, I know. There's an ICFP02 paper on the subject, by Thiemann et al. Worth a read. Problem with inference is that the type checker can't guess lambdas. Suppose we need to unify m Int with ST Int Int One possibility is m =3D ST Another is =09 m =3D \t. ST t Int Another is m =3D \t. ST Int t One solution is to restrict what lambdas are allowable, and that is what Thiemann et al do. Another is to declare the typechecker should never guess a lambda; instead the programmer has to specify what lambda to use whenever there is doubt. That is the approach that we're ruminating on here. Stay tuned, but don't hold your breath. Simon | -----Original Message----- | From: Hal Daume III [mailto:hdaume@ISI.EDU] | Sent: 04 March 2003 16:34 | To: Haskell Mailing List | Subject: big lambda in class declarations |=20 | So the word on the street is that allowing big lambda makes type inference | undecidable. This makes sense to me since allowing big lambda essentially | allows you to program at the type level and thus of course you'll get | undecidability. |=20 | However, I'm having difficulty understanding where the undecidability | sneaks in if you allow big lambda in class declarations. I suppose the | cannonical example is when you want to write something like: |=20 | > class Set s where { ... } | > instance Set (/\ a. FiniteMap a ()) where { ... } |=20 | but now you have to write: |=20 | > data FMSet a =3D FMSet (FiniteMap a ()) | > instance Set FMSet where { ... } |=20 | The big lambda is of course equivalent to not applying type synonyms | completely, somethign like: |=20 | > type FM a =3D FiniteMap a () | > instance Set FM where { ... } |=20 | will of course also be rejected (since this would give us a way to do big | lambda). |=20 | Could some one help my intuition a bit here and explain to me how you | could use big lambdas in class declarations to write programs? |=20 | Thanks! |=20 | - Hal |=20 | -- | Hal Daume III | hdaume@isi.edu | "Arrest this man, he talks in maths." | www.isi.edu/~hdaume |=20 | _______________________________________________ | Haskell mailing list | Haskell@haskell.org | http://www.haskell.org/mailman/listinfo/haskell From simonpj@microsoft.com Wed Mar 5 09:12:37 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Wed, 5 Mar 2003 09:12:37 -0000 Subject: First-class types Message-ID: | 1) Coerce a a can be defined as coerce=3Did for all a. However, this | may of course lead to overlap in the type structure, so we must | write a separate instance definition for Coerce Int Int, Coerce | Double Double, etc. if we want types to be decidable. I'd love for | some clever person to solve this little difficulty. Indeed so. And=20 instance Coerce a a where coerce =3D id does not overlap with instance Coerce Int Bool where ... instance Coerce Bool Int where ... There's no overlap here. (Overlap =3D there is a Coerce t1 t2, which matches more than one instance decl.) Furthermore, it works fine; I just tried it. | 2) When we define D a b c, we know that D b a c is also allowed. | Again, decidability prevents us from asserting this directly. | Again, a clever solution could save us a lot of code and even more | debugging. I suspect this may be a marginally easier nut to crack | than the previous one. Much harder, I think. Commutativity is always tricky! Simon From ashley@semantic.org Wed Mar 5 09:53:20 2003 From: ashley@semantic.org (Ashley Yakeley) Date: Wed, 05 Mar 2003 01:53:20 -0800 Subject: fundeps for extended Monad definition References: Message-ID: In article , "Simon Peyton-Jones" wrote: > Here's a less complicated variant of the same problem: > > class C a b | a -> b where {} > > instance C Int Int where {} > > f :: (C Int b) => Int -> b > f x = x > > Is the defn of f legal? Both GHC and Hugs reject it because the > inferred type of f is more like > C Int Int => Int -> Int If this were allowed, it would effectively allow type-lambda. For instance, I have a type function T that maps Int to Bool and Bool to Char: class C a b | a -> b instance C Int Bool instance C Bool Char newtype T a = MkT (forall b.(C a b) => b) helperIn :: (forall b.(C a b) => b) -> T a helperIn b = MkT b; -- currently won't work helperOut :: T a -> (forall b.(C a b) => b) helperOut (MkT b) = b; Here T is a type-constructor that does that. If I like, I can represent Char as "T (T Int)", though of course I need to use the helper functions to actually use it as a Char. -- Ashley Yakeley, Seattle WA From simon.guest@roke.co.uk Wed Mar 5 13:00:55 2003 From: simon.guest@roke.co.uk (Guest, Simon) Date: Wed, 5 Mar 2003 13:00:55 -0000 Subject: GUI for Windows Message-ID: <76C92FBBFB58D411AE760090271ED418040CA666@rsys002a.roke.co.uk> This is a multi-part message in MIME format. --------------InterScan_NT_MIME_Boundary Content-Type: text/plain; charset="iso-8859-1" Hi Markus, I use FranTk with ghc 5.04.2 on windows, and it works just fine. It provides a high level of abstraction, which is what I find particularly compelling. To build it with ghc 5.04 I had to patch it a little. Only trivial things like: in src/FRPSrc/StaticTypes/Compatibility.ghc.hs, you have to define fromInt and toInt in terms of fromIntegral. in src/FranTkSrc/FranTkConc.lhs and src/TclHaskellSrc/ConcTcl.hs, you have to import CVar (I think that's all.) I could send you my patches if you like. cheers, Simon > -----Original Message----- > From: Markus.Schnell@infineon.com [mailto:Markus.Schnell@infineon.com] > Sent: 03 March 2003 15:21 > To: haskell@haskell.org > Subject: GUI for Windows > > > What User Interface Library would you recommend for use under Windows? > I tried FranTk but it crashes as soon as I run the display > function (under > hugs) > and with ghc it won't even compile (I already tinkered with > the makefiles, > so > finally I could make the package, but then the demos won't compile). > > Any ideas, suggestions? > > Markus > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > --------------InterScan_NT_MIME_Boundary Content-Type: text/plain; name="RMRL-Disclaimer.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="RMRL-Disclaimer.txt" Registered Office: Roke Manor Research Ltd, Siemens House, Oldbury, Bracknell, Berkshire. RG12 8FZ The information contained in this e-mail and any attachments is confidential to Roke Manor Research Ltd and must not be passed to any third party without permission. This communication is for information only and shall not create or change any contractual relationship. --------------InterScan_NT_MIME_Boundary-- From ross@soi.city.ac.uk Wed Mar 5 13:02:40 2003 From: ross@soi.city.ac.uk (Ross Paterson) Date: Wed, 5 Mar 2003 13:02:40 +0000 Subject: Parsec: GHC /= Hugs? In-Reply-To: References: Message-ID: <20030305130240.GA7070@soi.city.ac.uk> On Tue, Mar 04, 2003 at 04:00:53PM +0100, Markus.Schnell@infineon.com wrote: > My program has a different behaviour under hugs and ghc. > > I wrote a very simple parser with Parsec and it parses a file quite easily - > as long as > I use hugs to run it. But when I compile it with ghc, the parse fails. > (I'm currently working on WinNT with cygwin). > > Something else, but related: how do I avoid writing different Code for Hugs > and ghc? Try the November release of Hugs with the +N option. From Markus.Schnell@infineon.com Wed Mar 5 13:31:35 2003 From: Markus.Schnell@infineon.com (Markus.Schnell@infineon.com) Date: Wed, 5 Mar 2003 14:31:35 +0100 Subject: AW: Parsec: GHC /= Hugs? Message-ID: > Try the November release of Hugs with the +N option. Well, now Hugs and ghc show the same behaviour for my program: they don't parse my doc, even with the same error. But the +N does not work: it says "New hierarchical libraries not found along search path; ignoring +N toggle." I tried adding {Hugs}\libraries to the Options, but after a restart, it is missing again. How can I change that? From joe@isun.informatik.uni-leipzig.de Wed Mar 5 13:42:19 2003 From: joe@isun.informatik.uni-leipzig.de (Johannes Waldmann) Date: Wed, 5 Mar 2003 14:42:19 +0100 (MET) Subject: HTTP protocol libraries Message-ID: Dear all, I am looking for a Haskell library for the HTTP/1.1 protocol, i. e. data types for Requests and Responses, and functions to read chunked bodies etc. Is there such a thing? -- -- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ -- -- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/207 -- From Alistair_Bayley@ldn.invesco.com Wed Mar 5 13:48:06 2003 From: Alistair_Bayley@ldn.invesco.com (Bayley, Alistair) Date: Wed, 5 Mar 2003 13:48:06 -0000 Subject: HTTP protocol libraries Message-ID: On a related note, what happened to the source code for the Haskell Web Server? http://research.microsoft.com/~simonmar/hws.tar.gz Is it no longer suitable for public consumption? (I have a copy at home somewhere, though). -----Original Message----- From: Johannes Waldmann [mailto:joe@isun.informatik.uni-leipzig.de] Sent: 05 March 2003 13:42 To: haskell@haskell.org Subject: HTTP protocol libraries Dear all, I am looking for a Haskell library for the HTTP/1.1 protocol, i. e. data types for Requests and Responses, and functions to read chunked bodies etc. Is there such a thing? -- -- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ -- -- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/207 -- ***************************************************************** The information in this email and in any attachments is confidential and intended solely for the attention and use of the named addressee(s). This information may be subject to legal professional or other privilege or may otherwise be protected by work product immunity or other legal rules. It must not be disclosed to any person without our authority. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are not authorised to and must not disclose, copy, distribute, or retain this message or any part of it. ***************************************************************** From simonmar@microsoft.com Wed Mar 5 14:08:31 2003 From: simonmar@microsoft.com (Simon Marlow) Date: Wed, 5 Mar 2003 14:08:31 -0000 Subject: HTTP protocol libraries Message-ID: <9584A4A864BD8548932F2F88EB30D1C60C143249@tvp-msg-01.europe.corp.microsoft.com> > From: Bayley, Alistair [mailto:Alistair_Bayley@ldn.invesco.com]=20 >=20 > On a related note, what happened to the source code for the=20 > Haskell Web > Server? >=20 > http://research.microsoft.com/~simonmar/hws.tar.gz >=20 > Is it no longer suitable for public consumption? (I have a=20 > copy at home somewhere, though). It's in GHC's CVS repository, under fptools/hws.=20 Cheers, Simon From shae@webwitches.com Wed Mar 5 15:41:19 2003 From: shae@webwitches.com (shae@webwitches.com) Date: Wed, 05 Mar 2003 16:41:19 +0100 Subject: Haskell Web Server Was Re: HTTP protocol libraries In-Reply-To: ("Bayley, Alistair"'s message of "Wed, 5 Mar 2003 13:48:06 -0000") Message-ID: <87adg9lt28.fsf@thunderbird.webwitches.com> "Bayley, Alistair" writes: > On a related note, what happened to the source code for the Haskell Web > Server? > > http://research.microsoft.com/~simonmar/hws.tar.gz > > Is it no longer suitable for public consumption? (I have a copy at home > somewhere, though). There's also a neat version called HWS-WP (with plugins) that allows for apache-style plugin loading that uses Andre Pang's runtime loader for GHC. You can get it from the CVS tree of http://sf.net/projects/haskell-libs/ -- Shae Matijs Erisson - 2 days older than RFC0226 #haskell on irc.freenode.net - We Put the Funk in Funktion 10 PRINT "HELLO" 20 GOTO 10 ; mapM_ putStrLn $ hello = "HELLO" : hello From gk@ninebynine.org Wed Mar 5 23:01:29 2003 From: gk@ninebynine.org (Graham Klyne) Date: Wed, 05 Mar 2003 23:01:29 +0000 Subject: URI handling code in Haskell available Message-ID: <5.1.0.14.2.20030305225858.00bcf300@127.0.0.1> I've released a first version of some URI parsing and handling code at: http://www.ninebynine.org./Software/HaskellURI.zip With a (very) few words of write-up at: http://www.ninebynine.org./Software/ReadMe-URI-Haskell.txt The URI parser code is based very closely on the syntax specification given in Roy Fielding's current revision of the URI specification [1]. The unit tests are based substantially on Dan Connolly's Python code [2]. The code is a bit scrappy, as I'm new to Haskell, but it does pass a fairly comprehensive array of unit tests (also included with the software). Error handling is in the range of weak-to-non-existent. #g -- [1] http://www.apache.org/~fielding/uri/rev-2002/rfc2396bis.html [2] http://www.w3.org/2000/10/swap/uripath.py ------------------- Graham Klyne PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E From rjp02u@Cs.Nott.AC.UK Thu Mar 6 00:50:41 2003 From: rjp02u@Cs.Nott.AC.UK (Robert Perren) Date: Thu, 6 Mar 2003 00:50:41 -0000 Subject: Function wows Message-ID: <000001c2e37a$6a031f60$d052030a@thedude> This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C2E37A.6A031F60 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit As part of a larger program I have created the following functions to convert a list of bits into the integer represents, also to simplify things the order of the bits is reversed [1,1,0,1] represents 1011 (or 13). At the moment the frombin function below works fine. type Bit = Int frombin :: [Bit] -> Int frombin xs = sum (tonum xs) tonum :: [Bit] -> [Bit] tonum [] = [] tonum (n:ns) = (n:(tonum (map (*2) ns))) However why when I try the function below does it not work in Hugs? frombin :: [Bit] -> Int frombin [] = 0 frombin (n:ns) = sum (n:( frombin (map (*2) ns))) Is this surely not just a combination of the two? Any help would be much appreciated Thanks, Rob --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.456 / Virus Database: 256 - Release Date: 18/02/2003 ------=_NextPart_000_0001_01C2E37A.6A031F60 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

As part of a larger program I have created the = following functions to convert a list of bits into the integer represents, also to simplify things the order of the bits is reversed [1,1,0,1] represents = 1011 (or 13). At the moment the frombin function below works fine. =

 

type Bit =3D Int

 

frombin :: [Bit] -> Int

frombin xs =3D sum (tonum xs)

 

tonum :: [Bit] -> [Bit]

tonum [] =3D []

tonum (n:ns) =3D (n:(tonum (map (*2) = ns)))

 

However why when I try the function below does it not = work in Hugs?

 

frombin :: [Bit] -> Int

frombin [] =3D 0

frombin (n:ns) =3D sum (n:( frombin (map (*2) = ns)))

 

Is this surely not just a combination of the = two?

 

Any help would be much appreciated

 

Thanks,

Rob

 

 

 

 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.456 / Virus Database: 256 - Release Date: 18/02/2003

------=_NextPart_000_0001_01C2E37A.6A031F60-- From b.i.mills@massey.ac.nz Thu Mar 6 02:02:54 2003 From: b.i.mills@massey.ac.nz (b.i.mills@massey.ac.nz) Date: Thu, 6 Mar 2003 15:02:54 +1300 Subject: int to float problem (resend with addendum) In-Reply-To: <200303031210.AA617087468@snip.net> Message-ID: <200303060202.h2622sE15895@it012687.massey.ac.nz> I just fluffed the To: field in the header, so my previous message was bounced, I'm resending this ... sorry if it turns up twice. (I also took the opportunity to make an addendum). Yo, > Haskell Integers are not a proper subset of Haskell Floats or > Doubles. Haskell does not support real numbers. I'd just like to add ... Real numbers are not implementable on a digital computer. This is not a "practical" matter of resources, or a design decision in by the language designer, but the fact that any data type each of whose elements are represented in a finite number of bytes can't have more than a countable number of data elements. Integers, and Rationals can be represented. Even the so-called computable-real-numbers, (still countable) don't work as well as you would want, since things such as "is this number bigger than that one" can't always be computed. Add to this the fact that the generic float type does not satisfy algebraic constraints such as associativity, and so can't, from the axiomatic point of view, be considered to be a representation of rational numbers (let alone reals). Basically, from the algebraic perspective, the float type is a messy fudge, and does not fit in nicely with any of the "pure" types. In general the containment Complex ---> Real --> Rational ---> integer ---> whatever. Does not apply in this simple way to numerical types on a computer, because data types are often constructed on the basis of not just what they represent, but also how they represent these things. The computable world (constructive mathematics) is a lot more complicated and open ended than the existential approach. Regards, Bruce. ps: I've made previous comments about this sort of thing: ``Algebraic Conversions'', A mathematical paper introducing a generalisation of homomorphism of universal algebras. In Research Letters in the Information and Mathematical Sciences Vol 2, May 2001. (pub by Massey University New Zealand). see also, \verb|http://www.massey.ac.nz/~wwiims/rlims| Addendum: Personally I think that lattices of extension fields of the rationals give a good model for understanding what is going on with pure numerical types on digital computers, but maybe that's just me? From oleg@pobox.com Thu Mar 6 02:28:16 2003 From: oleg@pobox.com (oleg@pobox.com) Date: Wed, 5 Mar 2003 18:28:16 -0800 (PST) Subject: fundeps for extended Monad definition Message-ID: <200303060228.h262SG8i056921@adric.fnmoc.navy.mil> Ashley Yakeley wrote: > If this were allowed, it would effectively allow type-lambda > class C a b | a -> b > instance C Int Bool > instance C Bool Char > newtype T a = MkT (forall b.(C a b) => b) > helperIn :: (forall b.(C a b) => b) -> T a > helperIn b = MkT b; -- currently won't work > helperOut :: T a -> (forall b.(C a b) => b) > helperOut (MkT b) = b And it does work (based on the code shown here previously): > class C a b | a -> b > instance C Int Bool > instance C Bool Char > instance C Char Float > instance C Float (Int->()) > instance (C a b) => C (a->()) (b->()) > newtype T a = T (forall b.(C a b) => b) > data T1 a = T1 a (T a) > xx b = case (T1 b (T undefined)) of T1 _ (T x) -> x Ok, modules loaded: Main. *Main> :type xx$(1::Int) Bool *Main> :type xx$ xx$ (1::Int) Char *Main> :type xx$ xx$ xx$ (1::Int) Float *Main> :type xx$ xx$ xx$ xx$ (1::Int) Int -> () *Main> :type xx$ xx$ xx$ xx$ xx$ (1::Int) Bool -> () *Main> :type xx$ xx$ xx$ xx$ xx$ xx$ (1::Int) Char -> () *Main> :type xx$ xx$ xx$ xx$ xx$ xx$ xx$ (1::Int) Float -> () *Main> :type xx$ xx$ xx$ xx$ xx$ xx$ xx$ xx$ (1::Int) (Int -> ()) -> () *Main> :type xx$ xx$ xx$ xx$ xx$ xx$ xx$ xx$ xx$ (1::Int) (Bool -> ()) -> () *Main> :type xx$ xx$ xx$ xx$ xx$ xx$ xx$ xx$ xx$ xx$ (1::Int) (Char -> ()) -> () It seems it does compute.... The principle was to use constraints to force the "evaluation" of the type "lambda". Obtaining the type "lambda" was the thrust behind the exercise with existential and useless types. Perhaps I neglected to mention that point. We can use the Coerce type function (aka class) mentioned in the thread on first-class types to convert from the types computed by 'xx' to values. Incidentally, the class D was already a type function: the function 'meet'. From aegnor@antioch-college.edu Thu Mar 6 02:52:44 2003 From: aegnor@antioch-college.edu (Abraham Egnor) Date: Wed, 5 Mar 2003 21:52:44 -0500 (EST) Subject: Conway's Life Message-ID: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---559023410-851401618-1046919164=:9250 Content-Type: TEXT/PLAIN; charset=US-ASCII I'm implementing Conway's Life in Haskell; my basic implementation is attached. Does anyone have suggestions for optimizations (or alternative representations)? It's interesting to note that the difference between this with no ghc optimization, -O, and -O2 is pretty striking; on my computer, it's about seven seconds, two seconds, and one second runtime, respectively. Abe ---559023410-851401618-1046919164=:9250 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="Life.hs" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: bW9kdWxlIE1haW4gd2hlcmUNCg0KaW1wb3J0IERhdGEuQXJyYXkuSUFycmF5 DQppbXBvcnQgRGF0YS5BcnJheS5VbmJveGVkDQppbXBvcnQgRGF0YS5JeA0K aW1wb3J0IFN5c3RlbS5SYW5kb20NCg0KdHlwZSBHcmlkID0gVUFycmF5IChJ bnQsIEludCkgSW50DQoNCnJhbmRvbUdyaWQgOjogKFJhbmRvbUdlbiBnKSA9 PiBnIC0+IEludCAtPiBHcmlkDQpyYW5kb21HcmlkIGcgcyA9IGxpc3RBcnJh eSBiICQgbWFwIChceCAtPiBpZiB4IHRoZW4gMSBlbHNlIDApICQgdGFrZSAo cmFuZ2VTaXplIGIpICQgcmFuZG9tcyBnDQogIHdoZXJlIGIgPSAoKDAsMCks KHMtMSxzLTEpKQ0KDQpnZXRDZWxsIDo6IEdyaWQgLT4gKEludCwgSW50KSAt PiBJbnQNCmdldENlbGwgZyBjQCh4LHkpID0gaWYgKHggPCB4bWluKSB8fCAo eCA+IHhtYXgpIHx8ICh5IDwgeW1pbikgfHwgKHkgPj0geW1heCkgdGhlbiAw IGVsc2UgZyAhIGMNCiAgd2hlcmUgKCh4bWluLCB5bWluKSwgKHhtYXgsIHlt YXgpKSA9IGJvdW5kcyBnDQoNCnVwZGF0ZSA6OiBHcmlkIC0+IEdyaWQNCnVw ZGF0ZSBnID0gYXJyYXkgKGJvdW5kcyBnKSAkIG1hcCBhdXggJCBhc3NvY3Mg Zw0KICB3aGVyZSBhdXggKGNAKHgseSksZSkgPSBsZXQgYXJvdW5kID0gbWFw IChnZXRDZWxsIGcpICQgZmlsdGVyICgvPSAoeCx5KSkgJCByYW5nZSAoKHgt MSx5LTEpLCh4KzEseSsxKSkNCgkJCWluIChjLHJ1bGUgKHN1bSBhcm91bmQp IGUpDQoJcnVsZSAyIGUgPSBlDQoJcnVsZSAzIGUgPSAxDQoJcnVsZSBfIF8g PSAwDQoNCnByaW50R3JpZCA6OiBHcmlkIC0+IElPICgpDQpwcmludEdyaWQg ZyA9IGRvIGxldCAoKHhtaW4sIHltaW4pLCAoeG1heCwgeW1heCkpID0gYm91 bmRzIGcNCgkJIG1hcE1fIGF1eCAkIG1hcCAoXHggLT4gcmFuZ2UgKCh4LHlt aW4pLCh4LHltYXgpKSkgW3htaW4uLnhtYXhdDQoJCSBwdXRTdHJMbiAiIg0K ICB3aGVyZSBhdXggaXhzID0gZG8gbWFwTV8gKHB1dFN0ciAuIHNob3cpICQg bWFwIChnISkgaXhzDQoJCSAgICAgcHV0U3RyTG4gIiINCg0KbWFpbiA6OiBJ TyAoKQ0KbWFpbiA9IHByaW50R3JpZCAkIChpdGVyYXRlIHVwZGF0ZSAocmFu ZG9tR3JpZCAobWtTdGRHZW4gMCkgNTApKSAhISAxMDANCg0K ---559023410-851401618-1046919164=:9250-- From b.i.mills@massey.ac.nz Thu Mar 6 01:57:01 2003 From: b.i.mills@massey.ac.nz (b.i.mills@massey.ac.nz) Date: Thu, 6 Mar 2003 14:57:01 +1300 Subject: (no subject) Message-ID: <200303060157.h261v1o15877@it012687.massey.ac.nz> To Subject: Re: int to float problem In-Reply-To: <200303031210.AA617087468@snip.net> Yo, > Haskell Integers are not a proper subset of Haskell Floats or > Doubles. Haskell does not support real numbers. I'd just like to add ... Real numbers are not implementable on a digital computer. This is not a "practical" matter of resources, or a design decision in by the language designer, but the fact that any data type each of whose elements are represented in a finite number of bytes can't have more than a countable number of data elements. Integers, and Rationals can be represented. Even the so-called computable-real-numbers, (still countable) don't work as well as you would want, since things such as "is this number bigger than that one" can't always be computed. Add to this the fact that the generic float type does not satisfy algebraic constraints such as associativity, and so can't, from the axiomatic point of view, be considered to be a representation of rational numbers (let alone reals). Basically, from the algebraic perspective, the float type is a messy fudge, and does not fit in nicely with any of the "pure" types. In general the containment Complex ---> Real --> Rational ---> integer ---> whatever. Does not apply in this simple way to numerical types on a computer, because data types are often constructed on the basis of not just what they represent, but also how they represent these things. The computable world (constructive mathematics) is a lot more complicated and open ended than the existential approach. Regards, Bruce. ps: I've made previous comments about this sort of thing: ``Algebraic Conversions'', A mathematical paper introducing a generalisation of homomorphism of universal algebras. In Research Letters in the Information and Mathematical Sciences Vol 2, May 2001. (pub by Massey University New Zealand). see also, \verb|http://www.massey.ac.nz/~wwiims/rlims| From Steffen.Mazanek@UniBw-Muenchen.de Thu Mar 6 02:02:23 2003 From: Steffen.Mazanek@UniBw-Muenchen.de (Steffen Mazanek) Date: 06 Mar 2003 02:02:23 +0000 Subject: Function wows In-Reply-To: <000001c2e37a$6a031f60$d052030a@thedude> References: <000001c2e37a$6a031f60$d052030a@thedude> Message-ID: <86llztjlqo.fsf@pseiko.studfb.unibw-muenchen.de> Hello, > frombin :: [Bit] -> Int > > frombin [] = 0 > > frombin (n:ns) = sum (n:( frombin (map (*2) ns))) frombin takes a list of Bits and returns an Int, but (:) needs a list as its second argument. Try something like > frombin (n:ns) = n + 2*(frombin ns) or >frombin = foldr (\x y->x+2*y) 0 Ciao, Steffen From m.p.donadio@ieee.org Thu Mar 6 03:54:22 2003 From: m.p.donadio@ieee.org (Matthew Donadio) Date: Wed, 05 Mar 2003 22:54:22 -0500 Subject: int to float problem (resend with addendum) References: <200303060202.h2622sE15895@it012687.massey.ac.nz> Message-ID: <3E66C66E.7E68D08@ieee.org> b.i.mills@massey.ac.nz wrote: > Basically, from the algebraic perspective, the float type is > a messy fudge, and does not fit in nicely with any of the > "pure" types. In general the containment I agree with what you said, but I think you may have missed my point. In numeric programming, at least what I am currently working on, numeric types are very often mixed. With all of the syntactic sugar that Haskell has to make the progarmmer's life easier, and programs easier to read, I find it odd that there is no mechanism to control implicit type coersion. The two biggest examples I can think of are Int to Float (or Double) and Float to Complex Float. Consinder a direct translation of a discrete Fourier transform > dft :: Array Int (Complex Double) -> Array Int (Complex Double) > dft a = dft' a w n > where w = listArray (0,n-1) [ cis (-2 * pi * fromIntegral i / fromIntegral n) | i <- [0..(n-0)] ] > n = snd (bounds a) + 1 > dft' :: Array Int (Complex Double) -> Array Int (Complex Double) -> Int -> Array Int (Complex Double) > dft' a w n = listArray (0,n-1) [ sum [ a!k * wik i k | k <- [0..(n-1)] ] | i <- [0..(n-1)] ]) > where wik i k = w!(i*k `mod` n) In the defintion of w, the fromIntegrals serve no purpose other than to make everything type. This seems to go against the merits of declarative programming. Also consider the multiplication of a Complex Double by a Double. There are two ways to do this. One is to make the scalar a complex, but this turns what should be two multiplications into four mults and two adds if the zero valued imaginary term doesn't get optimized out. > scale1 :: Complex Double -> Double -> Complex Double > scale1 z x = z * (x :+ 0) The second way to handle this is to expand the complex term into real and imaginary parts, and do the multiplication. > scale2 :: Complex Double -> Double -> Complex Double > scale2 (zr :+ zi) x = (zr * x) :+ (zi * x) Again, these two methods are needed only to make the functions type. I am not advocating C / FORTRAN style type coersion. What I am wishing for is a per module or per function mechanism for giving the programmer a way to state how coersion should take place, with the default being none. A new language feature would be great, but I would settle for a pragma. -- Matthew Donadio (m.p.donadio@ieee.org) From b.i.mills@massey.ac.nz Thu Mar 6 05:13:36 2003 From: b.i.mills@massey.ac.nz (b.i.mills@massey.ac.nz) Date: Thu, 6 Mar 2003 18:13:36 +1300 Subject: int to float problem In-Reply-To: <3E66C66E.7E68D08@ieee.org> Message-ID: <200303060513.h265Daq16274@it012687.massey.ac.nz> > I agree with what you said, > but I think you may have missed my point. Sounds likely on both counts. The same thing annoys me, but my work is in exact or symbolic: -- I don't claim this is a practical example -- I'm just saying that it is logically plausible denominator 2 % 3 == 3 denominator 23 == 1 --- only works because 23 might mean 23%1 denominator (floor (23 % 45)) == type error in application. So now I have to say ... denominator $ fromInteger (floor (23 % 45)) Is this the same malarkey that you are complaining about? I don't like using the conversions, so I generally try to find some way to rephrase the problem at a higher level. So, you want some way to define a default manner in which other types can be mapped to the type that is used in the definition of the function? (Do I understand correctly)? I can see merit in this, someone might use, floor xor ceiling, to shoehorn a float into and integer function. Getting different answers. On the other hand, it looks like ad-hoc polymorphism. I mean you are requesting that we can write a function .... myIntFn :: Integer -> Integer and then define a default mapping for each type into integers. So what if I define functions myFloatInt, myRatioIntInt, etc, to be used by default when the "wrong" type is presented as argument. Such that the range of each of these is distinct. In this way myIntFn can actually map Floats and Ratio Ints in totally different ways. That is, such a mechanism is very close to the ad-hoc polymorphism C++ style ... myIntFn :: Integer -> Integer myIntFn x = 2*x myIntFn :: Float -> Float myIntFn x = x*x and so on. Don't get me wrong, I am not fundamentally opposed to ad-hoc polymorphism, in fact ... (Ok, don't get me onto the subject of polymorphism). > In the definition of w, the fromIntegrals serve no purpose > other than to make everything type. This seems to go > against the merits of declarative programming. I feel were you are coming from here ... but I wonder if the issue is more the problem that Int is not a subset of Float. That is, the matter that (1 :: Integer) and (1 :: Float) are not represented the same in the computer means that they really are not in a subset hierarchy. A conversion is a non trivial operation (not just a projection) I just don't feel we can miss out this point. We (as programmers) are pretending that the Floats and Integers are a model of reals and integers. But, they are not, so we have to write our program in such a way that we make up for the sense in which they are not. Ultimately, float is what it is ... not a real number. The fact that we can write programs to get a good approximation to certain real results, using floats, shows that we are good at compensating for the distinction. I don't think that it goes against the merits of declarative programming, rather (once again) declarative programming is causing us to have to recognise the reality of the situation. (In this case that real arithmetic is non computable). Mind you, maybe having to recognise the reality is a form of demerit. Regards Bruce. ps: Parametric polymorphism only works because other operators available are ad-hoc polymorphic :p From joe@isun.informatik.uni-leipzig.de Thu Mar 6 07:25:51 2003 From: joe@isun.informatik.uni-leipzig.de (Johannes Waldmann) Date: Thu, 6 Mar 2003 08:25:51 +0100 (MET) Subject: URI handling code in Haskell available In-Reply-To: <5.1.0.14.2.20030305225858.00bcf300@127.0.0.1> Message-ID: On Wed, 5 Mar 2003, Graham Klyne wrote: > I've released a first version of some URI parsing and handling code at: > http://www.ninebynine.org./Software/HaskellURI.zip but this library is already in ghc: http://www.haskell.org/ghc/docs/latest/html/network/Network.URI.html best regards -- -- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ -- -- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/207 -- From Markus.Schnell@infineon.com Thu Mar 6 09:32:57 2003 From: Markus.Schnell@infineon.com (Markus.Schnell@infineon.com) Date: Thu, 6 Mar 2003 10:32:57 +0100 Subject: Random Permutations Message-ID: Is there a library routine for random permutations? I didn't find any and did a quick hack, which works fine for my application (length of list < 100), but what would be a more elegant way? > permute :: StdGen -> [a] -> [a] > permute gen [] = [] > permute gen xs = (head tl) : permute gen' (hd ++ tail tl) > where (idx, gen') = randomR (0,length xs - 1) gen > (hd, tl) = splitAt idx xs Markus -- Markus Schnell, Infineon Technologies AG From mivori@hotmail.com Thu Mar 6 09:45:14 2003 From: mivori@hotmail.com (mike V) Date: Thu, 06 Mar 2003 20:45:14 +1100 Subject: Persistant (as in on disk) data Message-ID: Here is my post from the ffi mail list and some comments. Although not directly related to your question, I believe this whole issue merits further discussion, which unfortunately did not ensue with my post on the ffi mail list. And indeed from time to time it does seem to pop-up. I guess it is like the uncomfortable bed, never uncomfortable enough to be rid of. 1. The answer to your question: look at the Binary package (haskell libs) which implements a class Binary that allows binary IO, whether this package suffers from bit rot I don't know. 2. That haskell does not support a "Binary IO Standard" I believe to be an issue. An issue which with the advent of a "Standard FFI" is ripe to be addressed. 2.1. The binary package mentioned above implements it's own marshalling library which could to some extent(see 2.2.1) be subsumed by the FFI libraries. 2.2. The function of the Binary Class could be replaced by the Class Storable .ie. what is Storable can be written. 2.2.1 Notwithstanding the above, Class Binary may still be required. Haskell may opt for a "Standard Serialised" format across all platforms - this distinction comes into play with Big-endian vs little-endian int representations etc. Which for Storable does not come into play as by default you whish to have the same representation as the standard platform representation. Candidate representations could be ASN, XDR there are plenty of them (I believe that DCE, CORBA, Java etc all define some sort of standard serialisation). 2.2.1.1 There may be a need to define a set of data types similar to the CForeign package eg XDRInt etc, but on first inspection I believe them to be unnecessary. 2.2.2 A standard serialised binary representation would be of some benefit allowing sharing of binary files across platforms. 2.3 Class Storable or Binary could be made derivable, thereby facilitating the easy marshalling of structures to disk, see note below. 2.4 I guess it all comes down to whether the Haskell community feels that no standard binary io is ok. deriving instances of Storable Wed, 05 Feb 2003 20:37:25 +1100 Previous message: haskell finalisers driven underground Next message: deriving instances of Storable Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] -------------------------------------------------------------------------------- Is there any merit in the idea of allowing instances of Storable to be derived in a similar fashion to Show, providing that constituents are of class Storable. for instance (Int, Int) two Ints would be marshalled into consecutive memory locations in their order of declaration. (Int,String) an Int followed by a String dealing with constructors ========================== data X = X1 Int | X2 deriving Storable data Y = Y1 | Y2 deriving Storable three possible alternatives spring to mind A) Indexing Constructors by position X1 -> 0:Int X2 -> 1 where 0, 1 represent the constructor indexes ":" represents that the data items are physically contiguous "->" reads "marshalled as" This has the disadvantage of being sensitive to the constructor order B) using the constructor name as the index X1 -> X1:Int X2 -> X2 has the disadvantage of requiring a variable amount of memory for the tag. C) some other hash on the constructor name ? I would think that implementation would be fairly straight forward? The benefits would be significant - automatic marshalling of structures. uses: storing to disk, passing over network etc etc.. _________________________________________________________________ Hotmail now available on Australian mobile phones. Go to http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp From karczma@info.unicaen.fr Thu Mar 6 10:19:42 2003 From: karczma@info.unicaen.fr (Jerzy Karczmarczuk) Date: Thu, 06 Mar 2003 11:19:42 +0100 Subject: Random Permutations References: Message-ID: <3E6720BE.3060304@info.unicaen.fr> Markus.Schnell@infineon.com wrote: > Is there a library routine for random permutations? > > I didn't find any and did a quick hack... There are many algorithms. One, quite natural and quite fast (n log n; slower than linear, though...) consists in: 1. Generate N random numbers r_k, say, uniform between 0 and 1. 2. Form N pairs (1,r_1), (2,r_2), (3, r_3) ... (N,r_n). 3. Sort this list/vector wrt the *secon* (random) number. 4. In the sorted list the firs values (indices) give you the result. This is of course quite general, not restricted to any Haskell peculiarities. Jerzy Karczmarczuk From GK@ninebynine.org Thu Mar 6 08:51:57 2003 From: GK@ninebynine.org (Graham Klyne) Date: Thu, 06 Mar 2003 08:51:57 +0000 Subject: URI handling code in Haskell available In-Reply-To: References: <5.1.0.14.2.20030305225858.00bcf300@127.0.0.1> Message-ID: <5.1.0.14.2.20030306084846.02c36e90@127.0.0.1> At 08:25 06/03/2003 +0100, Johannes Waldmann wrote: >On Wed, 5 Mar 2003, Graham Klyne wrote: > > > I've released a first version of some URI parsing and handling code at: > > http://www.ninebynine.org./Software/HaskellURI.zip > >but this library is already in ghc: >http://www.haskell.org/ghc/docs/latest/html/network/Network.URI.html Oops. I didn't find that. Thanks for the pointer. (Thinks: does it work with HUGS?) A significant amount of my work went into the test cases and matching the parsing code against the (revised work-in-progress) URI spec, so maybe there's some residual value there...? #g ------------------- Graham Klyne PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E From per@L4i.se Thu Mar 6 12:42:23 2003 From: per@L4i.se (Per Larsson) Date: Thu, 6 Mar 2003 13:42:23 +0100 Subject: source layout Message-ID: <200303061342.23113.per@L4i.se> Hi all, I'm looking for some kind of style-guide for layout and indentation of ha= skell=20 source code, can anyone help me? Thanks, Per From carlos.scheidegger@terra.com.br Thu Mar 6 03:19:35 2003 From: carlos.scheidegger@terra.com.br (Carlos Eduardo Scheidegger) Date: 06 Mar 2003 00:19:35 -0300 Subject: Fundeps question Message-ID: <1046920776.3504.75.camel@trillian.krikkit> Hello, I am currently toying with the idea of implementing a PostScript library in Haskell, and I am currently implementing a static, simplified version of the Postscript type checker using phantom types and functional dependencies. I am enriching the Postscript definitions with types so that as many typing mistakes as possible are detected, as early as possible. The implementation is not very fancy, but some of the functional dependency issues I've come across are a bit confusing, so I am hoping some of the knowledgeable people in the list can lend me a hand in solving the problems. My first attempt at solving the problem involved something similar to this: > data Nil > data Cons t l > u = undefined > class EqList a b c | a b -> c where > comp :: a -> b -> c > comp _ _ = error "" > instance EqList Nil Nil Nil > instance EqList l1 l2 r => EqList (Cons t l1) (Cons t l2) r This works if there are no type variables involved: *Main> :t comp (u :: Cons Int Nil) (u :: Cons Float Nil) No instance for (EqList (Cons Int Nil) (Cons Float Nil) c) arising from use of `comp' at *Main> :t comp (u :: Cons Int Nil) (u :: Cons Int Nil) Nil *Main> :t comp (u :: Cons Int (Cons Float Nil)) (u :: Cons Int (Cons Float Nil)) Nil *Main> :t comp (u :: Cons Int (Cons Float Nil)) (u :: Cons Int (Cons Int Nil)) No instance for (EqList (Cons Float Nil) (Cons Int Nil) c) arising from use of `comp' at Now, in my application, the types had type variables in them, and I wanted to unify, for example, (Cons Int Nil) with (Cons a Nil). As most of you smart folks must have already deduced from reading the above code alone, this won't work. I suppose it is because the old confusion between a type variable being universally quantified and existentially quantified (is it?). Thinking that there should be a way to do this, I decided to try a different approach, using a helper class: > class SameType a b | a -> b, b -> a where > instance SameType a a > instance EqList Nil Nil Nil > instance EqList (SameType t1 t2, EqList l1 l2 r) => > EqList (Cons t1 l1) (Cons t2 l2) r But, this time, the typechecker gives me attitude: Inferred type is less polymorphic than expected Quantified type variable `t2' is unified with another quantified type variable `t1' When trying to generalise the type inferred for `comp' Signature type: forall t1 l1 t2 l2 r. (SameType t1 t2, EqList l1 l2 r) => Cons t1 l1 -> Cons t2 l2 -> r Type to generalise: Cons t1 l1 -> Cons t1 l2 -> r In the instance declaration for `EqList (Cons t1 l1) (Cons t2 l2) r' I don't quite understand the error. If I figured it out correctly, the compiler is examining the SameType fundep and concluding that in order two enforce the constraint (SameType t1 t2), t1 and t2 must be the same type, and since I'm telling him they possibly aren't, he's complaining. I may be grossly misunderstanding the issue here, but what I expected would happen is that instead of failing the typecheck, I would simply not be allowed to have instances of EqList of t1 and t2 not being the same class, because that would fail the fundep check later. And, more interestingly, if I use a definition of SameType like this: > instance SameType Int Int > instance SameType Float Float > instance SameType a b => Sametype [a] [b] > instance (SameType a b, SameType c d) > => SameType (Either a c) (Either b d) ... Both my original program and this example work properly. For example, (Cons Int Nil) (Cons a Nil) becomes a proper instance of EqList. This approach works in the case of my library, because there's a limited number of types in Postscript, but I was looking fore a more elegant solution. I do not know if I'm doing something utterly stupid, or if there are more serious underlying issues that I am not aware of, but I would be very grateful for any information or pointers to papers that discuss the issues involved. And if by any chance anyone is interested in the library, I'd be more than happy to put it somewhere public. I think it's turning out to be a rather nice application of fundeps and type computations. Thank you very much in advance, Carlos From ralf@informatik.uni-bonn.de Thu Mar 6 10:16:11 2003 From: ralf@informatik.uni-bonn.de (Ralf Hinze) Date: Thu, 6 Mar 2003 11:16:11 +0100 Subject: Random Permutations In-Reply-To: References: Message-ID: <200303061116.11978.ralf@informatik.uni-bonn.de> > Is there a library routine for random permutations? > > I didn't find any and did a quick hack, which works fine for my > application (length of list < 100), but what would be a more > elegant way? > > > permute :: StdGen -> [a] -> [a] > > permute gen [] = [] > > permute gen xs = (head tl) : permute gen' (hd ++ tail tl) > > where (idx, gen') = randomR (0,length xs - 1) gen > > (hd, tl) = splitAt idx xs I've attached some *old* code that generates a random permutation. Hope it still works ... Cheers, Ralf ---- %-------------------------------= -------------------------------------------- \section{Generate a random permutation} %-------------------------------= -------------------------------------------- > module RandomPerm( > randomPerm, randomPerms) > where > import Random > import Int > import Array > import ST % - - - - - - - - - - - - - - - = - - - - - - - - - - - - - - - - - - - - - - - \subsection{Signature} % - - - - - - - - - - - - - - - = - - - - - - - - - - - - - - - - - - - - - - - > randomPerm :: (RandomGen g) => [a] -> g -> ([a], g) > randomPerms :: (RandomGen g) => [a] -> g -> [[a]] % - - - - - - - - - - - - - - - = - - - - - - - - - - - - - - - - - - - - - - - \subsection{Implementation} % - - - - - - - - - - - - - - - = - - - - - - - - - - - - - - - - - - - - - - - For a list of length |n| we calculate a random number between |0| and |n! - 1|. This random number is converted to the factorial number system, see \cite[p.66]{Knu97Art2}. Recall that in this system a sequence of `digits' $b_{n-1}\ldots b_0$ with $0 \leq b_i \leq i$ denotes the number $\sum_{i} b_i\cdot i!$ (note that $b_0$ is necessarily $0$). This sequence is then used as a recipe for building a random permutation: we exchange the elements at positions $i$ and $i + b_i$ for $0 \leq i < n$. > randomPerm as g = (permute num as, g') > where (num, g') = generate (length as) g > randomPerms as g = as' : randomPerms as g' > where (as', g') = randomPerm as g Generates a random number between |0| and |n! - 1| in the `factorial' number system representation. > generate :: (RandomGen g) => Int -> g -> ([Int], g) > generate n g = (convert fs r, g') > where (f : fs) = reverse (take (n + 1) (factorials 0 1)) > (r, g') = randomR (0, f - 1) g Convert a number to a mixed-radix numeral (the radices are given as the first argument). > convert :: [Integer] -> Integer -> [Int] > convert [] _n = [] -- |_n| should be |0| > convert (f : fs) n = toInt q : convert fs r > where (q, r) = divMod n f The list of factorial numbers. > factorials :: Int -> Integer -> [Integer] > factorials i f = f : factorials (i + 1) (f * fromInt (i + 1)) Note that we have to call |factorial i f| such that |f| is |i!|. The function |permute| permutes the given list according to the `factorial' numeral. > permute :: [Int] -> [a] -> [a] > permute num as = runST ( > do { a <- newSTArray bs undefined; > sequence_ [ > writeSTArray a i e > | (i, e) <- zip is as ]; > sequence [ > swap a i (i + r) > | (i, r) <- zip is num ]; > mapM (readSTArray a) is }) > where bs = (0, length as - 1) > is = range bs The operation |swap| exchanges two elements of a mutable array. > swap :: (Ix ix) => STArray s ix a -> ix -> ix -> ST s () > swap a i j = do { x <- readSTArray a i; > y <- readSTArray a j; > writeSTArray a i y; > writeSTArray a j x } From simonmar@microsoft.com Thu Mar 6 14:25:50 2003 From: simonmar@microsoft.com (Simon Marlow) Date: Thu, 6 Mar 2003 14:25:50 -0000 Subject: URI handling code in Haskell available Message-ID: <9584A4A864BD8548932F2F88EB30D1C60C1436C4@tvp-msg-01.europe.corp.microsoft.com> > Oops. I didn't find that. Thanks for the pointer. (Thinks:=20 > does it work with HUGS?) It works with the latest hugs, November 2002 (use "hugs +N" to get the hierarchical libraries). > A significant amount of my work went into the test cases and=20 > matching the=20 > parsing code against the (revised work-in-progress) URI spec,=20 > so maybe=20 > there's some residual value there...? When I wrote Network.URI I took the grammar from the RFC, and also a bunch of test cases, which are in GHC's testsuite (fptools/testsuite/tests/ghc-regress/lib/net/uri001.hs). It might not be up to date with the latest rev of the spec, however. Any extra testing you can do and/or comments you have on the API would be appreciated. One thing I know is questionable is that parseURI returns a Maybe URI, when in fact there are no strings for which it can return Nothing (*everything* is a valid URI, it seems!). Cheers, Simon From ng13@mcs.le.ac.uk Thu Mar 6 14:39:45 2003 From: ng13@mcs.le.ac.uk (N Ghani) Date: Thu, 06 Mar 2003 14:39:45 +0000 Subject: BCTCS 19 Message-ID: **** **** Please can you publicise this amongst your colleagues and particularly PhD students who could take advantage of our grants for accommodation etc +---------------------------------------------------------------------+ CALL FOR PARTICIPATION British Colloquium on Theoretical Computer Science 7th - 9th April 2003 Leicester, United Kingdom http://www.mcs.le.ac.uk/events/bctcs19/ The British Colloquium for Theoretical Computer Science (BCTCS) is an annual conference providing a forum for research in all areas of theoretical computer science. As such, it aims to provide an informal setting within which researchers can meet and discuss recent developments and results in the broad swathe of the subject rather than in just their own area of specialty. The BCTCS is also dedicated to the development and training of postgraduate research students. Indeed, the relaxed nature of the conference provides an excellent environment where postgraduate students may gain the experience of presenting their work to their colleagues and benefit from contact with established researchers in the community. A number of grants are available to fund the accommodation and registration costs of postgraduate students who are willing to give talks. This year, we are pleased to have invited talks in the areas of programming language semantics, category theory, algorithms, formal languages and automata theory given by Prof A. Jung, University of Birmingham, UK Prof F.W. Lawvere, State University of New York, USA Prof K. Mehlhorn, Universitaet des Saarlandes, Germany Dr S. Muthukrishnan, Rutgers University, USA and AT&T Prof. J. Pin, Universite Paris Denis Diderot et CNRS, France Further details of the program etc will be available from the website http://www.mcs.le.ac.uk/events/bctcs19/ and registration, travel, costs etc can be found at http://www.le.ac.uk/conference/bctcs/ For any other issues, please contact bctcs19@mcs.le.ac.uk Neil Ghani Dr Conference Organiser +---------------------------------------------------------------------+ | Dr Neil Ghani Email : ng13@mcs.le.ac.uk | | Dept of Maths and Computer Science Web : www.mcs.le.ac.uk/~ng13 | | University of Leicester | | University Rd, | | Leicester LE1 7RH Phone : +44 (0)116 252 3807 | | United Kingdom Fax : +44 (0)116 252 3915 | +---------------------------------------------------------------------+ From simonmar@microsoft.com Thu Mar 6 14:42:55 2003 From: simonmar@microsoft.com (Simon Marlow) Date: Thu, 6 Mar 2003 14:42:55 -0000 Subject: Persistant (as in on disk) data Message-ID: <9584A4A864BD8548932F2F88EB30D1C60C1436E0@tvp-msg-01.europe.corp.microsoft.com> > a recent post reminded me of a feature i'd like. > for all i know it is already implemenetd in GHC so pointers=20 > are welcome. >=20 > i'd like to be able to dump data structures to disk, and later load=20 > them. A Binary library was discussed recently on the libraries list. The thread starts here: http://www.haskell.org/pipermail/libraries/2002-November/000691.html It's currently stalled. There are several implementations of Binary: one that comes with NHC and is described in a paper (sorry, don't have a link to hand), a port of this library to GHC by Sven Panne (suffers from bitrot), a derived/simplified version used in GHC which is heavily hacked for speed, and a further derived version of this library by Hal Daume who is adapting it to support bit-by-bit serialisation. I think the outstanding issues are (a) is the API for GHC's Binary library acceptable, or do we need the extra bells and whistles that the NHC version has? (b) can we make a version of Binary that uses a bit-by-bit rather than byte-by-byte serialisation of the data that is as fast (or nearly as fast) as the current byte-by-byte implementation? Perhaps performance isn't that important to the majority of people: please comment if you have an opinion. (c) how do we derive instances of Binary? IMHO: something is better than nothing, so I'd be in favour of just plugging in the Binary library from GHC, and marking it "experimental". Cheers, Simon From abel@informatik.uni-muenchen.de Thu Mar 6 15:03:17 2003 From: abel@informatik.uni-muenchen.de (Andreas Abel) Date: Thu, 06 Mar 2003 16:03:17 +0100 Subject: Random Permutations References: <200303061116.11978.ralf@informatik.uni-bonn.de> Message-ID: <3E676335.7050207@informatik.uni-muenchen.de> >Is there a library routine for random permutations? > >I didn't find any and did a quick hack, which works fine for my >application (length of list < 100), but what would be a more >elegant way? Well, sorting is a special case of permuting, so my idea was to use the library routine List.sortBy :: (a -> a -> Ordering) -> [a] -> [a] passing it a comparison function which ignores its arguments and simply returns a random bit when invoked, e.g. permute = sortBy $ \_ _ -> if random() then GT else LT Unfortunately, this one-line hack is impossible since random numbers rely on state and sortBy is not prepared for use with a monad. Back in the old days when we had assignments... --Andreas -- Andreas Abel --<>-- What if Jesus is right? Theoretical Computer Science, University of Munich http://www.tcs.informatik.uni-muenchen.de/~abel/ From shae@webwitches.com Thu Mar 6 15:07:55 2003 From: shae@webwitches.com (shae@webwitches.com) Date: Thu, 06 Mar 2003 16:07:55 +0100 Subject: source layout In-Reply-To: <200303061342.23113.per@L4i.se> (Per Larsson's message of "Thu, 6 Mar 2003 13:42:23 +0100") Message-ID: <87ptp44jp0.fsf@thunderbird.webwitches.com> Per Larsson writes: > I'm looking for some kind of style-guide for layout and indentation of haskell > source code, can anyone help me? There are various pretty-printing libraries for Haskell, for example: http://www.haskell.org/ghc/docs/latest/html/haskell-src/Language.Haskell.Pretty.html http://www.haskell.org/ghc/docs/latest/html/base/Text.PrettyPrint.html http://www.cs.uu.nl/~daan/pprint.html For editors, there's haskell-mode for emacs which does a good job of indenting intelligently. I've heard the vim mode works well also. A bit of googling turned up these: http://www.haskell.org/~simonmar/libraries/libraries.html http://www.cs.ou.edu/~rlpage/fpclassFall96/handouts/styleGuide.html http://www.cs.bris.ac.uk/Teaching/Resources/COMS12100/java/style.html Hope this helps, -- Shae Matijs Erisson - 2 days older than RFC0226 #haskell on irc.freenode.net - We Put the Funk in Funktion 10 PRINT "HELLO" 20 GOTO 10 ; mapM_ putStrLn $ fix ("hello":) From voigt@tcs.inf.tu-dresden.de Thu Mar 6 15:24:54 2003 From: voigt@tcs.inf.tu-dresden.de (Janis Voigtlaender) Date: Thu, 06 Mar 2003 16:24:54 +0100 Subject: Random Permutations References: <200303061116.11978.ralf@informatik.uni-bonn.de> <3E676335.7050207@informatik.uni-muenchen.de> Message-ID: <3E676846.9D028D47@tcs.inf.tu-dresden.de> Andreas Abel wrote: > Well, sorting is a special case of permuting, so my idea was to use the library > routine > > List.sortBy :: (a -> a -> Ordering) -> [a] -> [a] > > passing it a comparison function which ignores its arguments and simply returns > a random bit when invoked, e.g. > > permute = sortBy $ \_ _ -> if random() then GT else LT > > Unfortunately, this one-line hack is impossible since random numbers rely on > state and sortBy is not prepared for use with a monad. Well, even if it were possible to use sortBy with a monad, wouldn't your hack be a bit dangerous? Here is what the report has to say on sortBy: "... when the "By" function replaces an Ord context by a binary predicate, the predicate is assumed to define a total ordering." Clearly, (\_ _ -> if random() then GT else LT) does not make for a total ordering. While you might say that this is no problem, since you don't actually want to *sort*, you might even get nontermination, if the implementation of sortBy happened to use the property "total ordering" for ensuring termination (as, e.g., a naive implementation of bubblesort does). Regards, Janis. -- Janis Voigtlaender http://wwwtcs.inf.tu-dresden.de/~voigt/ mailto:voigt@tcs.inf.tu-dresden.de From Alistair_Bayley@ldn.invesco.com Thu Mar 6 15:20:41 2003 From: Alistair_Bayley@ldn.invesco.com (Bayley, Alistair) Date: Thu, 6 Mar 2003 15:20:41 -0000 Subject: source layout Message-ID: > There are various pretty-printing libraries for Haskell, for example: Yeah, but that's only half the job. You have to combine these with a Haskell parser in order to get a program with the functionality of (say) 'indent' (or have I misunderstood what the libraries do?) I though this was quite good (but I still use tabs - horrors...) http://www.cs.bris.ac.uk/Teaching/Resources/COMS12100/java/style.html -----Original Message----- From: shae@webwitches.com [mailto:shae@webwitches.com] Sent: 06 March 2003 15:08 To: Per Larsson Cc: Haskell Mailing List Subject: Re: source layout Per Larsson writes: > I'm looking for some kind of style-guide for layout and indentation of haskell > source code, can anyone help me? There are various pretty-printing libraries for Haskell, for example: http://www.haskell.org/ghc/docs/latest/html/haskell-src/Language.Haskell.Pre tty.html http://www.haskell.org/ghc/docs/latest/html/base/Text.PrettyPrint.html http://www.cs.uu.nl/~daan/pprint.html For editors, there's haskell-mode for emacs which does a good job of indenting intelligently. I've heard the vim mode works well also. A bit of googling turned up these: http://www.haskell.org/~simonmar/libraries/libraries.html http://www.cs.ou.edu/~rlpage/fpclassFall96/handouts/styleGuide.html http://www.cs.bris.ac.uk/Teaching/Resources/COMS12100/java/style.html Hope this helps, -- Shae Matijs Erisson - 2 days older than RFC0226 #haskell on irc.freenode.net - We Put the Funk in Funktion 10 PRINT "HELLO" 20 GOTO 10 ; mapM_ putStrLn $ fix ("hello":) ***************************************************************** The information in this email and in any attachments is confidential and intended solely for the attention and use of the named addressee(s). This information may be subject to legal professional or other privilege or may otherwise be protected by work product immunity or other legal rules. It must not be disclosed to any person without our authority. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are not authorised to and must not disclose, copy, distribute, or retain this message or any part of it. ***************************************************************** From Malcolm.Wallace@cs.york.ac.uk Thu Mar 6 16:00:32 2003 From: Malcolm.Wallace@cs.york.ac.uk (Malcolm Wallace) Date: Thu, 6 Mar 2003 16:00:32 +0000 Subject: ANNOUNCE: hmake-3.07 Message-ID: <20030306160032.45b587ea.Malcolm.Wallace@cs.york.ac.uk> hmake-3.07 ---------- http://www.haskell.org/hmake We announce a new release, 3.07, of hmake, the automatic compilation manager for Haskell programs. This fresh version has the following improved configuration features over previous releases: * Hmake now once again builds cleanly with GHC under Cygwin. * Better handling of config files. Your personal config file is now used as an override for the system-wide config file, rather than being used instead of it. Hence, any global config updates are now automatically propagated to all users. * The new command `hmake-config new' is now needed to begin a fresh personal config file, rather than one being created for you silently against your expectations. * `hmake-config list' can now take a specific compiler argument to show detailed info for that compiler. Regards, Malcolm From m.p.donadio@ieee.org Thu Mar 6 16:13:00 2003 From: m.p.donadio@ieee.org (Matthew Donadio) Date: Thu, 06 Mar 2003 11:13:00 -0500 Subject: Random Permutations References: Message-ID: <3E67738C.CBA81EB6@ieee.org> Markus.Schnell@infineon.com wrote: > Is there a library routine for random permutations? Check out this link: http://www.nist.gov/dads/HTML/perfectShuffle.html -- Matthew Donadio (m.p.donadio@ieee.org) From ger@tzi.de Thu Mar 6 16:20:57 2003 From: ger@tzi.de (George Russell) Date: Thu, 06 Mar 2003 17:20:57 +0100 Subject: random permutations Message-ID: <3E677569.9040505@tzi.de> Andreas wrote > Well, sorting is a special case of permuting, so my idea was to use the library > routine > > List.sortBy :: (a -> a -> Ordering) -> [a] -> [a] > > passing it a comparison function which ignores its arguments and simply returns > a random bit when invoked, e.g. > > permute = sortBy $ \_ _ -> if random() then GT else LT > > Unfortunately, this one-line hack is impossible since random numbers rely on > state and sortBy is not prepared for use with a monad. No this is an extremely bad way of doing it, since some permutations will come up more than others. (Consider what happens with a three-element list.) I think Ralf Hinze's method is the best presented so far. I would write it slightly differently though. In pseudo-code I would proceed as follows: (1) write the values to an array a[1]..a[n] (2) for i from n to 2 do j <- random integer between 1 and i swap a[i] and a[j] At the end the elements of a will be a random permutation. In Haskell you can of course use an STArray for this. Ralf Hinze's method requires you to do n multiplications and n divisions to compute the factorial and then compute a random number. I have to compute n random numbers rather than a single random number, on the other hand I don't have to do the multiplications and divisions. Indeed, since you need more random bits to compute a random big number than a random little number, I don't think in theory my method requires much more work from the random number generator than Ralf Hinze's. From wangmeng@comp.nus.edu.sg Thu Mar 6 17:35:44 2003 From: wangmeng@comp.nus.edu.sg (Wang Meng) Date: Fri, 7 Mar 2003 01:35:44 +0800 (GMT-8) Subject: overload lift function In-Reply-To: <200303061342.23113.per@L4i.se> Message-ID: Hi All, I have a data type defined as > data D a = D1 Int | D2 a Follow this definition, I have D2 Int,D2 Bool and D2 [D2 Int] as instances of type D. I want to write an overloaded function lift which lifts an atom type to D. It is easily done for D2 Int and D2 Bool using type classes.I can have > class Liftable a where > lift :: a -> L a > > instance Liftable Int where > lift x = D2 x However, I have problem with D2 [D2 Int].I want to lift [Int] to D2 [D2 Int]. Is there any solution to it? Thank you very much. -W-M- @ @ | \_/ From dnovatchev@yahoo.com Thu Mar 6 19:27:08 2003 From: dnovatchev@yahoo.com (Dimitre Novatchev) Date: Thu, 6 Mar 2003 11:27:08 -0800 (PST) Subject: random permutations In-Reply-To: <20030306191953.44730.qmail@web41110.mail.yahoo.com> Message-ID: <20030306192708.89708.qmail@web41104.mail.yahoo.com> --- George Russell wrote: > I think Ralf Hinze's method is the best presented so far. I would > write > it slightly differently though. In pseudo-code I would proceed as > follows: > (1) write the values to an array a[1]..a[n] > (2) for i from n to 2 > do > j <- random integer between 1 and i > swap a[i] and a[j] > At the end the elements of a will be a random permutation. In > Haskell > you can of course use an STArray for this. > > Ralf Hinze's method requires you to do n multiplications and n > divisions > to compute the factorial and then compute a random number. I have > to compute n random numbers rather than a single random number, on > the > other hand I don't have to do the multiplications and divisions. > Indeed, since you need more random bits to compute a random big > number > than a random little number, I don't think in theory my method > requires > much more work from the random number generator than Ralf Hinze's. This is exactly how I did it in producing a randomised node-set in XSLT: "Randomization of node-sets or node-lists" http://www.topxml.com/code/default.asp?p=3&id=v20020504013704 ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ From m.p.donadio@ieee.org Fri Mar 7 00:22:45 2003 From: m.p.donadio@ieee.org (Matthew Donadio) Date: Thu, 06 Mar 2003 19:22:45 -0500 Subject: int to float problem References: <200303060513.h265Daq16274@it012687.massey.ac.nz> Message-ID: <3E67E655.5CE2E669@ieee.org> b.i.mills@massey.ac.nz wrote: > > I agree with what you said, > > but I think you may have missed my point. > > Sounds likely on both counts. Probably. I get confused a lot. :) > So now I have to say ... > > denominator $ fromInteger (floor (23 % 45)) > > Is this the same malarkey that you are complaining about? Yup. I just looked at some of the code I am workong on. In 2000 lines of DSP code, 85 contain fromIntegral. That is roughly 1 out of every 25, and it doesn't count instances where fromIntegral appears more than once in a line of code. All are needed solely to placate the type system. > So, you want some way to define a default manner in which > other types can be mapped to the type that is used in the > definition of the function? (Do I understand correctly)? Yup, and by doing so I would accept the numeric shenanigans that may result. [ I'm not sure what I want to say in response to the points you made in the rest of the message, so there will probably be a part two tomorrow. ] -- Matthew Donadio (m.p.donadio@ieee.org) From oleg@pobox.com Fri Mar 7 01:39:20 2003 From: oleg@pobox.com (oleg@pobox.com) Date: Thu, 6 Mar 2003 17:39:20 -0800 (PST) Subject: Random Permutations Message-ID: <200303070139.h271dKTD058677@adric.fnmoc.navy.mil> > 1. Generate N random numbers r_k, say, uniform between 0 and 1. > 2. Form N pairs (1,r_1), (2,r_2), (3, r_3) ... (N,r_n). > 3. Sort this list/vector wrt the *secon* (random) number. > 4. In the sorted list the firs values (indices) give you the result. > This is of course quite general, not restricted to any Haskell > peculiarities. I'm sorry but this algorithm does NOT in general provide the perfect random permutation. Here's an excerpt from http://pobox.com/~oleg/ftp/Haskell/perfect-shuffle.txt that deals extensively with this issue: A commonly used shuffle algorithm attaches random tags to elements of a sequence and then sorts the sequence by the tags. Although this algorithm performs well in practice, it does not achieve the perfect shuffling. Let us consider the simplest example (which happens to be the worst case): a sequence of two elements, [a b]. According to the shuffle-by-random-keys algorithm, we pick two binary random numbers, and associate the first number with the 'a' element, and the second number with the 'b' element. The two numbers are the tags (keys) for the elements of the sequence. We then sort the keyed sequence in the ascending order of the keys. We assume a stable sort algorithm. There are only 4 possible combinations of two binary random numbers. Therefore, there are only four possible tagged sequences: [(0,a) (0,b)] [(0,a) (1,b)] [(1,a) (0,b)] [(1,a) (1,b)] After the sorting, the sequences become: [(0,a) (0,b)] [(0,a) (1,b)] [(0,b) (1,a)] [(1,a) (1,b)] As we can see, after the sorting, the sequence [a, b] is three times more likely than the sequence [b, a]. That can't be a perfect shuffle. Furthermore, if we have a sequence of N elements and associate with each element a key -- a random number uniformly distributed within [0, M-1] (where N!>M>=N), we have the configurational space of size M^N (i.e., M^N ways to key the sequence). There are N! possible permutations of the sequence. Alas, for N>2 and M References: Message-ID: Johannes Waldmann writes: > Dear all, I am looking for a Haskell library for the HTTP/1.1 protocol, > i. e. data types for Requests and Responses, > and functions to read chunked bodies etc. Is there such a thing? Warrick Gray wrote a small HTTP library. You can find it at: http://homepages.paradise.net.nz/warrickg/haskell/http/ Jens From sulzmann@comp.nus.edu.sg Fri Mar 7 03:42:49 2003 From: sulzmann@comp.nus.edu.sg (Martin Sulzmann) Date: Fri, 7 Mar 2003 11:42:49 +0800 (GMT-8) Subject: Fundeps question In-Reply-To: <1046920776.3504.75.camel@trillian.krikkit> References: <1046920776.3504.75.camel@trillian.krikkit> Message-ID: <15976.4648.987215.443272@sf0.comp.nus.edu.sg> There seems to be a mismatch between hugs and ghc. hugs -98 :version -- Hugs Version February 2001 accepts the following: ====== EqList.hs ======== module EqList where data Nil = Nil data Cons x xs = Cons x xs class EqList a b c | a b -> c where comp :: a -> b -> c comp _ _ = error "" class SameType a b | a -> b, b -> a instance SameType a a instance EqList Nil Nil Nil instance (SameType t1 t2, EqList l1 l2 r) => EqList (Cons t1 l1) (Cons t2 l2) r e x y = comp (Cons x Nil) (Cons y Nil) -- :t e yields e :: a -> a -> Nil --f = comp (Cons True Nil) (Cons 'a' Nil) -- yields {- Constraints are not consistent with functional dependency *** Constraint : SameType Bool Char *** And constraint : SameType Char Char *** For class : SameType a b *** Break dependency : b -> a -} ================= My guess is that ghc doesn't like if you "inherit" dependencies. Here's a simplified example: =========== class Force a b | a -> b, b -> a instance Force a a class Test a b instance Force a b => Test a b =========== Again ghc complains whereas hugs accepts the above code. Martin From carlos.scheidegger@terra.com.br Fri Mar 7 06:22:25 2003 From: carlos.scheidegger@terra.com.br (Carlos Eduardo Scheidegger) Date: 07 Mar 2003 03:22:25 -0300 Subject: GHCi 5.04.2 segfaults on expression evaluation Message-ID: <1047018148.996.42.camel@trillian.krikkit> Hello. I think I've come across a GHCi bug. Using the following module, GHCi version 5.04.2 segfaults, apparently trying to compute a type using functional dependencies. The segfault happens when I try to calculate (v1 .> v2). I tried the code on Hugs, and it answers Main> v1 .> v2 V [] :: PSOp (Pop a Id) as expected. I think the problem is occuring in the line > instance Reverse a b c => CheckPS Id a b c because if I remove the line > instance Reverse a (Pop t b) c => Reverse (Pop t a) b c instead of segfaulting, GHCi rightfully complains: :1: No instance for (Reverse (Pop a Id) Id c) arising from use of `.>' at :1 In the definition of `it': v1 .> v2 GHC compiles the program just fine and runs it without any issues. I installed GHC 5.04.2 using the RedHat 8.0 RPM's. If there's any important information you may need from me, please, tell me and I will be glad to help. I've also cross-posted this to the bug section at sourceforge.net, and there the module file can be found as a separate file. Thank you, Carlos -------------------------------------------------------------------------------- > class ComposePS a b c | a b -> c where > (.>) :: PSOp a -> PSOp b -> PSOp c > (V a) .> (V b) = V (a ++ b) > instance (ConcatPS a b c, CheckPS c Id Id d) => ComposePS a b d -------------------------------------------------------------------------------- > data PSOp a = V [String] deriving Show > data Id > data Push t rest > data Pop t rest > class Reverse a b c | a b -> c > instance Reverse Id b b > instance Reverse a (Pop t b) c => Reverse (Pop t a) b c > instance Reverse a (Push t b) c => Reverse (Push t a) b c -------------------------------------------------------------------------------- > class ConcatPS a b c | a b -> c where > ccat :: a -> b -> c > instance ConcatPS Id a a > instance ConcatPS a b c => ConcatPS (Pop t a) b (Pop t c) > instance ConcatPS a b c => ConcatPS (Push t a) b (Push t c) -------------------------------------------------------------------------------- > class CheckPS a b c d | a b c -> d where > check :: a -> b -> c -> d > check _ _ _ = error "oki" > instance Reverse a b c => CheckPS Id a b c -- instance CheckPS a b (Push t c) d => CheckPS (Push t a) b c d > instance CheckPS a (Pop t b) Id d => CheckPS (Pop t a) b Id d -- instance CheckPS a b c d => CheckPS (Pop t a) b (Push t c) d -- instance (SameType t1 t2, CheckPS a b c d) => CheckPS (Pop t1 a) b (Push t2 c) d > u = undefined > v1 :: PSOp (Pop a Id) > v1 = V [] > v2 :: PSOp Id > v2 = V [] From karczma@info.unicaen.fr Fri Mar 7 07:51:27 2003 From: karczma@info.unicaen.fr (Jerzy Karczmarczuk) Date: Fri, 07 Mar 2003 08:51:27 +0100 Subject: Random Permutations References: <200303070139.h271dKTD058677@adric.fnmoc.navy.mil> Message-ID: <3E684F7F.10606@info.unicaen.fr> oleg@pobox.com comments my suggestion: >>1. Generate N random numbers r_k, say, uniform between 0 and 1. >>2. Form N pairs (1,r_1), (2,r_2), (3, r_3) ... (N,r_n). >>3. Sort this list/vector wrt the *second* (random) number. >>4. In the sorted list the first values (indices) give you the result. > I'm sorry but this algorithm does NOT in general provide the perfect > random permutation. Here's an excerpt from > > http://pobox.com/~oleg/ftp/Haskell/perfect-shuffle.txt > that deals extensively with this issue: Oleg, I have read that, I know also the comments here: http://www.nist.gov/dads/HTML/perfectShuffle.html This is a known issue, and I am not *so* ignorant. > Let us consider the simplest example (which happens to be the worst > case): a sequence of two elements, [a b]. According to the > shuffle-by-random-keys algorithm, we pick two binary random numbers, > and associate the first number with the 'a' element, and the second > number with the 'b' element. The two numbers are the tags (keys) for > the elements of the sequence. We then sort the keyed sequence in the > ascending order of the keys. We assume a stable sort algorithm. There > are only 4 possible combinations of two binary random > numbers. Therefore, there are only four possible tagged sequences: > [(0,a) (0,b)] > [(0,a) (1,b)] > [(1,a) (0,b)] > [(1,a) (1,b)] ... In this context the generator of the random tags should be a little more serious than choosing randomly two binary digits, don't you think? Your criticism is perfectly valid, as most hair-splitting objections are, but it is really not practical. > Furthermore, if we have a sequence of N elements and associate with > each element a key -- a random number uniformly distributed within [0, > M-1] (where N!>M>=N), we have the configurational space of size M^N > (i.e., M^N ways to key the sequence). There are N! possible > permutations of the sequence. Alas, for N>2 and M evenly divisible by N!. Therefore, certain permutations are bound to > be a bit more likely than the others. I am still waiting to see *any* practical consequences of this theoretical conclusion, when N is of order of dozens, hundreds or more. Nobody interested in practical generation of those permutations would dream of generating *all* of them; if this is the case, the exhaustive enumeration would be better.... So, the fact that some permutations are slightly more likely than others is practically not too meaningful. The swapping perfect shuffle method is obviously quite fine. Why did I suggested the sorting method? Because I just glimpsed over the original query, and I was not sure whether the author of the posting used vectors or lists. With lists the swapping algorithm becomes inefficient, as you may clearly see. With mergesort I believe that you get your permutations faster. Anyway, I will not defend the sorting approach as something ideal. Jerzy Karczmarczuk From gk@ninebynine.org Thu Mar 6 11:40:41 2003 From: gk@ninebynine.org (Graham Klyne) Date: Thu, 06 Mar 2003 11:40:41 +0000 Subject: www.haskell.org/libraries - a suggestion Message-ID: <5.1.0.14.2.20030306113816.00b73870@127.0.0.1> Prompted by my overlooking the GHC library URI code, may I suggest that a reference to the GHC network library be added to the Libraries page at: http://www.haskell.org/libraries/#xml #g ------------------- Graham Klyne PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E From dreamgyrl24@yahoo.com Thu Mar 6 21:39:03 2003 From: dreamgyrl24@yahoo.com (muskaan asdfg) Date: Thu, 6 Mar 2003 13:39:03 -0800 (PST) Subject: help please Message-ID: <20030306213903.92813.qmail@web11905.mail.yahoo.com> hi there, i am attending university of new orleans and for my 4501 class i picked haskell language to do my project. rite now i am dealing with a lot of problems because there are no books avaliable in bookstore on haskell, and i dont find online information any helpfull. so please help. i am trying to find what are the compliation units for a complete program in haskell. is the answer seperate compliation in modules is the answer. please lead in right direction thanks tina __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ From simonpj@microsoft.com Fri Mar 7 13:14:06 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Fri, 7 Mar 2003 13:14:06 -0000 Subject: Persistant (as in on disk) data Message-ID: | (c) how do we derive instances of Binary? If you guys can agree an interface that GHC, nhc and Hugs can all support, I'll gladly do the 'deriving' stuff to make 'deriving Binary' work for GHC. What's always inhibited me is that there isn't a single agreed interface. For most users, having a library that works across all Haskell implementations and platforms is much more important than having the most efficient possible library. But (the possibility of an) efficient implementation has to be a goal, just not the only goal. If GHC can't use it directly for interface files, so be it. Simon From carette@mcmaster.ca Fri Mar 7 14:31:16 2003 From: carette@mcmaster.ca (Jacques Carette) Date: Fri, 7 Mar 2003 09:31:16 -0500 Subject: Random Permutations In-Reply-To: <3E684F7F.10606@info.unicaen.fr> Message-ID: Pertinent to this thread (though perhaps overkill) is the work of Flajolet et al on (fast) random generation of combinatorial structures for any structure given as a context-free grammar, including Permutation. In particular see http://citeseer.nj.nec.com/flajolet93calculus.html http://citeseer.nj.nec.com/flajolet95computer.html There is a complete implementation of this in Maple as well as a partial port to MuPAD. The Maple version is available at http://pauillac.inria.fr/algo/libraries/libraries.html. Also worth a look is the set of fully documented example applications (available in various formats) at http://pauillac.inria.fr/algo/libraries/autocomb/autocomb.html A translation of the random generation parts of this work to Haskell would not be too difficult, and might in fact be easier than the original, although a full translation would require Template Haskell. Translating the automatic generation of the 'counting' functions would be very challenging [as no one has, as far as I know, yet to create a workable, truly statically-typed computer algebra system!] Jacques From ross@soi.city.ac.uk Fri Mar 7 15:09:30 2003 From: ross@soi.city.ac.uk (Ross Paterson) Date: Fri, 7 Mar 2003 15:09:30 +0000 Subject: Problem with hierarchical libraries in Hugs compared to ghc/nhc98 In-Reply-To: <3E68AE43.E344AC9C@cs.york.ac.uk> References: <3E68AE43.E344AC9C@cs.york.ac.uk> Message-ID: <20030307150929.GA19727@soi.city.ac.uk> On Fri, Mar 07, 2003 at 02:35:47PM +0000, Olaf Chitil wrote: > When trying to make our Haskell tracer Hat work with Hugs (November > 2002) I noticed that > > * Hugs' implementation of hierarchical libraries differs from those > of ghc and nhc98, and > * Hugs' implementation choice makes it more restrictive than ghc/nhc98 > > A simple example: > There is module B in file B.hs > There is module Test.B in file Test/B.hs > There is module Test.A in file Test/A.hs > Module Test.A contains "import B". > > When compiling module Test.A both nhc98 and ghc imports module B from > file B.hs. In contrast, Hugs imports module Test.B from file Test/B.hs > and then stops with an error, because the module name is wrong. > > The simple reason why Hugs behaves so is that when searching a module it > *always* searches the current directory (* where the import was demanded > *) first. Only afterwards the paths set with the -P option are searched. > > [noble attempt at rationalizing Hugs's behaviour omitted] This is a clear flaw in Hugs (long known, but hard to fix). A workaround is to add the -X option to stop it adding the extra directory. From olaf@cs.york.ac.uk Fri Mar 7 14:35:47 2003 From: olaf@cs.york.ac.uk (Olaf Chitil) Date: Fri, 07 Mar 2003 14:35:47 +0000 Subject: Problem with hierarchical libraries in Hugs compared to ghc/nhc98 Message-ID: <3E68AE43.E344AC9C@cs.york.ac.uk> When trying to make our Haskell tracer Hat work with Hugs (November 2002) I noticed that * Hugs' implementation of hierarchical libraries differs from those of ghc and nhc98, and * Hugs' implementation choice makes it more restrictive than ghc/nhc98 A simple example: There is module B in file B.hs There is module Test.B in file Test/B.hs There is module Test.A in file Test/A.hs Module Test.A contains "import B". When compiling module Test.A both nhc98 and ghc imports module B from file B.hs. In contrast, Hugs imports module Test.B from file Test/B.hs and then stops with an error, because the module name is wrong. The simple reason why Hugs behaves so is that when searching a module it *always* searches the current directory (* where the import was demanded *) first. Only afterwards the paths set with the -P option are searched. I know that we generally try to avoid specifying filename and directory issues. However, this is not really a filename issue, but a problem of relative and absolute module names (wrt possibly several hierarchies). An "import B" in module Test.A could mean either module B or module Test.B. I suggest that the absolute module name takes precedence, because otherwise there is no way to import module B from module Test.A, whereas you can always import module Test.B from module Test.A by saying "import Test.B". I admit that this has the slight disadvantage that moving a set of modules into the hierarchical library will require not only changing all module names at the top but also in every import declaration, to not inadvertedly import the wrong module. So in the end this suggests that we should not allow relative module names at all. Note that this proposal still allows the current directory (of Hugs or in which the compiler was started) to be the root of the hierarchy that is searched first. In fact, this is probably the desirable default behaviour. Currently the hierarchical library proposal http://www.haskell.org/~simonmar/libraries/libraries.html does not say much about the semantics of the hierarchical module names. It really should. I'd very much like to hear other people's opinion on this (especially the Hugs maintainers'). The current behaviour of Hugs makes it impossible for Hat to work with Hugs. Hat creates a shadow hierarchy of transformed libraries: the transformed variant of Prelude is Hat.Prelude, the transformed variant of Control.Arrow is Hat.Control.Arrow etc. Nearly all of the transformed modules import both Prelude and Hat.Prelude ... Olaf -- OLAF CHITIL, Dept. of Computer Science, The University of York, York YO10 5DD, UK. URL: http://www.cs.york.ac.uk/~olaf/ Tel: +44 1904 434756; Fax: +44 1904 432767 From olaf@cs.york.ac.uk Fri Mar 7 17:44:27 2003 From: olaf@cs.york.ac.uk (Olaf Chitil) Date: Fri, 07 Mar 2003 17:44:27 +0000 Subject: Problem with hierarchical libraries in Hugs compared to ghc/nhc98 References: <3E68AE43.E344AC9C@cs.york.ac.uk> <20030307150929.GA19727@soi.city.ac.uk> Message-ID: <3E68DA7B.5DDC5685@cs.york.ac.uk> Ross Paterson wrote: > On Fri, Mar 07, 2003 at 02:35:47PM +0000, Olaf Chitil wrote: > > The simple reason why Hugs behaves so is that when searching a module it > > *always* searches the current directory (* where the import was demanded > > *) first. Only afterwards the paths set with the -P option are searched. > > This is a clear flaw in Hugs (long known, but hard to fix). A workaround > is to add the -X option to stop it adding the extra directory. Thank you very much for pointing me to the -X option which I had not noticed before. Why is it hard to fix if -X actually exists? Why not have -X as default? Is the current default behaviour good for anything? I still suggest putting some semantical description into the hierarchical libraries extension document, so that people like me do not jump to wrong conclusions because of the similarity with directory structures. Olaf -- OLAF CHITIL, Dept. of Computer Science, The University of York, York YO10 5DD, UK. URL: http://www.cs.york.ac.uk/~olaf/ Tel: +44 1904 434756; Fax: +44 1904 432767 From diatchki@cse.ogi.edu Fri Mar 7 21:38:25 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Fri, 07 Mar 2003 13:38:25 -0800 Subject: Problem with hierarchical libraries. In-Reply-To: <3E68AE43.E344AC9C@cs.york.ac.uk> References: <3E68AE43.E344AC9C@cs.york.ac.uk> Message-ID: <3E691151.7010604@cse.ogi.edu> hello, Olaf Chitil wrote: >... > I know that we generally try to avoid specifying filename and directory > issues. > However, this is not really a filename issue, but a problem of relative > and absolute module names (wrt possibly several hierarchies). An "import > B" in module Test.A could mean either module B or module Test.B. > I suggest that the absolute module name takes precedence, because > otherwise there is no way to import module B from module Test.A, whereas > you can always import module Test.B from module Test.A by saying "import > Test.B". why not fix the design to take this into account? one can have two ways to refer to modules - relative and absolute (just like in the file system, which years of experience show works pretty well). import .Test.A -- refers to an absolute path -- (relative to a user specified root) -- i.e. $HS_PATH/Test/A.hs import Test.A -- is a path relative to the location of -- the current module, i.e. -- [location of module]/Test/A.hs in fact it seems that a nice way to implement separate compilation in a concrete implementation could be to have 2 top level paths: $HS_LIBS $HS_PROJ the implementation should look for absoulte files relative to both of those, but it would expect that if something is found in the $HS_LIBS path it will be already compiled and not look for source code. just an idea. i also have another question about the hirarchical modules design -- why does one have to duplicate the path to a particular file inside the file itself? i.e. what is the point of the module name within the file? it seems that all haskell implementations assume that the module name and file name are the same (and this seems perfectly reasonable), and with the hirarchical name space this is even more the case. and for example C programers never specify the name of the current file within the file. why do we want to do it? just wondering iavor -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From thgibbs@deltafarms.com Fri Mar 7 20:45:34 2003 From: thgibbs@deltafarms.com (Tanton Gibbs) Date: Fri, 7 Mar 2003 15:45:34 -0500 Subject: Problem with hierarchical libraries. References: <3E68AE43.E344AC9C@cs.york.ac.uk> <3E691151.7010604@cse.ogi.edu> Message-ID: <007201c2e4ea$81de39a0$6401a8c0@brooklyn> > > I know that we generally try to avoid specifying filename and directory > > issues. > > However, this is not really a filename issue, but a problem of relative > > and absolute module names (wrt possibly several hierarchies). An "import > > B" in module Test.A could mean either module B or module Test.B. > > I suggest that the absolute module name takes precedence, because > > otherwise there is no way to import module B from module Test.A, whereas > > you can always import module Test.B from module Test.A by saying "import > > Test.B". > > why not fix the design to take this into account? one can have two ways > to refer to modules - relative and absolute (just like in the file > system, which years of experience show works pretty well). > > import .Test.A -- refers to an absolute path > -- (relative to a user specified root) > -- i.e. $HS_PATH/Test/A.hs > import Test.A -- is a path relative to the location of > -- the current module, i.e. > -- [location of module]/Test/A.hs An interesting idea, but I have two comments on it. First, I think using a . at the beginning of the module name is not visual enough to be easily seen. Something as important as which module to pick should have something that stands out as absolute or relative. Second, I would prefer it select relative offset modules before checking for absolute modules. I would imagine that the designer of a module would want associated modules inserted more often than those with the same name but not associated with the current module. (Actually, the second comment is not on your post, but on the post you commented on). > i also have another question about the hirarchical modules design -- why > does one have to duplicate the path to a particular file inside the file > itself? i.e. what is the point of the module name within the file? > it seems that all haskell implementations assume that the module name > and file name are the same (and this seems perfectly reasonable), and > with the hirarchical name space this is even more the case. and for > example C programers never specify the name of the current file within > the file. why do we want to do it? Often, in C++ and Java, one has many modules in a file, but only one that is meant to be visible to the outside world. Other modules might be name _ext_X or _private_X or something along those lines. By requiring a module name, you allow the primary module to start anywhere in the file as well as other modules to be defined in the file. Furthermore, you allow files that don't contain modules, something very important for quick prototyping. Thanks! Tanton From diatchki@cse.ogi.edu Sat Mar 8 01:14:21 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Fri, 07 Mar 2003 17:14:21 -0800 Subject: Persistant (as in on disk) data In-Reply-To: References: Message-ID: <3E6943ED.5040902@cse.ogi.edu> hello, thanks for your replies. i browsed thrugh the discussion on the libraries list, but it mainly seems to discuss if one should use bits or bytes in the binary representation. not that this is not important (my personal preference is to be fast rather then small, within reason), but i was more interested in what these functions should do. unfortunately i couldn't quite figure that out from the discussion there. in particular, i was thinking that this dumping facility should preserve sharing and support cyclic data. as such, i don't think one can write it in Haskell, as presumbably sharing is not observable from within the language. this is why the "deriving" bit seems essential - the compiler can perform some magic. bye iavor Simon Peyton-Jones wrote: > | (c) how do we derive instances of Binary? > > If you guys can agree an interface that GHC, nhc and Hugs can all > support, I'll gladly do the 'deriving' stuff to make 'deriving Binary' > work for GHC. What's always inhibited me is that there isn't a single > agreed interface. > > For most users, having a library that works across all Haskell > implementations and platforms is much more important than having the > most efficient possible library. But (the possibility of an) efficient > implementation has to be a goal, just not the only goal. If GHC can't > use it directly for interface files, so be it. > > Simon > -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From hdaume@ISI.EDU Sat Mar 8 01:22:33 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Fri, 7 Mar 2003 17:22:33 -0800 (PST) Subject: Persistant (as in on disk) data In-Reply-To: <3E6943ED.5040902@cse.ogi.edu> Message-ID: I'd not been following this discussion, but now it seems it's gotten to instances of the Binary module. I figured I'd chime in briefly: > thanks for your replies. i browsed thrugh the discussion on the > libraries list, but it mainly seems to discuss if one should use bits or > bytes in the binary representation. not that this is not important (my The bits/bytes argument was largely because the NHC library supported Bits and the GHC library supported Bytes. In order ot have a common library, we wanted to support both. > personal preference is to be fast rather then small, within reason), but > i was more interested in what these functions should do. unfortunately > i couldn't quite figure that out from the discussion there. Basically, write arbitrary data to a file in a binary fashion, or to a memory location (as in BinMem). > in particular, i was thinking that this dumping facility should preserve > sharing and support cyclic data. as such, i don't think one can write I'm not convinced that the binary library should "natively" support cyclic data. I think that if saying: print x would not terminate, then there's no reason that puts bh x should terminate. I like to think of "puts" as a binary version of print. (That is, of course, unless the instance writer for the Binary/Show instances of the type of x is smart enough to not keep writing the same thing over and over again.) I would challenge the interested party to write a Show instance of String which wouldn't loop indefinitely on "repeat 'x'". If the user has some cyclic data structure and they want to be able to write it in binary form, it should be on their shoulders to do it correctly, not on the library's. So essentially, I believe 'deriving Binary' should work identically to 'deriving Show', except using a binary rep instead of a string rep. > it in Haskell, as presumbably sharing is not observable from within the > language. this is why the "deriving" bit seems essential - the compiler > can perform some magic. I assume you mean something like: let x = ...some really large structure... y = [x,x] in puts bh y then the size of what is written is |x+c| not |2x| for some small c? If so, then I don't believe this can be implemented in the language; it would have to be in the compiler. I see this as unlikely of happening because it would mean that all compilers would have to implement this identically and some might not handle sharing the same manner. It might be nice, but again, I see this as something you could do yourself if you really want it (i.e., replace this function with: let x = ... in puts bh 2 >> puts bh x or something like that, when you can -- and obviously you won't always be able to.) - Hal From john@repetae.net Sat Mar 8 10:37:58 2003 From: john@repetae.net (John Meacham) Date: Sat, 8 Mar 2003 02:37:58 -0800 Subject: palm? Message-ID: <20030308103758.GE9682@momenergy.repetae.net> This may be an intractable goal, but is any project out there anywhere close to a working haskell 98(ish) implementation for the Palm Pilot? There would probably have to be some compromises, like 16 bit Ints and perhaps some other restrictions, but i don't think its impossible to get some sort of lazy implementation to work on such a resource starved architecture so has anyone given it a shot? for those that don't know, the palm pilot is based on the 68k processor family similar to what was used in early macintoshs. (and a whole lot of other things..) John -- --------------------------------------------------------------------------- John Meacham - California Institute of Technology, Alum. - john@foo.net --------------------------------------------------------------------------- From heringto@cs.unc.edu Sun Mar 9 03:36:57 2003 From: heringto@cs.unc.edu (Dean Herington) Date: Sat, 8 Mar 2003 22:36:57 -0500 (EST) Subject: data vs. newtype, abstractly Message-ID: If a type that could be defined either by `data` or `newtype` (i.e., a single-constructor type) is exported abstractly (without its constructor), can the user of the type tell how the type was declared? Dean From hdaume@ISI.EDU Sun Mar 9 04:06:10 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Sat, 8 Mar 2003 20:06:10 -0800 (PST) Subject: data vs. newtype, abstractly In-Reply-To: Message-ID: yes. > data D = D Int > newtype N = N Int there is a difference between (N undefined) `seq` () and (D undefined) `seq` () there has been a lot of discussion about this on the mailing list, probably under a title of something like "difference between data and newtype". -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Sat, 8 Mar 2003, Dean Herington wrote: > If a type that could be defined either by `data` or `newtype` (i.e., a > single-constructor type) is exported abstractly (without its constructor), > can the user of the type tell how the type was declared? > > Dean > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From Malcolm.Wallace@cs.york.ac.uk Sun Mar 9 11:39:11 2003 From: Malcolm.Wallace@cs.york.ac.uk (Malcolm Wallace) Date: Sun, 9 Mar 2003 11:39:11 +0000 Subject: ANNOUNCE: nhc98-1.16 Message-ID: <20030309113911.276773d2.Malcolm.Wallace@cs.york.ac.uk> nhc98-1.16 ---------- http://www.haskell.org/nhc98 We announce a new release, 1.16, of the Haskell compiler nhc98, with the following new features and bugfixes of note. * nhc98 once again builds on Windows (Cygwin) with ghc. * nhc98 now works correctly in the presence of gcc-3.x. * A large subset of the 'base' package of hierarchical libraries is now included in the build. * The primitive FFI mechanism has been updated to match the latest official spec, and the full Foreign libraries are also included (in hierarchical form). * The library function List.sortBy now uses a stable O(n log n) mergesort. * Numerous other small fixes, including revisions to the Haskell'98 standard. * The website is now hosted at haskell.org * Our CVS repository is also now hosted at cvs.haskell.org Regards, The nhc98 team at York From koen@cs.chalmers.se Sun Mar 9 11:58:49 2003 From: koen@cs.chalmers.se (Koen Claessen) Date: Sun, 9 Mar 2003 12:58:49 +0100 (MET) Subject: data vs. newtype, abstractly In-Reply-To: Message-ID: Hal Daume III wrote: | there is a difference between | | (N undefined) `seq` () | | and | | (D undefined) `seq` () The question stated "without its constructor". My guess is "no". /K From hdaume@ISI.EDU Sun Mar 9 15:57:00 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Sun, 9 Mar 2003 07:57:00 -0800 (PST) Subject: data vs. newtype, abstractly In-Reply-To: Message-ID: well, yes, but if you export: mkN :: Int -> N mkD :: Int -> D or something like that, then they'll still bea ble to tell the difference, right? -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Sun, 9 Mar 2003, Koen Claessen wrote: > Hal Daume III wrote: > > | there is a difference between > | > | (N undefined) `seq` () > | > | and > | > | (D undefined) `seq` () > > The question stated "without its constructor". My guess is > "no". > > /K > From john@repetae.net Sun Mar 9 17:20:13 2003 From: john@repetae.net (John Meacham) Date: Sun, 9 Mar 2003 09:20:13 -0800 Subject: data vs. newtype, abstractly In-Reply-To: References: Message-ID: <20030309172013.GF9682@momenergy.repetae.net> my guess is no too. An informal argument to that: imagine the datatype is abstract and no functions which act on it are exported .call it 'Type'. since there are no non-bottom values of this type that are exported, the only way to create them is with bottom as in: (undefined :: Type) (or an equivalant) which is equivalant for a newtype (N undefined :: Type) and for a data (undefined :: Type) note that there is no way to create the (D undefined) which is what lets you observe the difference. therefore you cannot tell the difference... Just my line of thought which led to saying 'no', interpret it as you will. John On Sun, Mar 09, 2003 at 12:58:49PM +0100, Koen Claessen wrote: > Hal Daume III wrote: > > | there is a difference between > | > | (N undefined) `seq` () > | > | and > | > | (D undefined) `seq` () > > The question stated "without its constructor". My guess is > "no". > > /K > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > -- --------------------------------------------------------------------------- John Meacham - California Institute of Technology, Alum. - john@foo.net --------------------------------------------------------------------------- From b.i.mills@massey.ac.nz Sun Mar 9 20:03:35 2003 From: b.i.mills@massey.ac.nz (b.i.mills@massey.ac.nz) Date: Mon, 10 Mar 2003 09:03:35 +1300 Subject: broken "Research Letters" link Message-ID: <200303092003.h29K3Z732187@it012687.massey.ac.nz> >> ``Algebraic Conversions'', A mathematical paper introducing >> a generalisation of homomorphism of universal algebras. >> In Research Letters in the Information and Mathematical >> Sciences Vol 2, May 2001. (pub by Massey University New Zealand). >> see also, \verb|http://www.massey.ac.nz/~wwiims/rlims| >This web link is broken. My apologies ... http://iims.massey.ac.nz/research/letters/volume2number1/02mills.pdf will get you there. I tested it just now, it works fine. Regards, Bruce. From heringto@cs.unc.edu Sun Mar 9 23:10:47 2003 From: heringto@cs.unc.edu (Dean Herington) Date: Sun, 9 Mar 2003 18:10:47 -0500 (EST) Subject: data vs. newtype, abstractly In-Reply-To: Message-ID: On Sun, 9 Mar 2003, Hal Daume III wrote: > well, yes, but if you export: > > mkN :: Int -> N > mkD :: Int -> D > > or something like that, then they'll still bea ble to tell the difference, > right? Well, yes, but I don't. In fact the type in question is an MVar which my abstraction ensures is always defined. My question came up in the context of describing such an abstract type for users of the type. Like many others, I like to include actual Haskell code where appropriate in the documentation. It didn't seem right to commit there to either `data` or `newtype`. Perhaps I'll use: type Foo a -- abstract Does that disturb anyone? Any other ideas? Dean From asloane@ics.mq.edu.au Sun Mar 9 23:27:10 2003 From: asloane@ics.mq.edu.au (Tony Sloane) Date: Mon, 10 Mar 2003 10:27:10 +1100 Subject: palm? In-Reply-To: <20030308103758.GE9682@momenergy.repetae.net> Message-ID: John Meacham wrote: > This may be an intractable goal, but is any project out there anywhere > close to a working haskell 98(ish) implementation for the Palm Pilot? > > There would probably have to be some compromises, like 16 bit Ints and > perhaps some other restrictions, but i don't think its impossible to get > some sort of lazy implementation to work on such a resource starved > architecture so has anyone given it a shot? Here at Macquarie University we have done some work on this. Matthew Tarnawsky ported the nhc98 runtime to the Palm as part of his 2002 honours project working with myself and Dom Verity. With this port it's possible to compile programs on a desktop machine and load the bytecode onto a Palm for execution. There is a limited interface to the Palm GUI libraries. Having said that, there is much to be done. The current implementation has only been lightly tested and there are a number of design decisions that we want to revisit, particularly relating to how garbage collection works. We are starting to port the work to a recent version of nhc98 and are looking at some of these questions. We hope to have something for others to play with in a few months. Stay tuned to this list for an announcement. Cheers, Tony Sloane -- Senior Lecturer Dept of Computing, Macquarie University Sydney, Australia From Tom.Pledger@peace.com Sun Mar 9 23:59:28 2003 From: Tom.Pledger@peace.com (Tom Pledger) Date: Mon, 10 Mar 2003 12:59:28 +1300 Subject: data vs. newtype, abstractly In-Reply-To: References: Message-ID: <15979.54624.431865.334891@tux-17.corp.peace.com> Dean Herington writes: : | My question came up in the context of describing such an abstract type for | users of the type. Like many others, I like to include actual Haskell | code where appropriate in the documentation. It didn't seem right to | commit there to either `data` or `newtype`. Perhaps I'll use: | | type Foo a -- abstract | | Does that disturb anyone? Any other ideas? That's pretty close to Haddock's approach. For example, see newtype N4 in http://www.haskell.org/haddock/Test.hs : "An abstract newtype - we show this one as data rather than newtype because the difference isn't visible to the programmer for an abstract type." From diatchki@cse.ogi.edu Mon Mar 10 01:14:21 2003 From: diatchki@cse.ogi.edu (diatchki@cse.ogi.edu) Date: Sun, 9 Mar 2003 17:14:21 -0800 (PST) Subject: Persistant (as in on disk) data In-Reply-To: References: <3E6943ED.5040902@cse.ogi.edu> Message-ID: <53806.128.193.4.98.1047258861.squirrel@webmail.cse.ogi.edu> hello, > I'm not convinced that the binary library should "natively" support > cyclic data. I think that if saying: > > print x > > would not terminate, then there's no reason that > > puts bh x > > should terminate. I like to think of "puts" as a binary version of > print. (That is, of course, unless the instance writer for the > Binary/Show instances of the type of x is smart enough to not keep > writing the same thing over and over again.) I would challenge the > interested party to write a Show instance of String which wouldn't loop > indefinitely on "repeat 'x'". well, it is your choice to think of it as you like, but this is not what my original mail was about. i think the ability to make data persistant is a useful one and it should be as transperant to the programmer as possible. when i write something like: ones = 1 : ones i don't think of "printing infinately many ones in memory" and i don't see why i should start thinking of it that way just because i want to make the object persistant. after all, one can think of the disk as a verys low memory. > If the user has some cyclic data structure and they want to be able to > write it in binary form, it should be on their shoulders to do it > correctly, not on the library's. why is that? i thought the whole point of having nice tools is that you don't need to write mindless stuff and concentrate on the important bits of your program. i don't have to worry much about sharing and cyclic data when i program in Haskell (i.e. it just happens), why should i suddenly start to worry about that if i want to make something persistant across executions of my program. > So essentially, I believe 'deriving Binary' should work identically to > 'deriving Show', except using a binary rep instead of a string rep. something like that could be useful, but with drift and the atrem library one can already do some of that. and the aterm library is a reasonably portable way to represent terms. this is definately not what i had in mind in my original post. >> it in Haskell, as presumbably sharing is not observable from within >> the language. this is why the "deriving" bit seems essential - the >> compiler can perform some magic. > > I assume you mean something like: > > let x = ...some really large structure... > y = [x,x] > in puts bh y > > then the size of what is written is |x+c| not |2x| for some small c? If > so, then I don't believe this can be implemented in the language; it > would have to be in the compiler. this is what i meant by compiler magic. > I see this as unlikely of happening > because it would mean that all compilers would have to implement this > identically and some might not handle sharing the same manner. different implementations do not need to implement sharing in the same way. they need to understand a common format. i am not saying designing such a format is easy, in fact things like: nats = 0 : map (+1) nats seem tricky as they involve functions. but persitance is useful. in fact as a beginning i was hoping for something that works in say GHC, and won't be too hard to implement. actually i thought it might already exist, but i guess not. bye iavor From m.p.donadio@ieee.org Mon Mar 10 03:13:35 2003 From: m.p.donadio@ieee.org (Matthew Donadio) Date: Sun, 09 Mar 2003 22:13:35 -0500 Subject: FFI Tutorial / Examples Message-ID: <3E6C02DF.949CD381@ieee.org> Hi all, I may be being a bit dense about this, but I am having some trouble understanding how to use FFI, especially with respect to interfacing Haskell lists/arrays to C arrays. For example, say I have the C functions void foo (double *input, double *output, int N); double bar (double *input, int N); and I want to create an FFI interface and have the resulting type signatures be > foo :: Array Int Double -> Array Int Double > bar :: Array Int Double -> Double where the bounds of the arrays are (0,N-1), and both foo and bar are pure. I read through the FFI docs, but I am still confused about how to do this. Can anyone point me to an FFI tutorial, or some examples? I have a feeling that once I see some examples using lists and arrays that things will fall into place. Thanks. -- Matthew Donadio (m.p.donadio@ieee.org) From mparker@texasycl.org Sun Mar 9 22:08:50 2003 From: mparker@texasycl.org (M. Parker) Date: Sun, 9 Mar 2003 22:08:50 +0000 Subject: palm? In-Reply-To: References: Message-ID: <200303092208.50312.mparker@texasycl.org> What about a port to Windows CE (i.e., for Pocket PC's). Or even better y= et,=20 hugs for Pocket PC! -Matt On Sunday 09 March 2003 11:27 pm, Tony Sloane wrote: > John Meacham wrote: > > This may be an intractable goal, but is any project out there > > anywhere > > > close to a working haskell 98(ish) implementation for the Palm > > Pilot? > > > There would probably have to be some compromises, like 16 bit Ints > > and > > > perhaps some other restrictions, but i don't think its impossible to > > get > > > some sort of lazy implementation to work on such a resource starved > > architecture so has anyone given it a shot? > > Here at Macquarie University we have done some work on this. Matthew > Tarnawsky ported the nhc98 runtime to the Palm as part of his 2002 > honours project working with myself and Dom Verity. With this port > it's possible to compile programs on a desktop machine and load the > bytecode onto a Palm for execution. There is a limited interface to > the Palm GUI libraries. > > Having said that, there is much to be done. The current > implementation has only been lightly tested and there are a number of > design decisions that we want to revisit, particularly relating to how > garbage collection works. We are starting to port the work to a > recent version of nhc98 and are looking at some of these questions. > > We hope to have something for others to play with in a few months. > Stay tuned to this list for an announcement. > > Cheers, > Tony Sloane From haskellmail@yahoo.com.sg Mon Mar 10 04:35:58 2003 From: haskellmail@yahoo.com.sg (Kenny Lu Zhuo Ming) Date: Mon, 10 Mar 2003 12:35:58 +0800 Subject: Fw: palm? Message-ID: <004501c2e6be$912aa120$22528489@comp.nus.edu.sg> ----- Original Message ----- From: "Tony Sloane" To: "Kenny Lu Zhuo Ming" Sent: Monday, March 10, 2003 11:13 AM Subject: RE: palm? > Hi Kenny, > > > How about PocketPC? any porting is done on that? > > No, we have not done any work on Haskell on the PocketPC platform. > > Tony __________________________________________________ Do You Yahoo!? Promote your business from just $5 a month! http://sg.biztools.yahoo.com From daanleijen@xs4all.nl Mon Mar 10 08:11:31 2003 From: daanleijen@xs4all.nl (Daan Leijen) Date: Mon, 10 Mar 2003 09:11:31 +0100 Subject: FFI Tutorial / Examples In-Reply-To: <3E6C02DF.949CD381@ieee.org> References: <3E6C02DF.949CD381@ieee.org> Message-ID: On Sun, 09 Mar 2003 22:13:35 -0500, Matthew Donadio wrote: > I may be being a bit dense about this, but I am having some trouble > understanding how to use FFI, especially with respect to interfacing > Haskell lists/arrays to C arrays. > > For example, say I have the C functions > > void foo (double *input, double *output, int N); Hi Donadio, I do this from the top of my head, but it should get you started. The easiest way to marshal this is to use lists: foo :: [Double] -> [Double] foo xs = unsafePerformIO (fooIO xs) fooIO :: [Double] -> IO [Double] fooIO [] = return [] -- I guess a null array is not supported in foo? fooIO xs = withArray xs $ \cxs -> -- array of the list (auto deallocated) allocaArray n $ \cys -> -- fresh array of size n (auto deallocated) do fooC cxs cys n -- call "foo" in C land peekArray n cys -- unmarshal the values in cys back to a list of doubles where n = length xs foreign import ccall "foo" fooC :: Ptr Double -> Ptr Double -> Int -> IO () If you really want to use Array's, you can convert the lists to arrays in "foo". Note though that it almost never pays to use Array's in Haskell unless you really need random access (which is rarely needed in practice). Hope this helps, -- Daan. btw. If you have the header file of the "foo", you should include it. Say: foreign import ccall "Foo.h foo" fooC :: Ptr Double -> Ptr Double -> Int -> IO () and use on top of the Haskell file: {-# OPTIONS -fvia-C -#include Foo.h #-} This will check your foreign import signature against the C declaration. (of course, we should update H/Direct to GHC 5.04 and let it work better with C header files, and none of this would be needed -- but life is never perfect :-) From lisper@it.kth.se Mon Mar 10 08:59:49 2003 From: lisper@it.kth.se (Bjorn Lisper) Date: Mon, 10 Mar 2003 09:59:49 +0100 (MET) Subject: palm? In-Reply-To: <200303092208.50312.mparker@texasycl.org> References: <200303092208.50312.mparker@texasycl.org> Message-ID: <200303100859.JAA07526@ripper.it.kth.se> M. Parker: >What about a port to Windows CE (i.e., for Pocket PC's). Or even better yet, >hugs for Pocket PC! > >-Matt There is an interesting research question in here: how to design "lean" implementations of lazy functional languages so they can run on small handheld and embedded systems with restricted resources. In particular the restricted memory available poses an interesting challenge. What I would like to see is an implementation that is designed to be easy to port among different handheld/embedded systems, since there are quite a few of them (in particular there are many embedded processors). Probably a bytecode implementation is good since byte code is compact. Nhc might provide a good starting point since it uses bytecode and was designed to be resource lean in the first place. I think the people at York even did some experiments putting it on some embedded system some years ago. Compilation of standalone programs is also interesting since especially embedded programs often execute in fixed environments. Lots of room for program specialization and subsequent code optimizations here. But I think the programming model also must be developed. One will need to give the programmer more control over resources when necessary. This requires operational semantics with good cost models, notoriously difficult with lazy languages. So one will have to continue the work to integrate eager and stateful execution into the lazy model. Furthermore, the i/o model must be developed to accomodate the event-driven style typical for both embedded and interactive systems. I think the functional reactive stuff from Yale (Fran/FRP) provides a really nice high-level notation but it is hard to make guarantees about limited resource consumption in that model. There are models with resource guarantees (E-FRP) but they seem to limited to be really useful in practice. One would like to cover the spectrum in-between. Now, if one would succeed in doing all this, then there would be support for an embedded software development model where one could first write highly declarative executable specifications, test them for logical bugs, and then sucessively refine the code towards a resource-lean implementation using more and more resource-aware primitives where necessary. I think this would be a really interesting alternative to the current imperative practice (head on with C or assembler) and the object-oriented trend with UML/java/C++. Björn Lisper From karczma@info.unicaen.fr Mon Mar 10 09:11:52 2003 From: karczma@info.unicaen.fr (Jerzy Karczmarczuk) Date: Mon, 10 Mar 2003 10:11:52 +0100 Subject: palm? References: <200303092208.50312.mparker@texasycl.org> <200303100859.JAA07526@ripper.it.kth.se> Message-ID: <3E6C56D8.5050205@info.unicaen.fr> Bjorn Lisper wrote: > There is an interesting research question in here: how to design "lean" > implementations of lazy functional languages so they can run on small > handheld and embedded systems with restricted resources. In particular the > restricted memory available poses an interesting challenge. What I would > like to see is an implementation that is designed to be easy to port among > different handheld/embedded systems, since there are quite a few of them (in > particular there are many embedded processors). Probably a bytecode > implementation is good since byte code is compact. Nhc might provide a good > starting point since it uses bytecode and was designed to be resource lean > in the first place. I think the people at York even did some experiments > putting it on some embedded system some years ago. Just a side remark. I wonder whether the byte-code approach is the best possible solution taking into account the overload of the decoder. Why not threaded code? The FORTH (and similar) experience, PostScript implementations, etc. show that this paradigm may be more interesting. Anyway, when you read for the first time the Talmud, ehmmm....., I mean the description of the STG machine by Simon PJ and others, you see that some of their ideas are not very far from code threading. The classical FORTH style, with the separation between tha data and return stacks seems quite appropriate for easy implementations of higher-order control structures. If you saw the bells and whistles inside a FORTH processor implemented on 8bit machines, you would agree with me. But I do not exclude the possibility that all this has been already discussed and rejected for some serious reasons... Jerzy Karczmarczuk From pk@cs.tut.fi Mon Mar 10 09:47:56 2003 From: pk@cs.tut.fi (=?ISO-8859-1?Q?Pertti_Kellom=E4ki?=) Date: Mon, 10 Mar 2003 11:47:56 +0200 Subject: palm? References: <200303092208.50312.mparker@texasycl.org> <200303100859.JAA07526@ripper.it.kth.se> Message-ID: <3E6C5F4C.6030100@cs.tut.fi> Bjorn Lisper wrote: > There is an interesting research question in here: how to design "lean" > implementations of lazy functional languages so they can run on small > handheld and embedded systems with restricted resources. [...] > Furthermore, the i/o model > must be developed to accomodate the event-driven style typical for both > embedded and interactive systems. What would be extermely nice for embedded systems work is a functional language with very lightweight threading (as in concurrency, not as in threaded code) and easy inter-thread communication. One could then assign e.g. a thread per an I/O pin in a microcontroller and write programs in a style that matches the problem domain. I have toyed around with a design for a sort of pico-Erlang to accomplish this, but it is just vaporware at the moment. I have looked at some work on embedded functional programming, but it seems to be concentrated on resource constrained decices but still rather high-end systems, rather than the extremely resource impoverished 8-bit controller world I am interested in. -- pertti From lisper@it.kth.se Mon Mar 10 09:46:51 2003 From: lisper@it.kth.se (Bjorn Lisper) Date: Mon, 10 Mar 2003 10:46:51 +0100 (MET) Subject: palm? In-Reply-To: <3E6C56D8.5050205@info.unicaen.fr> (message from Jerzy Karczmarczuk on Mon, 10 Mar 2003 10:11:52 +0100) References: <200303092208.50312.mparker@texasycl.org> <200303100859.JAA07526@ripper.it.kth.se> <3E6C56D8.5050205@info.unicaen.fr> Message-ID: <200303100946.KAA07649@ripper.it.kth.se> >Just a side remark. >I wonder whether the byte-code approach is the best possible solution >taking into account the overload of the decoder. Why not threaded code? >The FORTH (and similar) experience, PostScript implementations, etc. >show that this paradigm may be more interesting. Anyway, when you read >for the first time the Talmud, ehmmm....., I mean the description of >the STG machine by Simon PJ and others, you see that some of their >ideas are not very far from code threading. > >The classical FORTH style, with the separation between tha data and >return stacks seems quite appropriate for easy implementations of >higher-order control structures. If you saw the bells and whistles >inside a FORTH processor implemented on 8bit machines, you would >agree with me. > >But I do not exclude the possibility that all this has been already >discussed and rejected for some serious reasons... > > >Jerzy Karczmarczuk Good remark, I just didn't think of the threaded approach. There is a reason Forth was popular on early desktop systems. I'd like to hear some arguments regarding the pros and cons of the threaded vs bytecode approaches! Björn From kff@it.kth.se Mon Mar 10 12:21:39 2003 From: kff@it.kth.se (Karl-Filip Faxen) Date: Mon, 10 Mar 2003 13:21:39 +0100 Subject: palm? In-Reply-To: Your message of Mon, 10 Mar 2003 10:46:51 +0100. <200303100946.KAA07649@ripper.it.kth.se> Message-ID: <200303101221.h2ACLdY18083@mail2.it.kth.se> Wait a minute! As far as I have understood, "threaded" refers (in this context) to a = style of writing (byte code) interpreters. A threaded interpreter does not have a dispatch loop which reads the next byte code and then = invokes the correct handler (typically by using the byte code as an index= into a table of handler addresses). Instead, the dispatch code (fetch byte code, select handler) is integrated into each handler, eliminating the return branch from the handler to the dispatch loop and allowing = the overlap of the dispatch code with the handler code for much = improved instruction scheduling. Just my 2 =F6re. /kff From Jeremy.Gibbons@comlab.ox.ac.uk Mon Mar 10 15:02:55 2003 From: Jeremy.Gibbons@comlab.ox.ac.uk (Jeremy Gibbons) Date: Mon, 10 Mar 2003 15:02:55 GMT Subject: Postdoc & PhD positions in Datatype-Generic programming Message-ID: <200303101502.h2AF2ts9023484@mercury.comlab.ox.ac.uk> [We apologize if you receive multiple copies of this announcement.] Postdoctoral research fellow (University of Nottingham) Doctoral studentship (University of Oxford) in DATATYPE-GENERIC PROGRAMMING The Universities of Nottingham and Oxford have positions available to work on an EPSRC-supported project entitled "Datatype-Generic Programming", running for three years and starting on or shortly after 1st August 2003. There is a postdoctoral research fellowship at Nottingham, and a DPhil studentship at Oxford. The project is to develop a novel mechanism for parametrizing programs, namely parametrization by a datatype or type constructor. The mechanism is related to parametric polymorphism, but of higher order. We aim to develop a calculus for constructing datatype-generic programs, with the ultimate goal of improving the state of the art in generic object-oriented programming, as occurs for example in the C++ Standard Template Library. Further details of the project can be obtained from the contacts listed below. Applicants for the postdoctoral fellowship should have completed (or be about to complete) a PhD degree. Preference will be given to applicants with an excellent knowledge of the calculational style of reasoning. Expertise in functional programming, object-oriented programming and the mathematics of program construction is required. Send a detailed curriculum vitae and the names and addresses of two referees to Professor Roland Backhouse, School of Computer Science and Information Technology, University of Nottingham, Jubilee Campus, Wollaton Road, Nottingham NG8 1BB, UK, rcb@cs.nott.ac.uk, www.cs.nott.ac.uk/~rcb, from whom further details can also be obtained. Electronic applications should be sent in PDF format; other formats will not be accepted. The ideal applicant for the DPhil studentship would have (or be about to obtain) a first- or upper-second class honours degree or equivalent in computer science, with expertise in functional programming, object-oriented programming and the mathematics of program construction. The studentship pays for all university and college fees, in addition to the standard EPSRC maintenance grant. Applicants should follow the procedure described at www.comlab.ox.ac.uk/oucl/courses/grad02-03/dphil/requirements.html, but should also mention this position in the application. For further details contact Dr Jeremy Gibbons, Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QD, UK, jeremy.gibbons@comlab.ox.ac.uk, www.comlab.ox.ac.uk/oucl/people/jeremy.gibbons.html. The closing date for applications for both positions is Monday 14th April 2003. Roland Backhouse Jeremy Gibbons -- Jeremy.Gibbons@comlab.ox.ac.uk Oxford University Computing Laboratory, TEL: +44 1865 283508 Wolfson Building, Parks Road, FAX: +44 1865 273839 Oxford OX1 3QD, UK. URL: http://www.comlab.ox.ac.uk/oucl/people/jeremy.gibbons.html From yeogekhu@comp.nus.edu.sg Mon Mar 10 17:17:06 2003 From: yeogekhu@comp.nus.edu.sg (Yeo Gek Hui) Date: Tue, 11 Mar 2003 01:17:06 +0800 (GMT-8) Subject: Help on handles Message-ID: Hi, Has anyone have experience reading from a handle using hGetContents when the handle is still open and receives input from outside? I need to do some manipulation to the contents and I can't afford to close this handle. for example, an infinite stream "abcabc..." is written from outside to this handle and I know that 'c' means the termination and I want to get "abc", "abc" and the rest coming. I have used no-buffering for my handle and have written a function,extractC to extract the string end with the terminating character c. There is one more function, keepRest to keep the remainder of the stream. However, let's say response <- hGetContents handle and the response still has "abcabc...". I know in imperative language, response can be reassigned globally. How can I do that in Haskell? This is because I want to avoid duplications and ensure the program terminates. Thanks a lot. Cheers, Gek ,-.___,-. \> , , -._.-<- / / \ \ ,' ( ) `. (_,' )--._.--( `._) ,-' / \ `-. (,-. ,' `.,-. ) From wangmeng@comp.nus.edu.sg Mon Mar 10 17:25:52 2003 From: wangmeng@comp.nus.edu.sg (Wang Meng) Date: Tue, 11 Mar 2003 01:25:52 +0800 (GMT-8) Subject: polymorphic type in state of state monad In-Reply-To: <200303101221.h2ACLdY18083@mail2.it.kth.se> Message-ID: Hi All, Any one of your have the experience of defining a state of a state monad as a polymorphic type? I want to have: > type State = Term a => [a] > data M a = M (State -> IO(State,a)) GHC yields a error message "Illegal polymorphic type". How to resolve this? Thank you very much. -W-M- @ @ | \_/ From Tom.Pledger@peace.com Mon Mar 10 19:34:06 2003 From: Tom.Pledger@peace.com (Tom Pledger) Date: Tue, 11 Mar 2003 08:34:06 +1300 Subject: polymorphic type in state of state monad In-Reply-To: References: <200303101221.h2ACLdY18083@mail2.it.kth.se> Message-ID: <15980.59566.146234.138627@tux-17.corp.peace.com> Wang Meng writes: | Hi All, | | Any one of your have the experience of defining a state of a state monad | as a polymorphic type? | I want to have: | | > type State = Term a => [a] | > data M a = M (State -> IO(State,a)) | | GHC yields a error message "Illegal polymorphic type". | How to resolve this? If you only want to vary the state type between separate monadic computations, all you need to do is parameterise your datatype over the state type: > data M s a = M (s -> IO (s, a)) This is available in some libraries, such as http://www.haskell.org/ghc/docs/latest/html/base/Control.Monad.State.html You could use it like this: > import Control.Monad.State > type M s = StateT s IO If, on the other hand, you want to vary the state type *during* a single monadic computation, it gets messy. You could try one of the following. - Declare a datatype with a branch for each instance of Term, and use this as the state type. > data State = TermType1 TermType1 > | TermType2 TermType2 > | ... > | TermTypeN TermTypeN - Do something similar with an existential type. > data State = forall a . Term a => State a - Don't use monadic state at all, but instead pass the state around explicitly. Regards, Tom From ajb@spamcop.net Mon Mar 10 23:05:27 2003 From: ajb@spamcop.net (Andrew J Bromage) Date: Tue, 11 Mar 2003 10:05:27 +1100 Subject: polymorphic type in state of state monad In-Reply-To: <15980.59566.146234.138627@tux-17.corp.peace.com> References: <200303101221.h2ACLdY18083@mail2.it.kth.se> <15980.59566.146234.138627@tux-17.corp.peace.com> Message-ID: <20030310230527.GA20866@smtp.alicorna.com> G'day all. On Tue, Mar 11, 2003 at 08:34:06AM +1300, Tom Pledger wrote: > If, on the other hand, you want to vary the state type *during* a > single monadic computation, it gets messy. You could try one of the > following. Very often, you just want to vary the state type for some portion of the computation then go back to the original. In that case, a simpler solution is to stack a new state monad transformer (such as Control.Monad.State.StateT) on top of your existing state monad for the part where you need it. Cheers, Andrew Bromage From nilsson@cs.yale.edu Mon Mar 10 23:11:27 2003 From: nilsson@cs.yale.edu (nilsson@cs.yale.edu) Date: Mon, 10 Mar 2003 18:11:27 -0500 Subject: AADBUG 2003: Reminder Message-ID: <3E6D1B9F.68B170C8@cs.yale.edu> This is a multi-part message in MIME format. --------------8C4AAC88FBC57CEB8372AC3C Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Dear All, The deadline for submisson to AADEBUG'2003, the Fifth International Workshop on Automated and Algorithmic Debugging, is approaching. Papers and demos should be received by 22 March, 2003. Please find the CFP enclosed. See http://aadebug2003.elis.rug.ac.be/ for further details. Best regards, /Henrik -- Henrik Nilsson Yale University Department of Computer Science nilsson@cs.yale.edu --------------8C4AAC88FBC57CEB8372AC3C Content-Type: text/plain; charset=iso-8859-1; name="cfp2003.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="cfp2003.txt" AADEBUG'2003 Fifth Int. Workshop on Automated and Algorithmic Debugging Ghent, Belgium, September 8-10, 2003 Call for papers and demos Over the past decades automated debugging has seen major achieve- ments. However, as debugging is by necessity attached to particu- lar programming paradigms, the results are scattered. The aims of the workshop are to gather common themes and solutions across programming communities, and to cross-fertilize ideas. We seek papers describing original research as well as reports on practi- cal experience. We also welcome demonstrations of tools and re- search prototypes. Typical topics of the workshop include (but are not limited to): automated debugging declarative debugging = type debugging knowledge-based debugging algorithmic debugging assertion-based debugging trace analysis software testing program slicing monitoring = performance debugging parallel and distributed debugging debugging by simulation debugging using record/replay for any kind of programming paradigms (sequential, parallel, dis- tributed, real-time, logic programming, functional, object-ori- ented, imperative, visual languages). Accepted papers and demo descriptions will be included in the workshop proceedings, distributed locally on paper and CD, and will also be published on the CoRR (Computing Research Reposito- ry) website. Authors of the best papers will be invited to submit journal versions of their papers to a special issue of the Jour- nal of Automated Software Engineering on automated debugging. Demonstration of tools and research prototypes that implement new ideas in debugging automation will be part of the AADEBUG2003 technical program. Demos will be given in sessions together with technical paper presentations. Both demos and regular papers will receive a 30' time slot. Submission of Papers Contributors should be aware that the prospective audience will not necessarily be familiar with the addressed programming paradigms, which should, therefore, be briefly introduced. Papers should be no longer than 5000 words in length, including a 150 to 200 word abstract. Submit papers by uploading a PDF file to = http://aadebug2003.elis.rug.ac.be/. Concurrently send an e-mail = to aadebug2003@elis.rug.ac.be with the title of the paper, names = of the authors, full address of the correspondent and a 150 to = 200 word abstract of the paper. Submission of Demos Demo descriptions should be no longer than 2000 words including a 150 to 200 word abstract. Submit demos by uploading a PDF file to http://aadebug2003.elis.rug.ac.be/ Concurrently send an e-mail = to aadebug2003@elis.rug.ac.be containing the title of the demo, = names of the authors, full address of the correspondent and a 150 = to 200 word abstract of the paper. Clearly mention the fact that = you submit a demo and not a regular paper in your email. Authors having problems to submit using the web server can send the paper to aadebug2003@elis.rug.ac.be. Conference Information The website for AADEBUG2003 containing this Call for Papers and more info can be found at http://aadebug2003.elis.rug.ac.be/. If = you encounter any kind of problem or need more information mail = to aadebug2003@elis.rug.ac.be. Important Dates Paper and demo submission before March 22, 2003 = Notification of acceptance by May 15, 2003 = Final version of paper before June 30, 2003 (this applies to the local and the CoRR proceedings) Conference Information The website for AADEBUG2003 containing this Call for Papers and more information about the conference can be found at http://aadebug2003.elis.rug.ac.be/. If you encounter any kind of problem or need more information mail aadebug2003@elis.rug.ac.be. General Conference Chair Koen De Bosschere Ghent University, Belgium = Email: kdb@elis.rug.ac.be Program Chair Michiel Ronsse Ghent University, Belgium = Email: ronsse@elis.rug.ac.be Program Committee Members Mikhail Auguston New Mexico State University, USA Koen De Bosschere Ghent University, Belgium Jacques Chassin de Kergommeaux LSR/ENSIMAG, France Jong-Deok Choi IBM T.J. Watson Research Center, USA Mireille Ducass=E9 IRISA/INSA, France Peter Fritzson Link=F6pings Universitet, Sweden Michael Gerndt Tech. Universit=E4t M=FCnchen, Germany Gerda Janssens Katholieke Universiteit Leuven, Belgium Clinton L. Jeffery New Mexico State University, USA Mariam Kamkar Link=F6pings Universitet, Sweden Dieter Kranzlm=FCller Joh. Kepler University Linz, Austria Raimondas Lencevicius Nokia Research Center, Boston Edu Metz Nokia Research Center, Boston Henrik Nilsson Yale University, USA Michiel Ronsse Ghent University, Belgium Gary Sevitsky IBM T.J. Watson Research Center, USA Markus Stumptner University of South Australia, Australia Kazunori Ueda Waseda University, Japan Roland Wism=FCller Technische Univ. M=FCnchen, Germany About Ghent Ghent is one of the oldest cities in Flanders, the Dutch speaking northern part of Belgium. Through the Middle Ages, it was among the most important economic centres of Western Europe and the historic city centre still reminds us of this period through its beautiful medieval towers. There are several trains an hour that connect Ghent to the closest international airport (Brus- sels, 60km). Other closeby airports are Schiphol (The Nether- lands, 200km) and Lille (France, 90km), both having easy train connections to Ghent. --------------8C4AAC88FBC57CEB8372AC3C-- From simonpj@microsoft.com Tue Mar 11 08:20:58 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Tue, 11 Mar 2003 08:20:58 -0000 Subject: polymorphic type in state of state monad Message-ID: | | > type State =3D Term a =3D> [a] | | > data M a =3D M (State -> IO(State,a)) | | | | GHC yields a error message "Illegal polymorphic type". | | How to resolve this? I can tell you what it happening. If you have -fglasgow-exts on, the type for State is short for type State =3D forall a. Term a =3D> [a] And then you can't use that polymorphic type in the argument of a tuple, as you are doing in the next line. =20 Without -fglasgow-exts (i.e. in Haskell 98) the first line is plain illegal: 'a' is not in scope. But GHC may not produce as perspicuous a message as it should for that. Simon From afie@cs.uu.nl Tue Mar 11 10:30:47 2003 From: afie@cs.uu.nl (Arjan van IJzendoorn) Date: Tue, 11 Mar 2003 11:30:47 +0100 Subject: ANNOUNCE: Helium, for Learning Haskell, version 1.1 Message-ID: <00a701c2e7b9$481c1080$ec50d383@sushi> Dear all, We are proud to announce version 1.1 of Helium. It can be found at the Helium website: http://www.cs.uu.nl/~afie/helium/ Version 1.1 has the following improvements: - An installer for Windows systems for an improved out-of- the-box experience. - A cool Java-based graphical interpreter called Hint written by a student at our institute. It has a nice GUI with colours, toolbar buttons and menu's. The best feature is that it integrates with your favourite editor and you can jump to the exact locations of messages by clicking on them! - New warnings and hints for common mistakes: "sin .3", "X = 5" (see below for examples of messages) - Completely new presentation of type errors with more information - Much improved syntax error messages thanks to a new lexer. And thanks to Parsec we can tell not only what was unexpected, but also what would be legal at that position. - The command-line interpreter is now called 'texthint' to avoid conflicts with hmake's 'hi' (sorry!). TextHint is improved in many ways. For one, it now accepts file paths after :l. Other improvements can be found if you type :? - User manuals for the different tools (helium, hint, texthint) and other helpful information on the Helium website - We've compiled Helium with Oxygen (ghc -O2) and this makes the compiler twice as fast. Great work, GHC people! - One well-placed 'seq' makes Helium another 25% faster. - Very many minor bug fixes - The webpage is simpler, wider and easier to navigate thanks to a road map Have fun! the Helium team -- Examples of Helium messages These messages where generated by typing expressions on the texthint prompt. If you compile a file with these errors you will get exact error locations. Prelude> [(1, 3] Unexpected close bracket ']' Hint: Expecting a close bracket for '(' Prelude> sinn .2 Warning: Function composition (.) immediately followed by number Hint: If a Float was meant, write "0.2" Otherwise, insert a space for readability Undefined variable "sinn" Hint: Did you mean "sin" ? Prelude> map [1..10] even Type error in application expression : map [1 .. 10] even term : map type : (a -> b) -> [a] -> [b] does not match : [Int] -> (Int -> Bool) -> c probable fix : re-order arguments Prelude> let X = 5 in X Left hand side pattern defines no variables Undefined constructor "X" Hint: Use identifiers starting with a lower case letter to define a function or a variable Undefined constructor "X" Prelude> 1+chr '0' Type error in variable expression : chr type : Int -> Char expected type : Char -> Int probable fix : use ord instead From tronci@dsi.uniroma1.it Tue Mar 11 11:21:03 2003 From: tronci@dsi.uniroma1.it (Tronci Enrico) Date: Tue, 11 Mar 2003 12:21:03 +0100 Subject: CHARME 2003 Message-ID: <200303111121.MAA08182@poppea.dsi.uniroma1.it> ---------------------------------------------------------------------- We apologize if you receive multiple copies of this announcement. ---------------------------------------------------------------------- *********************************************************************** C A L L F O R P A P E R S *********************************************************************** CHARME 2003 The 12th Advanced Research Working Conference on: Correct Hardware Design and Verification Methods 21-24 October 2003, University of L'Aquila, L'Aquila, Italy http://www.di.univaq.it/charme2003 Co-sponsored by the IFIP TC10/WG10.5 Working Group on Design and Engineering of Electronic Systems CHARME 2003 is the twelfth in a series of working conferences devoted to the development and use of leading-edge formal techniques and tools for the design and verification of hardware and systems. It has been the aim of the conference to expand its interest to software as well when the technology is related. Previous conferences have been held in Darmstadt, Edinburgh, Grenoble, Glasgow, Leuven, Torino, Arles, Frankfurt, Montreal, and Bad Herrenalb, and Edinburgh. It is the biennial counterpart of FMCAD, which takes place every even year in the USA. The aim of CHARME 2003 is to bring together researchers and users from academia and industry working in this active area of research. The conference will cover original research results, case studies, use of technologies across application domains, and reports on practical experiments. Papers describing original work in all aspects of formal hardware and system design and verification methods are invited. Papers related to formal modeling and verification of concurrent software are also welcome. The event will be held 21-24 October 2003 and hosted by University of L'Aquila, Italy. L'Aquila can be easily reached from Rome Airport. Topics of interest include, but are not limited to: * usage of semi-formal methods (combining simulation methods with formal verification) * high level design modeling languages and high level design constructs * formal verification of hybrid systems * timing verification * formal methods for commercial hardware description languages * correctness preserving transformations * formal synthesis methods * use of theorem provers for verification * BDD and FSM based approaches, including model checking and SAT checking * correctness aspects in HW/SW co-design * abstraction and compositional techniques * formal verification of protocols * diagnosis of design errors * coverage directed verification and other semi-formal verification methods * use of formal specification languages in simulation * formal verification of concurrent software * practical and industrial applications of formal techniques The conference proceedings will appear as a volume in Springer-Verlag's Lecture Notes in Computer Science series and will be available at the conference. Papers should not exceed 15 pages, formatted as specified by Springer-Verlag in the Authors Instructions page, and submitted electronically following the procedure given on the submissions page of the conference website, http://www.di.univaq.it/charme2003. Selected contributions may be invited for publication in STTT (International Journal on Software Tools for Technology Transfer, Springer-Verlag). ****************************************************************************** Author's Schedule: * 11 April 2003 - Deadline for paper submission * 6 June 2003 - Notification of acceptance * 11 July 2003 - Deadline for final version ****************************************************************************** Chairs Enrico Tronci (conference chair) (University of Rome, Italy) Daniel Geist (programme chair) (IBM, Israel) ****************************************************************************** Programme Committee Alan Hu (University of British Columbia, Canada) Alan Mycroft (University of Cambridge, UK) Anna Slobodova (Intel, USA) Armin Biere (Swiss Federal Institute of Technology, Switzerland) Byron Cook (Microsoft Corporation, USA) Carl Pixley (Synopsys, USA) Daniel Geist (PC Chair) (IBM, Israel) Dominique Borrione (University of Grenoble, France) Eli Singerman (Intel, Israel) Enrico Tronci (Conference Chair) (University of Rome, Italy) Ganesh Gopalakrishnan (University of Utah, USA) Hans Eveking (T.U. Darmstadt, Germany) John O'Leary (Intel, USA) Ken McMillan (Cadence, USA) Laurence Pierre (University of Marseille, France) Limor Fix (Intel, Israel) Mark Aagaard (University of Waterloo, Canada) Mary Sheeran (Chalmers Univ. and Prover Technology, Sweden) Moshe Vardi (Rice University, USA) Ofer Strichman (Carnegie-Mellon University, USA) Steve Johnson (Indiana University, USA) Thomas Kropf (Bosch, Germany) Tiziana Margaria (Univ. of Dortmund and METAFrame Techn., Germany) Tom Melham (University of Oxford,UK) Warren Hunt (University of Texas at Austin, USA) ****************************************************************************** From simonmar@microsoft.com Tue Mar 11 15:13:29 2003 From: simonmar@microsoft.com (Simon Marlow) Date: Tue, 11 Mar 2003 15:13:29 -0000 Subject: ANNOUNCE: GHC vesrion 5.04.3 released Message-ID: <9584A4A864BD8548932F2F88EB30D1C60909FD27@tvp-msg-01.europe.corp.microsoft.com> ============================================================== The (Interactive) Glasgow Haskell Compiler -- version 5.04.3 ============================================================== We are pleased to announce a new patchlevel release of the Glasgow Haskell Compiler (GHC), version 5.04.3. This is a bugfix-only release. For all the changes since 5.02.3, see the release notes: http://www.haskell.org/ghc/docs/latest/html/users_guide/release-5-04.htm l How to get it ~~~~~~~~~~~~~ The easy way is to go to the WWW page, which should be self-explanatory: http://www.haskell.org/ghc/ We supply binary builds in the native package format for various flavours of Linux and BSD, and in InstallShield form for Windows folks. Binary builds for other platforms are available as a .tar.gz which can be installed wherever you want. The source distribution is also available from the same place. Once you have the distribution, please follow the pointers in the README file to find all of the documentation about this release. Background ~~~~~~~~~~ Haskell is a standard lazy functional programming language; the current language version is Haskell 98, agreed in December 1998. GHC is a state-of-the-art programming suite for Haskell. Included is an optimising compiler generating good code for a variety of platforms, together with an interactive system for convenient, quick development. The distribution includes space and time profiling facilities, a large collection of libraries, and support for various language extensions, including concurrency, exceptions, and foreign language interfaces (C, whatever). GHC is distributed under a BSD-style open source license. A wide variety of Haskell related resources (tutorials, libraries, specifications, documentation, compilers, interpreters, references, contact information, links to research groups) are available from the Haskell home page (see below). On-line GHC-related resources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Relevant URLs on the World-Wide Web: GHC home page http://www.haskell.org/ghc/ Haskell home page http://www.haskell.org/ comp.lang.functional FAQ http://www.cs.nott.ac.uk/~gmh/faq.html System requirements ~~~~~~~~~~~~~~~~~~~ To compile programs with GHC, you need a machine with 64+MB memory, GCC and perl. This release is known to work on the following platforms: * i386-unknown-{linux,*bsd,mingw32} * sparc-sun-solaris2 * alpha-dec-osf3 * powerpc-apple-darwin (MacOS/X) Ports to the following platforms should be relatively easy (for a wunderhacker), but haven't been tested due to lack of time/hardware: * hppa1.1-hp-hpux{9,10} * i386-unknown-solaris2 * mips-sgi-irix{5,6} * {rs6000,powerpc}-ibm-aix The builder's guide on the web site gives a complete run-down of what ports work; it can be found at http://www.haskell.org/ghc/docs/latest/building/building-guide.html Mailing lists ~~~~~~~~~~~~~ We run mailing lists for GHC users and bug reports; to subscribe, use the web interfaces at http://www.haskell.org/mailman/listinfo/glasgow-haskell-users http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs There are several other haskell and ghc-related mailing lists on www.haskell.org; for the full list, see http://www.haskell.org/mailman/listinfo/ Please report bugs using our SourceForge page at http://sourceforge.net/projects/ghc/ or send them to glasgow-haskell-bugs@haskell.org. GHC users hang out on glasgow-haskell-users@haskell.org. Bleeding edge CVS users party on cvs-ghc@haskell.org. From nr@eecs.harvard.edu Tue Mar 11 18:02:30 2003 From: nr@eecs.harvard.edu (Norman Ramsey) Date: Tue, 11 Mar 2003 13:02:30 -0500 (EST) Subject: clueless GHCI user wishes to load QuickCheck Message-ID: <20030311180230.B08023FDD@labrador.eecs.harvard.edu> Can anyone help me figure out how to load QuickCheck into GHCI? QuickCheck is included in my Debian package, but my attempts at loading it are bootless: Prelude> :load QuickCheck can't find module `QuickCheck' Prelude> :load util/QuickCheck can't find module `util/QuickCheck' Prelude> :info syntax: `:i ' Prelude> :load util/QuickCheck.hi can't find module `util/QuickCheck.hi' Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi' Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck' Prelude> Any advice, anyone? Norman From shae@webwitches.com Tue Mar 11 18:12:34 2003 From: shae@webwitches.com (shae@webwitches.com) Date: Tue, 11 Mar 2003 19:12:34 +0100 Subject: clueless GHCI user wishes to load QuickCheck In-Reply-To: <20030311180230.B08023FDD@labrador.eecs.harvard.edu> (nr@eecs.harvard.edu's message of "Tue, 11 Mar 2003 13:02:30 -0500 (EST)") Message-ID: <87y93l7ox9.fsf@thunderbird.webwitches.com> --=-=-= nr@eecs.harvard.edu (Norman Ramsey) writes: > Can anyone help me figure out how to load QuickCheck into GHCI? > QuickCheck is included in my Debian package, but my attempts > at loading it are bootless: > > Prelude> :load QuickCheck > Any advice, anyone? You need to load a source file that imports QuickCheck. With the attached file and ghci, Prelude> :l /path/to/ProtoQuickCheck.hs then: *ProtoQuickCheck> quickCheck prop_RevUnit The first QuickCheck paper is an excellent guide to using QuickCheck. --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=ProtoQuickCheck.hs Content-Transfer-Encoding: base64 Content-Description: some transcribed code from the original QuickCheck paper bW9kdWxlIFByb3RvUXVpY2tDaGVjayB3aGVyZQppbXBvcnQgUXVpY2tDaGVjawppbXBvcnQg TGlzdAoKLS0gCSRJZDogUHJvdG9RdWlja0NoZWNrLmhzLHYgMS4yIDIwMDMvMDMvMTEgMTg6 MDk6MTQgc2hhZSBFeHAgJAkKCnByb3BfUmV2VW5pdCA6OiBbSW50XSAtPiBCb29sCnByb3Bf UmV2VW5pdCB4ID0gCiAgICByZXZlcnNlIFt4XSA9PSBbeF0KCnByb3BfUmV2QXBwIDo6IFtJ bnRdIC0+IFtJbnRdIC0+IEJvb2wKcHJvcF9SZXZBcHAgeHMgeXMgPSAKICAgIHJldmVyc2Ug KHhzICsrIHlzKSA9PSByZXZlcnNlIHlzICsrIHJldmVyc2UgeHMKCnByb3BfUmV2UmV2IDo6 IFtJbnRdIC0+IEJvb2wKcHJvcF9SZXZSZXYgeHMgPSAKICAgIHJldmVyc2UgKHJldmVyc2Ug eHMpID09IHhzCgooZiA9PT0gZykgeCA9IGYgeCA9PSBnIHgKCnByb3BfQ29tcEFzc29jICAg ICAgIDo6IChJbnQgLT4gSW50KSAtPiAoSW50IC0+IEludCkgIC0+IChJbnQgLT4gSW50KSAt PiBJbnQgLT4gQm9vbApwcm9wX0NvbXBBc3NvYyBmIGcgaCA9IChmIC4gKGcgLiBoKSkgPT09 ICgoZiAuIGcpIC4gaCkKCnByb3BfQ29tcENvbW11dCAgICAgICA6OiAoSW50IC0+IEludCkg LT4gKEludCAtPiBJbnQpIC0+IEludCAtPiBCb29sCnByb3BfQ29tcENvbW11dCBmIGcgPSAo ZiAuIGcpID09PSAoZyAuIGYpCgppbnN0YW5jZSBTaG93IChhIC0+IGIpIHdoZXJlIHNob3cg XyA9ICI8PGZ1bmN0aW9uPj4iCgpwcm9wX01heExlICAgICA6OiBJbnQgLT4gSW50IC0+IFBy b3BlcnR5CnByb3BfTWF4TGUgeCB5ID0geCA8PSB5ID09PiBtYXggeCB5ID09IHkKCgpwcm9w X0luc2VydCAgICAgIDo6IEludCAtPiBbSW50XSAtPiBQcm9wZXJ0eQpwcm9wX0luc2VydCB4 IHhzID0KICAgIG9yZGVyZWQgeHMgPT0+IG9yZGVyZWQgKGluc2VydCB4IHhzKQoKcHJvcF9J bnNlcnQyICAgICAgOjogSW50IC0+IFtJbnRdIC0+IFByb3BlcnR5CnByb3BfSW5zZXJ0MiB4 IHhzID0KICAgIG9yZGVyZWQgeHMgPT0+IGNsYXNzaWZ5IChudWxsIHhzKSAidHJpdmlhbCIg JCBvcmRlcmVkIChpbnNlcnQgeCB4cykKCnByb3BfSW5zZXJ0MyAgICAgIDo6IEludCAtPiBb SW50XSAtPiBQcm9wZXJ0eQpwcm9wX0luc2VydDMgeCB4cyA9CiAgICBvcmRlcmVkIHhzID09 PiBjb2xsZWN0IChsZW5ndGggeHMpICQgb3JkZXJlZCAoaW5zZXJ0IHggeHMpCgpwcm9wX0Rv dWJsZUN5Y2xlICAgIDo6IFtJbnRdIC0+IFByb3BlcnR5CnByb3BfRG91YmxlQ3ljbGUgeHMg PQogICAgbm90IChudWxsIHhzKSA9PT4gCiAgICAgICAgY3ljbGUgeHMgPT0gY3ljbGUgKHhz ICsrIHhzKQoKcHJvcF9Eb3VibGVDeWNsZTIgICAgICA6OiBbSW50XSAtPiBJbnQgLT4gUHJv cGVydHkKcHJvcF9Eb3VibGVDeWNsZTIgeHMgbiA9IAogICAgbm90IChudWxsIHhzKSAmJiBu ID49IDAgPT0+IAogICAgICAgIHRha2UgbiAoY3ljbGUgeHMpID09IHRha2UgbiAoY3ljbGUg KHhzICsrIHhzKSkKCi0tIGNvdXJ0ZXN5IEhlZmZhbHVtcApvcmRlcmVkIFtdICAgICAgID0g IFRydWUKb3JkZXJlZCBbeF0gICAgICA9ICBUcnVlCm9yZGVyZWQgKHg6eTp4cykgPSAgeDw9 eSAmJiBvcmRlcmVkICh5OnhzKQoKLS0gTG9jYWwgVmFyaWFibGVzOgotLSBjb21waWxlLWNv bW1hbmQ6ICIuL3F1aWNrY2hlY2sgK25hbWVzIFByb3RvUXVpY2tDaGVjay5ocyIKLS0gRW5k OgoKbWFpbiA9IHB1dFN0ciAieW8i --=-=-= -- Shae Matijs Erisson - 2 days older than RFC0226 #haskell on irc.freenode.net - We Put the Funk in Funktion 10 PRINT "HELLO" 20 GOTO 10 ; mapM_ putStrLn $ fix ("hello":) --=-=-=-- From diatchki@cse.ogi.edu Tue Mar 11 18:34:28 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Tue, 11 Mar 2003 10:34:28 -0800 Subject: Problem with hierarchical libraries. In-Reply-To: <9584A4A864BD8548932F2F88EB30D1C60C2404BD@tvp-msg-01.europe.corp.microsoft.com> References: <9584A4A864BD8548932F2F88EB30D1C60C2404BD@tvp-msg-01.europe.corp.microsoft.com> Message-ID: <3E6E2C34.90307@cse.ogi.edu> hi, sorry for moving this back to the haskell mailing list, but i think the module system is part of the language and is not a library. Simon Marlow wrote: > [ moved to libraries@haskell.org ] > > >>why not fix the design to take this into account? one can >>have two ways >>to refer to modules - relative and absolute (just like in the file >>system, which years of experience show works pretty well). >> >>import .Test.A -- refers to an absolute path >> -- (relative to a user specified root) >> -- i.e. $HS_PATH/Test/A.hs >>import Test.A -- is a path relative to the location of >> -- the current module, i.e. >> -- [location of module]/Test/A.hs > > > IIRC, something very similar was suggested a while back on the libraries > list, except that the form beginning with a dot was the relative module > name (actually I think I prefer it that way). this seems exactly the opposite of what all file systems do. i know lateral thinking is great, but why do we have to be backwards all the time? > Personally, I've been using the hierarchical module names for a while > and I really don't mind writing out the whole name each time. It means > you have less context to think about when reading the source. oh come on :-) most of the time you don't get to see the module name at all -- you have to keep scrolling to the top of the file. virtually every editor can tell you what is the name of the file you are editing... (:f in vim). and tools like haddoc can display the name of the module anyways. >>i also have another question about the hirarchical modules >>design -- why >>does one have to duplicate the path to a particular file >>inside the file >>itself? i.e. what is the point of the module name within the file? >>it seems that all haskell implementations assume that the module name >>and file name are the same (and this seems perfectly reasonable), and >>with the hirarchical name space this is even more the case. and for >>example C programers never specify the name of the current >>file within >>the file. why do we want to do it? > > > This arises because the meaning of a module is defined independently of > the mapping between modules and filenames. the meaning of modules can still be independent of the mapping between modules and filesnames. all that has to be specified is how to compute this mapping. and one has to do that anyways, even if the haskell report pretends that this can be ommited. in fact this is exactly what the initial poster was asking. this whole issue about realtive/absoulte paths is part of specifying the mapping between module names and file names. in fact if one decides to ignore this mapping, all that the "hirarchical modules" proposal does is allow one to write "." in a module name. if one wants to keep modules and file names comletely independent it seems that one should introduce some notion of a "project" or something, which specifies the above mentioned mapping. however i am not sure that the additional flexibility of such an approach would be useful, and i would be perfectly happy with a single fixed way to compute the maping between modules and files. > I agree that this leads to some redundancy, and it can be annoying that > moving modules from one place in the hierarchy to another requires > editing the source. > > Building knowledge of the filesystem into the spec is the wrong thing to > do, given that filesystems tend to have platform-specific differences > (eg. single quote is allowed in a module name - is it allowed in a > filename? on which operating systems?). making them the same seems wrong. the one being an abstraction of the other does not seem all that bad. for the particular problem you raise there are at least two more or less obvious choices: * disallow single quotes in module names (but not necessarily module name aliases) * say what should single quote be mapped to in the file system (e.g. _) i like the first one better. what does GHC do in this situation? bye iavor -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From arthurb@cs.uu.nl Wed Mar 12 00:06:25 2003 From: arthurb@cs.uu.nl (Arthur Baars) Date: Wed, 12 Mar 2003 01:06:25 +0100 Subject: clueless GHCI user wishes to load QuickCheck In-Reply-To: <20030311180230.B08023FDD@labrador.eecs.harvard.edu> Message-ID: <76D4D6EC-541E-11D7-9FC2-003065529378@cs.uu.nl> QuickCheck is in de "util" package. You can load a package with the -package flag: $ ghci -package util Prelude> :browse QuickCheck class Arbitrary a where { arbitrary :: Gen a; coarbitrary :: forall b. a -> Gen b -> Gen b; } arbitrary :: forall a. (Arbitrary a) => Gen a ... Prelude>:module QuickCheck Prelude QuickCheck> :info trivial -- trivial is a variable trivial :: forall a. (Testable a) => Bool -> a -> Property Hope this helps. Cheers, Arthur On Tuesday, March 11, 2003, at 07:02 PM, Norman Ramsey wrote: > Can anyone help me figure out how to load QuickCheck into GHCI? > QuickCheck is included in my Debian package, but my attempts > at loading it are bootless: > > Prelude> :load QuickCheck > can't find module `QuickCheck' > Prelude> :load util/QuickCheck > can't find module `util/QuickCheck' > Prelude> :info > syntax: `:i ' > Prelude> :load util/QuickCheck.hi > can't find module `util/QuickCheck.hi' > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi' > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck' > Prelude> > > Any advice, anyone? > > > Norman > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From aegnor@antioch-college.edu Wed Mar 12 07:54:45 2003 From: aegnor@antioch-college.edu (Abraham Egnor) Date: Wed, 12 Mar 2003 02:54:45 -0500 (EST) Subject: Conway's Life In-Reply-To: Message-ID: I'll answer my own question; I've got a much better implementation, along with an HOpenGL-based frontend, at "http://ofb.net/~abe/hlife/hlife-0.1.tar.gz". It uses a FiniteMap of 5x5 UArrays that are created and destroyed as needed; this gives it a good balance of size (the grid is only bounded by the max values of an Int) and speed (my test program runs 100 generations in about three seconds). Abe From simonmar@microsoft.com Wed Mar 12 11:59:49 2003 From: simonmar@microsoft.com (Simon Marlow) Date: Wed, 12 Mar 2003 11:59:49 -0000 Subject: Problem with hierarchical libraries. Message-ID: <9584A4A864BD8548932F2F88EB30D1C60C240A52@tvp-msg-01.europe.corp.microsoft.com> > > IIRC, something very similar was suggested a while back on=20 > the libraries > > list, except that the form beginning with a dot was the=20 > relative module > > name (actually I think I prefer it that way). > > this seems exactly the opposite of what all file systems do. i know=20 > lateral thinking is great, but why do we have to be backwards=20 > all the time? Because it seems strange to have to add the prefix dot to all of our existing imports ('import Prelude' becomes 'import .Prelude'). Besides, I like the idea that the prefix dot is an indication that the current module name has been omitted. > > Personally, I've been using the hierarchical module names=20 > for a while > > and I really don't mind writing out the whole name each=20 > time. It means > > you have less context to think about when reading the source. > oh come on :-) most of the time you don't get to see the=20 > module name=20 > at all -- you have to keep scrolling to the top of the file. =20 > virtually=20 > every editor can tell you what is the name of the file you are=20 > editing... (:f in vim). and tools like haddoc can display=20 > the name of=20 > the module anyways. I think you misunderstand me - my point was that currently, an import declaration means the same regardless of what the current module name is. With relative imports, that's not true any more (but you're right that the editor usually helps by showing the filename). It's a minor point I grant you, but simplicity at the expense of a bit of extra typing is sometimes a good thing. > > This arises because the meaning of a module is defined=20 > independently of > > the mapping between modules and filenames. > > the meaning of modules can still be independent of the=20 > mapping between=20 > modules and filesnames. all that has to be specified is how=20 > to compute this mapping. And that's exactly what we don't want to do (IMO). Filesystems are too different - what about filesystems that don't have directories? What if I want to store my source code in a database or on the web? What about non-case-sensitive filesystems, or ones with restrictions on the length of filenames? > and one has to do that anyways, even if the haskell=20 > report pretends that this can be ommited.=20 Yes, but the point is that it is done by the compiler, not the language specification, so compilers are free to implement different policies, and the spec doesn't have to acquire any platform-specific warts. The mapping between filenames and module names in GHC is rather complicated, see recent discussions on glasgow-haskell-users@haskell.org. The mapping in Hugs is different - more liberal in some ways, but less complicated because of the lack of interface files. [snip] > in fact if one decides to ignore this mapping,=20 > all that the "hirarchical modules" proposal does is allow one=20 > to write "." in a module name. Bingo :-) Cheers, Simon From pecheur@email.arc.nasa.gov Wed Mar 12 10:01:16 2003 From: pecheur@email.arc.nasa.gov (Charles Pecheur (from home)) Date: Wed, 12 Mar 2003 02:01:16 -0800 Subject: MoChArt-03 submission deadline extended to March 17 Message-ID: <90DB207A-5471-11D7-BAB3-000393A330B8@email.arc.nasa.gov> [Apologies if you receive more than one copy of this message. -- The Organizers.] ===================================================================== **************************************************** *** EXTENDED Submission deadline: March 17, 2003 *** **************************************************** CALL FOR PAPERS & PARTICIPATION *************************************** SECOND WORKSHOP ON MODEL CHECKING AND ARTIFICIAL INTELLIGENCE (MoChArt-03) August 10, 2003, Acapulco, Mexico IJCAI-03 Workshop Program http://mochart03.na.infn.it/ ===================================================================== Model checking (MC) is the name given to the process of determining whether or not a formula of some logic is satisfied by a model for the logic. Model checking is limited by its exponential complexity with respect to the size of the system being verified. Nevertheless, MC procedures for many classes of models and logics of interest have been efficiently automated and successfully applied to a broad range of real-size applications in the last decade. These recent advances have lead to a growth of interest in the use of the technology in Artificial Intelligence (AI). In the meantime, state space exploration is a central aspect of AI, and the AI community has a long and impressive line of research in developing and improving search algorithms over very large state spaces under a broad range of assumptions. MC researchers are showing a growing interest in this vast body of knowledge, as a way to mitigate the state-space explosion problem. Under a slightly different perspective there is growing interest in the use of model checking techniques for verifying and validating AI applications (as opposed to inside these applications themselves). This is becoming a critical issue, as AI techniques are increasingly considered for safety-critical applications such as space missions. AI software typically features unconventional architectures and requirements that ask for specific verification solutions. These solutions will only emerge from a sustained dialogue between the AI and V&V communities, through forums such as this one. The purpose of the Second MoChArt workshop is therefore to bring together researchers with an interest in both MC and AI. The goals are to tease out common themes and differences, identify common problems and their solutions, share experiences with the applicability of techniques from one field to problems from the other, and to identify the key issues to be addressed in increasing the convergence between MC and AI. The workshop will welcome submissions on all ideas, research, experiments and tools that relate to both MC and AI fields. Topics of interest include: - Foundations - Comparisons between MC and AI problems, approaches and algorithms. - Model checking for combined modal/temporal logics - Model checking for logics of common sense reasoning - Model checking approaches to AI - Planning via model checking - Model checking for multi-agent systems - Model checking for diagnosis - Model checking for games - Using concurrency models in AI (Process Algebras, Petri Nets, Statecharts,...) - AI approaches to model checking - AI approaches to the state explosion problem - Heuristics for model checking - AI approaches to automatic abstraction - Model checking for verification of AI systems - Requirements/specifications/properties for AI systems - Automated verification of AI systems - Model checking of multi-agent systems - Model checking of model-based systems - Model checking of knowledge-based systems - Tools related to any of these topics - Case studies related to any of these topics SUBMISSION The workshop notes will include original material. Archived material will also be considered for presentation but will not appear in the proceedings. Shorter papers are encouraged, particularly those exposing novel ideas or work in progress. Authors are invited to submit papers (11pt, letter or A4, no more than 12 pages long) in PostScript format or Adobe PDF by March 7, 2003 to the following e-mail address: mochart03@na.infn.it. The first page of each submission should carry the contact details of a nominated contact person, including email address. PARTICIPATION Participation will be by invitation. Potentially interested participants must submit a *short* position statement, indicating the reasons for their interest in the topics of the workshop to the e-mail address mochart03@na.infn.it, by April 1, 2003 IMPORTANT DATES AND DEADLINES - Deadline for the submission of papers: March 17, 2003. - Notification of acceptance/rejection of papers: March 30, 2003. - Deadline for the posotion statement: April 1, 2003 - Deadline for the receipt of camera-ready papers: May 15, 2003. ORGANIZING COMMITEE Massimo Benerecetti Dipartimento di Scienze Fisiche Universita di Napoli ``Federico II'' Via Cintia, Complesso Monte S. Angelo I-80126 Napoli, Italy e-mail: bene@na.infn.it http://people.na.infn.it/~bene/ Charles Pecheur RIACS / ASE Group NASA Ames Research Center, M/S 269-2 Moffett Field, CA 94035, U.S.A. e-mail: pecheur@ptolemy.arc.nasa.gov http://ase.arc.nasa.gov/pecheur ===================================================================== _______________________________________________________________________ Charles Pecheur RIACS / ASE Group NASA Ames Research Center, M/S 269-2 Bldg N-269, Rm 230 Moffett Field, CA 94035, U.S.A. http://ase.arc.nasa.gov/pecheur Phone : +1-650-604-3588 mailto:pecheur@ptolemy.arc.nasa.gov Fax : +1-650-604-3594 Home phone : +1-650-967-5918 From elke@espresto.com Wed Mar 12 18:08:15 2003 From: elke@espresto.com (Elke Kasimir) Date: Wed, 12 Mar 2003 19:08:15 +0100 (CET) Subject: recursive modules in Haskell Message-ID: Hi all! I've just got one of the rare chances to do a somewhat bigger piece of software development in Haskell. After having set up a design (with much use of multi-parameter-classes) I was very excited. However, to extent that implementation proceeded I had to recognize many unforeseen implementation dependencies between instance. A standard situation is: file A.hs: instance Foo A f :: -- implementation requires A and B to be an instance of Foo file B.hs: instance Foo B f :: -- implementation requires A and B to be an instance of Foo The mutual dependencies increase if one uses class constraints to enforce semantic wellformedness, that is if one writes given Bar A => class Foo A whenever this makes sense from the view of the application logic - as I did. No Problem at all for Haskell, but a problem for certain often-used Haskell compilers and interpreters... Factoring out "the common part" does not work in examples like above, so the only way is to collapse everything, and to reduce class constraints as much as is possible - something which hurts deep inside! That the problems appear step-by-step in the course of implementation or even debugging, adds to the pain. So I have put onto my personal Haskell whish-list that certain compilers and interpreters shall either ultimately converged against the language they intend to support, or else provide some suitable alternative. Thinking in the first direction, a precompiler appears before my inner eye which is able to collapse mutually dependent modules into one bigger module. Even if this led to incorrect line numbers in error messages and the like, I would definitely use such a precompiler. A step in the second direction was a slight modification of Haskell such that instance declaration and instance implementation can be provided in separate modules. Elke. -- Elke Kasimir EsPresto AG ----------------------------------------------------------------- - Software Development- Breite Str. 30-31 Tel/Fax: +49-30-90 226-750/-760 10178 Berlin/Germany From diatchki@cse.ogi.edu Wed Mar 12 19:12:57 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Wed, 12 Mar 2003 11:12:57 -0800 Subject: recursive modules in Haskell In-Reply-To: References: Message-ID: <3E6F86B9.7040806@cse.ogi.edu> hi, Elke Kasimir wrote: > No Problem at all for Haskell, but a problem for certain > often-used Haskell compilers and interpreters... > > Factoring out "the common part" does not work in examples like > above, so the only way is to collapse everything, and to reduce > class constraints as much as is possible - something which hurts > deep inside! That the problems appear step-by-step in the course > of implementation or even debugging, adds to the pain. > > So I have put onto my personal Haskell whish-list > that certain compilers and interpreters shall either ultimately > converged against the language they intend to > support, or else provide some suitable alternative. Thinking in > the first direction, a precompiler appears before my inner eye which > is able to collapse mutually dependent modules into one bigger module. > Even if this led to incorrect line numbers in error messages and the like, > I would definitely use such a precompiler. A step in the second direction > was a slight modification of Haskell such that instance declaration and instance > implementation can be provided in separate modules. there is no need to use such hacks. it is not dificult to add suport for mutually recursive modules to an implementation directly. unfortunatley none of the working haskell implementations support recursive modules, i guess they are probably not considered important enough. and the haskell report does not say how they should work (ergh why?), but if you are interested you can take a look at "A formal specification for the Haskel 98 module system" a paper we wrote to remedy this situation. in the mean time you can work around the problem in GHC, by using the hi-boot files take a look at the documentation "How to compile mutually recursive modules". bye iavor -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From alethenorio@home.se Thu Mar 13 00:02:06 2003 From: alethenorio@home.se (Alexandre Weffort Thenorio) Date: Thu, 13 Mar 2003 01:02:06 +0100 Subject: How to search for a string sequence in a file a rewrite it??? References: <76D4D6EC-541E-11D7-9FC2-003065529378@cs.uu.nl> Message-ID: <002e01c2e8f3$ca3ff000$0800a8c0@thenorio> OK Guys. First I would like to say thanks for all the help given before. As I said I am still learning Haskell. My problem is the following: I have a text file and somewhere in the file there is string (Let's say aaaa). So I need to find this exact string and overwrite with another string (Lets say bbbb). I have thought a bit and couldn't find any solution, and I believe it is a piece of cake for some of you. Is there a method already implemented in haskell to do that?? Anyway thanks in advance. Best Regards NooK ----- Original Message ----- From: "Arthur Baars" To: Cc: "Norman Ramsey" Sent: Wednesday, March 12, 2003 1:06 AM Subject: Re: clueless GHCI user wishes to load QuickCheck > QuickCheck is in de "util" package. You can load a package with the > -package flag: > > $ ghci -package util > Prelude> :browse QuickCheck > class Arbitrary a where { > arbitrary :: Gen a; coarbitrary :: forall b. a -> Gen b -> Gen b; } > arbitrary :: forall a. (Arbitrary a) => Gen a > ... > Prelude>:module QuickCheck > > Prelude QuickCheck> :info trivial > -- trivial is a variable > trivial :: forall a. (Testable a) => Bool -> a -> Property > > Hope this helps. > > Cheers, > > Arthur > > On Tuesday, March 11, 2003, at 07:02 PM, Norman Ramsey wrote: > > > Can anyone help me figure out how to load QuickCheck into GHCI? > > QuickCheck is included in my Debian package, but my attempts > > at loading it are bootless: > > > > Prelude> :load QuickCheck > > can't find module `QuickCheck' > > Prelude> :load util/QuickCheck > > can't find module `util/QuickCheck' > > Prelude> :info > > syntax: `:i ' > > Prelude> :load util/QuickCheck.hi > > can't find module `util/QuickCheck.hi' > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi > > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi' > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck > > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck' > > Prelude> > > > > Any advice, anyone? > > > > > > Norman > > _______________________________________________ > > Haskell mailing list > > Haskell@haskell.org > > http://www.haskell.org/mailman/listinfo/haskell > > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From hdaume@ISI.EDU Thu Mar 13 00:05:13 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Wed, 12 Mar 2003 16:05:13 -0800 (PST) Subject: How to search for a string sequence in a file a rewrite it??? In-Reply-To: <002e01c2e8f3$ca3ff000$0800a8c0@thenorio> Message-ID: This is how I would do it: recurse down the input string. use isPrefixOf to check is the string youw ant to replace is at the head of the string. if it is, 'drop' the appropriate number of characters and stick the replacement string on the front. then recurse. this should be about 3 lines of code. -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > OK Guys. First I would like to say thanks for all the help given before. As > I said I am still learning Haskell. My problem is the following: > > I have a text file and somewhere in the file there is string (Let's say > aaaa). So I need to find this exact string and overwrite with another string > (Lets say bbbb). > > I have thought a bit and couldn't find any solution, and I believe it is a > piece of cake for some of you. Is there a method already implemented in > haskell to do that?? > Anyway thanks in advance. > > Best Regards > > NooK > > ----- Original Message ----- > From: "Arthur Baars" > To: > Cc: "Norman Ramsey" > Sent: Wednesday, March 12, 2003 1:06 AM > Subject: Re: clueless GHCI user wishes to load QuickCheck > > > > QuickCheck is in de "util" package. You can load a package with the > > -package flag: > > > > $ ghci -package util > > Prelude> :browse QuickCheck > > class Arbitrary a where { > > arbitrary :: Gen a; coarbitrary :: forall b. a -> Gen b -> Gen b; } > > arbitrary :: forall a. (Arbitrary a) => Gen a > > ... > > Prelude>:module QuickCheck > > > > Prelude QuickCheck> :info trivial > > -- trivial is a variable > > trivial :: forall a. (Testable a) => Bool -> a -> Property > > > > Hope this helps. > > > > Cheers, > > > > Arthur > > > > On Tuesday, March 11, 2003, at 07:02 PM, Norman Ramsey wrote: > > > > > Can anyone help me figure out how to load QuickCheck into GHCI? > > > QuickCheck is included in my Debian package, but my attempts > > > at loading it are bootless: > > > > > > Prelude> :load QuickCheck > > > can't find module `QuickCheck' > > > Prelude> :load util/QuickCheck > > > can't find module `util/QuickCheck' > > > Prelude> :info > > > syntax: `:i ' > > > Prelude> :load util/QuickCheck.hi > > > can't find module `util/QuickCheck.hi' > > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi > > > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi' > > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck > > > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck' > > > Prelude> > > > > > > Any advice, anyone? > > > > > > > > > Norman > > > _______________________________________________ > > > Haskell mailing list > > > Haskell@haskell.org > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > _______________________________________________ > > Haskell mailing list > > Haskell@haskell.org > > http://www.haskell.org/mailman/listinfo/haskell > > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From alethenorio@home.se Thu Mar 13 00:36:00 2003 From: alethenorio@home.se (Alexandre Weffort Thenorio) Date: Thu, 13 Mar 2003 01:36:00 +0100 Subject: How to search for a string sequence in a file a rewrite it??? References: Message-ID: <004001c2e8f8$855e7a10$0800a8c0@thenorio> Well the problem is that the string I want to replace will usually be in the middle of a line in the text file and then is PrefixOf of no use?? Any other suggestion?? Like the text file will be similar to abcdedjkfhlafl sajkhlabbbbsf akfhjklafjkhfk sdfasfsaasffaa So I want to replace this bbbb in the middle there with aaaa. I could run lines on the file but from there i have no idea. I have got an idea but for it to work I need to know if there is a function that I can replace a certain Char in a string by another Char by knowing the index of this char?? Best Regards NooK ----- Original Message ----- From: "Hal Daume III" To: "Alexandre Weffort Thenorio" Cc: Sent: Thursday, March 13, 2003 1:05 AM Subject: Re: How to search for a string sequence in a file a rewrite it??? > This is how I would do it: > > recurse down the input string. use isPrefixOf to check is the string youw > ant to replace is at the head of the string. if it is, 'drop' the > appropriate number of characters and stick the replacement string on the > front. then recurse. > > this should be about 3 lines of code. > > -- > Hal Daume III | hdaume@isi.edu > "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > > On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > > > OK Guys. First I would like to say thanks for all the help given before. As > > I said I am still learning Haskell. My problem is the following: > > > > I have a text file and somewhere in the file there is string (Let's say > > aaaa). So I need to find this exact string and overwrite with another string > > (Lets say bbbb). > > > > I have thought a bit and couldn't find any solution, and I believe it is a > > piece of cake for some of you. Is there a method already implemented in > > haskell to do that?? > > Anyway thanks in advance. > > > > Best Regards > > > > NooK > > > > ----- Original Message ----- > > From: "Arthur Baars" > > To: > > Cc: "Norman Ramsey" > > Sent: Wednesday, March 12, 2003 1:06 AM > > Subject: Re: clueless GHCI user wishes to load QuickCheck > > > > > > > QuickCheck is in de "util" package. You can load a package with the > > > -package flag: > > > > > > $ ghci -package util > > > Prelude> :browse QuickCheck > > > class Arbitrary a where { > > > arbitrary :: Gen a; coarbitrary :: forall b. a -> Gen b -> Gen b; } > > > arbitrary :: forall a. (Arbitrary a) => Gen a > > > ... > > > Prelude>:module QuickCheck > > > > > > Prelude QuickCheck> :info trivial > > > -- trivial is a variable > > > trivial :: forall a. (Testable a) => Bool -> a -> Property > > > > > > Hope this helps. > > > > > > Cheers, > > > > > > Arthur > > > > > > On Tuesday, March 11, 2003, at 07:02 PM, Norman Ramsey wrote: > > > > > > > Can anyone help me figure out how to load QuickCheck into GHCI? > > > > QuickCheck is included in my Debian package, but my attempts > > > > at loading it are bootless: > > > > > > > > Prelude> :load QuickCheck > > > > can't find module `QuickCheck' > > > > Prelude> :load util/QuickCheck > > > > can't find module `util/QuickCheck' > > > > Prelude> :info > > > > syntax: `:i ' > > > > Prelude> :load util/QuickCheck.hi > > > > can't find module `util/QuickCheck.hi' > > > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi > > > > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi' > > > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck > > > > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck' > > > > Prelude> > > > > > > > > Any advice, anyone? > > > > > > > > > > > > Norman > > > > _______________________________________________ > > > > Haskell mailing list > > > > Haskell@haskell.org > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > _______________________________________________ > > > Haskell mailing list > > > Haskell@haskell.org > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > _______________________________________________ > > Haskell mailing list > > Haskell@haskell.org > > http://www.haskell.org/mailman/listinfo/haskell > > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From hdaume@ISI.EDU Thu Mar 13 00:38:30 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Wed, 12 Mar 2003 16:38:30 -0800 (PST) Subject: How to search for a string sequence in a file a rewrite it??? In-Reply-To: <004001c2e8f8$855e7a10$0800a8c0@thenorio> Message-ID: Right. *Recurse* down the list. Somethign like: foo orig_str new_str xl@(x:xs) | orig_str `isPrefixOf` xl = | otherwise = x : -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > Well the problem is that the string I want to replace will usually be in the > middle of a line in the text file and then is PrefixOf of no use?? Any other > suggestion?? > > Like the text file will be similar to > > abcdedjkfhlafl > sajkhlabbbbsf > akfhjklafjkhfk > sdfasfsaasffaa > > So I want to replace this bbbb in the middle there with aaaa. I could run > lines on the file but from there i have no idea. I have got an idea but for > it to work I need to know if there is a function that I can replace a > certain Char in a string by another Char by knowing the index of this char?? > > Best Regards > > NooK > ----- Original Message ----- > From: "Hal Daume III" > To: "Alexandre Weffort Thenorio" > Cc: > Sent: Thursday, March 13, 2003 1:05 AM > Subject: Re: How to search for a string sequence in a file a rewrite it??? > > > > This is how I would do it: > > > > recurse down the input string. use isPrefixOf to check is the string youw > > ant to replace is at the head of the string. if it is, 'drop' the > > appropriate number of characters and stick the replacement string on the > > front. then recurse. > > > > this should be about 3 lines of code. > > > > -- > > Hal Daume III | hdaume@isi.edu > > "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > > > > On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > > > > > OK Guys. First I would like to say thanks for all the help given before. > As > > > I said I am still learning Haskell. My problem is the following: > > > > > > I have a text file and somewhere in the file there is string (Let's say > > > aaaa). So I need to find this exact string and overwrite with another > string > > > (Lets say bbbb). > > > > > > I have thought a bit and couldn't find any solution, and I believe it is > a > > > piece of cake for some of you. Is there a method already implemented in > > > haskell to do that?? > > > Anyway thanks in advance. > > > > > > Best Regards > > > > > > NooK > > > > > > ----- Original Message ----- > > > From: "Arthur Baars" > > > To: > > > Cc: "Norman Ramsey" > > > Sent: Wednesday, March 12, 2003 1:06 AM > > > Subject: Re: clueless GHCI user wishes to load QuickCheck > > > > > > > > > > QuickCheck is in de "util" package. You can load a package with the > > > > -package flag: > > > > > > > > $ ghci -package util > > > > Prelude> :browse QuickCheck > > > > class Arbitrary a where { > > > > arbitrary :: Gen a; coarbitrary :: forall b. a -> Gen b -> Gen > b; } > > > > arbitrary :: forall a. (Arbitrary a) => Gen a > > > > ... > > > > Prelude>:module QuickCheck > > > > > > > > Prelude QuickCheck> :info trivial > > > > -- trivial is a variable > > > > trivial :: forall a. (Testable a) => Bool -> a -> Property > > > > > > > > Hope this helps. > > > > > > > > Cheers, > > > > > > > > Arthur > > > > > > > > On Tuesday, March 11, 2003, at 07:02 PM, Norman Ramsey wrote: > > > > > > > > > Can anyone help me figure out how to load QuickCheck into GHCI? > > > > > QuickCheck is included in my Debian package, but my attempts > > > > > at loading it are bootless: > > > > > > > > > > Prelude> :load QuickCheck > > > > > can't find module `QuickCheck' > > > > > Prelude> :load util/QuickCheck > > > > > can't find module `util/QuickCheck' > > > > > Prelude> :info > > > > > syntax: `:i ' > > > > > Prelude> :load util/QuickCheck.hi > > > > > can't find module `util/QuickCheck.hi' > > > > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi > > > > > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi' > > > > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck > > > > > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck' > > > > > Prelude> > > > > > > > > > > Any advice, anyone? > > > > > > > > > > > > > > > Norman > > > > > _______________________________________________ > > > > > Haskell mailing list > > > > > Haskell@haskell.org > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > _______________________________________________ > > > > Haskell mailing list > > > > Haskell@haskell.org > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > _______________________________________________ > > > Haskell mailing list > > > Haskell@haskell.org > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > _______________________________________________ > > Haskell mailing list > > Haskell@haskell.org > > http://www.haskell.org/mailman/listinfo/haskell > > > From sof@galois.com Thu Mar 13 05:09:59 2003 From: sof@galois.com (Sigbjorn Finne) Date: Wed, 12 Mar 2003 21:09:59 -0800 Subject: ANNOUNCE: hugs98.NET March 2003 snapshot Message-ID: <000701c2e91e$cb9474f0$6501a8c0@snapdragon> A new version of Hugs98.NET is now available, sporting the following: * A version of the popular Haskell interpreter, Hugs98 (http://haskell.org/hugs), targetted at the Microsoft .NET platform. * .NET interop integrated via the Haskell FFI. * Support for wrapping up Haskell functions as .NET classes / delegators, providing any .NET language with the ability to call and use Haskell. The distribution comes with documentation and examples demonstrating how to access and interact with .NET -- all available via the Hugs98.NET homepage: http://galois.com/~sof/hugs98.net/ Feedback, contributions, suggestions for improvements, bug reports etc. are most welcome -- please e-mail these to the author: sof@galois.com ----------------------------------------------------------------------- The Hugs 98 system is Copyright (c) Mark P Jones, Alastair Reid, the Yale Haskell Group, and the Oregon Graduate Institute of Science and Technology, 1994-2001, All rights reserved. It is distributed as free software under the license in the file "License", which is included in the distribution. The .NET extension is Copyright (c) Sigbjorn Finne, 2002-2003, All rights reserved. It is distributed as free software under the license in the file "License.net", which is included in the distribution. ----------------------------------------------------------------------- From afie@cs.uu.nl Thu Mar 13 12:01:20 2003 From: afie@cs.uu.nl (Arjan van IJzendoorn) Date: Thu, 13 Mar 2003 13:01:20 +0100 Subject: Learning Haskell, update Message-ID: <00eb01c2e958$42a245c0$ec50d383@sushi> Hi all, I've removed the frequently asked questions box at the bottom. It was unused. Fritz Ruehr made a nice Learning Haskell logo. Thank you, Fritz! NHC is compilable under Windows now, so the remark "no windows version" has been removed. Is there someone who wants to make a more decent language comparison table? If not, I'm thinking of removing it. Many things are said about it already in the comp.lang.functional FAQ. Greetings, Arjan From bjpop@cs.mu.OZ.AU Thu Mar 13 12:44:14 2003 From: bjpop@cs.mu.OZ.AU (Bernard James POPE) Date: Thu, 13 Mar 2003 23:44:14 +1100 (EST) Subject: ANNOUNCE: buddha 0.5 Message-ID: <200303131244.XAA02866@mulga.cs.mu.OZ.AU> Announcing the release of buddha 0.5 ------------------------------------ buddha is a declarative debugger for Haskell 98 http://www.cs.mu.oz.au/~bjpop/buddha/ What's new in this release: - a browsing facility - (optional) re-evaluation to improve space usage - better support for exceptions - accurate line numbers - minor interface improvements - many more interesting examples - and of course a swag of bug fixes Requirements: - ghc 5.04 or greater with libraries built for profiling (not tested with 5.04.3 yet) - a unix-ish environment (not tested on windows) Cheers, Bernie From alethenorio@home.se Thu Mar 13 20:13:11 2003 From: alethenorio@home.se (Alexandre Weffort Thenorio) Date: Thu, 13 Mar 2003 21:13:11 +0100 Subject: How to search for a string sequence in a file a rewrite it??? References: Message-ID: <003401c2e99c$f896fd50$0800a8c0@thenorio> Ooops a small error before but here is the right one. Great. I got almost everything. My problem now is: I got a function called findstr where findstr "aaaa" "zzzzz" ["xxxxaaaa","xxxaaaaxxx"] = ["xxxxzzzzz","xxxzzzzzxxx"] and then I try something like fillIn lines = do bkfilled <- (findstr str str2 lines) write bkfilled where write takes a [String] and concatenates it writing it to a file then. But I get this error saying: Expected Type: [String] Inferred Type: String In the first argument of 'write' namelly 'bkfilled' In a do expection pattern binding: write bkfilled Any idea?? I mean bkfilled is supposed to be [String] but it says it is a String, any idea why??? Best Regards Alex ----- Original Message ----- From: "Hal Daume III" To: "Alexandre Weffort Thenorio" Cc: Sent: Thursday, March 13, 2003 1:38 AM Subject: Re: How to search for a string sequence in a file a rewrite it??? > Right. *Recurse* down the list. Somethign like: > > foo orig_str new_str xl@(x:xs) > | orig_str `isPrefixOf` xl = > | otherwise = x : > > -- > Hal Daume III | hdaume@isi.edu > "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > > On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > > > Well the problem is that the string I want to replace will usually be in the > > middle of a line in the text file and then is PrefixOf of no use?? Any other > > suggestion?? > > > > Like the text file will be similar to > > > > abcdedjkfhlafl > > sajkhlabbbbsf > > akfhjklafjkhfk > > sdfasfsaasffaa > > > > So I want to replace this bbbb in the middle there with aaaa. I could run > > lines on the file but from there i have no idea. I have got an idea but for > > it to work I need to know if there is a function that I can replace a > > certain Char in a string by another Char by knowing the index of this char?? > > > > Best Regards > > > > NooK > > ----- Original Message ----- > > From: "Hal Daume III" > > To: "Alexandre Weffort Thenorio" > > Cc: > > Sent: Thursday, March 13, 2003 1:05 AM > > Subject: Re: How to search for a string sequence in a file a rewrite it??? > > > > > > > This is how I would do it: > > > > > > recurse down the input string. use isPrefixOf to check is the string youw > > > ant to replace is at the head of the string. if it is, 'drop' the > > > appropriate number of characters and stick the replacement string on the > > > front. then recurse. > > > > > > this should be about 3 lines of code. > > > > > > -- > > > Hal Daume III | hdaume@isi.edu > > > "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > > > > > > On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > > > > > > > OK Guys. First I would like to say thanks for all the help given before. > > As > > > > I said I am still learning Haskell. My problem is the following: > > > > > > > > I have a text file and somewhere in the file there is string (Let's say > > > > aaaa). So I need to find this exact string and overwrite with another > > string > > > > (Lets say bbbb). > > > > > > > > I have thought a bit and couldn't find any solution, and I believe it is > > a > > > > piece of cake for some of you. Is there a method already implemented in > > > > haskell to do that?? > > > > Anyway thanks in advance. > > > > > > > > Best Regards > > > > > > > > NooK > > > > > > > > ----- Original Message ----- > > > > From: "Arthur Baars" > > > > To: > > > > Cc: "Norman Ramsey" > > > > Sent: Wednesday, March 12, 2003 1:06 AM > > > > Subject: Re: clueless GHCI user wishes to load QuickCheck > > > > > > > > > > > > > QuickCheck is in de "util" package. You can load a package with the > > > > > -package flag: > > > > > > > > > > $ ghci -package util > > > > > Prelude> :browse QuickCheck > > > > > class Arbitrary a where { > > > > > arbitrary :: Gen a; coarbitrary :: forall b. a -> Gen b -> Gen > > b; } > > > > > arbitrary :: forall a. (Arbitrary a) => Gen a > > > > > ... > > > > > Prelude>:module QuickCheck > > > > > > > > > > Prelude QuickCheck> :info trivial > > > > > -- trivial is a variable > > > > > trivial :: forall a. (Testable a) => Bool -> a -> Property > > > > > > > > > > Hope this helps. > > > > > > > > > > Cheers, > > > > > > > > > > Arthur > > > > > > > > > > On Tuesday, March 11, 2003, at 07:02 PM, Norman Ramsey wrote: > > > > > > > > > > > Can anyone help me figure out how to load QuickCheck into GHCI? > > > > > > QuickCheck is included in my Debian package, but my attempts > > > > > > at loading it are bootless: > > > > > > > > > > > > Prelude> :load QuickCheck > > > > > > can't find module `QuickCheck' > > > > > > Prelude> :load util/QuickCheck > > > > > > can't find module `util/QuickCheck' > > > > > > Prelude> :info > > > > > > syntax: `:i ' > > > > > > Prelude> :load util/QuickCheck.hi > > > > > > can't find module `util/QuickCheck.hi' > > > > > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi > > > > > > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi' > > > > > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck > > > > > > can't find module `/usr/lib/ghc-5.02.2/imports/util/QuickCheck' > > > > > > Prelude> > > > > > > > > > > > > Any advice, anyone? > > > > > > > > > > > > > > > > > > Norman > > > > > > _______________________________________________ > > > > > > Haskell mailing list > > > > > > Haskell@haskell.org > > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Haskell mailing list > > > > > Haskell@haskell.org > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > _______________________________________________ > > > > Haskell mailing list > > > > Haskell@haskell.org > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > _______________________________________________ > > > Haskell mailing list > > > Haskell@haskell.org > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > From Tom.Pledger@peace.com Thu Mar 13 21:01:35 2003 From: Tom.Pledger@peace.com (Tom Pledger) Date: Fri, 14 Mar 2003 10:01:35 +1300 Subject: How to search for a string sequence in a file a rewrite it??? In-Reply-To: <003401c2e99c$f896fd50$0800a8c0@thenorio> References: <003401c2e99c$f896fd50$0800a8c0@thenorio> Message-ID: <15984.61871.740313.798601@tux-17.corp.peace.com> I've replied to this in haskell-cafe. Alexandre Weffort Thenorio writes: : | But I get this error saying: | | Expected Type: [String] | Inferred Type: String : From akos.ledeczi@vanderbilt.edu Fri Mar 14 02:24:29 2003 From: akos.ledeczi@vanderbilt.edu (Akos Ledeczi) Date: Thu, 13 Mar 2003 20:24:29 -0600 Subject: GPCE 03 CFC Message-ID: <3E713D5D.2030906@vanderbilt.edu> Dear Colleague, just a quick reminder that the deadline for papers and workshop proposals is fast approaching... I apologize if you receive multiple copies of this. Best Regards, Akos Ledeczi Publicity Chair GPCE 2003: Call for Contributions 2nd International Conference on Generative Programming and Component Engineering September 22-25, 2003 Erfurt, Germany Part of NetObjectDays'03 http://gpce.org In Cooperation with ACM SIGPLAN and SIGSOFT Generative and component approaches have the potential to revolutionize software development in a similar way as automation and components revolutionized manufacturing. Generative Programming (developing programs that synthesize other programs), Component Engineering (raising the level of modularization and analysis in application design), and Domain-Specific Languages (elevating program specifications to compact domain-specific notations that are easier to write and maintain) are key technologies for automating program development. GPCE arose as a joint conference, merging the prior conference on Generative and Component-Based Software Engineering (GCSE) and the Workshop on Semantics, Applications, and Implementation of Program Generation (SAIG). The goal of GPCE is to provide a meeting place for researchers and practitioners interested in cutting edge approaches to software development. Thanks to the co-location with NetObjectDays, one of the largest main-stream software development conferences in Germany, the GPCE'03 presentations are expected to have a high attendance by industry practitioners, in addition to regular conference attendees. Important Dates: --------------- Technical paper submission: Apr 6, 2003 Workshop proposal submission: Apr 6, 2003 Practitioner report submission: May 18, 2003 Tutorials proposal submission: May 18, 2003 Demonstration proposal submission: May 18, 2003 Poster proposal submission: Jul 13, 2003 Notification of acceptance for Technical papers: May 25, 2003 Workshop proposals: Apr 20, 2003 Practitioner reports: Jun 1, 2003 Tutorials proposals: Jun 1, 2003 Demonstration proposals: Jun 1, 2003 Poster proposals: Jul 27, 2003 Camera ready copy: Jun 22, 2003 Detailed submission instructions are available at: http://gpce.org Technical Papers ---------------- The GPCE'03 conference invites high quality papers reporting research results and/or experience related to generative programming and component engineering. We seek papers both in software engineering and in programming languages, and especially those that bridge the gap and are accessible to both communities at the same time. The conference solicits submissions related (but not limited) to: * Generative Programming: Reuse, meta-programming, partial evaluation, multi-stage and multi-level languages, * Semantics, type systems, symbolic computation, linking and explicit substitution, in-lining and macros, templates, program transformation * Runtime code generation, compilation, active libraries, synthesis from specifications, development methods, generation of non-code artefacts, formal methods, reflection. * Product Lines and architectures * Industrial Applications * Component-Based Software Engineering: Reuse, distributed platforms, distributed systems, evolution, analysis and design patterns, development methods, formal methods * Integration of Generative and Component-Based Approaches * Domain Engineering, analysis, and languages, domain-specific notations * Separation of Concerns: Aspect-Oriented Programming, Intentional Programming, and Multi-Dimensional Separation of Concerns * Model-driven architecture Reports on applications of these techniques to real-world problems are especially encouraged, as are submissions that relate ideas and concepts from several of these topics, or bridge the gap between theory and practice. Research papers should describe work that advances the current state of the art. The program committee will evaluate each contributed paper based on its relevance, significance, clarity and originality. The program committee is happy to advise on the appropriateness of a particular subject. Authors are invited to submit papers of at most 20 pages in LNCS proceedings format, in PDF form, by April 6, 2003. This deadline is firm. Simultaneous submission to other venues and submission of previously published material are not allowed. Electronic submission will be required, except by special arrangement with the program chairs. Selected papers from the conference will be invited for submission to a fast-track review process in either ACM TOPLAS or ACM TOSEM as appropriate. Practitioner Reports -------------------- GPCE '03 will feature a track geared towards industry and practice, where practitioners will present their experience and insight in applying generative and component-based technologies. We solicit reports in two categories: * Project reports describing successfully completed projects that applied technologies within the scope of GPCE'03. * Experience reports focussing on a particular aspect of technology usage and practice, or describe broad project experiences. The report submissions will be reviewed separately from technical paper submissions by a practitioner report committee. Workshops --------- GPCE workshops provide intensive collaborative environment to explore a specific sub-area of generative and component technology in depth, cover areas that cross the borders of several sub-areas, or focus on the applications and deployment of generative and/or component technology in a particular application domain. Workshops will take place on the first day of the conference. Young Researchers Workshop -------------------------- As in the past year, the conference will feature a one day doctoral symposium, where a panel of experts will review and discuss submissions from graduate students and other young researchers. For more details about submissions, please contact the YRW Chairs Isabel John (john@iese.fhg.de) and Matthias Clauss (Matthias.Clauss@gmx.de). Tutorials --------- We invite proposals for high-quality tutorials in all areas of generative programming and component-based development. Tutorial levels may be introductory, intermediate, or advanced. Introductory tutorials should seek to educate the participants about the basic concepts and techniques of generative and component-based development. More advanced tutorials may cover advanced development techniques and/or underlying theory. Demonstrations -------------- We invite proposals for demonstrating novel tools, systems, or techniques from both commercial and academic communities. Demonstrations should focus on technical aspects. Demonstrations showing how a specific technology is used in real world scenarios are particularly welcome. Both work in progress or proven techniques are appropriate. Product marketing is inappropriate in this forum. Posters ------- Posters at GPCE provide an excellent forum for authors to present their work in an informal and interactive setting. Posters are ideal for presenting speculative, late-breaking results or for giving an introduction to interesting, innovative work. Exhibits -------- The GPCE '03 exhibits will be held together with the exhibits of NetObjectDays'03, one of the largest main-stream software development conferences in Germany. Therefore, this will be an excellent forum to reach potential customers with news and demonstrations of your latest products, publications or services. If you would like your company to participate as an exhibitor at the conference, please refer to the web site for submission instructions. GPCE'03 Best Contribution Awards -------------------------------- The GPCE'03 audience will elect the best contributions in the following categories: * Best Paper * Best Practitioner Report * Best Commercial Tool * Best Non-Commercial Tool * Best Industrial Project Organizing Committee -------------------- General Chair: (chair03@gpce.org) Krzysztof Czarnecki, DaimlerChrysler Research and Technology, Germany. Program Committee Chairs: (pc03@gpce.org) Frank Pfenning, Carnegie Mellon University, USA Yannis Smaragdakis, Georgia Institute of Technology, USA Workshop Chair: (workshops03@gpce.org) Kasper Osterbye, IT University of Copenhagen, Denmark Tutorial Chair: (tutorials03@gpce.org) Gerd Frick, FZI, Karlsruhe, Germany Demonstration Chair: (demos03@gpce.org) Markus Voelter, independent consultant, Germany Poster Chair: (posters03@gpce.org) Jorn Bettin, SoftMetaWare, New Zealand Industrial Chair: (industrial03@gpce.org) Ulrich W. Eisenecker, University of Applied Sciences Kaiserslautern, Germany Publicity Chair: (publicity03@gpce.org) Akos Ledeczi, Vanderbilt University, USA Young Researchers Workshop Chairs Isabel John, Fraunhofer IESE, Germany (john@iese.fhg.de ) Matthias Clauss, Solutionline CSS, Germany (Matthias.Clauss@gmx.de) Program Committee Members (near-final): ------------------------- Giuseppe Attardi, University of Pisa, Italy Don Batory, University of Texas, USA Ira Baxter, Semantic Designs, USA Ted Biggerstaff, softwaregenerators.com, USA Shigeru Chiba, Tokyo Institute of Technology, Japan Rowan Davies, University of Western Australia, Australia Premkumar Devanbu, University of California, Davis, USA Ulrich W. Eisenecker, University of Applied Sciences Kaiserslautern, Germany Robert Glueck, Waseda University, Japan Trevor Jim, AT&T Labs Research, USA Gregor Kiczales, University of British Columbia, Canada Kai Koskimies, Tampere University of Technology, Finland Julia Lawall, DIKU, University of Copenhagen, Denmark Eugenio Moggi, DISI, University of Genova, Italy Jim Neighbors, Bayfront Technologies, USA Calton Pu, Georgia Tech, USA Olin Shivers, Georgia Tech, USA Clemens Szyperski, Microsoft Research, USA Peter Thiemann, University of Freiburg, Germany Eelco Visser, Utrecht University, The Netherlands From markus.schnell@web.de Fri Mar 14 08:21:36 2003 From: markus.schnell@web.de (Markus Schnell) Date: Fri, 14 Mar 2003 09:21:36 +0100 Subject: haskell cocoa integration Message-ID: <200303140821.h2E8La315589@mailgate5.cinetic.de> I put some points together of how one can integrate Haskell with a Mac OS = X Cocoa application: http://www.markusschnell.com/cocoa=5Fhowto.html Perhaps some Mac-Users can comment on it. Thanks, Markus -- Markus Schnell =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F 160 Zeichen sind f=FCr Ihre SMS zu wenig=3F Bei WEB.DE FreeMail koennen Sie bis 760 Zeichen versenden! http://freemail.web.de/features/=3Fmc=3D021183 From mechvel@botik.ru Fri Mar 14 12:51:17 2003 From: mechvel@botik.ru (Serge D. Mechveliani) Date: Fri, 14 Mar 2003 15:51:17 +0300 Subject: state of Standard Message-ID: <20030314155117.A854@botik.ru> Dear Haskellers, Could you, please, tell me what is the recent state of the Haskell Standard development? I have a wish for the Standard Library: FiniteMap, Set (of GHC library). And I have a question on the function name overloading, and on the record field name overloading. A language should support a natural naming of objects. For example: data Operator = Operator{opName :: String, opWeight :: Int, opSortage :: ([String],[String],String), opOrd :: Int, opPrecedences :: (Int, Int) } is not good -- due to `op' prefix. And many other data also have name, weight, ord, and so on. So, one may try to introduce class WithName a where name :: a -> String set_name :: a -> String -> a class WithWeight a where weight :: a -> Int set_weight :: a -> Int -> a ... trivialOperator = Operator{ ... some trivial setting ...} , to change the names like opName to opName__, opWeight__, ... to show that the latter are local and not for usage, to introduce instance WithName Operator where name = opName__ ... , and then, use all this, for example, as follows: let nm = name opr opr' = set_name "foo" $ set_weight 1 $ set_ord 2 $ opr in ... This leads to following complications. * Class declarations add. * The Standard does not allow to define the instances like type BN = (String, Bool) instance WithName BN where name = fst * There are many operations that should be synonymic but have different kind. For example, weight :: a -> Int weight :: Table -> a -> Int This leads to adventures with multiple parameter classes, and so on. Similar difficulties arise with the function names. Is Haskell all right at this point? Reply, please, to mechvel@botik.ru Thank you in advance for the explanation. ----------------- Serge Mechveliani mechvel@botik.ru From joe@informatik.uni-leipzig.de Fri Mar 14 13:59:53 2003 From: joe@informatik.uni-leipzig.de (Johannes Waldmann) Date: Fri, 14 Mar 2003 14:59:53 +0100 (MET) Subject: state of Standard In-Reply-To: <20030314155117.A854@botik.ru> Message-ID: Serge, I support your point of view > A language should support a natural naming of objects. > data Operator = > Operator{opName :: String, ... > } > is not good -- due to `op' prefix. You can use qualified names, this solves the problem (to a certain extent) module Operator where data Operator = Operator { name :: String, ... } module Foo where import qualified Operator ; foo = Operator.name bar It is a bit tedious to construct records that way, as in bar = Operator.Operator { Operator.name = "bar", ... } there are (at least) two better (?) solutions: a) something that works "only" for records, for instance one would like to write the above as bar = Operator.Operator { name = "bar", ... } (I think this has been suggested here before) Actually, the above looks a bit silly, so one should write module Operator where data Type = New { name :: String } module Foo where import qualified Operator bar = Operator.New { name = "bar" , .. } :: Operator.Type b) full static overloading (resolved by looking at the argument types) of course this is (one more) source of increased complexity in the language (affecting the user, and the implementors) (This has been discussed here as well, although I don't remember the result. Was there one?) It is sometimes strange to see how Haskell as a language is so powerful in all its advanced respects (esp. the type/class system) but is obviously lacking in some others (e. g., naming issues like the above) On the other hand, this seems to reflect the "academic" origin of the language (resp., its main body of designers, implementors, and users): You won't get promoted, or tenured, or whatever, just for implementing something as (seemingly) simple as a module and scoping system - that's not research, "just" engineering. And indeed, some of the more "engineered" languages (think of Ada or Java) seem to have got this one right, or at least better. But we can't blame the academics for doing their job (i. e. research is what they're paid for). Best regards, -- -- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ -- -- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/207 -- From alethenorio@home.se Fri Mar 14 16:53:06 2003 From: alethenorio@home.se (Alexandre Weffort Thenorio) Date: Fri, 14 Mar 2003 17:53:06 +0100 Subject: Recursion with do?? References: Message-ID: <002d01c2ea4a$2fa09dd0$0800a8c0@thenorio> Thanks it works but what exactly does this "in" before the last statement does?? I have never seen it before and the program gives me the parse error if I don't have it?? Best Regards NooK ----- Original Message ----- From: "Hal Daume III" To: "Alexandre Weffort Thenorio" Sent: Friday, March 14, 2003 4:32 PM Subject: Re: Recursion with do?? > > fbk size new_str (x:xs) = do > > let first = findstr size new_str x > > let bksize = (Function that gives the size of the string to substitute in > > this line) > > let done = fbk bksize new_str xs > > return done > > There's no reason to use do notation here. This is a pure function. YOu > can write it as: > > > fbk size new_str (x:xs) = > > let first = ... > > bksize = ... > > in fbk bksize new_str xs > > I'm not sure why you would be getting a parse error though. > > > > ----- Original Message ----- > > From: "Hal Daume III" > > To: "Alexandre Weffort Thenorio" > > Sent: Thursday, March 13, 2003 9:33 PM > > Subject: Re: How to search for a string sequence in a file a rewrite it??? > > > > > > > what is the type signature of write, and why are you using do > > > notation? might you want something like: > > > > > > fillIn lines = do > > > let bkfilled = findstr str str2 lines > > > write bkfilled > > > > > > or something like that? > > > > > > -- > > > Hal Daume III | hdaume@isi.edu > > > "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > > > > > > On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > > > > > > > Ooops a small error before but here is the right one. > > > > > > > > Great. I got almost everything. My problem now is: > > > > > > > > I got a function called findstr where > > > > > > > > findstr "aaaa" "zzzzz" ["xxxxaaaa","xxxaaaaxxx"] = > > > > ["xxxxzzzzz","xxxzzzzzxxx"] > > > > > > > > and then I try something like > > > > > > > > fillIn lines = do > > > > bkfilled <- (findstr str str2 lines) > > > > write bkfilled > > > > > > > > where write takes a [String] and concatenates it writing it to a file > > then. > > > > But I get this error saying: > > > > > > > > Expected Type: [String] > > > > Inferred Type: String > > > > In the first argument of 'write' namelly 'bkfilled' > > > > In a do expection pattern binding: write bkfilled > > > > > > > > Any idea?? I mean bkfilled is supposed to be [String] but it says it is > > a > > > > String, any idea why??? > > > > > > > > Best Regards > > > > > > > > Alex > > > > > > > > ----- Original Message ----- > > > > From: "Hal Daume III" > > > > To: "Alexandre Weffort Thenorio" > > > > Cc: > > > > Sent: Thursday, March 13, 2003 1:38 AM > > > > Subject: Re: How to search for a string sequence in a file a rewrite > > it??? > > > > > > > > > > > > > Right. *Recurse* down the list. Somethign like: > > > > > > > > > > foo orig_str new_str xl@(x:xs) > > > > > | orig_str `isPrefixOf` xl = > > > > > | otherwise = x : > > > > > > > > > > -- > > > > > Hal Daume III | hdaume@isi.edu > > > > > "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > > > > > > > > > > On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > > > > > > > > > > > Well the problem is that the string I want to replace will usually > > be in > > > > the > > > > > > middle of a line in the text file and then is PrefixOf of no use?? > > Any > > > > other > > > > > > suggestion?? > > > > > > > > > > > > Like the text file will be similar to > > > > > > > > > > > > abcdedjkfhlafl > > > > > > sajkhlabbbbsf > > > > > > akfhjklafjkhfk > > > > > > sdfasfsaasffaa > > > > > > > > > > > > So I want to replace this bbbb in the middle there with aaaa. I > > could > > > > run > > > > > > lines on the file but from there i have no idea. I have got an idea > > but > > > > for > > > > > > it to work I need to know if there is a function that I can replace > > a > > > > > > certain Char in a string by another Char by knowing the index of > > this > > > > char?? > > > > > > > > > > > > Best Regards > > > > > > > > > > > > NooK > > > > > > ----- Original Message ----- > > > > > > From: "Hal Daume III" > > > > > > To: "Alexandre Weffort Thenorio" > > > > > > Cc: > > > > > > Sent: Thursday, March 13, 2003 1:05 AM > > > > > > Subject: Re: How to search for a string sequence in a file a rewrite > > > > it??? > > > > > > > > > > > > > > > > > > > This is how I would do it: > > > > > > > > > > > > > > recurse down the input string. use isPrefixOf to check is the > > string > > > > youw > > > > > > > ant to replace is at the head of the string. if it is, 'drop' the > > > > > > > appropriate number of characters and stick the replacement string > > on > > > > the > > > > > > > front. then recurse. > > > > > > > > > > > > > > this should be about 3 lines of code. > > > > > > > > > > > > > > -- > > > > > > > Hal Daume III | hdaume@isi.edu > > > > > > > "Arrest this man, he talks in maths." | > > www.isi.edu/~hdaume > > > > > > > > > > > > > > On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > > > > > > > > > > > > > > > OK Guys. First I would like to say thanks for all the help given > > > > before. > > > > > > As > > > > > > > > I said I am still learning Haskell. My problem is the following: > > > > > > > > > > > > > > > > I have a text file and somewhere in the file there is string > > (Let's > > > > say > > > > > > > > aaaa). So I need to find this exact string and overwrite with > > > > another > > > > > > string > > > > > > > > (Lets say bbbb). > > > > > > > > > > > > > > > > I have thought a bit and couldn't find any solution, and I > > believe > > > > it is > > > > > > a > > > > > > > > piece of cake for some of you. Is there a method already > > implemented > > > > in > > > > > > > > haskell to do that?? > > > > > > > > Anyway thanks in advance. > > > > > > > > > > > > > > > > Best Regards > > > > > > > > > > > > > > > > NooK > > > > > > > > > > > > > > > > ----- Original Message ----- > > > > > > > > From: "Arthur Baars" > > > > > > > > To: > > > > > > > > Cc: "Norman Ramsey" > > > > > > > > Sent: Wednesday, March 12, 2003 1:06 AM > > > > > > > > Subject: Re: clueless GHCI user wishes to load QuickCheck > > > > > > > > > > > > > > > > > > > > > > > > > QuickCheck is in de "util" package. You can load a package > > with > > > > the > > > > > > > > > -package flag: > > > > > > > > > > > > > > > > > > $ ghci -package util > > > > > > > > > Prelude> :browse QuickCheck > > > > > > > > > class Arbitrary a where { > > > > > > > > > arbitrary :: Gen a; coarbitrary :: forall b. a -> Gen > > b -> > > > > Gen > > > > > > b; } > > > > > > > > > arbitrary :: forall a. (Arbitrary a) => Gen a > > > > > > > > > ... > > > > > > > > > Prelude>:module QuickCheck > > > > > > > > > > > > > > > > > > Prelude QuickCheck> :info trivial > > > > > > > > > -- trivial is a variable > > > > > > > > > trivial :: forall a. (Testable a) => Bool -> a -> Property > > > > > > > > > > > > > > > > > > Hope this helps. > > > > > > > > > > > > > > > > > > Cheers, > > > > > > > > > > > > > > > > > > Arthur > > > > > > > > > > > > > > > > > > On Tuesday, March 11, 2003, at 07:02 PM, Norman Ramsey wrote: > > > > > > > > > > > > > > > > > > > Can anyone help me figure out how to load QuickCheck into > > GHCI? > > > > > > > > > > QuickCheck is included in my Debian package, but my attempts > > > > > > > > > > at loading it are bootless: > > > > > > > > > > > > > > > > > > > > Prelude> :load QuickCheck > > > > > > > > > > can't find module `QuickCheck' > > > > > > > > > > Prelude> :load util/QuickCheck > > > > > > > > > > can't find module `util/QuickCheck' > > > > > > > > > > Prelude> :info > > > > > > > > > > syntax: `:i ' > > > > > > > > > > Prelude> :load util/QuickCheck.hi > > > > > > > > > > can't find module `util/QuickCheck.hi' > > > > > > > > > > Prelude> :load > > /usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi > > > > > > > > > > can't find module > > > > `/usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi' > > > > > > > > > > Prelude> :load /usr/lib/ghc-5.02.2/imports/util/QuickCheck > > > > > > > > > > can't find module > > `/usr/lib/ghc-5.02.2/imports/util/QuickCheck' > > > > > > > > > > Prelude> > > > > > > > > > > > > > > > > > > > > Any advice, anyone? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Norman > > > > > > > > > > _______________________________________________ > > > > > > > > > > Haskell mailing list > > > > > > > > > > Haskell@haskell.org > > > > > > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > > > Haskell mailing list > > > > > > > > > Haskell@haskell.org > > > > > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > > Haskell mailing list > > > > > > > > Haskell@haskell.org > > > > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > Haskell mailing list > > > > > > > Haskell@haskell.org > > > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > From hdaume@ISI.EDU Fri Mar 14 18:19:04 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Fri, 14 Mar 2003 10:19:04 -0800 (PST) Subject: Recursion with do?? In-Reply-To: <002d01c2ea4a$2fa09dd0$0800a8c0@thenorio> Message-ID: There are two types of 'let' in Haskell. There's let/in, which is an expression, and let (from do), which is a statement. This means that any place you would write an expression (for instance, after the '=' sign in function definitions), you can write: let in contrast this with do notation, where you a let is a statement (just like "x <- foo" is a statement) and doesn't have a corresponding "in". -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Fri, 14 Mar 2003, Alexandre Weffort Thenorio wrote: > Thanks it works but what exactly does this "in" before the last statement > does?? I have never seen it before and the program gives me the parse error > if I don't have it?? > > Best Regards > > NooK > > ----- Original Message ----- > From: "Hal Daume III" > To: "Alexandre Weffort Thenorio" > Sent: Friday, March 14, 2003 4:32 PM > Subject: Re: Recursion with do?? > > > > > fbk size new_str (x:xs) = do > > > let first = findstr size new_str x > > > let bksize = (Function that gives the size of the string to > substitute in > > > this line) > > > let done = fbk bksize new_str xs > > > return done > > > > There's no reason to use do notation here. This is a pure function. YOu > > can write it as: > > > > > fbk size new_str (x:xs) = > > > let first = ... > > > bksize = ... > > > in fbk bksize new_str xs > > > > I'm not sure why you would be getting a parse error though. > > > > > > > ----- Original Message ----- > > > From: "Hal Daume III" > > > To: "Alexandre Weffort Thenorio" > > > Sent: Thursday, March 13, 2003 9:33 PM > > > Subject: Re: How to search for a string sequence in a file a rewrite > it??? > > > > > > > > > > what is the type signature of write, and why are you using do > > > > notation? might you want something like: > > > > > > > > fillIn lines = do > > > > let bkfilled = findstr str str2 lines > > > > write bkfilled > > > > > > > > or something like that? > > > > > > > > -- > > > > Hal Daume III | hdaume@isi.edu > > > > "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > > > > > > > > On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > > > > > > > > > Ooops a small error before but here is the right one. > > > > > > > > > > Great. I got almost everything. My problem now is: > > > > > > > > > > I got a function called findstr where > > > > > > > > > > findstr "aaaa" "zzzzz" ["xxxxaaaa","xxxaaaaxxx"] = > > > > > ["xxxxzzzzz","xxxzzzzzxxx"] > > > > > > > > > > and then I try something like > > > > > > > > > > fillIn lines = do > > > > > bkfilled <- (findstr str str2 lines) > > > > > write bkfilled > > > > > > > > > > where write takes a [String] and concatenates it writing it to a > file > > > then. > > > > > But I get this error saying: > > > > > > > > > > Expected Type: [String] > > > > > Inferred Type: String > > > > > In the first argument of 'write' namelly 'bkfilled' > > > > > In a do expection pattern binding: write bkfilled > > > > > > > > > > Any idea?? I mean bkfilled is supposed to be [String] but it says it > is > > > a > > > > > String, any idea why??? > > > > > > > > > > Best Regards > > > > > > > > > > Alex > > > > > > > > > > ----- Original Message ----- > > > > > From: "Hal Daume III" > > > > > To: "Alexandre Weffort Thenorio" > > > > > Cc: > > > > > Sent: Thursday, March 13, 2003 1:38 AM > > > > > Subject: Re: How to search for a string sequence in a file a rewrite > > > it??? > > > > > > > > > > > > > > > > Right. *Recurse* down the list. Somethign like: > > > > > > > > > > > > foo orig_str new_str xl@(x:xs) > > > > > > | orig_str `isPrefixOf` xl = > > > > > > | otherwise = x : > > > > > > > > > > > > -- > > > > > > Hal Daume III | hdaume@isi.edu > > > > > > "Arrest this man, he talks in maths." | > www.isi.edu/~hdaume > > > > > > > > > > > > On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > > > > > > > > > > > > > Well the problem is that the string I want to replace will > usually > > > be in > > > > > the > > > > > > > middle of a line in the text file and then is PrefixOf of no > use?? > > > Any > > > > > other > > > > > > > suggestion?? > > > > > > > > > > > > > > Like the text file will be similar to > > > > > > > > > > > > > > abcdedjkfhlafl > > > > > > > sajkhlabbbbsf > > > > > > > akfhjklafjkhfk > > > > > > > sdfasfsaasffaa > > > > > > > > > > > > > > So I want to replace this bbbb in the middle there with aaaa. I > > > could > > > > > run > > > > > > > lines on the file but from there i have no idea. I have got an > idea > > > but > > > > > for > > > > > > > it to work I need to know if there is a function that I can > replace > > > a > > > > > > > certain Char in a string by another Char by knowing the index of > > > this > > > > > char?? > > > > > > > > > > > > > > Best Regards > > > > > > > > > > > > > > NooK > > > > > > > ----- Original Message ----- > > > > > > > From: "Hal Daume III" > > > > > > > To: "Alexandre Weffort Thenorio" > > > > > > > Cc: > > > > > > > Sent: Thursday, March 13, 2003 1:05 AM > > > > > > > Subject: Re: How to search for a string sequence in a file a > rewrite > > > > > it??? > > > > > > > > > > > > > > > > > > > > > > This is how I would do it: > > > > > > > > > > > > > > > > recurse down the input string. use isPrefixOf to check is the > > > string > > > > > youw > > > > > > > > ant to replace is at the head of the string. if it is, 'drop' > the > > > > > > > > appropriate number of characters and stick the replacement > string > > > on > > > > > the > > > > > > > > front. then recurse. > > > > > > > > > > > > > > > > this should be about 3 lines of code. > > > > > > > > > > > > > > > > -- > > > > > > > > Hal Daume III | > hdaume@isi.edu > > > > > > > > "Arrest this man, he talks in maths." | > > > www.isi.edu/~hdaume > > > > > > > > > > > > > > > > On Thu, 13 Mar 2003, Alexandre Weffort Thenorio wrote: > > > > > > > > > > > > > > > > > OK Guys. First I would like to say thanks for all the help > given > > > > > before. > > > > > > > As > > > > > > > > > I said I am still learning Haskell. My problem is the > following: > > > > > > > > > > > > > > > > > > I have a text file and somewhere in the file there is string > > > (Let's > > > > > say > > > > > > > > > aaaa). So I need to find this exact string and overwrite > with > > > > > another > > > > > > > string > > > > > > > > > (Lets say bbbb). > > > > > > > > > > > > > > > > > > I have thought a bit and couldn't find any solution, and I > > > believe > > > > > it is > > > > > > > a > > > > > > > > > piece of cake for some of you. Is there a method already > > > implemented > > > > > in > > > > > > > > > haskell to do that?? > > > > > > > > > Anyway thanks in advance. > > > > > > > > > > > > > > > > > > Best Regards > > > > > > > > > > > > > > > > > > NooK > > > > > > > > > > > > > > > > > > ----- Original Message ----- > > > > > > > > > From: "Arthur Baars" > > > > > > > > > To: > > > > > > > > > Cc: "Norman Ramsey" > > > > > > > > > Sent: Wednesday, March 12, 2003 1:06 AM > > > > > > > > > Subject: Re: clueless GHCI user wishes to load QuickCheck > > > > > > > > > > > > > > > > > > > > > > > > > > > > QuickCheck is in de "util" package. You can load a package > > > with > > > > > the > > > > > > > > > > -package flag: > > > > > > > > > > > > > > > > > > > > $ ghci -package util > > > > > > > > > > Prelude> :browse QuickCheck > > > > > > > > > > class Arbitrary a where { > > > > > > > > > > arbitrary :: Gen a; coarbitrary :: forall b. a -> Gen > > > b -> > > > > > Gen > > > > > > > b; } > > > > > > > > > > arbitrary :: forall a. (Arbitrary a) => Gen a > > > > > > > > > > ... > > > > > > > > > > Prelude>:module QuickCheck > > > > > > > > > > > > > > > > > > > > Prelude QuickCheck> :info trivial > > > > > > > > > > -- trivial is a variable > > > > > > > > > > trivial :: forall a. (Testable a) => Bool -> a -> Property > > > > > > > > > > > > > > > > > > > > Hope this helps. > > > > > > > > > > > > > > > > > > > > Cheers, > > > > > > > > > > > > > > > > > > > > Arthur > > > > > > > > > > > > > > > > > > > > On Tuesday, March 11, 2003, at 07:02 PM, Norman Ramsey > wrote: > > > > > > > > > > > > > > > > > > > > > Can anyone help me figure out how to load QuickCheck > into > > > GHCI? > > > > > > > > > > > QuickCheck is included in my Debian package, but my > attempts > > > > > > > > > > > at loading it are bootless: > > > > > > > > > > > > > > > > > > > > > > Prelude> :load QuickCheck > > > > > > > > > > > can't find module `QuickCheck' > > > > > > > > > > > Prelude> :load util/QuickCheck > > > > > > > > > > > can't find module `util/QuickCheck' > > > > > > > > > > > Prelude> :info > > > > > > > > > > > syntax: `:i ' > > > > > > > > > > > Prelude> :load util/QuickCheck.hi > > > > > > > > > > > can't find module `util/QuickCheck.hi' > > > > > > > > > > > Prelude> :load > > > /usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi > > > > > > > > > > > can't find module > > > > > `/usr/lib/ghc-5.02.2/imports/util/QuickCheck.hi' > > > > > > > > > > > Prelude> :load > /usr/lib/ghc-5.02.2/imports/util/QuickCheck > > > > > > > > > > > can't find module > > > `/usr/lib/ghc-5.02.2/imports/util/QuickCheck' > > > > > > > > > > > Prelude> > > > > > > > > > > > > > > > > > > > > > > Any advice, anyone? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Norman > > > > > > > > > > > _______________________________________________ > > > > > > > > > > > Haskell mailing list > > > > > > > > > > > Haskell@haskell.org > > > > > > > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > > > > Haskell mailing list > > > > > > > > > > Haskell@haskell.org > > > > > > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > > > Haskell mailing list > > > > > > > > > Haskell@haskell.org > > > > > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > > Haskell mailing list > > > > > > > > Haskell@haskell.org > > > > > > > > http://www.haskell.org/mailman/listinfo/haskell > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From hdaume@ISI.EDU Fri Mar 14 20:51:12 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Fri, 14 Mar 2003 12:51:12 -0800 (PST) Subject: big lambda in class declarations In-Reply-To: Message-ID: It seems that the inability to have (\x . x) as a type in the Theimann et al approach is a severe limitation. I don't think that having to help the typechecker along, as in boundless rank polymorphism, is a bad thing at all. -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Wed, 5 Mar 2003, Simon Peyton-Jones wrote: > Big lambda is in terms. You mean a "lambda at the type level", which is > usually written as a small lambda. Confusing, I know. > > There's an ICFP02 paper on the subject, by Thiemann et al. Worth a > read. > > Problem with inference is that the type checker can't guess lambdas. > Suppose we need to unify > > m Int > with > ST Int Int > > One possibility is > > m = ST > > Another is > > m = \t. ST t Int > > Another is > > m = \t. ST Int t > > > One solution is to restrict what lambdas are allowable, and that is what > Thiemann et al do. Another is to declare the typechecker should never > guess a lambda; instead the programmer has to specify what lambda to use > whenever there is doubt. That is the approach that we're ruminating on > here. Stay tuned, but don't hold your breath. > > Simon > > | -----Original Message----- > | From: Hal Daume III [mailto:hdaume@ISI.EDU] > | Sent: 04 March 2003 16:34 > | To: Haskell Mailing List > | Subject: big lambda in class declarations > | > | So the word on the street is that allowing big lambda makes type > inference > | undecidable. This makes sense to me since allowing big lambda > essentially > | allows you to program at the type level and thus of course you'll get > | undecidability. > | > | However, I'm having difficulty understanding where the undecidability > | sneaks in if you allow big lambda in class declarations. I suppose > the > | cannonical example is when you want to write something like: > | > | > class Set s where { ... } > | > instance Set (/\ a. FiniteMap a ()) where { ... } > | > | but now you have to write: > | > | > data FMSet a = FMSet (FiniteMap a ()) > | > instance Set FMSet where { ... } > | > | The big lambda is of course equivalent to not applying type synonyms > | completely, somethign like: > | > | > type FM a = FiniteMap a () > | > instance Set FM where { ... } > | > | will of course also be rejected (since this would give us a way to do > big > | lambda). > | > | Could some one help my intuition a bit here and explain to me how you > | could use big lambdas in class declarations to write programs? > | > | Thanks! > | > | - Hal > | > | -- > | Hal Daume III | hdaume@isi.edu > | "Arrest this man, he talks in maths." | www.isi.edu/~hdaume > | > | _______________________________________________ > | Haskell mailing list > | Haskell@haskell.org > | http://www.haskell.org/mailman/listinfo/haskell > From oleg_inconnu@myrealbox.com Fri Mar 14 21:50:03 2003 From: oleg_inconnu@myrealbox.com (Oleg) Date: Fri, 14 Mar 2003 16:50:03 -0500 Subject: redefining methods in a subCLASS Message-ID: <200303141650.03834.oleg_inconnu@myrealbox.com> Hi (Posted this to Haskell-Cafe 12 hours ago with no replies) Is it possible to redefine methods in a subclass (not an instance)? E.g. I get errors in class (Show a) => Employee a where speak :: a -> [Char] speak x = "Employee: " ++ (show x) class (Employee a) => Manager a where speak x = "Manager: " ++ (show x) Thanks Oleg From gk@ninebynine.org Sun Mar 16 13:13:05 2003 From: gk@ninebynine.org (Graham Klyne) Date: Sun, 16 Mar 2003 13:13:05 +0000 Subject: Question about scope of 'let' and 'where' Message-ID: <5.1.0.14.2.20030316130041.00bbabd0@127.0.0.1> In the function body (rhs): let { a = (e1) } in (e2) where { b = f a } Does the Haskell specification indicate that the definition of 'a' is in-scope for the definition of 'b'? Practical experience using HUGS suggests the answer is no, but my intuition is that the answer should be yes. I was unable to find anything in either the report or the "gentle introduction" that made the correct answer clear to me (which is not to say it's not there, just that I didn't find it). I think the tutorial might benefit from a discussion of what is in-scope for where clauses. FWIW, my intuition was that e where defs was a form of expression (like let ... in), in which some sub-expressions were factored out as subsidiary definitions; i.e. that I'd expect to be able to replace each occurrence of a name defined by 'where' with the body of the corresponding definition. Hence I'd expect the let definitions to be in-scope. I now see that use of 'where' is restricted to specific contexts. I wonder if such restriction is needed? The differences between let and where in Haskell are something I find to be confusing. #g ------------------- Graham Klyne PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E From gk@ninebynine.org Sun Mar 16 14:25:39 2003 From: gk@ninebynine.org (Graham Klyne) Date: Sun, 16 Mar 2003 14:25:39 +0000 Subject: Context not part of a function definition? Message-ID: <5.1.0.14.2.20030316141940.00b7c780@127.0.0.1> I'm trying to use the following idiom to selectively import functions from the List module: import qualified List nub = List.nub but I'm finding that HUGS complains about "unresolved top level overloading" with "outstanding context: "Eq b". If I duplicate the type signature thus: import qualified List nub :: Eq a => [a] -> [a] nub = List.nub All seems to be well. I find it counter-intuitive that I cannot simply define a = b such that any occurrence of a is equivalent to an occurrence of b. I thought that was the point of referential transparency in functional languages. I don't know where to look in the Haskell documents to decide whether the above is a bug or truly according to the language spec. #g ------------------- Graham Klyne PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E From bjpop@cs.mu.OZ.AU Mon Mar 17 05:50:22 2003 From: bjpop@cs.mu.OZ.AU (Bernard James POPE) Date: Mon, 17 Mar 2003 16:50:22 +1100 (EST) Subject: Context not part of a function definition? In-Reply-To: <5.1.0.14.2.20030316141940.00b7c780@127.0.0.1> from Graham Klyne at "Mar 16, 2003 02:25:39 pm" Message-ID: <200303170550.QAA12272@mulga.cs.mu.OZ.AU> > I'm trying to use the following idiom to selectively import functions from > the List module: > > import qualified List > nub = List.nub > > but I'm finding that HUGS complains about "unresolved top level > overloading" with "outstanding context: "Eq b". > > If I duplicate the type signature thus: > > import qualified List > nub :: Eq a => [a] -> [a] > nub = List.nub > > All seems to be well. I find it counter-intuitive that I cannot simply define > > a = b > > such that any occurrence of a is equivalent to an occurrence of b. I > thought that was the point of referential transparency in functional > languages. I don't know where to look in the Haskell documents to decide > whether the above is a bug or truly according to the language spec. You have struck the monomorphism restriction. See: http://research.microsoft.com/Users/simonpj/haskell98-revised/haskell98-report-html/decls.html#sect4.5.5 This is an often tripped over snag in Haskell 98's type system. Cheers, Bernie. From hdaume@ISI.EDU Mon Mar 17 06:00:56 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Sun, 16 Mar 2003 22:00:56 -0800 (PST) Subject: Question about scope of 'let' and 'where' In-Reply-To: <5.1.0.14.2.20030316130041.00bbabd0@127.0.0.1> Message-ID: It is not. Lets are expressions. Wheres are part of declarations. In a grammar sense, you have something like: funcdef ::= name = expr (where decls)? expr ::= let decls in expr so the declarations inside a let are internal to the expression and can't go outside into the where clause. -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Sun, 16 Mar 2003, Graham Klyne wrote: > In the function body (rhs): > > let > { a = (e1) } > in > (e2) > where > { b = f a } > > Does the Haskell specification indicate that the definition of 'a' is > in-scope for the definition of 'b'? > > Practical experience using HUGS suggests the answer is no, but my intuition > is that the answer should be yes. > > I was unable to find anything in either the report or the "gentle > introduction" that made the correct answer clear to me (which is not to say > it's not there, just that I didn't find it). I think the tutorial might > benefit from a discussion of what is in-scope for where clauses. > > > FWIW, my intuition was that > > e where defs > > was a form of expression (like let ... in), in which some sub-expressions > were factored out as subsidiary definitions; i.e. that I'd expect to be > able to replace each occurrence of a name defined by 'where' with the body > of the corresponding definition. Hence I'd expect the let definitions to > be in-scope. > > I now see that use of 'where' is restricted to specific contexts. I wonder > if such restriction is needed? The differences between let and where in > Haskell are something I find to be confusing. > > > #g > > > ------------------- > Graham Klyne > > PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From Steffen.Mazanek@UniBw-Muenchen.de Sat Mar 15 11:10:57 2003 From: Steffen.Mazanek@UniBw-Muenchen.de (Steffen Mazanek) Date: 15 Mar 2003 11:10:57 +0000 Subject: old hugs versions? Message-ID: <86vfykubpa.fsf@pseiko.studfb.unibw-muenchen.de> Hello, are there any valid links in the whole internet pointing to old versions of hugs? Concretely I need hugs-1.3b and all hints how to find it would be very appreciated. One may ask what the hell I want to do with this old stuff :-). My intention is to compare its parser.y file with the one of Johan Nordlanders ohugs (http://www.cs.chalmers.se/~nordland/ohugs/). Thanks in advance, Steffen Mazanek From wli@holomorphy.com Mon Mar 17 10:33:49 2003 From: wli@holomorphy.com (William Lee Irwin III) Date: Mon, 17 Mar 2003 02:33:49 -0800 Subject: old hugs versions? In-Reply-To: <86vfykubpa.fsf@pseiko.studfb.unibw-muenchen.de> Message-ID: <20030317103349.GQ5891@holomorphy.com> On Sat, Mar 15, 2003 at 11:10:57AM +0000, Steffen Mazanek wrote: > are there any valid links in the whole internet > pointing to old versions of hugs? Concretely > I need hugs-1.3b and all hints how to find it > would be very appreciated. > One may ask what the hell I want to do with > this old stuff :-). My intention is to compare > its parser.y file with the one of Johan Nordlanders > ohugs (http://www.cs.chalmers.se/~nordland/ohugs/). Well, it's not a particularly flattering statement about myself but the debian version of hugs is truly ancient. In fact, there's a crew preparing to do an NMI delivery mode + takeover of the package and I've in fact been holding off on updates to allow them to progress more readily. So you can find an horrifically ancient hugs version in debian unless they've already taken it over without my noticing -- I've been a terrible maintainer, I should just retreat and package kernels for large i386 systems and get out of the hugs packaging business. -- wli From alastair@reid-consulting-uk.ltd.uk Mon Mar 17 11:40:22 2003 From: alastair@reid-consulting-uk.ltd.uk (Alastair Reid) Date: Mon, 17 Mar 2003 11:40:22 +0000 Subject: old hugs versions? In-Reply-To: <20030317103349.GQ5891@holomorphy.com> (William Lee Irwin III's message of "Mon, 17 Mar 2003 02:33:49 -0800") References: <20030317103349.GQ5891@holomorphy.com> Message-ID: Steffen Mazanek wrote: > are there any valid links in the whole internet pointing to old > versions of hugs? Concretely I need hugs-1.3b and all hints how to > find it would be very appreciated. William Lee Irwin III replied: > Well, it's not a particularly flattering statement about myself but > the debian version of hugs is truly ancient. Old as the debian version is, it is not Hugs 1.3. You can find old copies of Hugs including Hugs 1.3 on Mark P Jones' web page: http://www.cse.ogi.edu/~mpj/hugsarc/index.html There are also some old Gofer versions: http://www.cse.ogi.edu/~mpj/goferarc/index.html Hugs/Gofer was a very lean and elegant system back then - in our defence though, it does a few more things and comes with a lot more libraries now. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/ From Steffen.Mazanek@UniBw-Muenchen.de Mon Mar 17 11:53:08 2003 From: Steffen.Mazanek@UniBw-Muenchen.de (Steffen Mazanek) Date: 17 Mar 2003 11:53:08 +0000 Subject: Haskell History Message-ID: <863clmi50b.fsf@pseiko.studfb.unibw-muenchen.de> Hello, I want to create a source of historic information to delight the Haskell community and therefore I need a lot of material relating the following topics: - from lambda calculus to functional programming - other roots of Haskell (e.g. Gofer, ...) - genesis of the well known and beloved standard Haskell98 This website should act as an archive of old releases of popular Haskell interpreters and compilers, too (seemingly there is nothing online at present). Sometimes you need an old release of a particular software, e.g. for comparisons and you become really bored with following quit a lot of dead links in the internet, wasting time and staying without results. Help me to close this existing gap. All suggestions are welcome. Steffen Mazanek From Steven.Krauwer@let.uu.nl Mon Mar 17 12:38:37 2003 From: Steven.Krauwer@let.uu.nl (Steven Krauwer) Date: Mon, 17 Mar 2003 13:38:37 +0100 Subject: ESS2003: Language and Speech Technology for Language Learning Message-ID: <20030317133837.A16250@syntax.let.uu.nl> FIRST ANNOUNCEMENT and CALL for PARTICIPATION The 11th ELSNET Summer School on Language and Speech Communication Topic: Language and Speech Technology in Language Learning Lille (France), Monday July 7 - Friday July 18, 2003 Organized by the University of Lille 3 We are happy to announce that registration for the 11th ELSNET Summer School is now open. For this school we have chosen a topic of great relevance to researchers and developers in Europe and in other multilingual environments: the use of language and speech technology in language learning, both of spoken and of written language. The goal of this workshop is to get young researchers on a track that will eventually contribute to an important application area. The underlying vision (or dream) is The automatic animated language tutor. + Audience and aims: We see the school as mainly research and development oriented, and hence the primary audience are researchers, developers and integrators who will make our vision happen (rather than teachers who would use it). Both technological and pedagogical aspects will be taken into consideration The aims are: * to make the students familiar with the main principles and problems of language learning/teaching * to make them familiar with current best practice in computer assisted language learning * to make them familiar with the main challenges in computer assisted language learning Participants are expected to have a general computational background and some familiarity with language or speech research and/or processing. After completion of the summer school participants should be able to function in teams aimed at designing or implementing tools, environments or courses for Computer Assisted Language Learning (abbreviated CALL). + Course programme: The provisonal programme is available at http://www.elsnet.org/ess2003/schedule.html The 2-weeks programme comprises the following courses: * Introduction to CALL (Teacher: Jozef Colpaert, [Univ of Antwerp]) * Introduction to natural language processing for CALL (Teacher: Wolfgang Menzel [Univ of Hamburg], to be confirmed) * Introduction to speech processing for CALL (Teacher: Philippe Delcloque [MSEC Manchester]) * Using NLP tools in CALL (hands-on) (Teacher: Wolfgang Menzel [Univ of Hamburg], to be confirmed) * Using Speech tools in CALL (hands-on) (Teacher: Michael McTear [Univ of Ulster]) * CALL design and interfaces (Teacher: Philippe Delcloque [MSEC Manchester]) * Grammatical and morphological error diagnosis (Teacher: Lars Borin [Univ of Gothenburg]) * Systems for pronunciation training (Teacher: Anne-Marie Oster [KTH Stockholm]) * Building a grammatical CALL system (hands-on) (Teacher: Lars Borin [Univ of Gothenburg]) * Building a speech CALL system (hands-on) (Teacher: Michael McTear [Univ of Ulster]) All students attend the same full programme, except for the hands-on sessions, where students can sign up for either NLP or Speech oriented streams. In special student sessions students can present their own work. The presentations will be published on the ELSNET website. Please note that the number of places for this summer school is limited and that early registration is recommended. The working language of the Summer School will be English. + Fees: Category Registration fee (euro) Students 125 Academic staff 250 Commercial organisations 500 ELSNET members are entitled to a 20% discount + Food and accommodation: The cost of accommodation (on campus) will be 30 euro per night. Meals will be free. Registration, grants and other information: For detailed information about registration procedures and deadlines, fees, accommodation, grant possibilities, venue, course and social programme, etc visit the ESS2003 website at http://www.univ-lille3.fr/ESS2003 [to be opened soon] or send an email to the local organizers at elsnetadmin@univ-lille3.fr A limited number of grants (covering the cost of accommodation) may be available for citizens of EU and associated countries. Details and application forms will be published on the website. For information about the programme visit the provisional ESS2003 website at http://www.elsnet.org/ess2003 or contact the chair of the programme committee, Steven Krauwer (steven.krauwer@elsnet.org) From Steven.Krauwer@let.uu.nl Mon Mar 17 13:01:40 2003 From: Steven.Krauwer@let.uu.nl (Steven Krauwer) Date: Mon, 17 Mar 2003 14:01:40 +0100 Subject: EACL2003 Workshop Programme, April 13-14 Message-ID: <20030317140140.A17192@syntax.let.uu.nl> EACL 2003 in Budapest, April 12-17, 2003 Workshop Programme and Call for Participation Important dates: ---------------- Workshop dates: Apr 13-14, 2003 Conference dates: Apr 12-17, 2003 Important URLs: --------------- Registration: http://www.conferences.hu/EACL03/Registration.html Main conference: http://www.conferences.hu/EACL03/ Workshops: http://www.elsnet.org/workshops Workshop overview: ------------------ Workshop 01: "MT and other language technology tools; Improving MT through other language technology tools; Resources and tools for building MT" URL: http://www.elsnet.org/workshops/progw01.html Organizer(s): Bente Maegaard Email: bente@cst.dk Date: April 13, 2003 ___________________________________________________________________ Workshop 02: "9th European Workshop on Natural Language Generation" URL: http://www.ags.uni-sb.de/~horacek/EACL-EWNLG03.html Organizer(s): Ehud Reiter Email: ereiter@csd.abdn.ac.uk Date: April 13+14, 2003 ___________________________________________________________________ Workshop 03 [supported b y ELSNET]: "4th International Workshop on Linguistically Interpreted Corpora (LINC-03)" URL: http://www.coli.uni-sb.de/linc03 Organizer(s): Silvia Hansen Email: hansen@CoLi.Uni-SB.DE Date: April 13+14, 2003 ___________________________________________________________________ Workshop 04: "Language Modeling for Text Entry Methods" URL: http://www.uni-koblenz.de/~compling/eaclws2003/ Organizer(s): Michael Kuhn Email: kuehn@uni-koblenz.de Date: April 14, 2003 ___________________________________________________________________ Workshop 05: "The Computational Treatment of Anaphora" URL: http://www.clt.mq.edu.au/eacl03ana.html Organizer(s): Rob Dale Email: rdale@ics.mq.edu.au Date: April 14, 2003 (morning) ___________________________________________________________________ Workshop 06: "Dialogue Systems: interaction, adaptation and styles of management" URL: http://www.dcs.shef.ac.uk/~roberta/eacl-w06.html Organizer(s): Kristiina Jokinen and Roberta Catizone Email: kjokinen@uiah.fi,R.Catizone@dcs.shef.ac.uk Date: April 13+14, 2003 ___________________________________________________________________ Workshop 07 [supported by ELSNET]: "Evaluation Initiatives in Natural Language Processing: are evaluation methods, metrics and resources reusable?" URL: http://www.dcs.shef.ac.uk/~katerina/EACL03-eval Organizer(s): Katerina Pastra Email: e.pastra@dcs.shef.ac.uk Date: April 14, 2003 ___________________________________________________________________ Workshop 08: "Computational Linguistics for South Asian Languages -- Expanding Synergies with Europe" URL: http://computing.open.ac.uk/Sites/EACLSouthAsia Organizer(s): Durgesh Rao and Pat Hall Email: drsystems@vsnl.net,p.a.v.hall@open.ac.uk Date: April 14, 2003 ___________________________________________________________________ Workshop 09: "Workshop on Finite State Methods in Natural Language Processing" URL: http://www-igm.univ-mlv.fr/~laporte/fsw-cfp.htm Organizer(s): Eric Laporte and Ken Beesley Email: eric.laporte@univ-mlv.fr,Ken.Beesley@xrce.xerox.com Date: April 13+14, 2003 ___________________________________________________________________ Workshop 10: "Language Technology and the Semantic Web: 3rd Workshop on NLP and XML (NLPXML-2003)" URL: http://www.cs.vassar.edu/~ide/events/NLPXML3.html Organizer(s): Nancy Ide and Graham Wilcock Email: ide@cs.vassar.edu,graham.wilcock@helsinki.fi Date: April 13, 2003 ___________________________________________________________________ Workshop 11: "Natural Language Processing (NLP) for Question-Answering" URL: http://www.science.uva.nl/~mdr/NLP4QA/ Organizer(s): Bonnie Webber and Maarten de Rijke Email: bonnie@inf.ed.ac.uk,mdr@science.uva.nl Date: April 14, 2003 (afternoon) ___________________________________________________________________ Workshop 12: "Morphological Processing of Slavic Languages" URL: http://nl.ijs.si/mpsl03/ Organizer(s): Tomaz Erjavec and Dusko Vitas Email: Tomaz.Erjavec@ijs.si,vitas@matf.bg.ac.yu Date: April 13, 2003 ___________________________________________________________________ Contact info: - for the workshops in general: steven.krauwer@elsnet.org - for individual workshops: workshop organizers - for the main conference: kindl@sztaki.hu - for registration: kindl@sztaki.hu _______________________________________________________________ From afie@cs.uu.nl Mon Mar 17 14:17:40 2003 From: afie@cs.uu.nl (Arjan van IJzendoorn) Date: Mon, 17 Mar 2003 15:17:40 +0100 Subject: Haskell History References: <863clmi50b.fsf@pseiko.studfb.unibw-muenchen.de> Message-ID: <017801c2ec8f$f7f1e9a0$ec50d383@sushi> Hello Steffen, > I need a lot of material relating the following topics: > > - from lambda calculus to functional programming > - other roots of Haskell (e.g. Gofer, ...) > - genesis of the well known and beloved standard Haskell98 See "Conception, evolution, and application of functional programming languages" by Paul Hudak. That's a great starting point for a "History of Haskell" page: http://portal.acm.org/citation.cfm?doid=72551.72554 Matthew Donadio suggested it to me for the Learning Haskell page, but your future history page seems like a better place to me. You're welcome to steal the simple layout of the Learning Haskell page and maybe someone will make you a logo... Greetings, Arjan From matt@immute.net Mon Mar 17 16:25:30 2003 From: matt@immute.net (Matt Hellige) Date: Mon, 17 Mar 2003 10:25:30 -0600 Subject: Question about scope of 'let' and 'where' In-Reply-To: ; from hdaume@ISI.EDU on Sun, Mar 16, 2003 at 10:00:56PM -0800 References: <5.1.0.14.2.20030316130041.00bbabd0@127.0.0.1> Message-ID: <20030317102530.A5110@metro.immute.net> [Hal Daume III ] > It is not. Lets are expressions. Wheres are part of declarations. In a > grammar sense, you have something like: > > funcdef ::= name = expr (where decls)? > expr ::= let decls in expr > > so the declarations inside a let are internal to the expression and can't > go outside into the where clause. Shouldn't the layout rule make this apparent? Is the following really OK? > In the function body (rhs): > > let > { a = (e1) } > in > (e2) > where > { b = f a } I'd say that's pretty misleading, and maybe should be illegal layout...? Matt -- Matt Hellige matt@immute.net http://matt.immute.net From hdaume@ISI.EDU Mon Mar 17 16:36:16 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Mon, 17 Mar 2003 08:36:16 -0800 (PST) Subject: Question about scope of 'let' and 'where' In-Reply-To: <20030317102530.A5110@metro.immute.net> Message-ID: No, that's not legal. You'll get an unbound variable error on the use of 'a' in the definition of 'b'. This doesn't really have anything to do with layout. Consider the following definition: > f x = > case x of > Nothing -> ... > Just (y,z) -> let Just q = z > in b > where b = g q does it really make sense to let the where clause look that deep into an expression to pull out a variable? And what if you use the name 'q' multiple times in the expression? -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Mon, 17 Mar 2003, Matt Hellige wrote: > [Hal Daume III ] > > It is not. Lets are expressions. Wheres are part of declarations. In a > > grammar sense, you have something like: > > > > funcdef ::= name = expr (where decls)? > > expr ::= let decls in expr > > > > so the declarations inside a let are internal to the expression and can't > > go outside into the where clause. > > Shouldn't the layout rule make this apparent? Is the following really > OK? > > > In the function body (rhs): > > > > let > > { a = (e1) } > > in > > (e2) > > where > > { b = f a } > > I'd say that's pretty misleading, and maybe should be illegal > layout...? > > Matt > > -- > Matt Hellige matt@immute.net > http://matt.immute.net > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From matt@immute.net Mon Mar 17 16:38:04 2003 From: matt@immute.net (Matt Hellige) Date: Mon, 17 Mar 2003 10:38:04 -0600 Subject: Question about scope of 'let' and 'where' In-Reply-To: ; from hdaume@ISI.EDU on Mon, Mar 17, 2003 at 08:36:16AM -0800 References: <20030317102530.A5110@metro.immute.net> Message-ID: <20030317103804.C5110@metro.immute.net> [Hal Daume III ] > No, that's not legal. You'll get an unbound variable error on the use of > 'a' in the definition of 'b'. This doesn't really have anything to do > with layout. Consider the following definition: > > > f x = > > case x of > > Nothing -> ... > > Just (y,z) -> let Just q = z > > in b > > where b = g q > > does it really make sense to let the where clause look that deep into an > expression to pull out a variable? And what if you use the name 'q' > multiple times in the expression? Right, I understand that it's an illegal 'where' clause. That was the point of the original post... I chose a bad example by using the example from the original question, which we've already established as illegal. My question has to do only with layout... Consider: f x = let ... in ... where ... Assuming that all the ...s are legal, is this OK? Should it be? It really makes the 'where' clause look like it's inside the 'let', when in fact it can't be. Sorry about the misunderstanding and lousy example... Matt -- Matt Hellige matt@immute.net http://matt.immute.net From hdaume@ISI.EDU Mon Mar 17 16:51:58 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Mon, 17 Mar 2003 08:51:58 -0800 (PST) Subject: Question about scope of 'let' and 'where' In-Reply-To: <20030317103804.C5110@metro.immute.net> Message-ID: Hi, > f x = let ... > in > ... > where > ... > > Assuming that all the ...s are legal, is this OK? Should it be? It > really makes the 'where' clause look like it's inside the 'let', when > in fact it can't be. Ah, sorry. Yes, this is legal. However, if you think about 'where's attaching to declarations, not expressions, I don't think you get too confused about it being indented "too much." Again, this is because the where clause (include its layout rules) doesn't care at all what your function body expression looks like. Personally, I don't often mix top-level lets and wheres, unless I have a good reason to do so. Though not for this reason, it does clean this up. From Tom.Pledger@peace.com Mon Mar 17 20:12:23 2003 From: Tom.Pledger@peace.com (Tom Pledger) Date: Tue, 18 Mar 2003 08:12:23 +1200 Subject: Question about scope of 'let' and 'where' In-Reply-To: <5.1.0.14.2.20030316130041.00bbabd0@127.0.0.1> References: <5.1.0.14.2.20030316130041.00bbabd0@127.0.0.1> Message-ID: <15990.11303.243152.978532@tux-17.corp.peace.com> Graham Klyne writes: | In the function body (rhs): | | let | { a = (e1) } | in | (e2) | where | { b = f a } : | : | I now see that use of 'where' is restricted to specific contexts. I wonder | if such restriction is needed? The differences between let and where in | Haskell are something I find to be confusing. | Hi. Other people have already replied confirming *that* the 'where' has a broader scope than the 'let' in the rhs of a function. Here's an example of *why* the broad 'where' scope can be useful: it allows us to share definitions between a function body and its guard, and among multiple guarded branches. The following is from Hugs's Prelude, and shows definitions being shared by two branches. floatProperFraction x | n >= 0 = (fromInteger m * fromInteger b ^ n, 0) | otherwise = (fromInteger w, encodeFloat r n) where (m,n) = decodeFloat x b = floatRadix x (w,r) = quotRem m (b^(-n)) HTH. Tom From simonpj@microsoft.com Mon Mar 17 22:06:21 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Mon, 17 Mar 2003 22:06:21 -0000 Subject: recursive modules in Haskell Message-ID: | there is no need to use such hacks. it is not dificult to add suport=20 | for mutually recursive modules to an implementation directly.=20 | unfortunatley none of the working haskell implementations support=20 | recursive modules, Simple in principle, not so simple in practice. If it was easy to make GHC do mutually recursive modules we'd do it right away. It's certainly possible but it's real work, and .hi-boot files, while clunky, do the job. S From diatchki@cse.ogi.edu Mon Mar 17 22:41:26 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Mon, 17 Mar 2003 14:41:26 -0800 Subject: recursive modules in Haskell In-Reply-To: References: Message-ID: <3E764F16.7040902@cse.ogi.edu> hi, i can't really argue with simon he is the real compiler expert. and i am not familiar with the inner workings of GHC, so my argument is even weaker. and in any case discussions on the haskell mailing list very rarely have any effect except for their entertainment value during boring meetings... so if you are sitting bored somewhere read on :-) in my defence, we do have recursive modules implemented in our front end, and it can do type checking (which is presumably where the difficulties with recursive modules arise). and implementing the recursive modules was definitely not the hardest part to get working. .hi-boot files indeed do the job. so do seq, the monomorphism restriction, defaulting and unsafePerformIO. it is just that they don't do the job very well. i am curious however, what is difficult about implementing recursive modules (that is, if it can be explained without getting into the technical details of GHC). bye iavor Simon Peyton-Jones wrote: > | there is no need to use such hacks. it is not dificult to add suport > | for mutually recursive modules to an implementation directly. > | unfortunatley none of the working haskell implementations support > | recursive modules, > > Simple in principle, not so simple in practice. If it was easy to make > GHC do mutually recursive modules we'd do it right away. It's certainly > possible but it's real work, and .hi-boot files, while clunky, do the > job. > > S > -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From gk@ninebynine.org Mon Mar 17 12:18:30 2003 From: gk@ninebynine.org (Graham Klyne) Date: Mon, 17 Mar 2003 12:18:30 +0000 Subject: Class or parameterized type? Message-ID: <5.1.0.14.2.20030317115501.01f32b18@127.0.0.1> I'm trying to figure how to use parameterized types and/or classes. Example: I wish to define a structured container type, let's call it a "RatsNest", that is type-variable in two ways: (a) it is parameterized by a type of some class, let's call it "RatsTail", such that a RatsNest is a structure of things that have common properties. Certain operations between RatsNest values (e.g. a merge) are valid only if they are containers for the same kind of RatsTail. Such operations would not be different operations due to variation of thye contained type. (b) it can be implemented in various ways; e.g. a simple version is an in-memory data structure, while another may be implemented in database storage. This corresponds to the Haskell idea of overloading, or classes. This seems to call for a type-parameterized class specification, e.g. [[ class (Eq n, RatsTail t) => (RatsNest t) n where merge :: ( (RatsNest t1) n1, (RatsNest t1) l2) => n1 -> n2 -> n2 ]] But this, as far as I can tell, is not valid Haskell. Is there a way to achieve this effect? What I can't figure out is a way to impose that the merge operation is not valid between *any* instances of RatsNest, but only those that are based on the same member element type, but *can* be used between different implementations (e.g. disk-based and memory-based). #g ------------------- Graham Klyne PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E From Steffen.Mazanek@unibw-muenchen.de Mon Mar 17 23:04:56 2003 From: Steffen.Mazanek@unibw-muenchen.de (Steffen Mazanek) Date: 17 Mar 2003 23:04:56 +0000 Subject: Haskell History In-Reply-To: <017801c2ec8f$f7f1e9a0$ec50d383@sushi> References: <863clmi50b.fsf@pseiko.studfb.unibw-muenchen.de> <017801c2ec8f$f7f1e9a0$ec50d383@sushi> Message-ID: <861y1561d3.fsf@pseiko.studfb.unibw-muenchen.de> Hello again, > See "Conception, evolution, and application of functional programming > languages" by Paul Hudak. That's a great starting point for a "History of > Haskell" page: > > http://portal.acm.org/citation.cfm?doid=72551.72554 thank you, I will read it. > You're welcome to steal the simple layout of the Learning Haskell page and > maybe someone will make you a logo... Great idea, thank you again. I am not a graphic-freak. Maybe someone else can realize my plan :-). I have a historic world map in mind, which becomes flooded by little lambdas *g*. I hope to present a first draft of this website in the nearer future. Ciao, Steffen From gk@ninebynine.org Tue Mar 18 01:38:45 2003 From: gk@ninebynine.org (Graham Klyne) Date: Tue, 18 Mar 2003 01:38:45 +0000 Subject: Question about scope of 'let' and 'where' In-Reply-To: References: <5.1.0.14.2.20030316130041.00bbabd0@127.0.0.1> Message-ID: <5.1.0.14.2.20030318013825.00bc4208@127.0.0.1> At 22:00 16/03/2003 -0800, Hal Daume III wrote: >It is not. Lets are expressions. Wheres are part of declarations. In a >grammar sense, you have something like: > >funcdef ::= name = expr (where decls)? >expr ::= let decls in expr > >so the declarations inside a let are internal to the expression and can't >go outside into the where clause. I see now. Thanks. #g ------------------- Graham Klyne PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E From gk@ninebynine.org Tue Mar 18 01:36:58 2003 From: gk@ninebynine.org (Graham Klyne) Date: Tue, 18 Mar 2003 01:36:58 +0000 Subject: Context not part of a function definition? In-Reply-To: <200303170550.QAA12272@mulga.cs.mu.OZ.AU> References: <5.1.0.14.2.20030316141940.00b7c780@127.0.0.1> Message-ID: <5.1.0.14.2.20030318013421.01e634d8@127.0.0.1> At 16:50 17/03/2003 +1100, Bernard James POPE wrote: >You have struck the monomorphism restriction. > >See: >http://research.microsoft.com/Users/simonpj/haskell98-revised/haskell98-report-html/decls.html#sect4.5.5 > >This is an often tripped over snag in Haskell 98's type system. Ah, thanks. I'd read that, but didn't understand it's relevance. (I'm still not sure I do: I guess the key gothcha here is the bit about [[ Any monomorphic type variables that remain when type inference for an entire module is complete, are considered ambiguous, and are resolved to particular types using the defaulting rules ... ]] meaning that a definition may need further qualification in different environments?) #g ------------------- Graham Klyne PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E From diatchki@cse.ogi.edu Tue Mar 18 17:48:16 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Tue, 18 Mar 2003 09:48:16 -0800 Subject: Context not part of a function definition? In-Reply-To: <5.1.0.14.2.20030316141940.00b7c780@127.0.0.1> References: <5.1.0.14.2.20030316141940.00b7c780@127.0.0.1> Message-ID: <3E775BE0.7020804@cse.ogi.edu> hi, as people pointed out, you are running into the monomorphism restriction. IMHO it is annoying (for exactly the kind of reason you point out, and it also has some unexpected semantic implications) and of somewhat dubious value, but here is i think why it is in the languge. consider the example: let x = 1 + 2 in (x,x) the question is how many times will "x" be evaluated. normally one might reason as follows: if i "pull" on the 1st component of the pair, the evaluation of "x" will happen (and the result will be stored for later use), and later if i "pull" on the 2nd component, the result will be returned immediately without "x" being recomputed again. this is the idea of call by need evaluation (as opposed to call by name). the thing is that since numbers in Haskell are overloaded, the definition above is really something like this: let x num = (plus num) (fromInteger num 1) (fromInteger num 2) in (x,x) i.e. x is really a function that takes as an argument a record containing the implementations of the numeric operations for the paritcular numeric type. now since the results of function applications are usually not cached, this will cause "x" to be computed more than once. the monomorphism restriction "remedies" this problem by saying that the overloading for bindings that "don't look like functions" (e.g. "x" above) should be resolvable in only one way (so that the results can be cached), unless an expicit type signature is present (so that the programmer is aware of the overloading). often you can fix the problem by eta expanding to make things look like a funciton, e.g: nub x = List.nub x but this is annoying. hope this helped bye iavor Graham Klyne wrote: > I'm trying to use the following idiom to selectively import functions > from the List module: > > import qualified List > nub = List.nub > > but I'm finding that HUGS complains about "unresolved top level > overloading" with "outstanding context: "Eq b". > > If I duplicate the type signature thus: > > import qualified List > nub :: Eq a => [a] -> [a] > nub = List.nub > > All seems to be well. I find it counter-intuitive that I cannot simply > define > > a = b > > such that any occurrence of a is equivalent to an occurrence of b. I > thought that was the point of referential transparency in functional > languages. I don't know where to look in the Haskell documents to > decide whether the above is a bug or truly according to the language spec. > > #g > > > ------------------- > Graham Klyne > > PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From oleg@pobox.com Wed Mar 19 02:42:09 2003 From: oleg@pobox.com (oleg@pobox.com) Date: Tue, 18 Mar 2003 18:42:09 -0800 (PST) Subject: Class or parameterized type? Message-ID: <200303190242.h2J2g9nY084625@adric.fnmoc.navy.mil> Hello! > Example: I wish to define a structured container type, let's call it a > "RatsNest", that is type-variable in two ways: > (a) it is parameterized by a type of some class, let's call it "RatsTail", > such that a RatsNest is a structure of things that have common > properties. Certain operations between RatsNest values (e.g. a merge) are > valid only if they are containers for the same kind of RatsTail. Such > operations would not be different operations due to variation of thye > contained type. > (b) it can be implemented in various ways; e.g. a simple version is an > in-memory data structure, while another may be implemented in database > storage. This corresponds to the Haskell idea of overloading, or classes. Do you consider the standard design lacking? For example, -- sort of things to put into a RatNest class (Eq n) => RatTail n where is_the_same_rat:: n -> n -> Bool class (RatTail t) => RatNest c t where in_nest:: c t -> t -> Bool put:: c t -> t -> c t rat_fold:: (t -> z -> z) -> z -> (c t) -> z merge:: (RatNest c1 t) => c t -> c1 t -> c t merge c c1 = rat_fold put_perhaps c c1 where put_perhaps rat nest = if in_nest nest rat then nest else put nest rat instance RatTail Int where is_the_same_rat = (==) -- Pretend this is an in-memory implementation instance (RatTail t) => RatNest [] t where in_nest lst el = not $ null $ filter (is_the_same_rat el) lst put = (flip (:)) rat_fold = foldr -- Pretend this is a "disk" implementation -- At least it's unmarshalled. newtype Disk t = D String deriving Show instance (Read t, Show t, RatTail t) => RatNest Disk t where in_nest disk el = rat_fold (\item z -> z || is_the_same_rat item el) False disk put (D block) item = D $ '|' : ((show item) ++ block) rat_fold f z (D []) = z rat_fold f z (D ('|':block)) = f item $ rat_fold f z (D rest) where [(item,rest)] = readsPrec 1 block nest1 = [1,12,123] :: [Int] nest2 = D "" test1 = merge nest2 nest1 -- D "|1|12|123" test1' = merge test1 nest1 -- D "|1|12|123" test2 = merge [4,5,123] test1 -- [1,12,4,5,123] Haskell extensions are required, of course, because we use multi-parameter type classes. From fjh@cs.mu.OZ.AU Wed Mar 19 06:48:24 2003 From: fjh@cs.mu.OZ.AU (Fergus Henderson) Date: Wed, 19 Mar 2003 17:48:24 +1100 Subject: data vs. newtype, abstractly In-Reply-To: References: Message-ID: <20030319064824.GA9600@ceres.cs.mu.oz.au> On 09-Mar-2003, Hal Daume III wrote: > well, yes, but if you export: > > mkN :: Int -> N > mkD :: Int -> D > > or something like that, then they'll still bea ble to tell the difference, > right? Not necessarily. For example mkD could be defined as mkD x = x `seq` D x in which case I think it would behave exactly the same as mkN. -- Fergus Henderson | "I have always known that the pursuit The University of Melbourne | of excellence is a lethal habit" WWW: | -- the last words of T. S. Garp. From GK@ninebynine.org Wed Mar 19 05:21:52 2003 From: GK@ninebynine.org (Graham Klyne) Date: Wed, 19 Mar 2003 05:21:52 +0000 Subject: Class or parameterized type? In-Reply-To: <200303190242.h2J2g9nY084625@adric.fnmoc.navy.mil> Message-ID: <5.1.0.14.2.20030319051444.029c6b60@127.0.0.1> At 18:42 18/03/2003 -0800, oleg@pobox.com wrote: > > Example: I wish to define a structured container type, let's call it a > > "RatsNest", that is type-variable in two ways: [...] >Do you consider the standard design lacking? For example, I wasn't aware there was a standard design, but you have given me some pointers. Thanks! Studying your code was very interesting for me, as it has shown me something more of the kinds of idiom that work with Haskell. Concerning my question, I think the key part of your code is in: [[ class (RatTail t) => RatNest c t where ]] which I think is exactly what I was looking for, and is not a Haskell structure I've come across before. (I assume that this form does not indicate that RatNest... is a subclass of RatTail (as opposed to saying (RatTail t) => RatNest t); I certainly wouldn't want to have that.) I suppose this is the multi-parameter type class extension you mentioned. Can you say where this extension is described, and how widely implemented it is? Thank you for your response, I found it most helpful. #g ------------------- Graham Klyne PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E From simonpj@microsoft.com Wed Mar 19 13:44:07 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Wed, 19 Mar 2003 13:44:07 -0000 Subject: recursive modules in Haskell Message-ID: | i am curious however, what is difficult about implementing recursive=20 | modules (that is, if it can be explained without getting into the=20 | technical details of GHC). Nothing deep. GHC is just a fairly big thing and one of its assumptions is that it is compiling one module at a time. There'd be quite a bit of chuffing around to remove this assumption. Nothing fundamental, but real work. Simon From luna@update.uu.se Wed Mar 19 14:56:58 2003 From: luna@update.uu.se (Daniel Luna) Date: Wed, 19 Mar 2003 15:56:58 +0100 (CET) Subject: flock and sockets Message-ID: I am planning a Haskell project and I need to access files. Since the program will be automatically started whenever a mail comes in I will need to be able to lock the access to files. Is there any support for this in some library? The second option that I have is to use a daemon and let the programs that get started by mail connect via some sort of socket. Is there any socket support in Haskell? #Luna -- Daniel Luna | Top reasons that I have a beard: luna@update.uu.se | a) Laziness. http://www.update.uu.se/~luna/ | b) I can. Don't look at my homepage (it stinks).| c) I can get away with it. From elke@espresto.com Wed Mar 19 15:02:52 2003 From: elke@espresto.com (Elke Kasimir) Date: Wed, 19 Mar 2003 16:02:52 +0100 (CET) Subject: recursive modules in Haskell In-Reply-To: Message-ID: On 17-Mar-2003 Simon Peyton-Jones wrote: > >| there is no need to use such hacks. it is not dificult to add suport >| for mutually recursive modules to an implementation directly. >| unfortunatley none of the working haskell implementations support >| recursive modules, > > Simple in principle, not so simple in practice. If it was easy to make > GHC do mutually recursive modules we'd do it right away. It's certainly > possible but it's real work, and .hi-boot files, while clunky, do the > job. My original posting was partly aimed at Hugs, since I find it very convenient to use Hugs during development, though I finally compile the stuff with ghc. A Haskell-toHaskell precompiler would solve the problem for both Hugs and ghc. And I wasn't sure from my first look into the manual that hi-boot-Files are actually a feasible solution for mutual recursion at a greater scale. But since you both find hi-modules feasible, I'll try out them in the next version. Elke. -- Elke Kasimir EsPresto AG ----------------------------------------------------------------- - Software Development- Breite Str. 30-31 Tel/Fax: +49-30-90 226-750/-760 10178 Berlin/Germany From alastair@reid-consulting-uk.ltd.uk Wed Mar 19 15:18:47 2003 From: alastair@reid-consulting-uk.ltd.uk (Alastair Reid) Date: Wed, 19 Mar 2003 15:18:47 +0000 Subject: recursive modules in Haskell In-Reply-To: ("Simon Peyton-Jones"'s message of "Wed, 19 Mar 2003 13:44:07 -0000") References: Message-ID: Simon Peyton-Jones writes: > Nothing deep. GHC is just a fairly big thing and one of its > assumptions is that it is compiling one module at a time. There'd > be quite a bit of chuffing around to remove this assumption. > Nothing fundamental, but real work. The other big problem is that, in the worst case, you need to typecheck the entire program (however many modules that may be) at once. If your program happens to be GHC, Lolita or one of the other big Haskell programs, this might be prohibitively expensive. A potentially lightweight alternative that Simon PJ and I talked about some time ago (1998/9?) is to break the recursion between two modules by using type signatures on top-level definitions. The idea is to generate the .hi-boot files that GHC currently uses automatically. Suppose we have a pair of mutually recursive modules A and B, we can generate A.hi-boot as follows: - read all of A and B discarding all function bodies as we go. [It might be possible to avoid reading B - depending on how much checking is performed at this stage.] - check all the type, class and instance definitions in A and B - keep the type signatures for exported definitions from A, discard everything else [At this point, GHC would normally start typechecking function bodies and generating code but we can stop now because all we need to do is generate the .hi-boot file.] - write A.hi-boot This approach gives most of what we need from recursive modules. It has the advantage that it probably doesn't take too much effort to add to a compiler that already uses interface files. The big disadvantage is that you have to provide type signatures for any definitions involved in cyclic module dependency. This may not be too bad since Haskell style guides suggest that you should provide type signatures for all exported top-level definitions. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/ From simonmar@microsoft.com Wed Mar 19 16:34:50 2003 From: simonmar@microsoft.com (Simon Marlow) Date: Wed, 19 Mar 2003 16:34:50 -0000 Subject: flock and sockets Message-ID: <9584A4A864BD8548932F2F88EB30D1C60C3C67CA@tvp-msg-01.europe.corp.microsoft.com> > I am planning a Haskell project and I need to access files. Since the > program will be automatically started whenever a mail comes=20 > in I will need > to be able to lock the access to files. Is there any support=20 > for this in some library? Yes, the Posix library distributed with GHC has support for file locking. See http://www.haskell.org/ghc/docs/latest/html/hslibs/sec-posix.html This library is currently undergoing a rewrite - the functionality will be available under System.Posix in future releases of GHC (and possibly Hugs & NHC). > The second option that I have is to use a daemon and let the=20 > programs that > get started by mail connect via some sort of socket. Is there=20 > any socket support in Haskell? Yes: http://www.haskell.org/ghc/docs/latest/html/network/index.html (currently only available with GHC). Cheers, Simon From diatchki@cse.ogi.edu Wed Mar 19 17:23:39 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Wed, 19 Mar 2003 09:23:39 -0800 Subject: recursive modules in Haskell In-Reply-To: References: Message-ID: <3E78A79B.7040406@cse.ogi.edu> hi, Alastair Reid wrote: > Simon Peyton-Jones writes: > >>Nothing deep. GHC is just a fairly big thing and one of its >>assumptions is that it is compiling one module at a time. There'd >>be quite a bit of chuffing around to remove this assumption. >>Nothing fundamental, but real work. that's reasonable. incidently i think (but am not 100% on this) that one can still do most of the work one module at a time. it seems that only type checking needs to happen one strongly connected module component at a time. > The other big problem is that, in the worst case, you need to > typecheck the entire program (however many modules that may be) at > once. If your program happens to be GHC, Lolita or one of the other > big Haskell programs, this might be prohibitively expensive. you only need to type check one strongly connected component of modules at a time. of course it could be the case that your whole program is one big strongly connected component, but that is not that easy to achieve. along those lines - it is of course possible to write a program where all *functions* are mutually recursive, but we don't usually do that. in fact it is very likely that most nontrivial programs have at least two SCCs as it is not usual to import the Main module in other moudles. and of course, most of the time modules don't need to be recusrive and then each module is in a SCC of its own. i very much doubt that GHC has more than a few modules per SCC, but perhaps one of the simons can give us a more definitive answer on that. bye iavor -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From Steffen.Mazanek@UniBw-Muenchen.de Wed Mar 19 20:35:03 2003 From: Steffen.Mazanek@UniBw-Muenchen.de (Steffen Mazanek) Date: 19 Mar 2003 20:35:03 +0000 Subject: History of Haskell, first draft Message-ID: <86vfyfqemg.fsf@pseiko.studfb.unibw-muenchen.de> Hello, a first draft of my little Haskell-history collection is online now: http://pseiko.gmxhome.de/pseiko/Haskell-History.html Please note, that one part is still just copied from http://www.idt.mdh.se/kurser/cd5100/ht02/history.html but I hope it will evolve quickly. Moreover some parts are still missing. So please understand it as a framework and base where all kinds of additional contributions are pluggable. A big thank you to all helpers. Ciao, Steffen From rjmh@cs.chalmers.se Thu Mar 20 08:19:10 2003 From: rjmh@cs.chalmers.se (John Hughes) Date: Thu, 20 Mar 2003 09:19:10 +0100 (MET) Subject: flock and sockets In-Reply-To: <9584A4A864BD8548932F2F88EB30D1C60C3C67CA@tvp-msg-01.europe.corp.microsoft.com> References: <9584A4A864BD8548932F2F88EB30D1C60C3C67CA@tvp-msg-01.europe.corp.microsoft.com> Message-ID: On Wed, 19 Mar 2003, Simon Marlow wrote: > > I am planning a Haskell project and I need to access files. Since the > > program will be automatically started whenever a mail comes > > in I will need > > to be able to lock the access to files. Is there any support > > for this in some library? > > Yes, the Posix library distributed with GHC has support for file > locking. See > > http://www.haskell.org/ghc/docs/latest/html/hslibs/sec-posix.html > > This library is currently undergoing a rewrite - the functionality will > be available under System.Posix in future releases of GHC (and possibly > Hugs & NHC). > I didn't find this when I needed to lock files, so my solution (under Unix) was to write a little C code and call it via the FFI. I used a single lock file, since my application was a CGI script which runs fairly rarely -- there's no need for a finer grain of locking. Here's the C code (taken from the web and slightly adapted): #include #include void claimLock() { struct flock fl; int fd; fl.l_type = F_WRLCK; /* F_RDLCK, F_WRLCK, F_UNLCK */ fl.l_whence = SEEK_SET; /* SEEK_SET, SEEK_CUR, SEEK_END */ fl.l_start = 0; /* Offset from l_whence */ fl.l_len = 0; /* length, 0 = to EOF */ fl.l_pid = getpid(); /* our PID */ fd = open("lock", O_WRONLY); fcntl(fd, F_SETLKW, &fl); /* F_GETLK, F_SETLK, F_SETLKW */ } Here's the corresponding Haskell declaration: foreign import claimLock :: IO () John Hughes From kyagrd@bawi.org Thu Mar 20 07:28:47 2003 From: kyagrd@bawi.org (Ahn Ki-yung) Date: Thu, 20 Mar 2003 16:28:47 +0900 Subject: Web server code in Haskell by Simon Marlow? Message-ID: <3E796DAF.7060208@hitel.net> I am very interested in writing server programs in haskell. There is a link to a paper and code of haskell web server in the following page. http://www.haskell.org/practice.html I can see the case study paper, but there is no code at the link location. I think inspecting through code might be very helpful, even if it does not compiling in the recent version of GHC. Please notice me where I can see the code if it is available. Also I hope the link at the haskell hompage be updated as well :-) Thanks. -- Ahn Ki-yung From simonmar@microsoft.com Thu Mar 20 12:14:19 2003 From: simonmar@microsoft.com (Simon Marlow) Date: Thu, 20 Mar 2003 12:14:19 -0000 Subject: Web server code in Haskell by Simon Marlow? Message-ID: <9584A4A864BD8548932F2F88EB30D1C60C4A2F1E@tvp-msg-01.europe.corp.microsoft.com> > I am very interested in writing server programs in haskell. >=20 > There is a link to a paper and code of haskell web server > in the following page. >=20 > http://www.haskell.org/practice.html > > I can see the case study paper, but there is no code at > the link location. I think inspecting through code might be > very helpful, even if it does not compiling in the recent > version of GHC. The link is out of date. The code is now in the CVS repository, and it has a proper license. You can browse it on the web, here: http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/hws/ Cheers, Simon From Alistair_Bayley@ldn.invesco.com Thu Mar 20 12:20:50 2003 From: Alistair_Bayley@ldn.invesco.com (Bayley, Alistair) Date: Thu, 20 Mar 2003 12:20:50 -0000 Subject: Web server code in Haskell by Simon Marlow? Message-ID: <6082F3448BC3364693FE37EA47D143DA2191D3@zGBLONEX06> This was mentioned earlier this month, see: http://haskell.org/pipermail/haskell/2003-March/011372.html http://haskell.org/pipermail/haskell/2003-March/011371.html -----Original Message----- From: Ahn Ki-yung [mailto:kyagrd@hitel.net] Sent: 20 March 2003 07:29 To: haskell@haskell.org Subject: Web server code in Haskell by Simon Marlow? *** WARNING - this email originates from the Internet *** I am very interested in writing server programs in haskell. There is a link to a paper and code of haskell web server in the following page. http://www.haskell.org/practice.html I can see the case study paper, but there is no code at the link location. I think inspecting through code might be very helpful, even if it does not compiling in the recent version of GHC. Please notice me where I can see the code if it is available. Also I hope the link at the haskell hompage be updated as well :-) Thanks. -- Ahn Ki-yung _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell *********************************************************************** INVESCO UK can accept no responsibility for the nature of this e-mail. If you have grounds to suspect that it is offensive or non-business related it should be deleted immediately. If you require an incoming Internet e-mail to be checked for content on your behalf please forward to the designated business mail parking area. If you wish to report the receipt of an offensive e-mail contact the IT Security section within London or Henley. It is an INVESCO UK policy that all Information Systems must be used for business related purposes. In order to protect the company's image and all personnel INVESCO UK Information Systems will be subject to monitoring. Disciplinary action will be taken against anyone who stores, distributes or displays inappropriate material. *********************************************************************** ***************************************************************** The information in this email and in any attachments is confidential and intended solely for the attention and use of the named addressee(s). This information may be subject to legal professional or other privilege or may otherwise be protected by work product immunity or other legal rules. It must not be disclosed to any person without our authority. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are not authorised to and must not disclose, copy, distribute, or retain this message or any part of it. ***************************************************************** From m.p.donadio@ieee.org Thu Mar 20 17:30:22 2003 From: m.p.donadio@ieee.org (Matthew Donadio) Date: Thu, 20 Mar 2003 12:30:22 -0500 Subject: Looking for Libraries Message-ID: <3E79FAAE.C473165B@ieee.org> Hi all, This is probably a long shot, but I am looking for a few libraries and don't want to put effort into something that has already been done. Is there a high level Haskell graphics library that would give functionality similar to gnuplot? I know I could build one myself, but I hate graphics programming. Does anyone have an FFI interface to LAPACK? Does anyone have an FFI interface to a free linear program solver? Or, a Haskell implmentation of the two-step simplex method? (I sold my copy of Chvatal's book in college for beer money). Thanks. -- Matthew Donadio (m.p.donadio@ieee.org) From wferi@afavant.elte.hu Thu Mar 20 19:09:59 2003 From: wferi@afavant.elte.hu (Ferenc Wagner) Date: Thu, 20 Mar 2003 20:09:59 +0100 Subject: Looking for Libraries In-Reply-To: <3E79FAAE.C473165B@ieee.org> (Matthew Donadio's message of "Thu, 20 Mar 2003 12:30:22 -0500") References: <3E79FAAE.C473165B@ieee.org> Message-ID: <3o65qdvoqg.fsf@tba.elte.hu> Matthew Donadio writes: > Is there a high level Haskell graphics library that would > give functionality similar to gnuplot? Why not simply USE gnuplot? Or plotutils? They have simple textual interfaces, do good work, and are fairly standard tools (on a Unix system, at least). > Does anyone have an FFI interface to LAPACK? Have a look at http://www.haskell.org/pipermail/haskell/2002-June/009833.html Feri. From oleg@pobox.com Thu Mar 20 19:41:14 2003 From: oleg@pobox.com (oleg@pobox.com) Date: Thu, 20 Mar 2003 11:41:14 -0800 (PST) Subject: Class or parameterized type? In-Reply-To: <5.1.0.14.2.20030319051444.029c6b60@127.0.0.1> Message-ID: <200303201941.h2KJfEL9089435@adric.fnmoc.navy.mil> Hello! > I wasn't aware there was a standard design, Edison is a good standard (in particular, Collection.hs, found, for example, in /usr/local/share/hugs/lib/exts/). The following projects have a lot of helpful code: http://sourceforge.net/projects/hbase/ http://sourceforge.net/projects/hfl/ > [[ > class (RatTail t) => RatNest c t where > ]] > which I think is exactly what I was looking for, and is not a Haskell > structure I've come across before. (I assume that this form does not > indicate that RatNest... is a subclass of RatTail (as opposed to saying > (RatTail t) => RatNest t); I certainly wouldn't want to have that.) Indeed, > class (RatTail t) => RatNest c t where says that collections of a class RatNest have elements of a class RatTail t: but collections themselves are not in the class RatTail. Using the OOP slang (which I hate), RatNest has-a RatTail but RatNest is-not-a RatTail. The method is_the_same_rat applies, in general, only to the elements of a RatNest, but not to the nest itself. Nothing prevents us from declaring a particular instance of a RatNest to be an instance of a RatTail as well. We can then store those instances in a RatNest. Nothing prevents us from making any RatNest a RatTail, so we can always store nests inside nests. -- sort of things to put into a RatNest -- Unlike the code in the previous message, -- this class declaration does not have the Eq context class RatTail n where is_the_same_rat:: n -> n -> Bool class (RatTail t) => RatNest c t where in_nest:: c t -> t -> Bool put:: c t -> t -> c t rat_fold:: (t -> z -> z) -> z -> (c t) -> z merge:: (RatNest c1 t) => c t -> c1 t -> c t merge c c1 = rat_fold put_perhaps c c1 where put_perhaps rat nest = if in_nest nest rat then nest else put nest rat instance RatTail Int where is_the_same_rat = (==) -- Pretend this is an in-memory implementation instance (RatTail t) => RatNest [] t where in_nest lst el = not $ null $ filter (is_the_same_rat el) lst put = (flip (:)) rat_fold = foldr -- Pretend this is a "disk" implementation -- At least it's unmarshalled. newtype Disk t = D String deriving Show instance (Read t, Show t, RatTail t) => RatNest Disk t where in_nest disk el = rat_fold (\item z -> z || is_the_same_rat item el) False disk put (D block) item = D $ '|' : ((show item) ++ block) rat_fold f z (D []) = z rat_fold f z (D ('|':block)) = f item $ rat_fold f z (D rest) where [(item,rest)] = readsPrec 1 block nest1 = [1,12,123] :: [Int] nest2 = D "" test1 = merge nest2 nest1 -- D "|1|12|123" test1' = merge test1 nest1 -- D "|1|12|123" test2 = merge [4,5,123] test1 -- [1,12,4,5,123] -- Every RatNest is a RatTail instance (RatTail t, RatNest c t) => RatTail (c t) where is_the_same_rat c1 c2 = subnest c1 c2 && subnest c2 c1 where subnest c1 c2 = rat_fold (\item res -> in_nest c1 item && res) True c2 -- Now we can make nests of nests test3 = merge [nest1] [test2] -- [[1,12,4,5,123],[1,12,123]] test3' = merge [nest1] [nest1] -- [[1,12,123]] test4 = put nest2 nest1 -- "|[1,12,123]" test5 = merge test4 (put test4 test2) -- D "|[1,12,4,5,123]|[1,12,123]" test7 = put [] test5 -- [D "|[1,12,4,5,123]|[1,12,123]"] The test7 shows three nested nests. > I suppose this is the multi-parameter type class extension you > mentioned. Can you say where this extension is described, and how widely > implemented it is? GHC (with the flag -fglasgow-exts) and Hugs (with the flag -98) implement it. I think NHC does too. From m.p.donadio@ieee.org Thu Mar 20 19:53:28 2003 From: m.p.donadio@ieee.org (Matthew Donadio) Date: Thu, 20 Mar 2003 14:53:28 -0500 Subject: Looking for Libraries References: <3E79FAAE.C473165B@ieee.org> <3o65qdvoqg.fsf@tba.elte.hu> Message-ID: <3E7A1C38.FF6E3C06@ieee.org> Ferenc Wagner wrote: > > Is there a high level Haskell graphics library that would > > give functionality similar to gnuplot? > > Why not simply USE gnuplot? Or plotutils? They have simple > textual interfaces, do good work, and are fairly standard > tools (on a Unix system, at least). I would like to be able to have plotting capabilities directly from a Haskell program rather than using a spawned process and temporary files, especially for interactive programs. This approach would probably work well enough, though. > > Does anyone have an FFI interface to LAPACK? > > Have a look at > http://www.haskell.org/pipermail/haskell/2002-June/009833.html Duh. I thought I looked through the archives for this, but I guess I didn't. Thanks. -- Matthew Donadio (m.p.donadio@ieee.org) From wferi@afavant.elte.hu Thu Mar 20 20:41:11 2003 From: wferi@afavant.elte.hu (Ferenc Wagner) Date: Thu, 20 Mar 2003 21:41:11 +0100 Subject: Looking for Libraries In-Reply-To: <3E7A1C38.FF6E3C06@ieee.org> (Matthew Donadio's message of "Thu, 20 Mar 2003 14:53:28 -0500") References: <3E79FAAE.C473165B@ieee.org> <3o65qdvoqg.fsf@tba.elte.hu> <3E7A1C38.FF6E3C06@ieee.org> Message-ID: <3oadfpn53s.fsf@tba.elte.hu> Matthew Donadio writes: > I would like to be able to have plotting capabilities > directly from a Haskell program rather than using a > spawned process Plotutils' functionality is included in a library. You can easily write an FFI wrapper for that. But I agree that a native module would be better... On the other hand, Octave uses Gnuplot for interactive purposes, too (and I also did in a smaller project). The CVS Gnuplot also has mouse support, which makes it even more usable this way. I don't know an example, though. Feri. From hdaume@ISI.EDU Thu Mar 20 22:42:41 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Thu, 20 Mar 2003 14:42:41 -0800 (PST) Subject: simulating dynamic dispatch Message-ID: hi all, i'm hoping to be able to simulate a sort of dynamic dispatch based on class instances. basically a function which takes a value and depending on what classes it is an instance of, does something. a simple example might be a 'maybeShow' function which sematically looks like: > maybeShow x > | typeOf x `instanceOf` Show = show x > | otherwise = "?" I've been trying for a while to simulate something along the lines of: > class Foo a where { foo :: a -> Bool } > class Bar a where { bar :: a -> Bool } > foo x > | typeOf x `instanceOf` Foo = Just (foo x) > | typeOf x `instanceOf` Bar = Just (bar x) > | otherwise = Nothing and I tried using dynamics but those require instances of typeable on universally quantified types, which doesn't work out too well in practice. also, we can do class sums using existential types: > data FB = forall a . Foo a => MkFoo a | forall a . Bar a => MkBar a and i tried something like: class FooBar a where wasFoo :: a -> Maybe FB -- will be MkFoo wasBar :: a -> Maybe FB -- will be MkBar wasFoo _ = Nothing wasBar _ = Nothing instance Foo a => FooBar a where wasFoo a = Just (MkFoo a) instance Bar a => FooBar a where wasBar a = Just (MkBar a) but this complains about duplicate instance declarations (for obvious reasons). i'm hoping one of the type class gurus out there can help me. Thanks in advance! -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume From oleg@pobox.com Fri Mar 21 02:28:24 2003 From: oleg@pobox.com (oleg@pobox.com) Date: Thu, 20 Mar 2003 18:28:24 -0800 (PST) Subject: flock and sockets Message-ID: <200303210228.h2L2SOxq089962@adric.fnmoc.navy.mil> John Hughes wrote: > I didn't find this when I needed to lock files, so my solution (under > Unix) was to write a little C code and call it via the FFI. I used a > single lock file, since my application was a CGI script which runs fairly > rarely -- there's no need for a finer grain of locking. Many Linux/Unix systems come with 'procmail' installed. One part of that installation is a nifty program called 'lockfile': /tmp> lockfile -h Usage: lockfile -v | -nnn | -r nnn | -l nnn | -s nnn | -! | -ml | -mu | file... -v display the version number and exit -nnn wait nnn seconds between locking attempts -r nnn make at most nnn retries before giving up on a lock -l nnn set locktimeout to nnn seconds -s nnn suspend nnn seconds after a locktimeout occurred -! invert the exitcode of lockfile -ml lock your system mail-spool file -mu unlock your system mail-spool file The man page is quite informative. The program is specifically intended to be used in shell scripts. Therefore, we can use 'lockfile' in any language system that is capable of executing a shell command. In Hugs, we can use > import System (system, ExitCode(ExitSuccess)) > do { system ("lockfile -ml") >>= \ExitSuccess -> print "OK" } Therefore, we do not have to use FFI, we do not have to compile our scripts. We can lock files right in Hugs or GHCi. Daniel Luna wrote: > The second option that I have is to use a daemon and let the programs that > get started by mail connect via some sort of socket. Is there any socket > support in Haskell? One of the easiest ways of accomplishing this is by using inetd or xinetd. In this case, your application _only_ needs to read from the standard input and write into the standard output. An interactive (that is, not a single request-single reply) daemon should also be able to flush the standard output or set it to an unbuffered/line buffered discipline. The application needs to know nothing at all about sockets. Your network daemon could be just a (uncompiled) Haskell code, interpreted by Hugs or GHCi. For example, if you use inetd, you need to get your sysadm to add the following line mysrv 13720/tcp # my service, to listen on port 13720 into /etc/services and the following line mysrv stream tcp nowait yourname /home/you/daemon /home/you/daemon into /etc/inetd.conf and reHUP the inetd. The file /home/you/daemon (with executable permissions set) is a start-up shell script #!/bin/sh cd /home/you/directory PATH=right-path exec hugs -flags your-script.lhs From oleg@pobox.com Fri Mar 21 04:19:03 2003 From: oleg@pobox.com (oleg@pobox.com) Date: Thu, 20 Mar 2003 20:19:03 -0800 (PST) Subject: simulating dynamic dispatch Message-ID: <200303210419.h2L4J37B090209@adric.fnmoc.navy.mil> > i'm hoping to be able to simulate a sort of dynamic dispatch based on > class instances. It seems you want to dispatch based not on a type but on the constraint of a type. You code almost worked. Here's the a bit updated and working version. class Foo a where { foo :: a -> Bool } class Bar a where { bar :: a -> Bool } data FB = forall a . Foo a => MkFoo a | forall a . Bar a => MkBar a instance Foo FB where foo (MkFoo x) = foo x instance Bar FB where bar (MkBar x) = bar x -- some instances for the test instance Foo Int where foo x = x == 0 instance Bar Char where bar x = x == 'a' test x = case x of (MkFoo a) -> Just $ foo a (MkBar a) -> Just $ bar a -- _ -> Nothing -- *Main> test $ MkFoo (0::Int) -- Just True -- *Main> test $ MkFoo (10::Int) -- Just False -- *Main> test $ MkBar 'a' -- Just True -- *Main> test $ MkBar 'b' -- Just False From hdaume@ISI.EDU Fri Mar 21 05:23:26 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Thu, 20 Mar 2003 21:23:26 -0800 (PST) Subject: simulating dynamic dispatch In-Reply-To: <200303210419.h2L4J37B090209@adric.fnmoc.navy.mil> Message-ID: > -- *Main> test $ MkFoo (0::Int) > -- Just True > -- *Main> test $ MkFoo (10::Int) > -- Just False > -- *Main> test $ MkBar 'a' > -- Just True > -- *Main> test $ MkBar 'b' > -- Just False ah, yes. i was aware that would work. i forgot to mention the constraint that i don't want the user to have to use the MkFoo/MkBar constructors. if i could use them internally to 'test', that would be great, but that's what i couldn't get to work :). From fjh@cs.mu.OZ.AU Fri Mar 21 06:49:44 2003 From: fjh@cs.mu.OZ.AU (Fergus Henderson) Date: Fri, 21 Mar 2003 17:49:44 +1100 Subject: simulating dynamic dispatch In-Reply-To: References: Message-ID: <20030321064944.GA14419@ceres.cs.mu.oz.au> On 20-Mar-2003, Hal Daume III wrote: > i'm hoping to be able to simulate a sort of dynamic dispatch based on > class instances. basically a function which takes a value and depending > on what classes it is an instance of, does something. I call this feature "dynamic type class casts". But there are some difficulties in defining the semantics of this. What should it mean in the presence of dynamic loading? If you're allowed to dynamically load new modules that might contain new instance declarations, and you're allowed to check (in a non-IO-monad context) whether a type is an instance of a type class, and you want things to remain referentially transparent, then you've got a problem. > i tried something like: > > class FooBar a where > wasFoo :: a -> Maybe FB -- will be MkFoo > wasBar :: a -> Maybe FB -- will be MkBar > wasFoo _ = Nothing > wasBar _ = Nothing > > instance Foo a => FooBar a where > wasFoo a = Just (MkFoo a) > > instance Bar a => FooBar a where > wasBar a = Just (MkBar a) > > but this complains about duplicate instance declarations (for obvious > reasons). You can use instance declarations for whichever ground types you need, e.g. instance FooBar Int where ... instance FooBar String where ... -- Fergus Henderson | "I have always known that the pursuit The University of Melbourne | of excellence is a lethal habit" WWW: | -- the last words of T. S. Garp. From gk@ninebynine.org Fri Mar 21 00:03:37 2003 From: gk@ninebynine.org (Graham Klyne) Date: Fri, 21 Mar 2003 00:03:37 +0000 Subject: Class or parameterized type? In-Reply-To: <200303201941.h2KJfEL9089435@adric.fnmoc.navy.mil> References: <5.1.0.14.2.20030319051444.029c6b60@127.0.0.1> Message-ID: <5.1.0.14.2.20030320235159.02ed9d40@127.0.0.1> At 11:41 20/03/2003 -0800, you wrote: > > I suppose this is the multi-parameter type class extension you > > mentioned. Can you say where this extension is described, and how widely > > implemented it is? > >GHC (with the flag -fglasgow-exts) and Hugs (with the flag -98) >implement it. I think NHC does too. Excellent! Your (previous) code example turned out to be extremely helpful. I was having a hard time figuring out what I needed to do to get my code to work in a reasonable fashion for my purposes, and it provided just the pointers I needed to break the logjam. Having it in a complete form with simple test cases was particularly helpful, and having got the type signatures sorted out I'm making much better progress on my project. Much appreciated. Having tried briefly to work without them, I now think multi-parameter classes are a really important extension for a range of programming tasks. Having support in Hugs and GHC seems to me like an important threshold of support. Thank you for your help. #g ------------------- Graham Klyne PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E From simonpj@microsoft.com Fri Mar 21 08:14:10 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Fri, 21 Mar 2003 08:14:10 -0000 Subject: simulating dynamic dispatch Message-ID: You might also find the 'cast' function in Section 3 of "Scrap your boilerplate" useful. http://research.microsoft.com/~simonpj/papers/hmap/ I'm not certain, but it has the right smell. Simon | -----Original Message----- | From: oleg@pobox.com [mailto:oleg@pobox.com] | Sent: 21 March 2003 04:19 | To: hdaume@ISI.EDU; haskell@haskell.org | Subject: Re: simulating dynamic dispatch |=20 |=20 | > i'm hoping to be able to simulate a sort of dynamic dispatch based on | > class instances. |=20 | It seems you want to dispatch based not on a type but on the | constraint of a type. |=20 | You code almost worked. Here's the a bit updated and working version. |=20 | class Foo a where { foo :: a -> Bool } | class Bar a where { bar :: a -> Bool } |=20 | data FB =3D forall a . Foo a =3D> MkFoo a | forall a . Bar a =3D> = MkBar a |=20 | instance Foo FB where | foo (MkFoo x) =3D foo x |=20 | instance Bar FB where | bar (MkBar x) =3D bar x |=20 | -- some instances for the test | instance Foo Int where | foo x =3D x =3D=3D 0 |=20 | instance Bar Char where | bar x =3D x =3D=3D 'a' |=20 |=20 | test x =3D case x of | (MkFoo a) -> Just $ foo a | (MkBar a) -> Just $ bar a | -- _ -> Nothing |=20 |=20 | -- *Main> test $ MkFoo (0::Int) | -- Just True | -- *Main> test $ MkFoo (10::Int) | -- Just False | -- *Main> test $ MkBar 'a' | -- Just True | -- *Main> test $ MkBar 'b' | -- Just False |=20 | _______________________________________________ | Haskell mailing list | Haskell@haskell.org | http://www.haskell.org/mailman/listinfo/haskell From Markus.Schnell@infineon.com Fri Mar 21 08:16:08 2003 From: Markus.Schnell@infineon.com (Markus.Schnell@infineon.com) Date: Fri, 21 Mar 2003 09:16:08 +0100 Subject: simulating dynamic dispatch Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C2EF82.201B9260 Content-Type: text/plain; charset="iso-8859-1" I think you are looking like something done in the HTML-Combinator-libraries. I tried something like that some time ago, but didn't finish. But perhaps you can get an idea from that. See the files with this mail. (The code is in unknown condition.) Markus > ah, yes. i was aware that would work. i forgot to mention > the constraint > that i don't want the user to have to use the MkFoo/MkBar > constructors. if i could use them internally to 'test', that would be > great, but that's what i couldn't get to work :). ------_=_NextPart_000_01C2EF82.201B9260 Content-Type: application/octet-stream; name="SaveExFStruct.hs" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="SaveExFStruct.hs" {- (C)2002 Markus Schnell -}=0A= =0A= module Main=0A= where=0A= =0A= {-=0A= This module demonstrates the use of the FStruct module.=0A= -}=0A= =0A= import SaveFStruct=0A= =0A= main =3D do=0A= putStrLn "The FStruct module, Markus Schnell, 2002"=0A= putStrLn "----------------------------------------"=0A= =0A= let exf =3D [name =3D: [vorname =3D: "Peter", nachname =3D: "Post"], = age =3D: (23::Int)]=0A= let fa =3D [vorname =3D: "Peter"]=0A= let fb =3D [nachname =3D: "Post"]=0A= af =3D [vorname =3D: "Paul"]=0A= let fc =3D fa ! fb =0A= fd =3D fa ! fa=0A= fe =3D fa ! af=0A= putStrLn (show exf)=0A= putStrLn (show fc)=0A= putStrLn (show fd)=0A= putStrLn (show fe)=0A= =0A= --- Es darf nicht beliebige Strukturen geben, the Structures should be = given Types=0A= name =3D mkArg "name"=0A= vorname =3D mkArg "vorname"=0A= nachname =3D mkArg "nachname"=0A= age =3D mkArg "age"=0A= =0A= =0A= =0A= {- =3D=3D=3D=3D=3D=3D List of Examples =3D=3D=3D=3D=3D=3D -}=0A= =0A= -- Examples that should work --=0A= -- indexing=0A= =0A= -- Examples that shouldn't work --=0A= -- e.g. wrong types=0A= =0A= ------_=_NextPart_000_01C2EF82.201B9260 Content-Type: application/octet-stream; name="SaveFStruct.hs" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="SaveFStruct.hs" {- Author: Markus Schnell, 2002 -}=0A= =0A= -- This module may be used freely. Direct comments to = haskell@markusschnell.com=0A= =0A= module SaveFStruct -- Feature Structure=0A= (FStruct=0A= ,Argument=0A= ,mkArg -- :: String -> Argument=0A= ,VALUE =0A= ,Value(Val)=0A= ,(=3D:) -- :: (VALUE a) =3D> Argument -> a -> Feature=0A= ,(!) -- :: FStruct -> FStruct -> Maybe FStruct (unification)=0A= )=0A= where=0A= =0A= {-=0A= What should the interface of a feature structure look like?=0A= Has anybody comments?=0A= How can I avoid (3::Int) for Integers?=0A= -}=0A= =0A= {-=0A= A feature structure is a data type with a collection of attributes, = which=0A= have values. These values can be atomic or can b e feature = structures=0A= themselves.=0A= To have more control and safety one has to specify which values are = possible=0A= for some feature. This can be done with a class system.=0A= -}=0A= =0A= import List=0A= import Monad=0A= =0A= =0A= =0A= =0A= =0A= {- =3D=3D=3D=3D=3D=3D Values =3D=3D=3D=3D=3D=3D -}=0A= =0A= {- Zun=8Achst muss ich das Problem l=9Asen, dass Int und String ohne = explizite Angabe =0A= in den Typ Value umgewandelt werden -}=0A= =0A= newtype Value =3D Val String deriving Eq=0A= =0A= class VALUE a where=0A= toValue :: a -> Value=0A= toValueFromList :: [a] -> Value=0A= toValueFromList xs =3D Val ("[" ++ (concat . intersperse ", ") [x | = (Val x) <- map toValue xs] ++ "]")=0A= =0A= instance (VALUE a) =3D> VALUE [a] where=0A= toValue xs =3D toValueFromList xs=0A= =0A= instance VALUE Value where=0A= toValue a =3D a=0A= =0A= instance VALUE Int where=0A= toValue a =3D Val (showint a)=0A= where showint :: Int -> String=0A= showint =3D show=0A= =0A= instance VALUE Char where=0A= toValue a =3D Val (show a)=0A= toValueFromList str =3D Val (show str)=0A= =0A= =0A= instance Show Value where=0A= showsPrec _ (Val s) =3D showString s=0A= =0A= =0A= =0A= =0A= =0A= =0A= {- =3D=3D=3D=3D=3D=3D Feature Structures =3D=3D=3D=3D=3D=3D -}=0A= =0A= type FStruct =3D [Feature]=0A= data Feature =3D (:=3D) { arg :: Argument, val :: Value }=0A= newtype Argument =3D Arg String deriving Eq=0A= =0A= (=3D:) :: (VALUE a) =3D> Argument -> a -> Feature=0A= arg =3D: val =3D arg :=3D (toValue val)=0A= =0A= instance VALUE Feature where=0A= toValue f =3D Val (show f)=0A= =0A= mkArg :: String -> Argument=0A= mkArg =3D Arg . id=0A= =0A= instance Show Feature where=0A= showsPrec _ (Arg arg :=3D Val s) =3D showString (arg ++ " =3D: " ++ = s)=0A= =0A= =0A= =0A= =0A= =0A= =0A= {- =3D=3D=3D=3D=3D=3D Unification =3D=3D=3D=3D=3D=3D -}=0A= =0A= {- Unification can fail -> Maybe -}=0A= =0A= (!) :: FStruct -> FStruct -> Maybe FStruct=0A= (!) =3D foldM (flip merge)=0A= =0A= -- put feature into structure=0A= merge :: Feature -> FStruct -> Maybe FStruct=0A= merge feat fs =3D=0A= if null sameArg=0A= then Just (feat:fs)=0A= else if val feat =3D=3D val (head sameArg)=0A= then Just fs=0A= else Nothing -- unification failed=0A= where=0A= sameArg =3D filter (\x -> arg x =3D=3D arg feat) fs=0A= ------_=_NextPart_000_01C2EF82.201B9260-- From Markus.Schnell@infineon.com Fri Mar 21 08:19:39 2003 From: Markus.Schnell@infineon.com (Markus.Schnell@infineon.com) Date: Fri, 21 Mar 2003 09:19:39 +0100 Subject: Scrap your Boilerplate Message-ID: Does the "zipper" fall into this category? http://haskell.org/wiki/wiki?TheZipper Markus > You might also find the 'cast' function in Section 3 of "Scrap your > boilerplate" useful. > http://research.microsoft.com/~simonpj/papers/hmap/ > I'm not certain, but it has the right smell. > Simon From gvidal@dsic.upv.es Fri Mar 21 11:10:58 2003 From: gvidal@dsic.upv.es (German Vidal) Date: Fri, 21 Mar 2003 12:10:58 +0100 (CET) Subject: WFLP'03: Deadline extension --> April 2 Message-ID: ********************************************************************** NEW: The deadline for submissions to WFLP 2003 has been extended to April 2, 2003 ********************************************************************** ====================================================================== SECOND CALL FOR PAPERS WFLP 2003 12th Int'l Workshop on Functional and (Constraint) Logic Programming June 12-13, 2003, Valencia (Spain) http://www.dsic.upv.es/~rdp03/wflp/ ====================================================================== WFLP is the International Workshop on Functional and (Constraint) Logic Programming. WFLP'03, the twelfth in the series, will be held in Valencia, Spain, June 12-13, 2003, at the Federated Conference on Rewriting, Deduction and Programming (RDP'03) http://www.dsic.upv.es/~rdp03/ The WFLP workshops aim at bringing together researchers interested in functional programming, (constraint) logic programming, as well as their integration. It promotes the cross-fertilizing exchange of ideas and experiences among researches and students from the different communities interested in the foundations, applications, and combina- tions of high-level, declarative programming languages and related areas.The technical program of the workshop will include invited talks, presentations of refereed papers and demo presentations. Previous editions of the workshop have been held in Grado (Italy), Kiel (Germany), Benicassim (Spain), Grenoble (France), Bad Honnef (Germany), Schwarzenberg (Germany), Marburg (Germany), Rattenberg (Germany), and Karlsruhe (Germany). ---------------------------------------------------------------------- TOPICS OF INTEREST WFLP'03 solicits papers in all areas of functional and (constraint) logic programming, including (but not limited to): * Language Design: modules and type systems, multi-paradigm languages, concurrency and distribution, objects * Foundations: formal semantics, rewriting and narrowing, nonmonotonic reasoning, dynamics, type theory * Implementation: abstract machines, parallelism, compile-time and run-time optimizations, interfacing with external languages * Transformation and Analysis: abstract interpretation, specialization, partial evaluation, program transformation, meta-programming * Software Engineering: design patterns, specification, verification and validation, debugging, test generation * Applications: declarative programming in education and industry, domain-specific languages, visual/graphical user interfaces,embedded systems, WWW applications, knowledge representation and machine learning, deductive databases, advanced programming environments and tools The main focus is on new and original research results but submissions describing innovative products, prototypes under development or interesting experiments (e.g., benchmarks) are also encouraged. ---------------------------------------------------------------------- IMPORTANT DATES Submission of papers: Wednesday, April 2, 2003 Notification of acceptance: Friday, April 25, 2003 Camera-ready papers: Sunday, May 11, 2003 Workshop: June 12 - 13, 2003 ---------------------------------------------------------------------- SUBMISSION Authors are invited to submit an extended abstract (no longer than 12 pages including figures and references) or a system description (no longer than 4 pages) in Postscript or PDF format (Springer LNCS style) via email to gvidal@dsic.upv.es before April 2, 2003. Submissions should include the title, authors' names, affiliations, addresses, and e-mail. ---------------------------------------------------------------------- PUBLICATION Accepted papers will be included in the preliminary proceedings that will be available at the workshop. After the workshop, authors of the best abstracts will be invited to submit full papers.These full papers will be reviewed and accepted papers will appear in the Electronic Notes in Theoretical Computer Science (Elsevier). ---------------------------------------------------------------------- BEST NEWCOMER AWARD An award will be given to the best paper exclusively written by one or several young researchers who have not yet obtained their PhD degrees. Papers written in this category should be clearly marked "Student papers" in the submission. ---------------------------------------------------------------------- PROGRAM COMMITTEE Maria Alpuente (Technical University of Valencia, Spain) Sergio Antoy (Portland State University, USA) Annalisa Bossi (Universita Ca' Foscari di Venezia, Italy) Olaf Chitil (University of York, UK) Rachid Echahed (Institut IMAG, France) Sandro Etalle (University of Twente, The Netherlands) Moreno Falaschi (Universita di Udine, Italy) Michael Hanus (CAU Kiel, Germany) Yukiyoshi Kameyama (University of Tsukuba, Japan) Herbert Kuchen (University of Muenster, Germany) Michael Leuschel (University of Southampton, UK) Juan Jose Moreno-Navarro (Universidad Politecnica de Madrid, Spain) Ernesto Pimentel (University of Malaga, Spain) Mario Rodriguez-Artalejo (Universidad Complutense de Madrid, Spain) German Vidal (Technical University of Valencia, Spain) ---------------------------------------------------------------------- LOCAL ORGANIZING COMMITTEE Elvira Albert Santiago Escobar Cesar Ferri Jose Hernandez Carlos Herrero Pascual Julian Marisa Llorens Gines Moreno Javier Oliver German Vidal Alicia Villanueva ---------------------------------------------------------------------- FURTHER INFORMATION WFLP 2003: http://www.dsic.upv.es/~rdp03/wflp Workshop contact: gvidal@dsic.upv.es RDP 2003: http://www.dsic.upv.es/~rdp03 From johanj@cs.uu.nl Fri Mar 21 12:01:42 2003 From: johanj@cs.uu.nl (Johan Jeuring) Date: Fri, 21 Mar 2003 13:01:42 +0100 Subject: Scrap your Boilerplate In-Reply-To: Message-ID: > Does the "zipper" fall into this category? > > http://haskell.org/wiki/wiki?TheZipper The zipper is a type-indexed data type, not just a type-indexed=20 function. See: R. Hinze, J. Jeuring and A L=F6h. Type-indexed data types. In Eerke A.=20= Boiten and Bernhard M=F6ller, editors, Proceedings of the 6th=20 International Conference on Mathematics of Program Construction, LNCS=20 2386, pages 148 - 174, 2002, =A9 Springer-Verlag. -- Johan= From R.E.Jones@ukc.ac.uk Fri Mar 21 16:56:47 2003 From: R.E.Jones@ukc.ac.uk (Richard Jones) Date: Fri, 21 Mar 2003 16:56:47 +0000 Subject: [list-mm-net] 1st MM-NET Workshop on Analytical Techniques for Memory Management Message-ID: 1st MM-NET Workshop on Analytical Techniques for Memory Management University of Kent at Canterbury 15th May 2003 Call for papers and participation There has been a recent increase in interest in applying analytical techniques to the prediction and modelling of memory management, which is broadly defined to include . garbage collection of main-memory, peristent and distributed systems; . explicit dynamic memory allocation/de-allocation . measurement of object demographics . interactions with languages and operating systems The UK's MM-NET (Memory Management Network) therefore proposes to hold a 1-day workshop on analytical techniques for memory management on Thurs 15th May 2003 at the University of Kent at Canterbury (venue and time to be confirmed). Topics of interest include but are not limited to static prediction and bounding of memory usage; garbage collection supported by compile-time techniques; memory management models. The keynote address will be given by Prof. Greg Morrisett, Cornell University. Participation is welcomed from both academic and industrial sectors. Registration is free for mm-net members and should be made through http://www.mm-net.org.uk/ Coffees and lunch will be provided. Some support for travel costs for UK personnel may be available (please contact Richard Jones ). Talk slots will be allocated on a first-come first-served basis. If you would like to give a talk, please indicate this when registering for the workshop, and indicate whether you prefer a short (15 min) or normal (30 min) slot. Titles and abstracts should be finalised before the workshopd. We will collect presentations from the workshop online to form an informal proceedings at the time, and may approach speakers to form an edited formal proceedings at a later date. Important Dates: now provisional registration and notification of talks 8th May 2003 workshop programme confirmed 15th May 2003 workshop 27th May 2003 provide copies of presentations for online "proceedings" The workshop organisers are: Kevin Hammond University of St Andrews kh@dcs.st-and.ac.uk Richard Jones University of Kent R.E.Jones@ukc.ac.uk Peter O'Hearn Queen Mary College ohearn@dcs.qmul.ac.uk MM-NET is generously sponsored by the UK's Engineering and Physical Sciences Research Council (EPSRC). From hdaume@ISI.EDU Fri Mar 21 22:29:12 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Fri, 21 Mar 2003 14:29:12 -0800 (PST) Subject: simulating dynamic dispatch In-Reply-To: Message-ID: Excellent paper! I have started using some of the techniques already! But, back to the real question :). I now no longer think such a thing is possible. Essentially what I want (given 'cast :: Typeable a, Typeable b => a -> Maybe b' [1]), is to write something like: test :: forall a r . Typeable a => (forall b . (Typeable b, Foo b) => b -> r) -> a -> Maybe r test f a = liftM f (cast a) but then 'b' is ambiguous. I'm not sure there is any way around this. Can someone help? - Hal [1] is there any reason why parens are requires around class contexts? i've always found this odd... -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Fri, 21 Mar 2003, Simon Peyton-Jones wrote: > You might also find the 'cast' function in Section 3 of "Scrap your > boilerplate" useful. > http://research.microsoft.com/~simonpj/papers/hmap/ > I'm not certain, but it has the right smell. > Simon > > | -----Original Message----- > | From: oleg@pobox.com [mailto:oleg@pobox.com] > | Sent: 21 March 2003 04:19 > | To: hdaume@ISI.EDU; haskell@haskell.org > | Subject: Re: simulating dynamic dispatch > | > | > | > i'm hoping to be able to simulate a sort of dynamic dispatch based > on > | > class instances. > | > | It seems you want to dispatch based not on a type but on the > | constraint of a type. > | > | You code almost worked. Here's the a bit updated and working version. > | > | class Foo a where { foo :: a -> Bool } > | class Bar a where { bar :: a -> Bool } > | > | data FB = forall a . Foo a => MkFoo a | forall a . Bar a => MkBar a > | > | instance Foo FB where > | foo (MkFoo x) = foo x > | > | instance Bar FB where > | bar (MkBar x) = bar x > | > | -- some instances for the test > | instance Foo Int where > | foo x = x == 0 > | > | instance Bar Char where > | bar x = x == 'a' > | > | > | test x = case x of > | (MkFoo a) -> Just $ foo a > | (MkBar a) -> Just $ bar a > | -- _ -> Nothing > | > | > | -- *Main> test $ MkFoo (0::Int) > | -- Just True > | -- *Main> test $ MkFoo (10::Int) > | -- Just False > | -- *Main> test $ MkBar 'a' > | -- Just True > | -- *Main> test $ MkBar 'b' > | -- Just False > | > | _______________________________________________ > | Haskell mailing list > | Haskell@haskell.org > | http://www.haskell.org/mailman/listinfo/haskell > From Steffen.Mazanek@UniBw-Muenchen.de Sat Mar 22 15:59:24 2003 From: Steffen.Mazanek@UniBw-Muenchen.de (Steffen Mazanek) Date: 22 Mar 2003 15:59:24 +0000 Subject: LambdaTeX and \usepackage{german}? Message-ID: <86r88zbder.fsf@pseiko.studfb.unibw-muenchen.de> Hello, I am a little confused. I have written a seminary paper using lambdaTeX for typesetting of the Haskell code. Now this paper shall be included in our seminary report. The problem: an annoying conflict arises when the package german is included, too. Are there any solutions? Thanks in advance, Steffen From oleg@pobox.com Sun Mar 23 21:41:48 2003 From: oleg@pobox.com (oleg@pobox.com) Date: Sun, 23 Mar 2003 13:41:48 -0800 (PST) Subject: simulating dynamic dispatch Message-ID: <200303232141.h2NLfm9S097639@adric.fnmoc.navy.mil> Hal Daume wrote: > -- *Main> test $ MkFoo (0::Int) > -- Just True > -- *Main> test $ MkBar 'a' > -- Just True > i forgot to mention the constraint > that i don't want the user to have to use the MkFoo/MkBar > constructors. if i could use them internally to 'test', that would be > great, but that's what i couldn't get to work :). It can be done without burdening the user with typing MkFoo and MkBar. In fact, the enclosed code shows that it is possible to implement the dynamic dispatch on a type class context -- exactly the way you wanted it, it seems. The code resorts to no unsafe operations. Here's the test: -- *Main> test (1::Int) -- "this is foo calling: 1" -- *Main> test 'a' -- "this is bar calling: 'a'" -- *Main> test [True,False] -- "this is quu calling: [True,False]" Here's the code -- Dynamic dispatch on a constraint: Foo, Bar, or Quux -- The constraints to dispatch on class Foo a where { foo :: a -> String } class Bar a where { bar :: a -> String } class Quu a where { quu :: a -> String } -- Populate the type classes instance Foo Int where foo x = "this is foo calling: " ++ (show x) instance Bar Char where bar x = "this is bar calling: " ++ (show x) instance Quu [Bool] where quu x = "this is quu calling: " ++ (show x) -- The Universe (with hidden constraints) data PACK = forall a . Foo a => MkFoo a | forall a . Bar a => MkBar a | forall a . Quu a => MkQuu a -- The packer class Packable a where pack:: a -> PACK -- The following three instances seem to be the "inverse" -- of the "instance Foo Int" .. instance Quu [Bool] -- The three instances below do an important job: they "introduce" -- the class context, so to speak. -- Also, a type can be a member of several type classes. The following -- instances resolve the ambiguity. For example, even if Int were a member -- of a class Bar (in addition to being the member of a class Foo), the first -- instance declaration below resolves Int to a class Foo (and so we would -- dispatch on Foo when we see an Int). instance Packable Int where pack = MkFoo instance Packable Char where pack = MkBar instance Packable [Bool] where pack = MkQuu -- The dispatcher instance Foo PACK where foo (MkFoo x) = foo x instance Bar PACK where bar (MkBar x) = bar x instance Quu PACK where quu (MkQuu x) = quu x test:: (Packable a) => a -> String test = dispatch . pack where dispatch x = case x of (MkFoo a) -> foo a (MkBar a) -> bar a (MkQuu a) -> quu a -- *Main> test (1::Int) -- "this is foo calling: 1" -- *Main> test 'a' -- "this is bar calling: 'a'" -- *Main> test [True,False] -- "this is quu calling: [True,False]" From Markus.Schnell@infineon.com Mon Mar 24 08:34:52 2003 From: Markus.Schnell@infineon.com (Markus.Schnell@infineon.com) Date: Mon, 24 Mar 2003 09:34:52 +0100 Subject: AW: simulating dynamic dispatch Message-ID: > http://research.microsoft.com/~simonpj/papers/hmap/ The technique you describe in that paper is exactly what I was wanting for many times. I often stopped using algebraic data types because of the immense amount of boilerplate I had to introduce. Thanks! But now I have a question regarding the forall. What does it do? How do I have to read a type definition with foralls? Or more concrete: What is the difference between (forall b. Term b => b -> b) -> a -> a and (Term b) => (b -> b) -> a -> a ? Markus From Steffen.Mazanek@unibw-muenchen.de Mon Mar 24 08:47:23 2003 From: Steffen.Mazanek@unibw-muenchen.de (Steffen Mazanek) Date: 24 Mar 2003 08:47:23 +0000 Subject: AW: simulating dynamic dispatch In-Reply-To: References: Message-ID: <86he9trw10.fsf@pseiko.studfb.unibw-muenchen.de> > concrete: What is the difference between > (forall b. Term b => b -> b) -> a -> a > and > (Term b) => (b -> b) -> a -> a > ? One may want: fun f x y = f x + f y for instance: fun length [True, False] [1,2] Therefore, I would say, you need typing a la fun::(forall a.[a]->Int)->[b]->[c]->Int Ciao, Steffen From Markus.Schnell@infineon.com Mon Mar 24 09:02:41 2003 From: Markus.Schnell@infineon.com (Markus.Schnell@infineon.com) Date: Mon, 24 Mar 2003 10:02:41 +0100 Subject: AW: simulating dynamic dispatch Message-ID: I think I get it. But to be sure: The forall means: The type for a may not be the same throughout the whole function. It just has to follow the pattern specified inside the braces. Interestingly, when I want hugs to show me the type of > fun::(forall a.[a]->Int)->[b]->[c]->Int it tells me: ERROR - Use of fun requires at least 1 argument Why that? At least I have explicitely specified the type. Markus > One may want: > > fun f x y = f x + f y > > for instance: > > fun length [True, False] [1,2] > > Therefore, I would say, you need typing a la > > fun::(forall a.[a]->Int)->[b]->[c]->Int > > Ciao, > Steffen > From Steffen.Mazanek@unibw-muenchen.de Mon Mar 24 09:19:19 2003 From: Steffen.Mazanek@unibw-muenchen.de (Steffen Mazanek) Date: 24 Mar 2003 09:19:19 +0000 Subject: AW: simulating dynamic dispatch In-Reply-To: References: Message-ID: <86smtd3yw8.fsf@pseiko.studfb.unibw-muenchen.de> > Interestingly, when I want hugs to show me the type > of > > fun::(forall a.[a]->Int)->[b]->[c]->Int > it tells me: ERROR - Use of fun requires at least 1 argument > Why that? At least I have explicitely specified the type. Hmm, ghci behaves properly. But using hugs I get the same error :-(. No idea! Maybe some additional flags have to be set? Ciao, Steffen From ndalton@Lastminute.com Mon Mar 24 09:24:06 2003 From: ndalton@Lastminute.com (Niall Dalton) Date: Mon, 24 Mar 2003 09:24:06 -0000 Subject: Arbitrary precision reals? Message-ID: Hi, Its been a while since I've been using Haskell seriously, so I might simply have overlooked the answer.. Is there an arbitrary precision real number library available for Haskell? IIRC, atleast GHC uses the GMP library, but only for integers? Thanks, niall ------------------------------ This e-mail is intended for the named addressee only. It may contain confidential and/or privileged information. If you have received this message in error, please let us know and then delete this message from your system. You should not copy the message, use it for any purpose or disclose its contents to anyone. ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From voigt@tcs.inf.tu-dresden.de Mon Mar 24 10:01:32 2003 From: voigt@tcs.inf.tu-dresden.de (Janis Voigtlaender) Date: Mon, 24 Mar 2003 11:01:32 +0100 Subject: AW: simulating dynamic dispatch References: Message-ID: <3E7ED77C.FB2B34FC@tcs.inf.tu-dresden.de> Markus.Schnell@infineon.com wrote: > > I think I get it. But to be sure: > The forall means: The type for a may not be the same > throughout the whole function. It just has to follow > the pattern specified inside the braces. Not exactly. In: > > fun::(forall a.[a]->Int)->[b]->[c]->Int > > fun f x y = f x + f y the forall means that the first argument to fun must be polymorphic, as in: > > fun length [True, False] [1,2] It is not enough "to follow the pattern". If, e.g., you have a function sum::[Int]->Int (which does "follow the pattern", if I understand correctly what you mean with this), you may NOT say something like: fun sum [1,2] [3,4] however sensible this might seem at first look. The reason is that sum only works on integer lists, whereas the given type for fun requires that the first argument be a function that works on lists of any type, such as length. If sum were allowed as argument to fun, then we would also have to be allowed to say: fun sum [True, False] [1,2] which clearly makes no sense. That Hugs refuses to report the type of fun has to with the fact that such (rank-2) types cannot be inferred. GHC generally has better support for higher-ranked types (no general inference, of course). Hope that helped, Janis. -- Janis Voigtlaender http://wwwtcs.inf.tu-dresden.de/~voigt/ mailto:voigt@tcs.inf.tu-dresden.de From Markus.Schnell@infineon.com Mon Mar 24 10:08:29 2003 From: Markus.Schnell@infineon.com (Markus.Schnell@infineon.com) Date: Mon, 24 Mar 2003 11:08:29 +0100 Subject: AW: AW: simulating dynamic dispatch Message-ID: Thanks! These examples and counterexamples help a lot in understanding. Markus > The reason is that sum only works on integer lists, whereas the given > type for fun requires that the first argument be a function that works > on lists of any type, such as length. > If sum were allowed as argument to fun, then we would also have to be > allowed to say: > > fun sum [True, False] [1,2] > > which clearly makes no sense. > > That Hugs refuses to report the type of fun has to with the fact that > such (rank-2) types cannot be inferred. GHC generally has > better support > for higher-ranked types (no general inference, of course). > > Hope that helped, > Janis. > > -- > Janis Voigtlaender > http://wwwtcs.inf.tu-dresden.de/~voigt/ > mailto:voigt@tcs.inf.tu-dresden.de > From slucas@dsic.upv.es Mon Mar 24 11:51:44 2003 From: slucas@dsic.upv.es (Salvador Lucas) Date: Mon, 24 Mar 2003 12:51:44 +0100 Subject: WRS 2003 - Deadline extended to April 3, 2003 Message-ID: <3E7EF141.C8B5A7F@dsic.upv.es> [- We apologize for multiple copies of this message -] Due to multiple requests, we are extending the deadline for submissions to WRS 2003. Please, send a message containing the title, authors and abstract of your submission before M a r c h 3 0, 2 0 0 3 to wrs03@logic.at The full version of your submission to WRS 2003 should be sent before A p r i l 3, 2 0 0 3 to the same e-mail address. ****************************************************************** Third International Workshop on Reduction Strategies in Rewriting and Programming (WRS 2003) http://www.dsic.upv.es/~rdp03/wrs part of the Federated Conference on Rewriting, Deduction and Programming (RDP 2003) Valencia, Spain, June 8, 2003 ****************************************************************** BACKGROUND AND AIMS Reduction strategies in rewriting and programming have attracted an increasing attention within the last years. New types of reduction strategies have been invented and investigated, and new results on rewriting / computation under particular strategies have been obtained. Research in this field ranges from primarily theoretical questions about reduction strategies to very practical application and implementation issues. The need for a deeper understanding of reduction strategies in rewriting and programming, both in theory and practice, is obvious, since they bridge the gap between unrestricted general rewriting (computation) and (more deterministic) rewriting with particular strategies (programming). Moreover, reduction strategies provide a natural way to go from operational principles (e.g., graph and term rewriting, narrowing, lambda-calculus) and semantics (e.g., normalization, computation of values, infinitary normalization, head-normalization) to implementations of programming languages. Therefore any progress in this area is likely to be of interest not only to the rewriting community, but also to neighbouring fields like functional programming, functional-logic programming, and termination proofs of algorithms. The workshop wants to provide a forum for the presentation and discussion of new ideas and results, recent developments, new research directions, as well as of surveys on existing knowledge in this area. Furthermore we aim at fostering interaction and exchange between researchers and students actively working on such topics. The workshop is part of the Federated Conference on Rewriting, Deduction and Programming (RDP 2003) to be held in Valencia (Spain) on June 8, 2003. The workshop is (co-)organized by TU Valencia and TU Wien. TOPICS OF INTEREST Topics of interest include, but are not restricted to: - theoretical foundations for the definition and semantic description of reduction strategies - strategies in different frameworks (term rewriting, graph rewriting, infinitary rewriting, lambda calculi, higher order rewriting and explicit substitutions, conditional rewriting, rewriting with built-ins, narrowing, constraint solving, etc.) and their application in (equational, functional, functional-logic) programming (languages) - properties of reduction strategies / computations under strategies (e.g., completeness, computability, decidability, complexity, optimality, (hyper-)normalization, cofinality, fairness, perpetuality, context-freeness, neededness, laziness, eagerness, strictness) - interrelations, combinations and applications of reduction under different strategies (e.g., equivalence conditions for fundamental properties like termination and confluence, applications in modularity analysis, connections between strategies of different frameworks, etc.) - program analysis and other semantics-based optimization techniques dealing with reduction strategies - rewrite systems / tools / implementations with flexible / programmable strategies as essential concept / ingredient - specification of reduction strategies in (real) languages - data structures and implementation techniques for reduction strategies. SUBMISSIONS We solicit papers on all aspects of reduction strategies in rewriting and programming. Submissions should describe unpublished work, except for survey papers which are explicitly welcome, too. Submissions should not exceed 10 pages (however, survey papers may be longer). Please, send a message containing the title, authors, and abstract of your submission before March 30, 2003 to the PC co-chairs at wrs03@logic.at The full version of your submission should be sent in postscript or PDF format before April 3, 2003. Submissions should include the title, authors' names, affiliations, addresses, and e-mail. Selection of papers by the PC will be based on originality, significance, and correctness. Final versions will be due by May 11, 2003. PUBLICATION Accepted papers will be included in the preliminary workshop proceedings that will be available at the workshop. The final workshop proceedings will be published in the Electronic Notes in Theoretical Computer Science (ENTCS) series of Elsevier. PROGRAM COMMITTEE Sergio Antoy Portland (USA) Zena M. Ariola Eugene (USA) Roberto Di Cosmo Paris VII (France) Juergen Giesl Aachen (Germany) Bernhard Gramlich (co-chair) Wien (Austria) Salvador Lucas (co-chair) Valencia (Spain) Aart Middeldorp Tsukuba (Japan) Ricardo Pe~na Madrid (Spain) Pierre Rety Orleans (France) Eelco Visser Utrecht (The Netherlands) ORGANIZERS Bernhard Gramlich Technische Universitaet Wien Salvador Lucas Universidad Politecnica de Valencia IMPORTANT DATES Abstract's submission: March 30, 2003 Deadline for submissions: April 3, 2003 Notification: April 25, 2003 Final version due: May 11, 2003 Workshop: June 8, 2003 FURTHER INFORMATION WRS 2003 website: http://www.dsic.upv.es/~rdp03/wrs WRS 2003 e-mail address: wrs03@logic.at RDP 2003 website: http://www.dsic.upv.es/~rdp03 ****************************************************************** From oleg@pobox.com Mon Mar 24 19:20:29 2003 From: oleg@pobox.com (oleg@pobox.com) Date: Mon, 24 Mar 2003 11:20:29 -0800 (PST) Subject: Polishing the boilerplate: a dis-unsafely safe cast In-Reply-To: Message-ID: <200303241920.h2OJKT9G099142@adric.fnmoc.navy.mil> Hello! The paper http://research.microsoft.com/~simonpj/papers/hmap/ by Ralf Laemmel and Simon Peyton Jones gave a reference implementation of a 'cast' function. Here's another implementation: cast:: (Show a, Read b) => a -> Maybe b cast = read_as . show where read_as s = case readsPrec 1 s of [(r,[])] -> Just r _ -> Nothing -- Tests from the hmap paper -- *Main> (cast 'a') :: Maybe Char -- Just 'a' -- *Main> (cast 'a') :: Maybe Int -- Nothing -- *Main> (cast 'a') :: Maybe Bool -- Nothing -- *Main> (cast True) :: Maybe Bool -- Just True -- *Main> (cast "True") :: Maybe Bool -- Nothing -- *Main> (cast "True") :: Maybe Int -- Nothing -- *Main> (cast "True") :: Maybe String -- Just "True" -- Additional tests -- *Main> (cast [1,2,3])::Maybe [Int] -- Just [1,2,3] -- *Main> (cast [1,2,3])::Maybe [Integer] -- Just [1,2,3] -- *Main> (cast [1,2,3])::Maybe [Float] -- Just [1.0,2.0,3.0] -- *Main> (cast (Just True)) :: Maybe Int -- Nothing -- *Main> (cast (Just True)) :: Maybe (Maybe Bool) -- Just (Just True) -- *Main> (cast (Nothing::Maybe Bool)) :: Maybe (Maybe Bool) -- Just Nothing -- *Main> (cast (Nothing::Maybe Bool)) :: Maybe (Maybe Int) -- Just Nothing -- *Main> (cast (Nothing::Maybe Bool)) :: Maybe (Maybe Char) -- Just Nothing Granted, the cast function here cannot handle exponential types. OTH, the cast function given here can cast an Int to an Integer or to a Float. Most of all, the cast function here is implemented entirely in Haskell 98, with no extensions whatsoever -- not existential types, let alone unsafeCoerce. An aside: OCaml has a function called Obj.magic: 'a -> 'b, which is unsafeCoerce with a positive name. If OCaml did not provide that function, it can be easily emulated: # let door_to_hell x = Marshal.from_string (Marshal.to_string () []) 0;; val door_to_hell : 'a -> 'b = This is a terminating function with a signature a->b. It critically relies on marshalling and unmarshalling. BTW, the function breaks all kinds of free theorems: # let (fake_id: 'a->'a) = function x -> door_to_hell x;; val fake_id : 'a -> 'a = # fake_id 123;; - : int = 0 We can write a totally polymorphic terminating function a->a that is patently not the identity. From Tom.Pledger@peace.com Mon Mar 24 21:13:30 2003 From: Tom.Pledger@peace.com (Tom Pledger) Date: Tue, 25 Mar 2003 09:13:30 +1200 Subject: Arbitrary precision reals? In-Reply-To: References: Message-ID: <15999.29946.967949.393321@tux-17.corp.peace.com> Niall Dalton writes: | Hi, | | Its been a while since I've been using Haskell seriously, so I might simply | have overlooked the answer.. | | Is there an arbitrary precision real number library available for Haskell? | IIRC, atleast GHC uses the GMP library, but only for integers? Hi. There's the Ratio library, which can be used to make arbitrary precision rationals from arbitrary precision integers. But it doesn't provide arbitrary *finite* precision implementations of imprecise functions such as exp, so I suspect it's not quite what you're after. I don't know whether arbitrary precision reals have been done in Haskell, but here's one of the issues... The floating point part of the GNU mp library looks difficult to fit into Haskell's numeric classes, because the type signatures in class Floating don't include a how-much-precision-do-you-want parameter. For example, Haskell's sqrt :: Floating a => a -> a may look like it matches GNU mp's void mpf_sqrt (mpf_t rop, mpf_t op) but the result pointer rop also provides the precision argument, which was prepared earlier by some impure stateful action such as void mpf_set_default_prec (unsigned long int prec) I can see three ways around this, but they're all rather fiddly. - Write a nonstandard version of Haskell's Floating class, introducing an explicit how-much-precision-do-you-want parameter. - Declare a separate Floating instance for each fixed precision level you want to use, e.g. instance Floating GNU_mpf_t_with_300bits. - Declare a data type which pairs a GNU mpf_t with a number of bits, and declare a Floating instance for this data type, inferring the required precision of the result from the precision of the arguments. This gets into trouble when there are no arguments: pi would presumably have to have fixed precision. Although you could always ignore it in favour of something like (4 `withBits` 300) * atan (1 `withBits` 300) Regards, Tom http://haskell.org/onlinereport/ratio.html http://www.swox.com/gmp/manual/Float-Arithmetic.html#Float%20Arithmetic http://www.swox.com/gmp/manual/Initializing-Floats.html#Initializing%20Floats From hdaume@ISI.EDU Tue Mar 25 00:34:40 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Mon, 24 Mar 2003 16:34:40 -0800 (PST) Subject: Polishing the boilerplate: a dis-unsafely safe cast In-Reply-To: <200303241920.h2OJKT9G099142@adric.fnmoc.navy.mil> Message-ID: This is getting off-topic, but... I don't like this solution at all :). It is very dependent on read being a true inverse of show, which isn't always the case. Perhaps more importantly though, I don't like the fact that it will readily convert between Int and Float, etc. For instance, in almost all of my applications I use something that looks like: > newtype Log = Log !Double where 'show (Log d) = show (exp l)' and 'read s = Log (log (read s))'. If I wanted to have a function applied to only Logs, having it also applied to Floats/Doubles/etc because of the show/read connection would be very bad and would require me to wrap things up in more and more constructors just to get unique show instances. Not to mention that it's terribly inefficient. If our concern is to stay within a standard subset of Haskell, using H98+FFI, we get unsafePerformIO with which we can write unsafeCoerce. Using simply String ids as in the referenced paper would make this sort-of-safe, provided users don't give bogus instances of Typeable. -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Mon, 24 Mar 2003 oleg@pobox.com wrote: > > Hello! > > The paper > http://research.microsoft.com/~simonpj/papers/hmap/ > by Ralf Laemmel and Simon Peyton Jones gave a reference > implementation of a 'cast' function. Here's another implementation: > > cast:: (Show a, Read b) => a -> Maybe b > > cast = read_as . show > where > read_as s = case readsPrec 1 s of > [(r,[])] -> Just r > _ -> Nothing > > > -- Tests from the hmap paper > > -- *Main> (cast 'a') :: Maybe Char > -- Just 'a' > -- *Main> (cast 'a') :: Maybe Int > -- Nothing > -- *Main> (cast 'a') :: Maybe Bool > -- Nothing > -- *Main> (cast True) :: Maybe Bool > -- Just True > -- *Main> (cast "True") :: Maybe Bool > -- Nothing > -- *Main> (cast "True") :: Maybe Int > -- Nothing > -- *Main> (cast "True") :: Maybe String > -- Just "True" > > -- Additional tests > > -- *Main> (cast [1,2,3])::Maybe [Int] > -- Just [1,2,3] > -- *Main> (cast [1,2,3])::Maybe [Integer] > -- Just [1,2,3] > -- *Main> (cast [1,2,3])::Maybe [Float] > -- Just [1.0,2.0,3.0] > -- *Main> (cast (Just True)) :: Maybe Int > -- Nothing > -- *Main> (cast (Just True)) :: Maybe (Maybe Bool) > -- Just (Just True) > -- *Main> (cast (Nothing::Maybe Bool)) :: Maybe (Maybe Bool) > -- Just Nothing > -- *Main> (cast (Nothing::Maybe Bool)) :: Maybe (Maybe Int) > -- Just Nothing > -- *Main> (cast (Nothing::Maybe Bool)) :: Maybe (Maybe Char) > -- Just Nothing > > > Granted, the cast function here cannot handle exponential types. OTH, > the cast function given here can cast an Int to an Integer or to a Float. Most > of all, the cast function here is implemented entirely in Haskell 98, > with no extensions whatsoever -- not existential types, let alone > unsafeCoerce. > > > An aside: OCaml has a function called Obj.magic: 'a -> 'b, > which is unsafeCoerce with a positive name. If OCaml did not provide > that function, it can be easily emulated: > > # let door_to_hell x = > Marshal.from_string (Marshal.to_string () []) 0;; > val door_to_hell : 'a -> 'b = > > This is a terminating function with a signature a->b. It critically > relies on marshalling and unmarshalling. BTW, the function breaks all > kinds of free theorems: > > # let (fake_id: 'a->'a) = function x -> door_to_hell x;; > val fake_id : 'a -> 'a = > # fake_id 123;; > - : int = 0 > > We can write a totally polymorphic terminating function a->a that is > patently not the identity. > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From weixrl@uwec.edu Tue Mar 25 00:32:54 2003 From: weixrl@uwec.edu (Weix, Rachel Lynn) Date: Mon, 24 Mar 2003 18:32:54 -0600 Subject: Haskell help! Message-ID: <0EBCCD9264788F41802CF255C0B3FF0E38777D@STAN.uwec.edu> This is a multi-part message in MIME format. ------_=_NextPart_001_01C2F266.132C29AC Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 I'm a college student trying to write a Haskell program, and I'm having some problems getting the correct output. I need to write a program which will return a set of optimally aligned sequences, with "optimal" being defined as such: mismatch or space (represented by a "-") =3D -1; else 1 for every pair (see below for what a pair is) =20 An example set of sequences with an alignment of -3 is as follows: =20 sc-h-e-me icecream- =20 (s,i) are a pair, (c, c), etc. =20 For right now, I'm only returning a potential solution (vs. a set of solutions), and I'm having problems with any set of sequences that aren't the same length. My results are listed below. I don't want to include the code for now since it's about a page long (printed out) but was hoping maybe someone had an idea as to why I'm getting such odd results? If code will help, I can exchange back and forth with whoever thinks they might be able to help me out. Your help is much appreciated! =20 Rachel =20 =20 -- Each word/sequence you see has been predefined in my Haskell code -- This first example appears to work just fine =20 Main> printSeq icecream scheme ("icecream", "scheme--") =20 Main> printSeq hate hatter ("hat-e", "hatte") Main> printSeq scheme saturn ("scheme", "saatur") Main> printSeq saturn scheme ("saaturn", "scheme-") Main> printSeq saturn hatter ("saaturn", "hatter-") Main> printSeq hatter saturn ("hatter", "saatur") Main> printSeq mad saturn ("mad", "saa") Main> printSeq hate hatter ("hat-e", "hatte") Main> printSeq snowball icecream ("snowb-all", "icecream-") Main> printSeq mad computer ("--mad", "compu") =20 Main> printSeq mad snowball ("mad", "sno") ------_=_NextPart_001_01C2F266.132C29AC Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Message
Hi,
 
I'm a = college=20 student trying to write a Haskell program, and I'm having some problems = getting=20 the correct output.  I need to write a program which will = return a set=20 of optimally aligned sequences, with "optimal" being defined as such:=20 mismatch or=20 space (represented by a "-") =3D -1; else 1 for every pair (see = below for=20 what a pair is)
 
An = example set of=20 sequences with an alignment of -3 is as follows:
 
sc-h-e-me
icecream-
 
(s,i) = are a pair,=20 (c, c), etc.
 
For = right now, I'm=20 only returning a potential solution (vs. a set of solutions), and I'm = having=20 problems with any set of sequences that aren't the same length.  My = results=20 are listed below.  I don't want to include the code for now since = it's=20 about a page long (printed out) but was hoping maybe someone had an idea = as to=20 why I'm getting such odd results?  If code will help, I can = exchange back=20 and forth with whoever thinks they might be able to help me out.  = Your help=20 is much appreciated!
 
Rachel
 
 
-- = Each=20 word/sequence you see has been predefined in my Haskell=20 code
-- = This first=20 example appears to work just fine
 

Main>=20 printSeq icecream scheme

(“icecream”, = “scheme--”)

 

Main> printSeq hate=20 hatter

(“hat-e”, “hatte”)

Main> printSeq scheme=20 saturn

(“scheme”, = “saatur”)

Main> printSeq saturn=20 scheme

(“saaturn”, = “scheme-”)

Main> printSeq saturn=20 hatter

(“saaturn”, = “hatter-”)

Main> printSeq hatter=20 saturn

(“hatter”, = “saatur”)

Main> printSeq mad=20 saturn

(“mad”, = “saa”)

Main> printSeq hate=20 hatter

(“hat-e”, “hatte”)

Main> printSeq snowball=20 icecream

(“snowb-all”, “icecream-”)

Main> printSeq mad=20 computer

(“--mad”, = “compu”)

 

Main> printSeq mad=20 snowball

(“mad”,=20 “sno”)

=00 ------_=_NextPart_001_01C2F266.132C29AC-- From shivers@cc.gatech.edu Tue Mar 25 06:22:30 2003 From: shivers@cc.gatech.edu (Olin Shivers) Date: Tue, 25 Mar 2003 01:22:30 -0500 (EST) Subject: FINAL CALL for papers: ICFP 2003 deadline is Saturday Message-ID: <200303250622.h2P6MUpx008803@tokyo.cc.gatech.edu> The submission deadline for ICFP -- the International Conference on Functional Programming -- is coming up soon: this Saturday, March 29. The 2003 ICFP will be in Uppsala, Sweden on August 25-29, in conjunction with PPDP (Principles and Practice of Declarative Programming). Please take a moment to read the "call for papers" I've appended below, and see if you have a topic or result you would like to submit to the program committee. See you in Sweden. -Olin Shivers program chairman =============================================================================== Eighth Annual ACM SIGPLAN International Conference on Functional Programming ICFP 2003 Call for Papers (Revised 2003/2/5) Affiliated with PLI 2003 August 25-29, 2003 Uppsala, Sweden http://www-users.cs.york.ac.uk/~colin/icfp2003.html http://www.cc.gatech.edu/icfp03/cfp.html ------------------------------------------------------------------------------- * Important dates ----------------- Submission deadline 18:00 EST 29 March, 2003 (Saturday) Notification of acceptance rejection 19 May, 2003 Final paper due 16 June, 2003 Conference 25-29 August, 2003 * Scope ------- ICFP 2003 seeks original papers on the full spectrum of the art, science, and practice of functional programming. The conference invites submissions on all topics ranging from principles to practice, from foundations to features, and from abstraction to application. The scope covers all languages that encourage programming with functions, including both purely applicative and imperative languages, as well as languages that support objects and concurrency. Topics of interest include, but are not limited to, the following: Foundations formal semantics, lambda calculus, type theory, monads, continuations, control, state, effects. Design Algorithms and data structures, modules and type systems, concurrency and distribution, components and composition, relations to object-oriented and logic programming, multiparadigm programming. Implementation abstract machines, compile-time and run-time optimization, just-in-time compilers, memory management. Interfaces to foreign functions, services, components and low-level machine resources. Transformation and analysis abstract interpretation, partial evaluation, program transformation, theorem proving, specification and verification. Software development techniques for functional programming design patterns, specification, verification and validation, debugging, test generation, tracing and profiling. Applications and domain-specific languages systems programming, scientific and numerical computing, symbolic computing and artificial intelligence, systems programming, databases, graphical user interfaces, multimedia programming, application scripting, system administration, distributed-systems construction, web programming. Practice and experience functional programming in education and industry, ramifications on other paradigms and computing disciplines. Functional pearls elegant, instructive examples of functional programming. Papers in the latter three categories need not necessarily report original research results; they may instead, for example, report practical experience that will be useful to others, re-usable programming idioms, or elegant new ways of approaching a problem. The key criterion for such a paper is that it makes a contribution from which other practitioners can benefit. It is not enough simply to describe a program! * Submission guidelines ----------------------- Due date & time: Submissions must be filed at the web site by 18:00 EST on Saturday 29 March. Some convenient equivalents to 18:00 EST are New York: 6:00 PM = 18h00 San Francisco: 3:00 PM = 15h00 Chicago: 5:00 PM = 17h00 Paris: Midnight Hong Kong: 7:00 AM (30 March) UTC: 2300 For other time-zones/locations, see http://www.timeanddate.com/worldclock/fixedtime.html Submission URL: http://www.cc.gatech.edu/icfp03/submit Authors should submit a 100-200 word abstract and a full paper by 23:00 Universal Coordinated Time on Saturday, 29 March, 2003. Submissions should be no more than 12 pages (including bibliography and appendices) in standard ACM conference format: two columns, nine-point font on a ten-point baseline, with pages 20pc (3.33in) wide and 54pc (9in) tall, with a column gutter of 2pc (0.33in). Detailed formatting guidelines are available at http://www.acm.org/sigs/pubs/proceed/template.html, along with formatting templates or style files for LaTeX, Word Perfect, and Word. You don't need to include categories, keywords, etc., though you are welcome to do so. Also, note that the ACM copyright notice is not required of submissions, only of accepted papers. Authors wishing to supply additional material to the reviewers beyond the 12-page limit can do so in clearly marked appendices, on the understanding that reviewers are not required to read the appendices. Submissions that do not meet these guidelines will not be considered. The submission deadline and length above are firm. Submissions will be carried out electronically via the Web, at the URL given above. Papers must be submitted in either PDF format, or as PostScript documents that are interpretable by Ghostscript, and they must be printable on US Letter sized paper. Individuals for which this requirement is a hardship should contact the program chair at least one week before the deadline. Submitted papers must have content that has not previously been published in other conferences or refereed venues; simultaneous submission to other conferences or refereed venues is unacceptable. Each paper should explain its contributions in both general and technical terms, clearly identifying what has been accomplished, saying why it is significant, and comparing it with previous work. Authors should strive to make the technical content of their papers understandable to a broad audience. Authors of accepted papers will be required to sign the ACM copyright form. Proceedings will be published by ACM Press. * Student Attendees ------------------- Students who have a paper accepted for the conference are offered student membership of SIGPLAN free for one year. As members of SIGPLAN they may apply for travel fellowships from the PAC fund. * Conference Chair ------------------ Colin Runciman University of York, UK * Program Chair --------------- Olin Shivers College of Computing Georgia Institute of Technology Atlanta, Ga. 30332-0280, USA shivers at cc.gatech.edu Phone: +1 404 385.00.91 Fax: +1 404 383.12.53 * Program Committee ------------------- Andrzej Filinski (DIKU, University of Copenhagen) Robby Findler (University of Chicago) Fritz Henglein (IT University of Copenhagen) Hugo Herbelin (INRIA) Ralf Hinze (Universität Bonn) Annie Liu (Stony Brook University) Benjamin Pierce (University of Pennsylvania) Todd Proebsting (Microsoft Corp.) Amr Sabry (University of Indiana) Zhong Shao (Yale University) Tim Sheard (OGI School of Science and Engineering) Eijiro Sumii (University of Tokyo) Andrew Wright (Cisco, Critical Infrastructure Assurance Group) * Accessing this document ------------------------- This document can be obtained in the following formats: HTML http://www.cc.gatech.edu/icfp03/cfp.html PostScript http://www.cc.gatech.edu/icfp03/cfp.ps PDF http://www.cc.gatech.edu/icfp03/cfp.pdf Plain text http://www.cc.gatech.edu/icfp03/cfp.txt * Change log ------------ 2003/2/5 Added program committee; revised submission deadline from 3/20 to 3/29; updated student travel-fellowship information. 2003/2/5 March 29 is Saturday, not Thursday. (March 20 is a Thursday.) 2003/2/7 Added Andrew Wright to PC list. 2003/2/9 Added URLs for accessing the CFP in various formats. From ger@tzi.de Tue Mar 25 11:22:54 2003 From: ger@tzi.de (George Russell) Date: Tue, 25 Mar 2003 12:22:54 +0100 Subject: Casting via Read/Show Message-ID: <3E803C0E.3020903@tzi.de> I'm afraid I don't much care for this solution either. (1) it's not at all clear to me what on earth it's good for. The main reason I use unsafe casting is because I need a way of storing and retrieving a value in a storage location which does not know its type. For example, a finite map which contains values of different types. It should always be the case that the type with which I wish to extract the value is the same at which I want to put the value in. Usually I do this kind of thing via Glasgow Haskell's Dynamic types. I don't think the Read/Show solution really helps much. (2) My mind revolts from the idea of having to casting numbers by converting them into their ASCII decimal representation. This is also potentially an expensive operation, for example for floats, where converting a very large or very small float to decimal in such a way that the original float can be recovered is an operation requiring expensive multiprecision arithmetic. (It is possible to speed this up to some extent, but this involves either tricky coding, or making compromises with precision which mean that the number you get out may not be the number you put in.) (3) In many cases this is wholly impossible, for example functions, or values of IO type. I have actual examples where I do this sort of thing. (4) It does not work intuitively. For example you can cast (10^20) from Integer to Float, even though it is not precisely representable. You cannot cast from Float to Integer at all. The main way I can envisage users using this kind of cast is for converting between different sorts of numbers. But there are already good ways of doing this kind of thing (fromIntegral, Numeric.fromRat). Surely it is much better for the user to be encouraged to these functions? From coeus@gmx.de Tue Mar 25 13:57:40 2003 From: coeus@gmx.de (Marc Ziegert) Date: Tue, 25 Mar 2003 14:57:40 +0100 Subject: Haskell help! In-Reply-To: <0EBCCD9264788F41802CF255C0B3FF0E38777D@STAN.uwec.edu> References: <0EBCCD9264788F41802CF255C0B3FF0E38777D@STAN.uwec.edu> Message-ID: <200303251457.40438.coeus@gmx.de> looks like a genetic algorithm, i've programmed years ago. :) i need the sourcecode to solve the problem. it seems that you "zip" the two strings together: unzip $ zip "abcde" "123" -> unzip [('a','1'),('b','2'),('c','3')] -> ("abc","123") i've no idea why you got "saaturn". - marc Am Dienstag, 25. M=E4rz 2003 01:32 schrieb Weix, Rachel Lynn: > Hi, > > I'm a college student trying to write a Haskell program, and I'm having > some problems getting the correct output. I need to write a program > which will return a set of optimally aligned sequences, with "optimal" > being defined as such: mismatch or space (represented by a "-") =3D -1; > else 1 for every pair (see below for what a pair is) > > An example set of sequences with an alignment of -3 is as follows: > > sc-h-e-me > icecream- > > (s,i) are a pair, (c, c), etc. > > For right now, I'm only returning a potential solution (vs. a set of > solutions), and I'm having problems with any set of sequences that > aren't the same length. My results are listed below. I don't want to > include the code for now since it's about a page long (printed out) but > was hoping maybe someone had an idea as to why I'm getting such odd > results? If code will help, I can exchange back and forth with whoever > thinks they might be able to help me out. Your help is much > appreciated! > > Rachel > > > -- Each word/sequence you see has been predefined in my Haskell code > -- This first example appears to work just fine > > Main> printSeq icecream scheme > > ("icecream", "scheme--") > > > > Main> printSeq hate hatter > > ("hat-e", "hatte") > > > > Main> printSeq scheme saturn > > ("scheme", "saatur") > > > > Main> printSeq saturn scheme > > ("saaturn", "scheme-") > > > > Main> printSeq saturn hatter > > ("saaturn", "hatter-") > > > > Main> printSeq hatter saturn > > ("hatter", "saatur") > > > > Main> printSeq mad saturn > > ("mad", "saa") > > > > Main> printSeq hate hatter > > ("hat-e", "hatte") > > > > Main> printSeq snowball icecream > > ("snowb-all", "icecream-") > > > > Main> printSeq mad computer > > ("--mad", "compu") > > > > Main> printSeq mad snowball > > ("mad", "sno") From c_minoli@hotmail.com Tue Mar 25 16:47:16 2003 From: c_minoli@hotmail.com (Cesar Augusto Acosta Minoli) Date: Tue, 25 Mar 2003 16:47:16 +0000 Subject: Error in Hugs 98 Message-ID:
Hello!
I have this error when running my code in Hugs98
 
Program error: {primDivFloat (1.#QNAN) (1.#QNAN)}   
 
Anyone knows what it means? 
 
Thanks.


Tired of spam? Get advanced junk mail protection with MSN 8. From diatchki@cse.ogi.edu Tue Mar 25 20:45:39 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Tue, 25 Mar 2003 12:45:39 -0800 Subject: Haskell help! In-Reply-To: <0EBCCD9264788F41802CF255C0B3FF0E38777D@STAN.uwec.edu> References: <0EBCCD9264788F41802CF255C0B3FF0E38777D@STAN.uwec.edu> Message-ID: <3E80BFF3.90709@cse.ogi.edu> hi, i think you might find the following paper relevant: "Algebrainc Dynamic Prorgamming" by Robert Gigerich and Carsten Meyer http://link.springer-ny.com/link/service/series/0558/papers/2422/24220349.pdf bye iavor Weix, Rachel Lynn wrote: > Hi, > > I'm a college student trying to write a Haskell program, and I'm having > some problems getting the correct output. I need to write a program > which will return a set of optimally aligned sequences, with "optimal" > being defined as such: mismatch or space (represented by a "-") = -1; > else 1 for every pair (see below for what a pair is) > > An example set of sequences with an alignment of -3 is as follows: > > sc-h-e-me > icecream- > > (s,i) are a pair, (c, c), etc. > > For right now, I'm only returning a potential solution (vs. a set of > solutions), and I'm having problems with any set of sequences that > aren't the same length. My results are listed below. I don't want to > include the code for now since it's about a page long (printed out) but > was hoping maybe someone had an idea as to why I'm getting such odd > results? If code will help, I can exchange back and forth with whoever > thinks they might be able to help me out. Your help is much > appreciated! > > Rachel > > > -- Each word/sequence you see has been predefined in my Haskell code > -- This first example appears to work just fine > > Main> printSeq icecream scheme > > ("icecream", "scheme--") > > > > Main> printSeq hate hatter > > ("hat-e", "hatte") > > > > Main> printSeq scheme saturn > > ("scheme", "saatur") > > > > Main> printSeq saturn scheme > > ("saaturn", "scheme-") > > > > Main> printSeq saturn hatter > > ("saaturn", "hatter-") > > > > Main> printSeq hatter saturn > > ("hatter", "saatur") > > > > Main> printSeq mad saturn > > ("mad", "saa") > > > > Main> printSeq hate hatter > > ("hat-e", "hatte") > > > > Main> printSeq snowball icecream > > ("snowb-all", "icecream-") > > > > Main> printSeq mad computer > > ("--mad", "compu") > > > > Main> printSeq mad snowball > > ("mad", "sno") > > -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From diatchki@cse.ogi.edu Tue Mar 25 21:33:17 2003 From: diatchki@cse.ogi.edu (Iavor S. Diatchki) Date: Tue, 25 Mar 2003 13:33:17 -0800 Subject: Haskell help! In-Reply-To: <0EBCCD9264788F41802CF255C0B3FF0E387783@STAN.uwec.edu> References: <0EBCCD9264788F41802CF255C0B3FF0E387783@STAN.uwec.edu> Message-ID: <3E80CB1D.7090707@cse.ogi.edu> hi, the paper i posted uses Haskell, no mutation or looping. it also uses Haskell's lazyness in a neat way. bye iavor Weix, Rachel Lynn wrote: > I have since been able to figure out my problems - the algorithm for one of my methods was wrong and I found two "typos" so to speak. I now need to figure out how to return all optimal solutions, and I have an idea as to how to start. If I have any more problems I may send out another email. > > Rachel > P.S. I need to solve the problem using functional programming, thus I cannot use looping structures or mutation. -- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ================================================== From simonpj@microsoft.com Wed Mar 26 00:21:10 2003 From: simonpj@microsoft.com (Simon Peyton-Jones) Date: Wed, 26 Mar 2003 00:21:10 -0000 Subject: Arbitrary precision reals? Message-ID: David Lester, who I saw today by coincidence, has a very nice arbitrary-precision real arithmetic package, which he is planning to finish up and offer to us Haskellites. I'll leave him to say when, and what it does, but it's a very cool thing and I hope we can persuade him to give it to us soon. Simon=20 | -----Original Message----- | From: Tom Pledger [mailto:Tom.Pledger@peace.com]=20 | Sent: 24 March 2003 21:14 | To: haskell@haskell.org | Subject: Arbitrary precision reals? |=20 |=20 | Niall Dalton writes: | | Hi, | |=20 | | Its been a while since I've been using Haskell seriously,=20 | so I might simply | have overlooked the answer.. |=20 | | Is there an arbitrary precision real number library=20 | available for Haskell? | IIRC, atleast GHC uses the GMP=20 | library, but only for integers? |=20 From jleite@di.fct.unl.pt Tue Mar 25 18:34:14 2003 From: jleite@di.fct.unl.pt (=?iso-8859-1?Q?Jo=E3o_Alexandre_Leite?=) Date: Tue, 25 Mar 2003 18:34:14 -00 Subject: CFP: DALT'03 - 1st Workshop on Declarative Agent Languages and Technologies Message-ID: <415-220033225183414856@ANIMAL> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D S E C O N D C A L L F O R P A P E R S DALT 2003 First International Workshop on Declarative Agent Languages and Technologies Melbourne, Australia July 15th 2003 http://centria=2Edi=2Efct=2Eunl=2Ept/~jleite/dalt03/index=2Ehtm In conjunction with AAMAS 2003 2nd International Conference on Autonomous Agents and Multi-Agent Systems http://www=2Eaamas-conference=2Eorg/ Submission: 11 of April, 2003 Post-Proceedings publishe by Springer-Verlag (LNAI) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D TECHNICAL DESCRIPTION Agent metaphors and technologies are ever more adopted to=20 harness and govern the complexity of today's systems=2E As a=20 consequence, the growing complexity of agent systems calls=20 for models and technologies that promote system=20 predictability, and enable feature discovery and=20 verification=2E Recent advances in the area of logics and=20 formal methods make declarative languages and technologies=20 a mostly promising approach to the modeling and engineering=20 of complex agent systems=2E DALT aims at fostering a discussion forum to export, on the=20 one hand, such techniques into the broader community of=20 agent researchers and practitioners and, on the other hand,=20 to bring in the issues of real-world, complex, and possibly=20 large-scale agent system design in the perspective of=20 formal methods and declarative technologies=2E DALT 2003 will take place in Melbourne, Australia, in=20 conjunction with AAMAS, the 2nd International Conference on=20 Autonomous Agents and Multi-Agent Systems=2E Topics of interest include, but are not limited to: * Declarative agent communication and coordination languages * Knowledge-based and knowledge-intensive MAS * Modeling of agent rationality * Declarative approaches to the engineering of MAS * High level agent specification languages * Practical aspects of declarative agent programming and implementation * Formal methods for the specification and verification of MAS * Computational logics in MAS * Argumentation and dialectical systems in MAS * Declarative description of contracts and negotiation issues in MAS * Lessons learned from the design and implementation of MAS * Declarative paradigms for the combination of heterogeneous agents * Constraints and MAS * Declarative representation of policies and security in MAS SUBMISSIONS We welcome and encourage the submission of high quality,=20 original papers, which are not simultaneously submitted for=20 publication elsewhere=2E Papers should be written in English, formatted according to=20 the Springer LNCS style, which can be obtained at=20 (http://www=2Espringer=2Ede/comp/lncs/authors=2Ehtml), and not=20 exceed 16 pages including figures, references, etc=2E Send your paper in PostScript (PS) or Portable Document=20 Format (PDF) to jleite@di=2Efct=2Eunl=2Ept=2E IMPORTANT DATES * Submission, 11 of April, 2003 * Notification, 6 of May, 2003 * Camera Ready, 16 of May, 2003 PROCEEDINGS To encourage and promote the discussion, early and final=20 versions of the accepted papers will be available online,=20 at the workshop's web page, as soon as they are available=2E A printed volume with the proceedings will be available at=20 the workshop=2E Authors of papers presented at the workshop will be asked=20 to extend their contributions, possibly incorporating the=20 results of the workshop discussion, to be included in the=20 workshop post-proceedings=2E Post-proceedings will be published by Springer-Verlag as a=20 volume of the Lecture Notes on Artificial Intelligence=20 series (http://www=2Espringer=2Ede/comp/lncs/index=2Ehtml)=2E PROGRAM COMMITTEE Rafael Bordini, The University of Liverpool, UK Jeff Bradshaw, The University of West Florida, FL, USA Antonio Brogi, Universit=E0 di Pisa, Italy Stefania Costantini, Universit=E0 degli Studi di L'Aquila, Italy Yves Demazeau, Institut IMAG, Grenoble, France J=FCrgen Dix, The University of Manchester, UK Toru Ishida, Kyoto University, Japan Catholijn Jonker, Vrije Universiteit Amsterdam, The Netherlands Antonis Kakas, University of Cyprus, Cyprus Daniel Kudenko, University of York, UK Alessio Lomuscio, King's College, London, UK Viviana Mascardi, DISI, Genova, Italy Paola Mello, Universit=E0 di Bologna, Italy John Jules Ch=2E Meyer, Universiteit Utrecht, The Netherlands Charles L=2E Ortiz, SRI International, Menlo Park, CA, USA Sascha Ossowski, Universidad Rey Juan Carlos, Madrid, Spain Lu=EDs Moniz Pereira, Universidade Nova de Lisboa, Portugal Jeremy Pitt, Imperial College, London, UK Ken Satoh, National Institute of Informatics, Tokyo, Japan Michael Schroeder, City University, London, UK Onn Shehory, IBM Research Lab in Haifa, Israel Carles Sierra, Spanish Research Council, Barcelona, Spain V=2ES=2E Subrahmanian, University of Maryland, MD, USA Francesca Toni, Imperial College, London, UK Wiebe van der Hoek, The University of Liverpool, UK Franco Zambonelli, Universit=E0 di Modena, Italy ORGANIZING COMMITTEE Co-chairs: Jo=E3o Alexandre Leite (Contact Person) Universidade Nova de Lisboa jleite@di=2Efct=2Eunl=2Ept Andrea Omicini Universit=E0 di Bologna aomicini@deis=2Eunibo=2Eit Leon Sterling The University of Melbourne leon@cs=2Emu=2Eoz=2Eau Paolo Torroni Universit=E0 di Bologna ptorroni@deis=2Eunibo=2Eit From weixrl@uwec.edu Tue Mar 25 21:07:54 2003 From: weixrl@uwec.edu (Weix, Rachel Lynn) Date: Tue, 25 Mar 2003 15:07:54 -0600 Subject: Haskell help! Message-ID: <0EBCCD9264788F41802CF255C0B3FF0E387783@STAN.uwec.edu> This is a multi-part message in MIME format. ------_=_NextPart_001_01C2F312.9A907270 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable I have since been able to figure out my problems - the algorithm for one = of my methods was wrong and I found two "typos" so to speak. I now need = to figure out how to return all optimal solutions, and I have an idea as = to how to start. If I have any more problems I may send out another = email. =20 Rachel P.S. I need to solve the problem using functional programming, thus I = cannot use looping structures or mutation. -----Original Message-----=20 From: Iavor S. Diatchki [mailto:diatchki@cse.ogi.edu]=20 Sent: Tue 3/25/2003 2:45 PM=20 To: Weix, Rachel Lynn=20 Cc: haskell@haskell.org=20 Subject: Re: Haskell help! =09 =09 hi, =09 i think you might find the following paper relevant: "Algebrainc Dynamic Prorgamming" by Robert Gigerich and Carsten Meyer = http://link.springer-ny.com/link/service/series/0558/papers/2422/24220349= .pdf =09 bye iavor =09 Weix, Rachel Lynn wrote: > Hi, >=20 > I'm a college student trying to write a Haskell program, and I'm = having > some problems getting the correct output. I need to write a program > which will return a set of optimally aligned sequences, with = "optimal" > being defined as such: mismatch or space (represented by a "-") =3D = -1; > else 1 for every pair (see below for what a pair is) >=20 > An example set of sequences with an alignment of -3 is as follows: >=20 > sc-h-e-me > icecream- >=20 > (s,i) are a pair, (c, c), etc. >=20 > For right now, I'm only returning a potential solution (vs. a set of > solutions), and I'm having problems with any set of sequences that > aren't the same length. My results are listed below. I don't want = to > include the code for now since it's about a page long (printed out) = but > was hoping maybe someone had an idea as to why I'm getting such odd > results? If code will help, I can exchange back and forth with = whoever > thinks they might be able to help me out. Your help is much > appreciated! >=20 > Rachel >=20 >=20 > -- Each word/sequence you see has been predefined in my Haskell code > -- This first example appears to work just fine >=20 > Main> printSeq icecream scheme > > ("icecream", "scheme--") > >=20 > > Main> printSeq hate hatter > > ("hat-e", "hatte") > > > > Main> printSeq scheme saturn > > ("scheme", "saatur") > > > > Main> printSeq saturn scheme > > ("saaturn", "scheme-") > > > > Main> printSeq saturn hatter > > ("saaturn", "hatter-") > > > > Main> printSeq hatter saturn > > ("hatter", "saatur") > > > > Main> printSeq mad saturn > > ("mad", "saa") > > > > Main> printSeq hate hatter > > ("hat-e", "hatte") > > > > Main> printSeq snowball icecream > > ("snowb-all", "icecream-") > > > > Main> printSeq mad computer > > ("--mad", "compu") > >=20 > > Main> printSeq mad snowball > > ("mad", "sno") > > =09 =09 -- = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =09 =09 ------_=_NextPart_001_01C2F312.9A907270 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable =0A= =0A= =0A= =0A= =0A= =0A= Re: Haskell help!=0A= =0A= =0A=
I have since been able to figure out my problems - the algorithm = for one of =0A= my methods was wrong and I found two "typos" so to speak.  I now = need to =0A= figure out how to return all optimal solutions, and I have an idea as to = how to =0A= start.  If I have any more problems I may send out another = email.
=0A=
 
=0A=
Rachel
=0A=
P.S.  I need  to solve the problem using functional = programming, =0A= thus I cannot use looping structures or mutation.
=0A=
=0A=
-----Original Message-----
From: Iavor = S. =0A= Diatchki [mailto:diatchki@cse.ogi.edu]
Sent: Tue 3/25/2003 = 2:45 PM =0A=
To: Weix, Rachel Lynn
Cc: haskell@haskell.org =0A=
Subject: Re: Haskell help!

=0A=

hi,

i think you might find the following = paper =0A= relevant:
"Algebrainc Dynamic Prorgamming"
by Robert Gigerich = and =0A= Carsten Meyer
http://link.springer-ny.com/link/service/series/0558/papers= /2422/24220349.pdf

bye
iavor

Weix, =0A= Rachel Lynn wrote:
> Hi,

> I'm a college = student =0A= trying to write a Haskell program, and I'm having
> some = problems =0A= getting the correct output.  I need to write a program
> = which will =0A= return a set of optimally aligned sequences, with "optimal"
> = being =0A= defined as such: mismatch or space (represented by a "-") =3D = -1;
> else 1 =0A= for every pair (see below for what a pair is)

> An = example =0A= set of sequences with an alignment of -3 is as = follows:

> =0A= sc-h-e-me
> icecream-

> (s,i) are a pair, = (c, c), =0A= etc.

> For right now, I'm only returning a = potential =0A= solution (vs. a set of
> solutions), and I'm having problems = with any =0A= set of sequences that
> aren't the same length.  My results = are =0A= listed below.  I don't want to
> include the code for now = since =0A= it's about a page long (printed out) but
> was hoping maybe = someone had =0A= an idea as to why I'm getting such odd
> results?  If code = will =0A= help, I can exchange back and forth with whoever
> thinks they = might be =0A= able to help me out.  Your help is much
> =0A= appreciated!

> = Rachel


> =0A= -- Each word/sequence you see has been predefined in my Haskell = code
> =0A= -- This first example appears to work just fine

> = Main> =0A= printSeq icecream scheme
>
> ("icecream", =0A= "scheme--")
>

>
> Main> printSeq = hate =0A= hatter
>
> ("hat-e", = "hatte")
>
>
>
> =0A= Main> printSeq scheme saturn
>
> ("scheme", =0A= "saatur")
>
>
>
> Main> printSeq saturn =0A= scheme
>
> ("saaturn", = "scheme-")
>
>
>
> =0A= Main> printSeq saturn hatter
>
> ("saaturn", =0A= "hatter-")
>
>
>
> Main> printSeq hatter =0A= saturn
>
> ("hatter", = "saatur")
>
>
>
> =0A= Main> printSeq mad saturn
>
> ("mad", =0A= "saa")
>
>
>
> Main> printSeq hate =0A= hatter
>
> ("hat-e", = "hatte")
>
>
>
> =0A= Main> printSeq snowball icecream
>
> ("snowb-all", =0A= "icecream-")
>
>
>
> Main> printSeq mad =0A= computer
>
> ("--mad", =0A= "compu")
>

>
> Main> printSeq mad =0A= snowball
>
> ("mad", =0A= = "sno")
>
>


--
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
| =0A= Iavor S. Diatchki, Ph.D. =0A= = student           =     =0A= |
| Department of Computer Science and Engineering |
| School of = OGI at =0A= = OHSU           &nb= sp;           &nbs= p;  =0A= |
| http://www.cse.ogi.edu/~diatchk= i           &n= bsp;   =0A= = |
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D

=0A= =0A= =0A= ------_=_NextPart_001_01C2F312.9A907270-- From fjh@cs.mu.OZ.AU Wed Mar 26 08:00:44 2003 From: fjh@cs.mu.OZ.AU (Fergus Henderson) Date: Wed, 26 Mar 2003 19:00:44 +1100 Subject: Arbitrary precision reals? In-Reply-To: <15999.29946.967949.393321@tux-17.corp.peace.com> References: <15999.29946.967949.393321@tux-17.corp.peace.com> Message-ID: <20030326080044.GA19988@ceres.cs.mu.oz.au> On 25-Mar-2003, Tom Pledger wrote: > > The floating point part of the GNU mp library looks difficult to fit > into Haskell's numeric classes, because the type signatures in class > Floating don't include a how-much-precision-do-you-want parameter. How about using a function type which takes a precision and gives you back an answer to that many digits, and making this function type an instance of the numeric type classes? E.g. data MPF_T -- abstract, corresponds to GNU mp's mpf_t type PRECISION = Int type ARBITRARY_PRECISION_REAL = (PRECISION -> MPF_T) instance Floating ARBITRARY_PRECISION_REAL where sqrt x = (\prec -> mpf_sqrt_ui (x (prec + sqrt_lossage))) where sqrt_lossage = 1 -- amount of precision lost by sqrt ... Here mpf_sqrt_ui would be an interface to GMP's mpf_sqrt_ui() function, which takes as input an mpf_t and a precision and produces an mpf_t as output. -- Fergus Henderson | "I have always known that the pursuit The University of Melbourne | of excellence is a lethal habit" WWW: | -- the last words of T. S. Garp. From alastair@reid-consulting-uk.ltd.uk Wed Mar 26 08:34:27 2003 From: alastair@reid-consulting-uk.ltd.uk (Alastair Reid) Date: Wed, 26 Mar 2003 08:34:27 +0000 Subject: Arbitrary precision reals? In-Reply-To: <20030326080044.GA19988@ceres.cs.mu.oz.au> (Fergus Henderson's message of "Wed, 26 Mar 2003 19:00:44 +1100") References: <15999.29946.967949.393321@tux-17.corp.peace.com> <20030326080044.GA19988@ceres.cs.mu.oz.au> Message-ID: Tom Pledger wrote: >> The floating point part of the GNU mp library looks difficult to >> fit into Haskell's numeric classes, because the type signatures in >> class Floating don't include a how-much-precision-do-you-want >> parameter. Fergus Henderson writes: > How about using a function type which takes a precision and gives > you back an answer to that many digits, and making this function > type an instance of the numeric type classes? That's pretty neat. But it seems that this will suffer from the same loss of sharing problem as we get with overloaded CAFs. That is, if I calculate: let a :: ARBITRARY_PRECISION_REAL a = 1 b = a+a c = b+b d = c+c e = d+d in e then, instead of doing just 4 additions, I will do 15. So I think we need to add in a memo table. More seriously though, can we make an Eq instance? Presumably the GNU MP equality test doesn't test for equality but equality over the first 'n' bits for some user-specified 'n'? -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/ From nad@cs.chalmers.se Wed Mar 26 12:00:16 2003 From: nad@cs.chalmers.se (Nils Anders Danielsson) Date: Wed, 26 Mar 2003 13:00:16 +0100 (MET) Subject: Arbitrary precision reals? In-Reply-To: <15999.29946.967949.393321@tux-17.corp.peace.com> References: <15999.29946.967949.393321@tux-17.corp.peace.com> Message-ID: On Tue, 25 Mar 2003, Tom Pledger wrote: > I don't know whether arbitrary precision reals have been done in > Haskell, but here's one of the issues... There is a "Haskell implementation of exact real arithmetic using Linear Fractional Transformations", see http://www.doc.ic.ac.uk/~ae/exact-computation/ for implementations and a bunch of papers. (The web server does not seem to respond right now, but the pages are cached by Google.) /NAD From Malcolm.Wallace@cs.york.ac.uk Wed Mar 26 19:00:30 2003 From: Malcolm.Wallace@cs.york.ac.uk (Malcolm Wallace) Date: Wed, 26 Mar 2003 19:00:30 +0000 Subject: ANNOUNCE: hat-2.02 Message-ID: <20030326190030.4fb4ac9a.Malcolm.Wallace@cs.york.ac.uk> hat-2.02 -------- http://www.haskell.org/hat/ We are pleased to announce a new release of Hat, the Haskell Tracer. Hat is a very useful tool for understanding and debugging programs. Hat is compiler independent, and can be used on any Unix-like platform. This new release, hat-2.02, can be used with the compilers ghc-5.04.2, nhc98-1.16, upwards. Particular features of note in this release are: * Support for hierarchical module namespaces. (The Hat distribution also includes a tracing version of a subset of the base package of standard hierarchical libraries.) * Support for common type-system extensions (if your compiler also supports them. These include: multi-parameter type classes, functional dependencies, and existential quantification of datatype declarations. * A significant speed improvement (20-40%) of traced programs over the previous release. (Plus, if you build Hat with ghc -O, you can get another 20-40% performance boost.) * We believe Hat now works under Windows (provided you have Cygwin, and some of the X toolset - please check the requirements listed on the website carefully). It continues to work under MacOS-X as well (provided you have Apple's X toolset). There are also lots of more minor improvements in the viewing tools. For instance: * The viewers now support qualified name syntax. * Named field constructions and updates are now displayed correctly. * List sugaring is fixed. * Large expressions that scroll off the display are now fixed. * Lots of other small bugfixes. See the website http://www.haskell.org/hat/ for full details. There is a dedicated mailing list for bug-reports and other discussion of Hat: http://www.haskell.org/mailman/listinfo/hat Regards, The Hat team at York [ The Hat team consists of Malcolm Wallace, Olaf Chitil, and Colin Runciman, with thanks to many other students, visitors, collaborators and reviewers. The development of Hat was funded by EPSRC grant number GR/M81953, and the latest release was partially supported by the University of York and Microsoft Research (Cambridge). ] From weixrl@uwec.edu Wed Mar 26 22:30:08 2003 From: weixrl@uwec.edu (Weix, Rachel Lynn) Date: Wed, 26 Mar 2003 16:30:08 -0600 Subject: Haskell help! Message-ID: <0EBCCD9264788F41802CF255C0B3FF0E387786@STAN.uwec.edu> This is a multi-part message in MIME format. ------_=_NextPart_001_01C2F3E7.41B04132 Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C2F3E7.41B04132" ------_=_NextPart_002_01C2F3E7.41B04132 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Currently I'm having problems with type checking due to Haskell being a = strongly typed language. In order to return all optimal solutions, my = professor suggested I create a list of tuples if they all have the same = score, as indicated in my new maxSeq method (see attachment). However, = this means that the maxSeq method would return type [[(Char,Char)]]. = Since maxSeq and getSeq must return the same type, I end up changing all = my signatures and end up with lots of problems. In my caseX methods, I = can't append [(Char)] to [[(Char,Char)]], and it also messes up trying = to get my score of each tuple, etc. I've been trying to solve the = problem in Scheme first but even then I'm having problems, and Scheme is = only loosely typed. Any suggestions? The format should be something = like the following (partial example): =20 [ [(-,M)] [(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)] = [(-,s)(h,t)(e,e)(-,r)(-,s)]]].=20 =20 Once I get back my list, I need to pair everything up in order to return = a list of optimal solutions. Taking the previous example, it would be = the following when paired up correctly: =20 [ [(-,M)(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)], = [(-,M)(T,a)(-,s)(h,t)(e,e)(-,r)(-,s)] ]=20 =20 >From there, I find which sequence has the maximum score. I then walk = through the list again, making a list of all the sequences that have = that score. These two steps seem fairly trivial, it's all the above = stuff which I'm struggling on. =20 Rachel =20 -----Original Message-----=20 From: Marc Ziegert [mailto:coeus@gmx.de]=20 Sent: Tue 3/25/2003 3:13 PM=20 To: Weix, Rachel Lynn=20 Cc:=20 Subject: Re: Haskell help! maxSeq had one mistake: || instead of && =09 i will think about the problem itself, before rewriting all. =09 this is the file a little bit more in haskell style. =09 =09 =09 Am Dienstag, 25. M=E4rz 2003 20:16 schrieben Sie: > I found my two mistakes, plus I fixed the method my Professor said = was > incorrect. Now I just have to be able to find ALL optimal solutions, > instead of just one. Hooray! > > Rachel =09 ------_=_NextPart_002_01C2F3E7.41B04132 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable =0A= =0A= =0A= =0A= =0A= =0A= =0A= Re: Haskell help!=0A= =0A= =0A=
Currently I'm having problems with type checking due to Haskell = being a =0A= strongly typed language.  In order to return all optimal solutions, = my =0A= professor suggested I create a list of tuples if they all have the same = score, =0A= as indicated in my new maxSeq method (see attachment).  However, = this means =0A= that the maxSeq method would return type [[(Char,Char)]].  = Since =0A= maxSeq and getSeq must return the same type, I end up changing all my = signatures =0A= and end up with lots of problems.  In my caseX methods, I can't = append =0A= [(Char)] to [[(Char,Char)]], and it also messes up trying to get my = score of =0A= each tuple, etc.  I've been trying to solve the problem in Scheme = first but =0A= even then I'm having problems, and Scheme is only loosely typed.  = Any =0A= suggestions?  The format should be something like the following = (partial =0A= example):
=0A=
 
=0A=
[ [(-,M)] [(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)] =0A= [(-,s)(h,t)(e,e)(-,r)(-,s)]]]. 
=0A=
 
=0A=
Once I get back my list, I need to pair everything up in order to = return a =0A= list of optimal solutions.  Taking the previous example, it would = be the =0A= following when paired up correctly:
=0A=
 
=0A=
[ [(-,M)(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)], =0A= [(-,M)(T,a)(-,s)(h,t)(e,e)(-,r)(-,s)] ] 
=0A=
 
=0A=
From there, I find which sequence has the maximum score.  I = then walk =0A= through the list again, making a list of all the sequences that have = that =0A= score.  These two steps seem fairly trivial, it's all the above = stuff which =0A= I'm struggling on.
=0A=
 
=0A=
Rachel
=0A=
 
=0A=
-----Original Message-----
From: Marc = Ziegert =0A= [mailto:coeus@gmx.de]
Sent: Tue 3/25/2003 3:13 PM =
To: =0A= Weix, Rachel Lynn
Cc:
Subject: Re: Haskell =0A= help!

=0A=
=0A=

maxSeq had one mistake: || instead of = &&

i will =0A= think about the problem itself, before rewriting all.

this is = the file =0A= a little bit more in haskell style.



Am Dienstag, 25. = M=E4rz 2003 =0A= 20:16 schrieben Sie:
> I found my two mistakes, plus I fixed the = method =0A= my Professor said was
> incorrect.  Now I just have to be = able to =0A= find ALL optimal solutions,
> instead of just one.  =0A= Hooray!
>
> Rachel

=0A= =0A= =0A= ------_=_NextPart_002_01C2F3E7.41B04132-- ------_=_NextPart_001_01C2F3E7.41B04132 Content-Type: application/octet-stream; name="prog1c.hs" Content-Transfer-Encoding: base64 Content-Description: prog1c.hs Content-Disposition: attachment; filename="prog1c.hs" LS1TYW1wbGUgU2VxdWVuY2VzDQppY2VjcmVhbSA9ICJpY2VjcmVhbSINCnNjaGVtZSA9ICJzY2hl bWUiDQpzYXR1cm4gPSAic2F0dXJuIiAgLS0gInNhYXR1cm4iDQptYWQgPSBbJ20nLCdhJywnZCdd DQpoYXR0ZXIgPSBbJ2gnLCdhJywndCcsJ3QnLCdlJywnciddDQpoYXRlID0gWydoJywnYScsJ3Qn LCdlJ10NCnNub3diYWxsID0gWydzJywnbicsJ28nLCd3JywnYicsJ2EnLCdsJywnbCddDQpjb21w dXRlciA9IFsnYycsJ28nLCdtJywncCcsJ3UnLCd0JywnZScsJ3InXQ0KY29mZmVlID0gWydjJywn bycsJ2YnLCdmJywnZScsJ2UnXQ0KDQoNCi0tRnVuY3Rpb24gdGhhdCdzIGNhbGxlZCBpbiBhIGNv bnNvbGUgd2luZG93IHdoaWNoIGRvZXMgdGhlIHNlcXVlbmNlIA0KLS1hbGlnbm1lbnQgYW5kIHB1 dHMgdGhlIHR3byBvcHRpbWFsIHNlcXVlbmNlcyBiYWNrIHRvZ2V0aGVyDQpwcmludFNlcSA6OiBT dHJpbmcgLT4gU3RyaW5nIC0+IChTdHJpbmcsU3RyaW5nKQ0KcHJpbnRTZXEgczEgczIgPSB1bnpp cCAoZ2V0U2VxIHMxIHMyKQ0KDQoNCi0tTWFpbiBmdW5jdGlvbiBvZiB0aGUgcHJvZ3JhbSB3aGlj aCBkb2VzIHRoZSBhY3R1YWwgc2VxdWVuY2UgYWxpZ25tZW50DQpnZXRTZXEgOjogU3RyaW5nIC0+ IFN0cmluZyAtPiBbKENoYXIsQ2hhcildDQpnZXRTZXEgW10gW10gPSBbXQ0KZ2V0U2VxIFtdIHMy ID0gY2FzZTIgW10gczINCmdldFNlcSBzMSBbXSA9IGNhc2UzIHMxIFtdDQpnZXRTZXEgczEgczIg PSBsZXQgYTEgPSBjYXNlMSBzMSBzMjsNCiAgICAgICAgICAgICAgICAgICBhMiA9IGNhc2UyIHMx IHMyOw0KICAgICAgICAgICAgICAgICAgIGEzID0gY2FzZTMgczEgczI7DQogICAgICAgICAgICAg ICBpbiBtYXhTZXEgYTEgYTIgYTMNCg0KDQpjYXNlMSA6OiBbQ2hhcl0gLT4gW0NoYXJdIC0+IFso Q2hhcixDaGFyKV0NCmNhc2UxIHMxIHMyID0gWyhoZWFkIHMxLGhlYWQgczIpXSArKyBnZXRTZXEg KHRhaWwgczEpICh0YWlsIHMyKQ0KDQpjYXNlMiA6OiBbQ2hhcl0gLT4gW0NoYXJdIC0+IFsoQ2hh cixDaGFyKV0NCmNhc2UyIHMxIHMyID0gWygnLScsaGVhZCBzMildICsrIGdldFNlcSBzMSAodGFp bCBzMikNCg0KY2FzZTMgOjogW0NoYXJdIC0+IFtDaGFyXSAtPiBbKENoYXIsQ2hhcildDQpjYXNl MyBzMSBzMiA9IFsoaGVhZCBzMSwnLScpXSArKyBnZXRTZXEgKHRhaWwgczEpIHMyDQoNCg0KLS1H cmFiIHRoZSBzY29yZSBvZiBvbmUgdHVwbGUgKGEgcG9zc2libGUgYWxpZ25tZW50KQ0Kc2NvcmUg OjogKEVxIGEpID0+IChhLGEpIC0+IEludGVnZXINCnNjb3JlIChjMSxjMikgfCBjMT09YzIgICAg PSAxDQogICAgICAgICAgICAgIHwgb3RoZXJ3aXNlID0gLTENCiAgICAgICAgICAgIA0KLS1TdW0g dXAgdGhlIHNjb3JlIGZvciBhIHNlcXVlbmNlDQpzY29yZVN1bSA6OiAoRXEgYSkgPT4gWyhhLGEp XSAtPiBJbnRlZ2VyDQpzY29yZVN1bSBzZXEgPSBzdW0gJCBtYXAgc2NvcmUgc2VxDQoNCg0KLS1S ZXR1cm5zIGEgc29sdXRpb24NCm1heFNlcSA6OiAoRXEgYSkgPT4gWyhhLGEpXSAtPiBbKGEsYSld IC0+IFsoYSxhKV0gLT4gWyhhLGEpXQ0KbWF4U2VxIGExIGEyIGEzDQogICAgICB8IHMxID09IHMy ICYmIHMxID09IHMzID0gW2ExLGEyLGEzXQ0KCXwgczEgPT0gczIgJiYgczEgPiBzMyA9ICBbYTEs YTJdDQoJfCBzMSA9PSBzMyAmJiBzMSA+IHMyID0gIFthMSxhM10NCgl8IHMyID09IHMzICYmIHMy ID4gczEgPSAgW2EyLGEzXQ0KCXwgczEgPiBzMiAmJiBzMSA+IHMzID0gICBbYTFdDQogICAgICB8 IHMyID4gczEgJiYgczIgPiBzMyA9ICAgW2EyXQ0KICAgICAgfCBvdGhlcndpc2UgICAgICAgICAg PSAgIFthM10NCiAgICAgICAgd2hlcmUgczEgPSBzY29yZVN1bSBhMQ0KICAgICAgICAgICAgICBz MiA9IHNjb3JlU3VtIGEyDQogICAgICAgICAgICAgIHMzID0gc2NvcmVTdW0gYTMNCg== ------_=_NextPart_001_01C2F3E7.41B04132-- From weixrl@uwec.edu Wed Mar 26 22:32:41 2003 From: weixrl@uwec.edu (Weix, Rachel Lynn) Date: Wed, 26 Mar 2003 16:32:41 -0600 Subject: Haskell help! Message-ID: <0EBCCD9264788F41802CF255C0B3FF0E387788@STAN.uwec.edu> This is a multi-part message in MIME format. ------_=_NextPart_001_01C2F3E7.9CD6E0DC Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable P.S. The example given is for the set of sequences/strings = (The,Masters) -----Original Message-----=20 From: Weix, Rachel Lynn=20 Sent: Wed 3/26/2003 4:30 PM=20 To: coeus@gmx.de=20 Cc: haskell@haskell.org=20 Subject: RE: Haskell help! =09 =09 Currently I'm having problems with type checking due to Haskell being a = strongly typed language. In order to return all optimal solutions, my = professor suggested I create a list of tuples if they all have the same = score, as indicated in my new maxSeq method (see attachment). However, = this means that the maxSeq method would return type [[(Char,Char)]]. = Since maxSeq and getSeq must return the same type, I end up changing all = my signatures and end up with lots of problems. In my caseX methods, I = can't append [(Char)] to [[(Char,Char)]], and it also messes up trying = to get my score of each tuple, etc. I've been trying to solve the = problem in Scheme first but even then I'm having problems, and Scheme is = only loosely typed. Any suggestions? The format should be something = like the following (partial example): =20 [ [(-,M)] [(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)] = [(-,s)(h,t)(e,e)(-,r)(-,s)]]].=20 =20 Once I get back my list, I need to pair everything up in order to = return a list of optimal solutions. Taking the previous example, it = would be the following when paired up correctly: =20 [ [(-,M)(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)], = [(-,M)(T,a)(-,s)(h,t)(e,e)(-,r)(-,s)] ]=20 =20 From there, I find which sequence has the maximum score. I then walk = through the list again, making a list of all the sequences that have = that score. These two steps seem fairly trivial, it's all the above = stuff which I'm struggling on. =20 Rachel =20 -----Original Message-----=20 From: Marc Ziegert [mailto:coeus@gmx.de]=20 Sent: Tue 3/25/2003 3:13 PM=20 To: Weix, Rachel Lynn=20 Cc:=20 Subject: Re: Haskell help! =09 =09 maxSeq had one mistake: || instead of && =09 i will think about the problem itself, before rewriting all. =09 this is the file a little bit more in haskell style. =09 =09 =09 Am Dienstag, 25. M=E4rz 2003 20:16 schrieben Sie: > I found my two mistakes, plus I fixed the method my Professor said = was > incorrect. Now I just have to be able to find ALL optimal = solutions, > instead of just one. Hooray! > > Rachel =09 ------_=_NextPart_001_01C2F3E7.9CD6E0DC Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= Re: Haskell help!=0A= =0A= =0A=
P.S.  The example given is for the set of sequences/strings =0A= (The,Masters)
=0A=
=0A=
-----Original Message-----
From: Weix, = Rachel =0A= Lynn
Sent: Wed 3/26/2003 4:30 PM
To: = coeus@gmx.de =0A=
Cc: haskell@haskell.org
Subject: RE: Haskell =0A= help!

=0A=
Currently I'm having problems with type checking due to Haskell = being a =0A= strongly typed language.  In order to return all optimal = solutions, my =0A= professor suggested I create a list of tuples if they all have the = same score, =0A= as indicated in my new maxSeq method (see attachment).  However, = this =0A= means that the maxSeq method would return type = [[(Char,Char)]].  =0A= Since maxSeq and getSeq must return the same type, I end up changing = all my =0A= signatures and end up with lots of problems.  In my caseX = methods, I =0A= can't append [(Char)] to [[(Char,Char)]], and it also messes up trying = to get =0A= my score of each tuple, etc.  I've been trying to solve the = problem in =0A= Scheme first but even then I'm having problems, and Scheme is only = loosely =0A= typed.  Any suggestions?  The format should be something = like the =0A= following (partial example):
=0A=
 
=0A=
[ [(-,M)] [(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)] =0A= [(-,s)(h,t)(e,e)(-,r)(-,s)]]]. 
=0A=
 
=0A=
Once I get back my list, I need to pair everything up in order to = return =0A= a list of optimal solutions.  Taking the previous example, it = would be =0A= the following when paired up correctly:
=0A=
 
=0A=
[ [(-,M)(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)], =0A= [(-,M)(T,a)(-,s)(h,t)(e,e)(-,r)(-,s)] ] 
=0A=
 
=0A=
From there, I find which sequence has the maximum score.  I = then =0A= walk through the list again, making a list of all the sequences that = have that =0A= score.  These two steps seem fairly trivial, it's all the above = stuff =0A= which I'm struggling on.
=0A=
 
=0A=
Rachel
=0A=
 
=0A=
-----Original Message-----
From: Marc = Ziegert =0A= [mailto:coeus@gmx.de]
Sent: Tue 3/25/2003 3:13 PM =
To: =0A= Weix, Rachel Lynn
Cc:
Subject: Re: Haskell =0A= help!

=0A=
=0A=

maxSeq had one mistake: || instead of = &&

i =0A= will think about the problem itself, before rewriting = all.

this is =0A= the file a little bit more in haskell style.



Am = Dienstag, 25. =0A= M=E4rz 2003 20:16 schrieben Sie:
> I found my two mistakes, = plus I fixed =0A= the method my Professor said was
> incorrect.  Now I just = have to =0A= be able to find ALL optimal solutions,
> instead of just = one.  =0A= Hooray!
>
> =0A= Rachel

=0A= =0A= =0A= ------_=_NextPart_001_01C2F3E7.9CD6E0DC-- From jawbrey@oakland.edu Wed Mar 26 22:40:56 2003 From: jawbrey@oakland.edu (Jon Awbrey) Date: Wed, 26 Mar 2003 17:40:56 -0500 Subject: Theme One Project Message-ID: <3E822C78.3F9C09D9@oakland.edu> o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o My name is Jon Awbrey. I have returned to university in my 50's to work on a doctorate in systems engineering and also to "capstone" a few old projects that I did not get to finish up in my last millennium. In the process I have dug up one of my old unfinished programming symphonies that I thought I might offer to the Haskell community as a potentially interesting exercise or project, since one of the things that I was trying to do there was to transpose Pascal into a functional style. The main idea of the program is to integrate an "empiricist" learning algorithm (working on 2-level formal languages) with a "rationalist" reasoning algorithm (working at the level of propositional calculus). It implements (what I used to think of as) some pretty radical graph-theoretic data structures, extending some ideas of C.S. Peirce on graphical syntaxes for propositional logic. (I had started this somewhat before Conceptual Graphs hit the streets.) I have begun documenting this work in a detailed way at the following list site, dedicated to this and related purposes: http://stderr.org/pipermail/inquiry/ http://stderr.org/cgi-bin/mailman/listinfo/inquiry You can also get the postings in newsgroup format from Gmane: http://gmane.org/ http://news.gmane.org/ http://news.gmane.org/thread.php?group=gmane.comp.inquiry The Pascal source code is here: 01. http://stderr.org/pipermail/inquiry/2003-March/000115.html 02. http://stderr.org/pipermail/inquiry/2003-March/000116.html 03. http://stderr.org/pipermail/inquiry/2003-March/000117.html 04. http://stderr.org/pipermail/inquiry/2003-March/000118.html 05. http://stderr.org/pipermail/inquiry/2003-March/000119.html And I will send the Exe file to anybody who wants it. Jon Awbrey o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o~~~~~~~~~o From ajb@spamcop.net Wed Mar 26 23:04:40 2003 From: ajb@spamcop.net (Andrew J Bromage) Date: Thu, 27 Mar 2003 10:04:40 +1100 Subject: Haskell help! In-Reply-To: <0EBCCD9264788F41802CF255C0B3FF0E387786@STAN.uwec.edu> References: <0EBCCD9264788F41802CF255C0B3FF0E387786@STAN.uwec.edu> Message-ID: <20030326230440.GA22604@smtp.alicorna.com> G'day. Some general advice... On Wed, Mar 26, 2003 at 04:30:08PM -0600, Weix, Rachel Lynn wrote: > Currently I'm having problems with type checking due to Haskell being > a strongly typed language. Problems with type checking are almost never caused by Haskell being a strongly typed language. (Note to the peanut gallery: I did say _almost_ never.) Problems with type checking are generally caused by one of 1) your program has a bug, or 2) you don't understand your program as well as you think you do. (This is no reflection on you, incidentally. The best programmers are often surprised by their own code.) > In order to return all optimal solutions, > my professor suggested I create a list of tuples if they all have the > same score, as indicated in my new maxSeq method (see attachment). > However, this means that the maxSeq method would return type > [[(Char,Char)]]. Since maxSeq and getSeq must return the same type, > I end up changing all my signatures and end up with lots of problems. You can save yourself a lot of grief by using type synonyms. If, as in your case, you have two functions which must return the same thing but that thing may change while the program is being written or maintained, a type synonym is precisely what you need. Change it once, and all your type declarations change with it. By the way, your examples aren't valid Haskell. This, for example: > [ [(-,M)(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)], [(-,M)(T,a)(-,s)(h,t)(e,e)(-,r)(-,s)] ] won't compile. You may like to come up with some concrete examples, put them in your script, then write code which tests the functions that you have written using those examples. If nothing else, the act of writing the examples in valid Haskell may help clarify your thinking a bit. Cheers, Andrew Bromage From coeus@gmx.de Wed Mar 26 23:51:57 2003 From: coeus@gmx.de (Marc Ziegert) Date: Thu, 27 Mar 2003 00:51:57 +0100 Subject: Fwd: Re: Haskell help! Message-ID: <200303270051.57389.coeus@gmx.de> ---------- Weitergeleitete Nachricht ---------- Subject: Re: Haskell help! Date: Wed, 26 Mar 2003 23:57:42 +0100 From: Marc Ziegert To: "Weix, Rachel Lynn" i'm just programming the solution. imagine a matrix / a rectangle with a grid: the first word at the top side, the second at the right. each entry takes the best solutions of your sequencing problem using just= a part of the words. in the top right there is the entry for the two empty words: (0,[ ("","") ]) the value is zero, the list has just one solution: ("","") below this entry: (-1,[ ("~","s") ]) at the bottom right: (-7,[ ("~~~~~~~","Masters") ]) all this was the rightmost column. the whole matrix is a list of columns - the head is the leftmost column. the head of one column is the entry at the bottom. the solution of the whole problem is at the bottom left - the head of the head of the matrix. - marc Am Mittwoch, 26. M=E4rz 2003 23:32 schrieben Sie: > P.S. The example given is for the set of sequences/strings (The,Master= s) > > =09-----Original Message----- > =09From: Weix, Rachel Lynn > =09Sent: Wed 3/26/2003 4:30 PM > =09To: coeus@gmx.de > =09Cc: haskell@haskell.org > =09Subject: RE: Haskell help! > > > =09Currently I'm having problems with type checking due to Haskell bein= g a > strongly typed language. In order to return all optimal solutions, my > professor suggested I create a list of tuples if they all have the same > score, as indicated in my new maxSeq method (see attachment). However, > this means that the maxSeq method would return type [[(Char,Char)]]. S= ince > maxSeq and getSeq must return the same type, I end up changing all my > signatures and end up with lots of problems. In my caseX methods, I ca= n't > append [(Char)] to [[(Char,Char)]], and it also messes up trying to get= my > score of each tuple, etc. I've been trying to solve the problem in Sch= eme > first but even then I'm having problems, and Scheme is only loosely typ= ed. > Any suggestions? The format should be something like the following > (partial example): > > =09[ [(-,M)] [(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)] [(-,s)(h,t)(e,e)(-,r)(-,s= )]]]. > > =09Once I get back my list, I need to pair everything up in order to re= turn a > list of optimal solutions. Taking the previous example, it would be th= e > following when paired up correctly: > > =09[ [(-,M)(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)], > [(-,M)(T,a)(-,s)(h,t)(e,e)(-,r)(-,s)] ] > > =09From there, I find which sequence has the maximum score. I then wal= k > through the list again, making a list of all the sequences that have th= at > score. These two steps seem fairly trivial, it's all the above stuff w= hich > I'm struggling on. > > =09Rachel > > =09-----Original Message----- > =09From: Marc Ziegert [mailto:coeus@gmx.de] > =09Sent: Tue 3/25/2003 3:13 PM > =09To: Weix, Rachel Lynn > =09Cc: > =09Subject: Re: Haskell help! > > > > =09=09maxSeq had one mistake: || instead of && > > =09=09i will think about the problem itself, before rewriting all. > > =09=09this is the file a little bit more in haskell style. > > =09=09Am Dienstag, 25. M=E4rz 2003 20:16 schrieben Sie: > =09=09> I found my two mistakes, plus I fixed the method my Professor s= aid was > =09=09> incorrect. Now I just have to be able to find ALL optimal solu= tions, > =09=09> instead of just one. Hooray! > =09=09> > =09=09> Rachel -- Ein Unseliger, der nur kreist um sich selbst, im Leben wird er dem Ruhm nachsehen und doppelt sterbend untergehen; im gemeinen Staub, aus dem er entsprungen, unbeweint, ungeehrt und unbesungen. [Sir Walter Scott] ------------------------------------------------------- --=20 Ein Unseliger, der nur kreist um sich selbst, im Leben wird er dem Ruhm nachsehen und doppelt sterbend untergehen; im gemeinen Staub, aus dem er entsprungen, unbeweint, ungeehrt und unbesungen. [Sir Walter Scott] From coeus@gmx.de Wed Mar 26 23:50:57 2003 From: coeus@gmx.de (Marc Ziegert) Date: Thu, 27 Mar 2003 00:50:57 +0100 Subject: Haskell help! In-Reply-To: <0EBCCD9264788F41802CF255C0B3FF0E387788@STAN.uwec.edu> References: <0EBCCD9264788F41802CF255C0B3FF0E387788@STAN.uwec.edu> Message-ID: <200303270050.57034.coeus@gmx.de> --------------Boundary-00=_XKRD6KRO09B4VGBLEXFE Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable done. - marc Am Mittwoch, 26. M=E4rz 2003 23:32 schrieb Weix, Rachel Lynn: > P.S. The example given is for the set of sequences/strings (The,Master= s) > > =09-----Original Message----- > =09From: Weix, Rachel Lynn > =09Sent: Wed 3/26/2003 4:30 PM > =09To: coeus@gmx.de > =09Cc: haskell@haskell.org > =09Subject: RE: Haskell help! > > > =09Currently I'm having problems with type checking due to Haskell bein= g a > strongly typed language. In order to return all optimal solutions, my > professor suggested I create a list of tuples if they all have the same > score, as indicated in my new maxSeq method (see attachment). However, > this means that the maxSeq method would return type [[(Char,Char)]]. S= ince > maxSeq and getSeq must return the same type, I end up changing all my > signatures and end up with lots of problems. In my caseX methods, I ca= n't > append [(Char)] to [[(Char,Char)]], and it also messes up trying to get= my > score of each tuple, etc. I've been trying to solve the problem in Sch= eme > first but even then I'm having problems, and Scheme is only loosely typ= ed.=20 > Any suggestions? The format should be something like the following > (partial example): > > =09[ [(-,M)] [(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)] [(-,s)(h,t)(e,e)(-,r)(-,s= )]]]. > > =09Once I get back my list, I need to pair everything up in order to re= turn a > list of optimal solutions. Taking the previous example, it would be th= e > following when paired up correctly: > > =09[ [(-,M)(T,a)(h,s)(-,t)(e,e)(-,r)(-,s)], > [(-,M)(T,a)(-,s)(h,t)(e,e)(-,r)(-,s)] ] > > =09From there, I find which sequence has the maximum score. I then wal= k > through the list again, making a list of all the sequences that have th= at > score. These two steps seem fairly trivial, it's all the above stuff w= hich > I'm struggling on. > > =09Rachel > > =09-----Original Message----- > =09From: Marc Ziegert [mailto:coeus@gmx.de] > =09Sent: Tue 3/25/2003 3:13 PM > =09To: Weix, Rachel Lynn > =09Cc: > =09Subject: Re: Haskell help! > > > > =09=09maxSeq had one mistake: || instead of && > > =09=09i will think about the problem itself, before rewriting all. > > =09=09this is the file a little bit more in haskell style. > > =09=09Am Dienstag, 25. M=E4rz 2003 20:16 schrieben Sie: > =09=09> I found my two mistakes, plus I fixed the method my Professor s= aid was > =09=09> incorrect. Now I just have to be able to find ALL optimal solu= tions, > =09=09> instead of just one. Hooray! > =09=09> > =09=09> Rachel --------------Boundary-00=_XKRD6KRO09B4VGBLEXFE Content-Type: text/plain; charset="windows-1252"; name="prog1.hs" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="prog1.hs" module Main where type VSeqs = (Integer,[(String,String)]) -- valued sequences type VS_matrix = [[VSeqs]] emptyVS :: VSeqs emptyVS = (0,[("","")]) rightmostCol :: String -> [VSeqs] rightmostCol "" = [emptyVS] rightmostCol (c:cs) = (v-1,[('~':s1,c:s2)]) : above where above@((v,(s1,s2):_):_) = rightmostCol cs nextCol :: Char -> String -> [VSeqs] -> [VSeqs] nextCol c "" ((v,(s1,s2):_):_) = (v-1,(c:s1,'~':s2):[]):[] nextCol c str2 (vs:vsr) = makeEntry c str2 (head above) vs (head vsr) : above where above = nextCol c (tail str2) vsr makeEntry :: Char-> String -> VSeqs -> VSeqs -> VSeqs -> VSeqs makeEntry c str2@(h:_) above@(va,sa) right@(vr,sr) aboveright@(vd,sd) = maxEntry fa fr fd where fa = (va-1, append '~' h sa ) fr = (vr-1, append c '~' sr ) fd = (vd+v, append c h sd ) v = if c==h then 1 else -1 append l r tups = [ (l:ls,r:rs) | (ls,rs)<-tups ] maxEntry :: VSeqs -> VSeqs -> VSeqs -> VSeqs maxEntry a@(va,_) b@(vb,_) c@(vc,_) = if va>vb then if va>vc then a else c else if vb>vc then b else c fillmatrix :: String -> String -> VS_matrix fillmatrix str1 str2 = scanr xcc (rightmostCol str2) str1 where xcc :: Char -> [VSeqs] -> [VSeqs] xcc x s = nextCol x str2 s findBestSeqs :: String -> String -> VSeqs findBestSeqs str1 str2 = head $ head $ fillmatrix str1 str2 main :: IO () main = do putStr "\"icecream\" \"scheme\" : " putStrLn $ show $ findBestSeqs "icecream" "scheme" putStr "\"hate\" \"hatter\" : " putStrLn $ show $ findBestSeqs "hate" "hatter" putStr "\"scheme\" \"saturn\" : " putStrLn $ show $ findBestSeqs "scheme" "saturn" putStr "\"saturn\" \"scheme\" : " putStrLn $ show $ findBestSeqs "saturn" "scheme" putStr "\"saturn\" \"hatter\" : " putStrLn $ show $ findBestSeqs "saturn" "hatter" putStr "\"hatter\" \"saturn\" : " putStrLn $ show $ findBestSeqs "hatter" "saturn" putStr "\"mad\" \"saturn\" : " putStrLn $ show $ findBestSeqs "mad" "saturn" putStr "\"snowball\" \"icecream\": " putStrLn $ show $ findBestSeqs "snowball" "icecream" putStr "\"mad\" \"computer\": " putStrLn $ show $ findBestSeqs "mad" "computer" putStr "\"mad\" \"snowball\": " putStrLn $ show $ findBestSeqs "mad" "snowball" {- --Sample Sequences icecream = "icecream" scheme = "scheme" saturn = "saturn" -- "saaturn" mad = ['m','a','d'] hatter = ['h','a','t','t','e','r'] hate = ['h','a','t','e'] snowball = ['s','n','o','w','b','a','l','l'] computer = ['c','o','m','p','u','t','e','r'] coffee = ['c','o','f','f','e','e'] --Function that's called in a console window which does the sequence --alignment and puts the two optimal sequences back together printSeq :: String -> String -> (String,String) printSeq s1 s2 = unzip (getSeq s1 s2) --Main function of the program which does the actual sequence alignment getSeq :: String -> String -> [(Char,Char)] getSeq [] [] = [] getSeq [] s2 = case2 [] s2 getSeq s1 [] = case3 s1 [] getSeq s1 s2 = let a1 = case1 s1 s2; a2 = case2 s1 s2; a3 = case3 s1 s2; in maxSeq a1 a2 a3 case1 :: [Char] -> [Char] -> [(Char,Char)] case1 s1 s2 = [(head s1,head s2)] ++ getSeq (tail s1) (tail s2) case2 :: [Char] -> [Char] -> [(Char,Char)] case2 s1 s2 = [('-',head s2)] ++ getSeq s1 (tail s2) case3 :: [Char] -> [Char] -> [(Char,Char)] case3 s1 s2 = [(head s1,'-')] ++ getSeq (tail s1) s2 --Grab the score of one tuple (a possible alignment) score :: (Eq a) => (a,a) -> Integer score (c1,c2) | c1==c2 = 1 | otherwise = -1 --Sum up the score for a sequence scoreSum :: (Eq a) => [(a,a)] -> Integer scoreSum seq = sum $ map score seq --Returns a solution maxSeq :: (Eq a) => [(a,a)] -> [(a,a)] -> [(a,a)] -> [(a,a)] maxSeq a1 a2 a3 | s1 > s2 && s1 > s3 = a1 | s3 > s1 && s3 > s2 = a3 | otherwise = a2 where s1 = scoreSum a1 s2 = scoreSum a2 s3 = scoreSum a3 -} --------------Boundary-00=_XKRD6KRO09B4VGBLEXFE-- From weixrl@uwec.edu Thu Mar 27 03:23:36 2003 From: weixrl@uwec.edu (Weix, Rachel Lynn) Date: Wed, 26 Mar 2003 21:23:36 -0600 Subject: Printing in Haskell Message-ID: <0EBCCD9264788F41802CF255C0B3FF0E87BA02@STAN.uwec.edu> This is a multi-part message in MIME format. ------_=_NextPart_001_01C2F410.40B0FA63 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable How do I print something in Haskell, i.e. if I want to print what a certain variable contains, etc.? (Synomous to cout> in C++, printf in C, System.out.println in Java, display in Scheme, etc.) =20 Rachel ------_=_NextPart_001_01C2F410.40B0FA63 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Message
How do = I print=20 something in Haskell, i.e. if I want to print what a certain variable = contains,=20 etc.?  (Synomous to cout> in C++, printf in C, = System.out.println in=20 Java, display in Scheme, etc.)
 
Rachel
=00 ------_=_NextPart_001_01C2F410.40B0FA63-- From glynn.clements@virgin.net Thu Mar 27 04:00:16 2003 From: glynn.clements@virgin.net (Glynn Clements) Date: Thu, 27 Mar 2003 04:00:16 +0000 Subject: Printing in Haskell In-Reply-To: <0EBCCD9264788F41802CF255C0B3FF0E87BA02@STAN.uwec.edu> References: <0EBCCD9264788F41802CF255C0B3FF0E87BA02@STAN.uwec.edu> Message-ID: <16002.30544.940938.603656@cerise.nosuchdomain.co.uk> Weix, Rachel Lynn wrote: > How do I print something in Haskell, i.e. if I want to print what a > certain variable contains, etc.? (Synomous to cout> in C++, printf in > C, System.out.println in Java, display in Scheme, etc.) Use "putStrLn" to print a string; use "show" to convert a value to a string. See: http://www.haskell.org/tutorial/io.html for more information about I/O in Haskell. -- Glynn Clements From SpencerJanssen@myrealbox.com Thu Mar 27 08:05:19 2003 From: SpencerJanssen@myrealbox.com (Spencer Janssen) Date: Thu, 27 Mar 2003 02:05:19 -0600 Subject: Performance Timing Message-ID: <3E82B0BF.4000109@myrealbox.com> I've written two versions of a prime number sieve, and I'm trying to figure out how to performance test them. I've found functions to get the current date and time, and to subtract them, but when I put them in a do notation, I guess the laziness or something, makes the calculation happen first, then the two times are called, so I get almost 0 difference between the two. I guess I'm looking for something like this: timer :: (a -> b) -> a -> IO TimeDiff Spencer Janssen From trinder@macs.hw.ac.uk Wed Mar 26 17:38:06 2003 From: trinder@macs.hw.ac.uk (Phil Trinder) Date: Wed, 26 Mar 2003 17:38:06 +0000 (GMT Standard Time) Subject: CFP: JFP Special Issue on Parallel Functional Programming Message-ID: Journal of Functional Programming Special Issue on Functional Approaches to High-Performance Parallel Programming Guest editor: Phil Trinder Submission deadine: 26th September 2003 Web Page: http://www.cee.hw.ac.uk/~trinder/jfpCFP.htm High-performance parallel programs are hard to write. For a long time it has been recognised that ideas and approaches drawn from functional programming may be particularly applicable in this area because * Concurrent stateless computations are much easier to coordinate. * High-level coordination reduces programming effort. * Declarative notations are amenable to reasoning, i.e. to transformation, derivation and analysis. After a long gestation, this potential is now finally being realised in practice. Declarative techniques are being used to construct significant parallel and high-throughput systems, e.g. real-time image analysis and high-end telephone exchanges. Many production systems use conventional imperative technologies in a declarative way, e.g. coordinating legacy Fortran code. Furthermore, the recent emergence of computational Grids pose new challenges that the functional paradigm is well-placed to address: grids offer enormous amounts of computing power, but require sophisticated and dynamic management that is hard to provide in a low-level paradigm. A special issue of the Journal of Functional Programming will be devoted to functional approaches to high-performance parallel programming. Full-length, archival-quality submissions are solicited on topics including but not limited to the following. * Skeletons and higher-order parallel program construction * Parallel Program development methodologies, including derivation and optimisation. * Parallel program modelling, including static analyses to predict properties (e.g. cost models) and dynamic analyses to profile execution properties. * Parallel functional languages, including design, semantics, implementation and performance. * High-performance functional and skeleton applications. * Adaption of high-performance functional technologies for emerging architectures such as the Grid. Papers covering a fusion of functional and more conventional technologies are encouraged, in addition to papers on purely functional technologies. Submissions should be sent to the guest editor Phil Trinder (trinder@macs.hw.ac.uk), with a copy to Jenny Parker (jparker@cambridge.org). Submitted articles should be sent in PDF or Postscript format, preferably gzipped. In addition please send as plain text: title, abstract, and contact information. The submission deadline is 26th September 2003, and for other submission details, please consult an issue of the Journal of Functional Programming or see the Journal's web pages. -------------------------------------------------- Phil Trinder School of Mathematical and Computer Sciences Heriot-Watt University Edinburgh, EH14 4AS E-mail: trinder@macs.hw.ac.uk Teleph: +44 (0)131 451 3435 Depart: +44 (0)131 451 3328 Fasmly: +44 (0)131 451 3327 Intrnt: http://www.macs.hw.ac.uk/~trinder From hdaume@ISI.EDU Thu Mar 27 15:19:29 2003 From: hdaume@ISI.EDU (Hal Daume III) Date: Thu, 27 Mar 2003 07:19:29 -0800 (PST) Subject: Performance Timing In-Reply-To: <3E82B0BF.4000109@myrealbox.com> Message-ID: This is in part an answer, in part a question. If 'b' is a "simple value", then somethign like: timer f a = do t1 <- get current time t2 <- f a `seq` get current time return (different in t2 and t1) (my memory of Time fails right now, so fill in the proper functions.) perhaps safer is to use DeepSeq, which has been cited a lot on this list; i think you can find a copy at http://www.isi.edu/~hdaume/haskell/Util/DeepSeq.hs and then replace `seq` with `deepSeq`. finally, another option (and here is my question, too), is: timer f a = do t1 <- get current time evaluate (f a) t2 <- get current time return (different in t2 and t1) where evaluate is from Control.Exception. could someone tell me how evaluate compares to seq and deepSeq? -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Thu, 27 Mar 2003, Spencer Janssen wrote: > I've written two versions of a prime number sieve, and I'm trying to > figure out how to performance test them. I've found functions to get > the current date and time, and to subtract them, but when I put them in > a do notation, I guess the laziness or something, makes the calculation > happen first, then the two times are called, so I get almost 0 > difference between the two. > > I guess I'm looking for something like this: > timer :: (a -> b) -> a -> IO TimeDiff > > Spencer Janssen > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > From simonmar@microsoft.com Thu Mar 27 16:12:54 2003 From: simonmar@microsoft.com (Simon Marlow) Date: Thu, 27 Mar 2003 16:12:54 -0000 Subject: Performance Timing Message-ID: <9584A4A864BD8548932F2F88EB30D1C60C5F13D2@tvp-msg-01.europe.corp.microsoft.com> > timer f a =3D do > t1 <- get current time > evaluate (f a) > t2 <- get current time > return (different in t2 and t1) >=20 > where evaluate is from Control.Exception. could someone tell me how > evaluate compares to seq and deepSeq? The documentation explains the difference, but it's a bit cryptic. Informally: 'evaluate e' is an IO action that, when performed, forces e to weak-head normal form. It's a kind of seq that you can use in the IO monad. Cheers, Simon From per@L4i.se Fri Mar 28 10:40:22 2003 From: per@L4i.se (Per Larsson) Date: Fri, 28 Mar 2003 11:40:22 +0100 Subject: Debugging Message-ID: <200303281140.22701.per@L4i.se> I need to learn to use a debugging tool for haskell. There seems to be a = whole=20 bunch of them (Hood, Freja, Hat, Buddha, ...). Can anyone give me a=20 (subjective) recommendation. Thanks Per =20 From p.mueller@web.de Sat Mar 29 15:39:58 2003 From: p.mueller@web.de (=?iso-8859-1?Q?Peter_M=FCller?=) Date: Sat, 29 Mar 2003 16:39:58 +0100 Subject: Assistant Positions in Software Component Technology, ETH Zurich, Switzerland Message-ID: Assistant Positions in Software Component Technology Department of Computer Science - ETH Zurich, Switzerland The new Software Component Technology group is recruiting two assistants (PhD students) to work in a young team on techniques and tools that enable the development of "trusted components", aiming at improving software quality and promoting reuse. The research of the Software Component Technology group focuses on techniques and tools for the development of correct object-oriented software components such as library classes. Together with the Chair of Software Engineering, our long-term objectives are to enable the development of "trusted components" and to establish a center for component certification. To achieve these goals, we concentrate on the following research areas: * Modular Specification and Verification Techniques to show that an object-oriented component behaves according to its specification in all contexts in which it might be reused. Our techniques are based on classical interface specification techniques and Hoare-logic, enhanced to specifically meet the requirements of component-based software development. * Language Design and Alias Control to improve encapsulation of components and complex pointer structures. We have developed a type system that can be used to statically describe properties of pointer structures, rule out common coding errors by static checking, and simplify formal reasoning. * Tool Support to make the application of formal techniques practical. We have implemented the Java Interactive Verification Environment, Jive, to support the development of correct software by applying static checking, interactive proof development, and semiautomatic proof strategies. Assistants are expected to participate in teaching, especially in the areas object-oriented programming, formal methods, semantics of programming languages, and project management. Among others, teaching activities include supporting courses and seminars as well as advising students doing their thesis work. Applicants must have a very good degree in Computing Science or in a related subject with a strong Computing Science component. They must also have documented practical experience in programming, preferably in object-oriented languages such as Java, C#, or Eiffel. Expertise in formal methods is a plus. Since assistants are expected to work towards a PhD, a strong interest in doing research as well as a good knowledge of English is required. Knowledge of German is a plus. An assistant position is a regular job with social benefits. Assistants at ETH receive an attractive salary and have access to excellent facilities in one of the world's top computer science departments. Zurich has just been voted #1 again in the world for quality of life (http://story.news.yahoo.com/news?tmpl=story2&u=/nm/20030303/hl_nm/cities_li vable_dc). As members of the new Software Component Technology group, the prospective assistants enjoy the benefits of a young team and the close cooperation with their advisor as well as the opportunities of collaborating with all members of the Chair of Software Engineering (Prof. Bertrand Meyer). For the preliminary web site of the Software Component Technology group consult http://www.inf.ethz.ch/~peter.mueller Questions on the positions and applications should be sent to Prof. Peter Mueller (peter.mueller@inf.ethz.ch) or to the postal address below. Applications should include a curriculum vitae, a brief description of research interests, and, if possible, letters of recommendation from teachers or employers. Postal Address: ETH Zurich Ruth Buerkli ETH Zentrum, RZ Building CH-8092 Zurich Switzerland From loulergue@univ-paris12.Fr Mon Mar 31 10:39:42 2003 From: loulergue@univ-paris12.Fr (Frederic Loulergue) Date: Mon, 31 Mar 2003 12:39:42 +0200 Subject: Cfp: HLPP 2003 DEADLINE EXTENSION Message-ID: <000001c2f771$da2506e0$3b50a8c0@monocephale> Please accept our apologies in case you receive this information from multiple sources. **** DEADLINE EXTENSION ** 18 April 2003 ***** ************************************************************************ HLPP 2003: Second International workshop on High-level parallel programming and applications Monday/Tuesday 16-17 June, 2003 Paris, France http://hlpp.free.fr ************************************************************************ Many applications of computing require performance levels attainable only on parallel architectures. Such systems are now readily available as their price/performance ratio continues to improve. The rapid development of affordable hardware for parallel computing makes the need to develop high-quality parallel software increasingly urgent. Sequential programming has long benefited from high-level programming techniques and tools that have made today's immense range of software economically viable. Two decades of research into high-level parallel programming has produced methods and tools that improve the price/performance ratio of parallel software, and broaden the range of target applications. GRIDs offer a tremendous computing power. Nevertheless, this power is far from being effectively exploited. In addition to technical problems related to portability and access, Grid computing needs new programming paradigms. Research on high level grid programming is particularly relevant. This workshop follows HLPP 2001 and is aimed at - computer science researchers, practitioners, graduate students - scientific computing researchers, practitioners, graduate students - high-performance application developers (e.g. in DBMS, data-mining, parallel model checking, virtual reality) Programme committee and organisers ---------------------------------- Rob Bisseling (Netherlands) Murray Cole (United Kingdom) Gaetan Hains (France) Herbert Kuchen (Germany) Frederic Loulergue (France) Quentin Miller (United Kingdom) Susanna Pelagatti (Italy) David Skillicorn (Canada) Contact : Frederic Loulergue (LACL, France) Papers and Publication ---------------------- We welcome submission of original, unpublished papers in English on topics including (but not limited to) - programming models and tools for GRID computing - algorithmic skeletons and parallel libraries - applications in all fields of high-performance computing - cost modelling (BSP, LogP, etc.) - experience with high-level tools and methods - object, functional, logic, constraint programming for parallel systems - parallel language design and implementation - parallel program design and optimisation Accepted papers should be presented at the workshop and will be published in special issues of Parallel Processing Letters, World Scientific Publishing (provided revisions suggested by the referees are made). Submission ---------- Papers should be sent to loulergue@univ-paris12.fr with subject "hlpp2003 submission" no later than Friday 18 April 2003. An early email with your intention to submit a paper would be greatly appreciated. Formatting instructions for paper submissions are available at http://hlpp.free.fr. Dates ----- Friday 18 April 2003 : deadline for submitted papers Friday 16 May 2003 : notification of acceptance/rejection Monday 2 June 2003 : deadline for draft proceedings versions of papers Sunday 15 June 2003 : pre-workshop social/cultural events in Paris Monday 16 June 2003 : Invited Speaker presentation of papers Tuesday 17 June 2003 : presentation of papers; workshop ends at noon ************************************************************************ From giavitto@lami.univ-evry.fr Mon Mar 31 21:58:26 2003 From: giavitto@lami.univ-evry.fr (RULE'03 workshop) Date: Mon, 31 Mar 2003 23:58:26 +0200 Subject: CFP for RULE 2003 Message-ID: <200303312158.XAA17797@ns.lami.univ-evry.fr> ********************************************************** *** RULE 2003: RPD workshop *** *** JUNE, 9, 2003 *** *** Valencia, Spain *** *** *** *** http://www.dsic.upv.es/~rdp03/rule/ *** ********************************************************** IMPORTANT DATE: April 6th 2003 - Submission of full paper Scope: ------ The rule-based programming paradigm is characterized by the repeated, localized transformation of a shared data object such as a term, graph, proof, or constraint store. The transformations are described by rules which separate the description of the sub-object to be replaced (the pattern) from the calculation of the replacement. Optionally, rules can have further conditions that restrict their applicability. The transformations are controlled by explicit or implicit strategies. The basic concepts of rule-based programming appear throughout computer science, from theoretical foundations to practical implementations. Term rewriting is used in semantics in order to describe the meaning of programming languages, as well as in the implementation of program transformation systems. It is used implicitly or explicitly to perform computations, e.g., in Mathematica, OBJ, or ELAN, or to perform deductions, e.g., by using inference rules to describe or implement a logic, theorem prover or constraint solver. Extreme examples of rule-based programming include the mail system in Unix which uses rules in order to rewrite mail addresses to canonical forms, or the transition rules used in model checkers. Rule-based programming is currently experiencing a renewed period of growth with the emergence of new concepts and systems that allow a better understanding and better usability. On the theoretical side, after the in-depth study of rewriting concepts during the eighties, the nineties saw the emergence of the general concepts of rewriting logic and of the rewriting calculus. On the practical side, new languages such as ASM, ASF+SDF, BURG, Claire, ELAN, Maude, and Stratego, new systems such as LRR and commercial products such as Ilog Rules and Eclipse have shown that rules are a useful programming tool. The practical application of rule-based programming prompts research into the algorithmic complexity and optimization of rule-based programs as well as into the expressivity, semantics and implementation of rules-based languages. The purpose of this workshop is to bring together researchers from the various communities working on rule-based programming to foster fertilisation between theory and practice, as well as to favour the growth of this programming paradigm. We solicit original papers on all topics of rule-based programming, including but not restricted to * Languages for rule-based programming o Expressivity o Semantics o Implementation techniques * Applications of rule-based programming o Analysis of rule-based programs o Programming methods * Environments for rule-based programming o (Partial) Evaluation o Abstract machines for rewriting * Combination of rule-based programming with other paradigms * System descriptions Submission procedure and publication: ------------------------------------- Submission process will be open in April 2003. Papers (of at most 15 pages) should be submitted electronically as PostScript or PDF files to one of the program committee chairs: - Jean-Louis Giavitto (giavitto@lami.univ-evry.fr), or - Pierre-Etienne Moreau (Pierre-Etienne.Moreau@loria.fr). The message should also contain a text-only abstract and author information. Accepted papers will be published and available during the workshop. After revision, final copies of the accepted papers will be published in Electronic Notes in Theoretical Computer Science (ENTCS), Elsevier Science. In addition, a selection of best papers could be published in a special issue of Higher-Order and Symbolic Computation. Program committee co-chairs: ---------------------------- Jean-Louis Giavitto, Evry Val d'Essone University, France Pierre-Etienne Moreau, LORIA-INRIA Nancy, France Program Committee members: -------------------------- James Cordy, Queen's University at Kingston, Canada Olivier Danvy, BRICS, Denmark Steven Eker, SRI International, USA Thom Fruehwirth, Ulm University, Germany Berthold Hoffmann, Bremen University, Germany Herbert Kuchen, Muenster University, Germany Oege de Moor, Oxford University Computing Laboratory, England Przemek Prusinkiewicz, Calgary University, Canada Patrick Viry, ILOG, France ----------------------------------------------------------------------- IMPORTANT DATES ----------------------------------------------------------------------- April 6th 2003 Submission of full paper May 5th 2003 Notification May 14th 2003 Final version due June 9th 2003 RULE 2003