From nonce+haskell.org at dfranke.us Tue May 1 00:41:11 2007 From: nonce+haskell.org at dfranke.us (Daniel Franke) Date: Tue May 1 00:38:21 2007 Subject: [Haskell] Instantiating MonadPlus from ArrowApply and ArrowPlus Message-ID: <20070501044109.GA5462@laurelin.dfranke.us> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Is there any reason that the following is not defined in Control.Arrow? instance (ArrowApply a, ArrowPlus a) => MonadPlus (ArrowMonad a) where mzero = ArrowMonad zeroArrow mplus (ArrowMonad a) (ArrowMonad b) = ArrowMonad (a <+> b) - -- Daniel Franke df@dfranke.us http://www.dfranke.us |----| =|\ \\\\ || * | -|-\--------- Man is free at the instant he wants to be. -----| =| \ /// --Voltaire -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGNsTlKTA17JAC/eYRAjE4AJ9QSyjYXGs2ZNgGLp6rh3Gc3qP5hgCfXMYW mOU9DtZ0A54h1KIJ35q2HsQ= =2Rs0 -----END PGP SIGNATURE----- From gorgonite at freesurf.fr Tue May 1 02:53:31 2007 From: gorgonite at freesurf.fr (Gorgonite) Date: Tue May 1 02:50:52 2007 Subject: [Haskell] Translation of the Gentle Introduction to Haskell 98 Message-ID: <51765.128.178.73.196.1178002411.squirrel@jose.freesurf.fr> Hello, I don't know if there are French-speaking people reading this mailing-list, but we at haskell-fr have some great news today ! We didn't find any French translation of the "Gentle Introduction to Haskell" (version 98), thus we decide to write it. Today, I would like to announce that we have completed a translation into French, that it can be read by following the link : http://gorgonite.developpez.com/livres/traductions/haskell/gentle-haskell/ It is currently available as a set of HTML pages. We are also putting into the "official format" with *.verb files. Hopefully you will soon be able to download that version as well. Please send your comments and suggestions to the French Haskell mailing list haskell-fr@haskell.org Best regards, From federico.squartini at googlemail.com Tue May 1 07:59:01 2007 From: federico.squartini at googlemail.com (Federico Squartini) Date: Tue May 1 07:56:25 2007 Subject: [Haskell] Haskell fast (?) arrays Message-ID: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> I was reading an old post where Hal Daume III was analyzing Haskell performance for arrays. He proposed a test program which initializes an array, reverse it a number of times, and sums the contents. So I wrote a c++ reference program, a naive haskell version using lists and I also tweaked a little bit with the IOArray version, which should be the fastest. Unfortunately there is a huge performance gap. Haskell is slower by a factor of ten, even when using imperative style. C++ time ./arrayC 499 real 0m0.059s user 0m0.044s sys 0m0.008s HASKELL - IOUArray time ./IOMutArrayUnboxed 499 real 0m0.720s user 0m0.571s sys 0m0.019s HASKELL - list time ./list 499 real 0m1.845s user 0m1.770s sys 0m0.064s Can anyone suggest a faster version (using whatever data structure)? I like Haskell very much but I still have to figure out if the slowness of some code is due to my lack of knowledge or to some intrinsic limitation of the language (or libraries). By the way, sorry for the poor quality of the code, I am not a computer scientist. ------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- //compile with //g++ -o arrayC arrayC.cc #include #include < math.h> int main() { int array[500001]; for (int i=0;i<=500000;i++) { array[i]=(19*i+23)%911; } int tmp=0; for (int cnt=0;cnt<12;cnt++) { for (int x=0;x<=250000;x++) { tmp=array[500000-x]; array[500000-x]=array[x]; array[x]=tmp; } } int result=0; for (int i=0;i<=500000;i++) { result=result+(array[i]%911); } result=result % 911; printf("%d",result); return 0; } --------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------- -- compile with -- ghc --make -o list list.hs module Main where testArray = [ (19*i+23) `mod` 911 |i <- [0..500000]] sumArrayMod = foldl (\x y -> (y+x) `mod` 911) 0 main = print $ sumArrayMod$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ reverse$ testArray --------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------- -- compile with -- ghc --make -o IOMutArrayUnboxed IOMutArrayUnboxed.hs module Main where import Monad import Data.Array.IO import Data.Array.MArray import Data.Array.Unboxed total, semiTotal ::Int total= 500000 semiTotal=250000 testArray :: IO (IOUArray Int Int) testArray = newListArray (0,total) [(19*i+23) `mod` 911 |i <- [0..total]] reverseArray :: IOUArray Int Int -> IO () reverseArray arr = mapM_ (\i -> do oldi <- readArray arr i oldj <- readArray arr (total-i) writeArray arr i oldj writeArray arr (total-i) oldi) [0..semiTotal] sumArrayMod :: IOUArray Int Int -> IO Int sumArrayMod arr = foldM (\s i -> do x <- readArray arr i return $!(s+x) `mod` 911) 0 [0..total] main::IO() main = testArray >>= \a -> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> reverseArray a >> sumArrayMod a >>= print --------------------------------------------------------------------------------------------------------- Federico -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell/attachments/20070501/2b1c9161/attachment-0001.htm From A.Simon at kent.ac.uk Tue May 1 08:31:35 2007 From: A.Simon at kent.ac.uk (Axel Simon) Date: Tue May 1 08:30:06 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> Message-ID: <1178022695.6227.10.camel@localhost> Frederico, On Tue, 2007-05-01 at 13:59 +0200, Federico Squartini wrote: > I was reading an old post where Hal Daume III was analyzing Haskell > performance for arrays. > He proposed a test program which initializes an array, reverse it a > number of times, and sums the contents. > > So I wrote a c++ reference program, a naive haskell version using > lists and I also tweaked a little bit with the IOArray version, which > should be the fastest. Unfortunately there is a huge performance gap. > Haskell is slower by a factor of ten, even when using imperative > style. I think the version using lists is a bit unfair, since in C++ you don't re-allocate the array on the heap and the Haskell version gives you a very nice high-level abstraction of lists. With respect to the imperative version, I would suggest a) letting the program run for longer so you get more reliable timing. b) use a similar optimisations that we've done for a demo of modifying images in-situ for our Gtk2Hs library (in http://darcs.haskell.org/gtk2hs/demo/fastdraw/FastDraw.hs ): import Data.Array.Base ( unsafeWrite ) doFromTo 0 255 $ \y -> doFromTo 0 255 $ \x -> -- Here, writeArray was replaced with unsafeWrite. The latter does -- not check that the index is within bounds which has a tremendous -- effect on performance. -- writeArray pbData (2+x*chan+y*row) blue -- checked indexing unsafeWrite pbData (2+x*chan+y*row) blue -- unchecked indexing Here, doFromTo is much faster and using unsafeWrite instead of writeArray eliminates the array bound check, which is a big win again. Then again, it is questionable if you really want to do that kind of low-level programming in Haskell. Axel. From stefanor at cox.net Tue May 1 09:44:31 2007 From: stefanor at cox.net (Stefan O'Rear) Date: Tue May 1 09:41:53 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> Message-ID: <20070501134431.GA2807@localhost.localdomain> On Tue, May 01, 2007 at 01:59:01PM +0200, Federico Squartini wrote: > I was reading an old post where Hal Daume III was analyzing Haskell > performance for arrays. > He proposed a test program which initializes an array, reverse it a number > of times, and sums the contents. > > So I wrote a c++ reference program, a naive haskell version using lists and > I also tweaked a little bit with the IOArray version, which should be the > fastest. Unfortunately there is a huge performance gap. Haskell is slower > by a factor of ten, even when using imperative style. I'd recommend using -O2 or -O. GHC doesn't even try to generate fast code if you don't use them. Stefan From federico.squartini at googlemail.com Tue May 1 10:36:25 2007 From: federico.squartini at googlemail.com (Federico Squartini) Date: Tue May 1 10:33:50 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <1178022695.6227.10.camel@localhost> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> <1178022695.6227.10.camel@localhost> Message-ID: <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> Of course I know that the list version is very unfair, but I wanted to see what was the trade off between elegance and speed. Regarding whether low level programming makes sense or not, I was just curious to see what are the limits of Haskell. Moreover there is not much literature on high performance Haskell programming (tricks like unsafeWrite), at least organized in a systematic and concise way. My original problem was writing a fast library for simple matrix computations (i.e. multiplication and inversion for small dense matrices). I have not been able to make GSLHaskell work with Lapack so far. :( Anyway here are the new versions and timings, I increased the number of times the vector is reversed, I also compiled everything with -O2. time ./arrayC 499 real 0m0.244s user 0m0.236s sys 0m0.005s time ./list 499 real 0m11.036s user 0m10.770s sys 0m0.118s time ./IOMutArrayUnboxed 499 real 0m2.573s user 0m2.408s sys 0m0.042s time ./IOMutUnbUnsafe 499 real 0m2.264s user 0m2.183s sys 0m0.025s ------------------------------ -------------------------------------------------- //compile with g++ -O2 -o arrayC arrayC.cc #include < stdio.h> #include int main() { int array[500001]; for (int i=0;i<=500000;i++) { array[i]=(19*i+23)%911; } int tmp=0; for (int cnt=0;cnt<120;cnt++) { for (int x=0;x<=250000;x++) { tmp=array[500000-x]; array[500000-x]=array[x]; array[x]=tmp; } } int result=0; for (int i=0;i<=500000;i++) { result=result+(array[i]%911); } result=result % 911; printf("%d",result); return 0; } -------------------------------------------------------------------------------- -- compile with -- ghc -O2 --make -o list list.hs module Main where import Data.List testArray = [ (19*i+23) `mod` 911 |i <- [0..500000]] sumArrayMod = foldl (\x y -> (y+x) `mod` 911) 0 main = print $ sumArrayMod$ foldl (.) id (replicate 120 reverse) $testArray -------------------------------------------------------------------------------------- -- compile with -- ghc -O2 --make -o IOMutArrayUnboxed IOMutArrayUnboxed.hs module Main where import Monad import Data.Array.IO import Data.Array.MArray import Data.Array.Unboxed total, semiTotal ::Int total= 500000 semiTotal=250000 testArray :: IO (IOUArray Int Int) testArray = newListArray (0,total) [(19*i+23) `mod` 911 |i <- [0..total]] reverseArray :: IOUArray Int Int -> IO () reverseArray arr = mapM_ (\i -> do oldi <- readArray arr i oldj <- readArray arr (total-i) writeArray arr i oldj writeArray arr (total-i) oldi) [0..semiTotal] sumArrayMod :: IOUArray Int Int -> IO Int sumArrayMod arr = foldM (\s i -> do x <- readArray arr i return $!(s+x) `mod` 911) 0 [0..total] main::IO() main = testArray >>= \a -> sequence (replicate 120 $reverseArray a)>> sumArrayMod a >>= print ------------------------------------------------------------------------------------ -- compile with -- ghc -O2 --make -o IOMutUnbUnsafe IOMutUnbUnsafe.hs module Main where import Monad import Data.Array.IO import Data.Array.MArray import Data.Array.Unboxed import Data.Array.Base ( unsafeWrite, unsafeRead ) total, semiTotal ::Int total= 500000 semiTotal=250000 testArray :: IO (IOUArray Int Int) testArray = newListArray (0,total) [(19*i+23) `mod` 911 |i <- [0..total]] reverseArray :: IOUArray Int Int -> IO () reverseArray arr = mapM_ (\i -> do oldi <- unsafeRead arr i oldj <- unsafeRead arr (total-i) unsafeWrite arr i oldj unsafeWrite arr (total-i) oldi) [0..semiTotal] sumArrayMod :: IOUArray Int Int -> IO Int sumArrayMod arr = foldM (\s i -> do x <- unsafeRead arr i return $!(s+x) `mod` 911) 0 [0..total] main::IO() main = testArray >>= \a -> doFromTo 1 120 (\_ -> reverseArray a) >> sumArrayMod a >>= print {-# INLINE doFromTo #-} -- do the action for [from..to], ie it's inclusive. doFromTo :: Int -> Int -> (Int -> IO ()) -> IO () doFromTo from to action = let loop n | n > to = return () | otherwise = do action n loop (n+1) in loop from ----------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell/attachments/20070501/600f229d/attachment.htm From dons at cse.unsw.edu.au Tue May 1 11:00:24 2007 From: dons at cse.unsw.edu.au (Donald Bruce Stewart) Date: Tue May 1 10:57:46 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> <1178022695.6227.10.camel@localhost> <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> Message-ID: <20070501150024.GA28107@cse.unsw.EDU.AU> federico.squartini: > > Of course I know that the list version is very unfair, but I > wanted to see what was the trade off between elegance and > speed. > Regarding whether low level programming makes sense or not, > I was just curious to see what are the limits of Haskell. > Moreover there is not much literature on high performance > Haskell programming (tricks like unsafeWrite), at least > organized in a systematic and concise way. > My original problem was writing a fast library for simple > matrix computations (i.e. multiplication and inversion for > small dense matrices). I have not been able to make > GSLHaskell work with Lapack so far. :( > Anyway here are the new versions and timings, I increased > the number of times the vector is reversed, I also compiled > everything with -O2. Probably a good idea to use techniques from Data.ByteString (ie. use strict Ptr loops, and Foreign arrays), or techniques from the shootout, if you're chasing C speed. Good examples are: http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsievebits&lang=ghc&id=4 (mutable bit arrays) http://shootout.alioth.debian.org/gp4/benchmark.php?test=nsieve&lang=ghc&id=0 (mutable byte (foreign) arrays) http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=ghc&id=4 (more mutable arrays) When I really really care about speed, I use Foreign.Marshal.Array Data.ByteString and apply ! patterns liberally, checking the Core output for inner loops. -O2 -optc-O2 -optc-march=pentium4 often helps. 1-4x C is around what you can best hope for. 10x says "still room for improvement" in my experience. -- Don From federico.squartini at googlemail.com Tue May 1 11:01:23 2007 From: federico.squartini at googlemail.com (Federico Squartini) Date: Tue May 1 10:58:44 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> <1178022695.6227.10.camel@localhost> <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> Message-ID: <197499360705010801q67166cfdj9fd5b3b0869c5e34@mail.gmail.com> Sorry, I was very silly! This is the correct version of the program using the doFromto loop. And it runs fast! I hope there are no further mistakes. Thanks Axel. time ./IOMutUnbUnsafe 499 real 0m0.708s user 0m0.573s sys 0m0.008s ----------------------------------------------------------------------------- -- compile with -- ghc --make -o IOMutUnbUnsafe IOMutUnbUnsafe.hs module Main where import Monad import Data.Array.IO import Data.Array.MArray import Data.Array.Unboxed import Data.Array.Base ( unsafeWrite, unsafeRead ) total, semiTotal ::Int total= 500000 semiTotal=250000 testArray :: IO (IOUArray Int Int) testArray = newListArray (0,total) [(19*i+23) `mod` 911 |i <- [0..total]] reverseArray :: IOUArray Int Int -> IO () reverseArray arr = doFromTo 0 semiTotal (\i -> do oldi <- unsafeRead arr i oldj <- unsafeRead arr (total-i) unsafeWrite arr i oldj unsafeWrite arr (total-i) oldi) sumArrayMod :: IOUArray Int Int -> IO Int sumArrayMod arr = foldM (\s i -> do x <- unsafeRead arr i return $!(s+x) `mod` 911) 0 [0..total] main::IO() main = testArray >>= \a -> doFromTo 1 120 (\_ -> reverseArray a) >> sumArrayMod a >>= print {-# INLINE doFromTo #-} -- do the action for [from..to], ie it's inclusive. doFromTo :: Int -> Int -> (Int -> IO ()) -> IO () doFromTo from to action = let loop n | n > to = return () | otherwise = do action n loop (n+1) in loop from ----------------------------------------------------------------------------------- Federico From federico.squartini at googlemail.com Tue May 1 11:23:45 2007 From: federico.squartini at googlemail.com (Federico Squartini) Date: Tue May 1 11:21:05 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <20070501150024.GA28107@cse.unsw.EDU.AU> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> <1178022695.6227.10.camel@localhost> <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> <20070501150024.GA28107@cse.unsw.EDU.AU> Message-ID: <197499360705010823v594f9674yeff46e29ece046c4@mail.gmail.com> Thanks for the hints. It's a pity that (as far as I know) no one has written a tutorial on those techniques, because I think it would be appreciated. Some of them are quite involved and learning them just by reading code is very time consuming. Federico From nikhil at bluespec.com Tue May 1 11:35:29 2007 From: nikhil at bluespec.com (Rishiyur Nikhil) Date: Tue May 1 11:32:48 2007 Subject: [Haskell] Haskell fast (?) arrays Message-ID: <867033cd0705010835t50ccdf0fleb49cc849bb54754@mail.gmail.com> I think another interesting data point would be for a C++ version that uses the 'vector' data type from STL (Standard Template Library) and using the vector indexing ops that do bounds-checking. Regards, Nikhil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell/attachments/20070501/094e4269/attachment.htm From taralx at gmail.com Tue May 1 13:36:16 2007 From: taralx at gmail.com (Taral) Date: Tue May 1 13:33:36 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <197499360705010823v594f9674yeff46e29ece046c4@mail.gmail.com> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> <1178022695.6227.10.camel@localhost> <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> <20070501150024.GA28107@cse.unsw.EDU.AU> <197499360705010823v594f9674yeff46e29ece046c4@mail.gmail.com> Message-ID: On 5/1/07, Federico Squartini wrote: > Thanks for the hints. It's a pity that (as far as I know) no one has > written a tutorial on those techniques, because I think it would be > appreciated. Some of them are quite involved and learning them just by > reading code is very time consuming. I personally recommend to people that if sections of your code are really performance-critical, you should consider writing them in a lower-level lanaguage like C and using FFI for access. P.S. I wonder if jhc could improve the output code? -- Taral "You can't prove anything." -- G?del's Incompetence Theorem From waldmann at imn.htwk-leipzig.de Tue May 1 13:45:34 2007 From: waldmann at imn.htwk-leipzig.de (Johannes Waldmann) Date: Tue May 1 13:43:06 2007 Subject: [Haskell] refactoring, catamorphism, termination of programs Message-ID: <46377CBE.5090209@imn.htwk-leipzig.de> Dear all, I'm looking for a tool that implements the source code transformation "replace recursion by catamorphism" (fold etc.). My application is that if the transformation succeeds, it implies that the program terminates. (roughly) I don't want to make a big research project out of this, rather I think of quickly putting together a prototype that proves the concept. I figure it could be distilled from some existing refactoring suite, or be manufactured from existing building blocks. E.g. Language.Haskell.* from the ghc libs, and perhaps "Typing Haskell in Haskell"? http://citeseer.ist.psu.edu/424440.html Any hints appreciated. Of course, if you already have some termination prover for Haskell programs, using any method whatsoever, then you're invited to take part in the "FP" category of the upcoming Termination Competition, see http://www.lri.fr/~marche/termination-competition/2007/ (Also, I'd welcome your comments on the proposed form and semantics of the FP category.) For discussion, please do not use this list but http://groups.google.de/group/fp-termination Best regards, Johannes Waldmann. From v.dijk.bas at gmail.com Tue May 1 14:20:18 2007 From: v.dijk.bas at gmail.com (Bas van Dijk) Date: Tue May 1 14:17:38 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> <1178022695.6227.10.camel@localhost> <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> Message-ID: On 5/1/07, Federico Squartini wrote: > Moreover there is not much literature on high performance Haskell programming > (tricks like unsafeWrite), at least organized in a systematic and concise way. Look at: http://haskell.org/haskellwiki/Performance regards, Bas van Dijk From s.a.herhut at herts.ac.uk Tue May 1 14:46:30 2007 From: s.a.herhut at herts.ac.uk (Stephan Herhut) Date: Tue May 1 14:43:53 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> Message-ID: <45d9bd430705011146k230f884bm71be282c602c48b8@mail.gmail.com> While scanning my Inbox I read 'fast' and 'array' in the context of functional programming. Well, of course SaC instantly came to my mind (what a surprise ;) ). So I did some measurements myself. I used your programs, except that I increased the array size by a factor of 10. For the C++ version I had to move the array to the heap and fix the order of function applications within the fold. Here are the timings: C++ 520 real 0m0.204s user 0m0.182s sys 0m0.023s Haskell IOArray (the extended version with unsafe accesses that was posted shortly after yours) 520 real 0m5.542s user 0m5.453s sys 0m0.068s Haskell Lists (just to be complete) 520 real 0m27.596s user 0m26.650s sys 0m0.870s and finally SaC Dimension: 0 Shape : < > 520 real 0m0.057s user 0m0.048s sys 0m0.000s The corresponding SaC program follows. I have compiled it with sac2c -O3. I used the current compiler from the website http://www.sac-home.org. use Structures : all; use StdIO : all; inline int sumMod( int a, int b) { return( (a + b) % 911); } inline int sumArrayMod( int[*] A) { res = with { ( shape(A) * 0 <= iv < shape(A)) : A[iv]; } : fold( sumMod, 0); return( res); } int main() { testArray = (19*iota(5000001)+23) % 911; print( sumArrayMod( reverse( reverse( reverse( reverse( reverse( reverse( reverse( reverse( reverse( reverse( reverse( reverse( reverse( reverse( reverse( reverse( testArray)))))))))))))))))); return( 0); } On 5/1/07, Federico Squartini wrote: > > I was reading an old post where Hal Daume III was analyzing Haskell > performance for arrays. > He proposed a test program which initializes an array, reverse it a number > of times, and sums the contents. > > So I wrote a c++ reference program, a naive haskell version using lists > and I also tweaked a little bit with the IOArray version, which should be > the fastest. Unfortunately there is a huge performance gap. Haskell is > slower by a factor of ten, even when using imperative style. > > C++ > time ./arrayC > 499 > real 0m0.059s > user 0m0.044s > sys 0m0.008s > > HASKELL - IOUArray > time ./IOMutArrayUnboxed > 499 > real 0m0.720s > user 0m0.571s > sys 0m0.019s > > HASKELL - list > time ./list > 499 > real 0m1.845s > user 0m1.770s > sys 0m0.064s > > > Can anyone suggest a faster version (using whatever data structure)? I > like Haskell very much but I still have to figure out if the slowness of > some code is due to my lack of knowledge or to some intrinsic limitation of > the language (or libraries). > > By the way, sorry for the poor quality of the code, I am not a computer > scientist. > > > ------------------------------------------------------------------------------------------------------------------------------- > > > ------------------------------------------------------------------------------------------------------------------------------- > //compile with > //g++ -o arrayC arrayC.cc > #include > #include < math.h> > > > > int main() > { > int array[500001]; > > for (int i=0;i<=500000;i++) > { > array[i]=(19*i+23)%911; > } > int tmp=0; > for (int cnt=0;cnt<12;cnt++) > { > for (int x=0;x<=250000;x++) > { > tmp=array[500000-x]; > array[500000-x]=array[x]; > array[x]=tmp; > } > } > int result=0; > for (int i=0;i<=500000;i++) > { > result=result+(array[i]%911); > } > result=result % 911; > printf("%d",result); > return 0; > } > > --------------------------------------------------------------------------------------------- > > > --------------------------------------------------------------------------------------------- > -- compile with > -- ghc --make -o list list.hs > module Main > where > > testArray = [ (19*i+23) `mod` 911 |i <- [0..500000]] > > sumArrayMod = foldl (\x y -> (y+x) `mod` 911) 0 > > main = print $ sumArrayMod$ > reverse$ reverse$ reverse$ reverse$ > reverse$ reverse$ reverse$ reverse$ > reverse$ reverse$ reverse$ reverse$ > reverse$ reverse$ reverse$ reverse$ > testArray > > > --------------------------------------------------------------------------------------------- > > > --------------------------------------------------------------------------------------------- > -- compile with > -- ghc --make -o IOMutArrayUnboxed IOMutArrayUnboxed.hs > module Main > where > > import Monad > import Data.Array.IO > import Data.Array.MArray > import Data.Array.Unboxed > > total, semiTotal ::Int > total= 500000 > semiTotal=250000 > > > testArray :: IO (IOUArray Int Int) > testArray = newListArray (0,total) [(19*i+23) `mod` 911 |i <- [0..total]] > > > reverseArray :: IOUArray Int Int -> IO () > reverseArray arr = mapM_ (\i -> do oldi <- readArray arr i > oldj <- readArray arr (total-i) > writeArray arr i oldj > writeArray arr (total-i) oldi) > [0..semiTotal] > > sumArrayMod :: IOUArray Int Int -> IO Int > sumArrayMod arr = foldM (\s i -> do x <- readArray arr i > return $!(s+x) > `mod` 911) 0 [0..total] > > > main::IO() > main = testArray >>= \a -> > reverseArray a >> reverseArray a >> reverseArray a >> reverseArray > a >> > reverseArray a >> reverseArray a >> reverseArray a >> reverseArray > a >> > reverseArray a >> reverseArray a >> reverseArray a >> reverseArray > a >> > reverseArray a >> reverseArray a >> reverseArray a >> reverseArray > a >> > sumArrayMod a >>= print > > > --------------------------------------------------------------------------------------------------------- > > Federico > > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > > -- Stephan Herhut Centre for Computer Science and Informatics Research University of Hertfordshire -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell/attachments/20070501/6ff54f39/attachment.htm From monnier at iro.umontreal.ca Tue May 1 15:44:08 2007 From: monnier at iro.umontreal.ca (Stefan Monnier) Date: Tue May 1 15:41:57 2007 Subject: [Haskell] Re: refactoring, catamorphism, termination of programs References: <46377CBE.5090209@imn.htwk-leipzig.de> Message-ID: > I'm looking for a tool that implements the source code transformation > "replace recursion by catamorphism" (fold etc.). > My application is that if the transformation succeeds, > it implies that the program terminates. (roughly) > I don't want to make a big research project out of this, > rather I think of quickly putting together a prototype > that proves the concept. Have you considered another approach? E.g. the Coq papers define its elimination constructs either as a catamorphism, or as a combination of case&fix, where the recursive calls are appropriately restricted to pass subterms as arguments. See for example Eduardo Gimenez's "Codifying guarded definition with recursive schemes". This paper also shows how to turn such a case&fix into a call to a catamorphism. Stefan From camior at gmail.com Tue May 1 15:47:24 2007 From: camior at gmail.com (David Sankel) Date: Tue May 1 15:44:44 2007 Subject: [Haskell] ANNOUNCE: rsa-haskell 2.0.1 Message-ID: RSA-Haskell is a collection of command-line cryptography tools and a cryptography library written in Haskell. It is intended to be useful to anyone who wants to secure files or communications or who wants to incorporate cryptography in their Haskell application. Download and documentation are available at http://www.netsuperbrain.com/rsa-haskell.html In this 2.0.1 release I've added a bunch of documentation and incorporated an archive with windows binaries for the command line tools. Please let me know if you have any questions or comments. Enjoy! David -- David Sankel Sankel Software www.sankelsoftware.com From zepedro.correia at gmail.com Tue May 1 16:25:58 2007 From: zepedro.correia at gmail.com (=?ISO-8859-1?Q?Jos=E9_Pedro_Correia?=) Date: Tue May 1 16:23:19 2007 Subject: [Haskell] refactoring, catamorphism, termination of programs In-Reply-To: <46377CBE.5090209@imn.htwk-leipzig.de> References: <46377CBE.5090209@imn.htwk-leipzig.de> Message-ID: <82d614550705011325u665c1558ge4f05ccea7ee965a@mail.gmail.com> Hi Maybe this link is of interest to you: http://wiki.di.uminho.pt/twiki/bin/view/Research/PURe/WebHome. A tool called DrHylo, developed in the context of this project is available, altough I don't know how suitable it could be for you: http://wiki.di.uminho.pt/twiki/bin/view/Personal/Alcino/DrHylo. Regards Jos? Pedro On 5/1/07, Johannes Waldmann wrote: > > Dear all, > > I'm looking for a tool that implements the source code transformation > "replace recursion by catamorphism" (fold etc.). > > My application is that if the transformation succeeds, > it implies that the program terminates. (roughly) > > I don't want to make a big research project out of this, > rather I think of quickly putting together a prototype > that proves the concept. > > I figure it could be distilled from some existing refactoring suite, > or be manufactured from existing building blocks. > > E.g. Language.Haskell.* from the ghc libs, > and perhaps "Typing Haskell in Haskell"? > http://citeseer.ist.psu.edu/424440.html > > Any hints appreciated. > > Of course, if you already have some termination prover > for Haskell programs, using any method whatsoever, > then you're invited to take part > in the "FP" category of the upcoming Termination Competition, > see http://www.lri.fr/~marche/termination-competition/2007/ > > (Also, I'd welcome your comments on the proposed form > and semantics of the FP category.) > For discussion, please do not use this list but > http://groups.google.de/group/fp-termination > > > Best regards, Johannes Waldmann. > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell/attachments/20070501/3dd2277b/attachment.htm From tomahawkins at gmail.com Tue May 1 16:51:55 2007 From: tomahawkins at gmail.com (Tom Hawkins) Date: Tue May 1 16:49:16 2007 Subject: [Haskell] ANNOUNCE: Atom 2007.05 Message-ID: <594c1e830705011351s300f5862m89362a342a949709@mail.gmail.com> Atom, a high-level hardware description language embedded in Haskell, compiles conditional term rewriting systems into conventional HDL. New in this release: - VHDL code generation (synthesis only, simulation directives not supported). - Improved rule mutual exclusion analysis. Now, mutual exclusion can be verified on many rule conditions without having to use MiniSat. - Automatic reset and clock generation for IO-less systems (Verilog only). Eliminates the need for separate Verilog testbenches when both the design and stimulus are described in Atom. - And few additions to the library. Enjoy! http://www.funhdl.org/ -Tom From dons at cse.unsw.edu.au Tue May 1 23:38:25 2007 From: dons at cse.unsw.edu.au (Donald Bruce Stewart) Date: Tue May 1 23:35:47 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <197499360705010801q67166cfdj9fd5b3b0869c5e34@mail.gmail.com> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> <1178022695.6227.10.camel@localhost> <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> <197499360705010801q67166cfdj9fd5b3b0869c5e34@mail.gmail.com> Message-ID: <20070502033825.GI26667@cse.unsw.EDU.AU> federico.squartini: > Sorry, I was very silly! > > This is the correct version of the program using the doFromto loop. > And it runs fast! I hope there are no further mistakes. > Thanks Axel. > > time ./IOMutUnbUnsafe > 499 > real 0m0.708s > user 0m0.573s > sys 0m0.008s Here's an improved version, using Foreign.Marshal.Array. I spent about 2 minutes inspecting the core, as well. Before, with your IOUArray version: $ time ./T 499 ./T 1.46s user 0.02s system 97% cpu 1.515 total with the new version: $ time ./S 499 ./S 1.15s user 0.01s system 99% cpu 1.168 total Here's the source, its more idiomatic high-perf Haskell, I'd argue. Cheers, Don ------------------------------------------------------------------------ {-# OPTIONS -O2 -optc-O -optc-march=pentium4 -fbang-patterns #-} import Control.Monad import Foreign.Marshal.Array import Foreign total :: Int total = 500001 type Arr = Ptr Int testArray :: IO Arr testArray = do u <- mallocArray total :: IO Arr forM_ [0 .. total] $ \i -> pokeElemOff u i ((19*i+23) `mod` 911) return u reverseArray :: Arr -> Int -> Int -> IO () reverseArray !p !i !j | i < j = do x <- peekElemOff p i y <- peekElemOff p j pokeElemOff p i y pokeElemOff p j x reverseArray p (i+1) (j-1) | otherwise = return () sumArrayMod :: Arr -> Int -> Int -> IO Int sumArrayMod !p !s !i | i < total = do x <- peekElemOff p i sumArrayMod p ((s + x) `rem` 911) (i+1) | otherwise = return s main :: IO () main = do a <- testArray replicateM_ 120 (reverseArray a 0 (total-1)) print =<< sumArrayMod a 0 0 From simonmarhaskell at gmail.com Wed May 2 05:23:05 2007 From: simonmarhaskell at gmail.com (Simon Marlow) Date: Wed May 2 05:20:49 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <197499360705010823v594f9674yeff46e29ece046c4@mail.gmail.com> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> <1178022695.6227.10.camel@localhost> <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> <20070501150024.GA28107@cse.unsw.EDU.AU> <197499360705010823v594f9674yeff46e29ece046c4@mail.gmail.com> Message-ID: <46385879.1090009@gmail.com> Federico Squartini wrote: > Thanks for the hints. It's a pity that (as far as I know) no one has > written a tutorial on those techniques, because I think it would be > appreciated. Some of them are quite involved and learning them just by > reading code is very time consuming. There's the Performance section of the Haskell wiki: http://haskell.org/haskellwiki/Performance Some of the techniques are described there, but by no means all. It's a good place to put knowledge that you acquire while doing these experiments, though. FWIW I vaguely recall there was a performance problem with initialising IOUArrays that we haven't got around to fixing yet. If you can narrow down the test case, then please submit a bug report. Cheers, Simon From troy.taillefer at lmco.com Wed May 2 07:15:45 2007 From: troy.taillefer at lmco.com (Taillefer, Troy (EXP)) Date: Wed May 2 07:13:36 2007 Subject: FW: [Haskell-cafe] RE:Cross-over from Haskell.org [Haskell] Re: Newbie: what are the advantages of Haskell? Message-ID: These Haskell lists seems to have a problem of having to many elitist pricks on it admittedly I am probably in this category as well so I will help you guys and by eliminating one prick and remove myself from the list good luck with the rest of them Troy -----Original Message----- From: u.stenzel@web.de [mailto:u.stenzel@web.de] Sent: Tuesday, May 01, 2007 5:35 PM To: Taillefer, Troy (EXP) Subject: Re: [Haskell-cafe] RE:Cross-over from Haskell.org [Haskell] Re: Newbie: what are the advantages of Haskell? Taillefer, Troy (EXP) wrote: > I really dislike Perl as a programming language but I have to strongly > disagree about your statements about CPAN and the quality of its > contents. Consider Sturgeon's Law: 90% of everything is crap. It's true of CPAN, too, which is only a stand in for any large collection of libraries. We don't gain anything from wrapping or reimplementing the crap, therefore, if you like some particular library, you should ask for *that* library, nor for more libraries in general. no need to get all touchy-feely about this. > Perl is popular so it must have some merit. So is Crack. I still won't smoke it, though. > I don't subscribe to the > flawed reasoning that Perl Hackers just don't know any better or that > they are dumb, or intellectual inferior in some way. Well, I didn't make that point in the mail you're replying to, but I subscribe to it. Perl *is* unadultered crap, it *is* a bad idea carried to perfection, a shoddy language that teaches bad habits, rewards stupidity and encourages you to attack every problem with the same blunt old tool, the regex, and most Perl Hackers, those who voluntarily use it to solve actual problem, *are* in fact dumb, don't want to know any better and are resistant to education. Perl is in every way the opposite of Haskell, and I happen to like Haskell. Imitating Perl is even worse than imitating C++. ...but I don't even wan't to discuss this, neither in private nor on a mailing list. If you want to argue, ask Google for Erik Naggum; nothing more needs to be said about it. > ... I am pro choice. And I *choose* to belittle Perl Hackers as much as I want. If that stops anyone from using Perl, it's their *choice*. And you can *choose* to hate me for belittling you, jackass. Political Correctness is even more misguided than Perl. From waldmann at imn.htwk-leipzig.de Wed May 2 07:18:01 2007 From: waldmann at imn.htwk-leipzig.de (Johannes Waldmann) Date: Wed May 2 07:15:20 2007 Subject: [Haskell] Re: refactoring, catamorphism, termination of programs In-Reply-To: References: <46377CBE.5090209@imn.htwk-leipzig.de> Message-ID: <46387369.3040708@imn.htwk-leipzig.de> Dear Stefan, thanks for your comment. > E.g. the Coq papers define its elimination constructs either as > a catamorphism, or as a combination of case&fix, where the recursive calls > are appropriately restricted to pass subterms as arguments. if we replace the "subterm" ordering by some other well-founded ordering on terms, and let a tool look for this ordering, then we get the "classical" approach (that is used for term rewriting systems). my point is that most (Haskell) programs don't require this because they are (or should be) just primitive recursive functions (catamorphisms) over data structures, and in fact they should be presented as such (explicit recursion should be replaced by the catamorphism), and I want a tool to do that replacement. Sure, this will not solve all Haskell termination problems. I just want to see how many are left (e.g. from the functions in the Prelude, or in my programs). If you want to contribute further to the discussion, then please do so via http://groups.google.com/group/fp-termination (I don't want to clutter the haskell mailing list, but I want to have the discussion in some public place.) Best regards, -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- ---- http://www.imn.htwk-leipzig.de/~waldmann/ ------- From jeremy.gibbons at comlab.ox.ac.uk Wed May 2 07:38:08 2007 From: jeremy.gibbons at comlab.ox.ac.uk (Jeremy Gibbons) Date: Wed May 2 07:36:35 2007 Subject: [Haskell] Re: refactoring, catamorphism, termination of programs In-Reply-To: <46387369.3040708@imn.htwk-leipzig.de> References: <46377CBE.5090209@imn.htwk-leipzig.de> <46387369.3040708@imn.htwk-leipzig.de> Message-ID: On 2 May 2007, at 12:18, Johannes Waldmann wrote: > If you want to contribute further to the discussion, > then please do so via http://groups.google.com/group/fp-termination > (I don't want to clutter the haskell mailing list, > but I want to have the discussion in some public place.) Isn't Haskell Cafe exactly the place for that discussion? (As opposed to the Haskell mailing list.) Good luck with the discussion. Someone mentioned DrHylo; that's built on the work of Hu, Onoue and others from Tokyo on a system called Hylo: http://www.ipl.t.u-tokyo.ac.jp/~onoue/hylo/ See also Alberto Pardo's HFusion: http://www.fing.edu.uy/inco/proyectos/fusion/ Jeremy Jeremy.Gibbons@comlab.ox.ac.uk Oxford University Computing Laboratory, TEL: +44 1865 283508 Wolfson Building, Parks Road, FAX: +44 1865 283531 Oxford OX1 3QD, UK. URL: http://www.comlab.ox.ac.uk/oucl/people/jeremy.gibbons.html From cmb21 at kent.ac.uk Wed May 2 10:06:42 2007 From: cmb21 at kent.ac.uk (C.M.Brown) Date: Wed May 2 10:04:27 2007 Subject: [Haskell] refactoring, catamorphism, termination of programs In-Reply-To: <46377CBE.5090209@imn.htwk-leipzig.de> References: <46377CBE.5090209@imn.htwk-leipzig.de> Message-ID: Hi Jahannes, > I don't want to make a big research project out of this, > rather I think of quickly putting together a prototype > that proves the concept. > > I figure it could be distilled from some existing refactoring suite, > or be manufactured from existing building blocks. Well, HaRe -- the Haskell refactorer -- offers a full API for building transformations and refactorings for the full Haskell 98 standard. http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html A new release will hopefully be released very soon (even in the next few days) which will be compatible with ghc-6.6.1. The releases on our refactoring page currently only work with GHC-6.4.*. > E.g. Language.Haskell.* from the ghc libs, > and perhaps "Typing Haskell in Haskell"? > http://citeseer.ist.psu.edu/424440.html HaRe also uses the GHC API and type checker, with parts of the HaRe API extended to retrieve type information from GHC on abritrary expressions and functions. Kind regards, Chris. From bulat.ziganshin at gmail.com Wed May 2 10:51:01 2007 From: bulat.ziganshin at gmail.com (Bulat Ziganshin) Date: Wed May 2 10:52:07 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <197499360705010823v594f9674yeff46e29ece046c4@mail.gmail.com> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> <1178022695.6227.10.camel@localhost> <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> <20070501150024.GA28107@cse.unsw.EDU.AU> <197499360705010823v594f9674yeff46e29ece046c4@mail.gmail.com> Message-ID: <1715300517.20070502185101@gmail.com> Hello Federico, Tuesday, May 1, 2007, 7:23:45 PM, you wrote: > Thanks for the hints. It's a pity that (as far as I know) no one has > written a tutorial on those techniques, except for me :) - http://haskell.org/haskellwiki/Modern_array_libraries -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com From bulat.ziganshin at gmail.com Wed May 2 11:00:44 2007 From: bulat.ziganshin at gmail.com (Bulat Ziganshin) Date: Wed May 2 11:01:46 2007 Subject: [Haskell] Haskell fast (?) arrays In-Reply-To: <20070502033825.GI26667@cse.unsw.EDU.AU> References: <197499360705010459u7cd032f2obbc30d218769155f@mail.gmail.com> <1178022695.6227.10.camel@localhost> <197499360705010736y2cc633a2o48c10a868da96390@mail.gmail.com> <197499360705010801q67166cfdj9fd5b3b0869c5e34@mail.gmail.com> <20070502033825.GI26667@cse.unsw.EDU.AU> Message-ID: <348798182.20070502190044@gmail.com> Hello Donald, Wednesday, May 2, 2007, 7:38:25 AM, you wrote: > Here's an improved version, using Foreign.Marshal.Array. I spent about 2 > minutes inspecting the core, as well. i think that using just the "!" on array arguments should be enough. there is nothing magic in "usafeReadArray" calls, they should be the same as peek -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com From phiroc at free.fr Wed May 2 11:23:47 2007 From: phiroc at free.fr (phiroc@free.fr) Date: Wed May 2 11:21:05 2007 Subject: [Haskell] Newbie: fix Message-ID: <1178119427.4638ad03bba2c@imp.free.fr> Hello, could someone please explain why "fix" is necessary here: fix (\f l -> if null l then [] else let (s,e) = break (==' ') l in s:f (drop 1 e)) Source: http://www.haskell.org/haskellwiki/Blow_your_mind Thanks. phiroc -------------- next part -------------- w?m?]y?????{????m???&?y'? ?zw^?+???-??.n7??6?zz j???7??N??Xm???? !j? ?Z+??b???j)??$zYj?Zr?????M;??6??6??=??????u?? -------------- next part -------------- Hello, could someone please explain why "fix" in necessary here: fix (\f l -> if null l then [] else let (s,e) = break (==' ') l in s:f (drop 1 e)) Source: http://www.haskell.org/haskellwiki/Blow_your_mind Thanks. phiroc From g9ks157k at acme.softbase.org Wed May 2 11:55:06 2007 From: g9ks157k at acme.softbase.org (Wolfgang Jeltsch) Date: Wed May 2 11:52:26 2007 Subject: [Haskell] Applications and libraries Message-ID: <200705021755.06922.g9ks157k@acme.softbase.org> Hello, the Haskell homepage contains a link ?Applications and libraries? but the page it links to is called ?Libraries and tools?. Since the title ?Applications and libraries? is better (A tool is an application and the page is also about non-tool applications.), I changed its name. I had to discover that there are lots of subpages of ?Libraries and tools?. Is it okay to rename these too? Best wishes, Wolfgang From dmhouse at gmail.com Wed May 2 12:55:50 2007 From: dmhouse at gmail.com (David House) Date: Wed May 2 12:53:08 2007 Subject: [Haskell] Newbie: fix In-Reply-To: <1178119427.4638ad03bba2c@imp.free.fr> References: <1178119427.4638ad03bba2c@imp.free.fr> Message-ID: On 02/05/07, phiroc@free.fr wrote: > Hello, > > could someone please explain why "fix" is necessary here: > > fix (\f l -> if null l then [] else let (s,e) = break (==' ') l in s:f (drop 1 > e)) > > Source: http://www.haskell.org/haskellwiki/Blow_your_mind Because you're writing a recursive function. If you just had: if null l then [] else let (s,e) = break (==' ') l in s:XXX (drop 1 e) Then what goes in place of 'XXX'? There's no name for this particular bit of code, so you can't call it. Using fix allows you to attach a name to an arbitrary expression so that you can call it recursively. The following would work exactly the same: words :: String -> [String] words l = if null l then [] else let (s,e) = break (==' ') l in s:words (drop 1 e) -- -David House, dmhouse@gmail.com From jgoerzen at complete.org Wed May 2 17:33:41 2007 From: jgoerzen at complete.org (John Goerzen) Date: Wed May 2 17:31:05 2007 Subject: [Haskell] ANN: HDBC 1.1.0 Message-ID: <20070502213341.GA12731@katherina.lan.complete.org> Hi, I'm pleased to announce the 1.1.0 release of HDBC and the three primary backends. The big news is an API change, implemented by Peter Thiemann, that transforms the primary connection object from a record to a typeclass. This allows database backends to define their own private functions that provide access to database-specific features. The Sqlite3 backend uses this capability to provide control over its locking mechanism. HDBC can be downloaded from http://software.complete.org/hdbc The backends are available from the index at http://software.complete.org/ -- John From gilesb at cpsc.ucalgary.ca Wed May 2 21:09:48 2007 From: gilesb at cpsc.ucalgary.ca (Brett G. Giles) Date: Wed May 2 21:07:08 2007 Subject: [Haskell] Applications and libraries In-Reply-To: <200705021755.06922.g9ks157k@acme.softbase.org> References: <200705021755.06922.g9ks157k@acme.softbase.org> Message-ID: <1178154588.14267.4.camel@gunther> Yes. I often do this when people miss the guidelines. After renaming, some links become redirects, but people usually clean those up eventually. (It can be done by clicking on the "What links here" on the WIKI page and then changing the links it finds.) On Wed, 2007-05-02 at 17:55 +0200, Wolfgang Jeltsch wrote: > Hello, > > the Haskell homepage contains a link ?Applications and libraries? but the page > it links to is called ?Libraries and tools?. Since the title ?Applications > and libraries? is better (A tool is an application and the page is also about > non-tool applications.), I changed its name. I had to discover that there > are lots of subpages of ?Libraries and tools?. Is it okay to rename these > too? > > Best wishes, > Wolfgang > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell -- Brett G. Giles Grad Student - Formal Methods gilesb@cpsc.ucalgary.ca http://pages.cpsc.ucalgary.ca/~gilesb From wiiat at kis-lab.com Thu May 3 11:24:22 2007 From: wiiat at kis-lab.com (Jia Hu) Date: Thu May 3 11:21:38 2007 Subject: [Haskell] 2nd CFP: IAT'07- DL: June 1, 2007 - Silicon Valley, USA Message-ID: <20070503152135.9BC1B32424F@www.haskell.org> [Apologies if you receive this more than once] ##################################################################### IEEE/WIC/ACM Intelligent Agent Technology 2007 CALL FOR PAPERS ##################################################################### 2007 IEEE/WIC/ACM International Conference on Intelligent Agent Technology (IAT'07) Silicon Valley, USA, November 2-5, 2007 Official: http://www.cs.sjsu.edu/wi07/iat/ Mirror: http://www.maebashi-it.org/wi07/iat/ (to be collocated with WI'07, BIBM'07 and GrC'07) Sponsored By IEEE Computer Society Web Intelligence Consortium (WIC) Association for Computing Machinery (ACM) ##################################################################### # Conference Chair # Andrei Broder, VP, Yahoo Fellow, Yahoo! Research # # Program Chair and Co-Chairs # T.Y. Lin, San Jose State University/UC Berkeley, USA # Jeffrey M. Bradshaw, UWF/Institute for Human and Machine Cognition, USA # Matthias Klusch, German Research Center for AI, Germany # Chengqi Zhang, University of Technology, Sydney, Australia # # Organizing Chair # Howard Ho, Manager, IBM Almaden Research Center # # IAT-WI Joint Keynote Speakers (Tentative) # # Vinton G. Cerf, Turing Award Winner, # VP and Chief Internet Evangelist, Google # Richard M. Karp, Turing Award Winner, # University of California Berkeley # Anant Jhingran, VP and CTO, IBM Silicon Valley Laboratory # # (More IAT Invited Speakers will be announced) # # (Papers Due: ** June 1 **, 2007) # Accepted papers will be published in the conference proceedings # by the IEEE Computer Society Press, which are indexed by EI. ###################################################################### The 2007 IEEE/WIC/ACM International Conference on Intelligent Agent Technology (IAT'07) will be jointly held with the 2007 IEEE/WIC/ACM International Conference on Web Intelligence (WI'07), the 2007 IEEE International Conference on Bioinformatics and Biomedicine (BIBM'07), and the 2007 IEEE International Conference on Granular Computing (GrC'07) for providing synergism among the four research areas. It will provide opportunities for technical collaboration beyond that of previous conferences. The four conferences will have a joint opening, keynote, reception, and banquet. Attendees only need to register for one conference and can attend workshops, sessions and tutorials across the four conferences. We are also planning a joint panel and joint paper sessions that discuss common problems in the four areas. IAT 2007 provides a leading international forum to bring together researchers and practitioners from diverse fields, such as computer science, information technology, business, education, human factors, systems engineering, and robotics, to (1) examine the design principles and performance characteristics of various approaches in intelligent agent technology, and (2) increase the cross-fertilization of ideas on the development of autonomous agents and multi-agent systems among different domains. By encouraging idea-sharing and discussions on the underlying logical, cognitive, physical, and sociological foundations as well as the enabling technologies of intelligent agents, IAT 2007 will foster the development of novel paradigms and advanced solutions in agent-based computing. +++++++++++ Highlights +++++++++++ The conference will be held in Silicon Valley, California. Many high-tech companies and three distinguished universities (Stanford, UC Berkely and UCSC) are just around the corner. The highlight of the conference is that a unique forum consisting of a half-day demo session and free discussion will be organized to link industries and academics. Leading IT companies like IBM, Google, and Yahoo etc will present at the conference. The area now known as Silicon Valley has been a center of technological development since the 1950's. The name Silicon Valley stems from the early 1970's, when the area had become the center for many semiconductor companies. While still hosting semiconductor and microprocessor companies, the region now hosts the headquarters of high tech companies of every kind, including many of the best known and most prestigious names in personal computers, Web search, Internet auctions, networking, storage, databases, etc. +++++++++++++++++++ Topics of Interest +++++++++++++++++++ The topics and areas include, but not limited to: * Autonomy-Oriented Computing (AOC) - Agent-Based Complex Systems Modeling and Development - Agent-Based Simulation - Autonomy-Oriented Modeling and Computation Methods - Behavioral Self-Organization - Complex Behavior Characterization and Engineering - Emergent Behavior - Hard Computational Problem Solving - Nature-Inspired Paradigms - Self-Organized Criticality - Self-Organized Intelligence - Swarm Intelligence * Autonomous Knowledge and Information Agents - Agent-Based Distributed Data Mining - Agent-Based Knowledge Discovery And Sharing - Autonomous Information Services - Distributed Knowledge Systems - Emergent Natural Law Discovery in Multi-Agent Systems - Evolution of Knowledge Networks - Human-Agent Interaction - Information Filtering Agents - Knowledge Aggregation - Knowledge Discovery - Ontology-Based Information Services * Agent Systems Modeling and Methodology - Agent Interaction Protocols - Cognitive Architectures - Cognitive Modeling of Agents - Emotional Modeling - Fault-Tolerance in Multi-Agent Systems - Formal Framework for Multi-Agent Systems - Information Exchanges in Multi-Agent Systems - Learning and Self-Adaptation in Multi-Agent Systems - Mobile Agent Languages and Protocols - Multi-Agent Autonomic Architectures - Multi-Agent Coordination Techniques - Multi-Agent Planning and Re-Planning - Peer-to-Peer Models for Multi-Agent Systems - Reinforcement Learning - Social Interactions in Multi-Agent Systems - Task-Based Agent Context - Task-Oriented Agents * Distributed Problem Solving - Agent-Based Grid Computing - Agent Networks in Distributed Problem Solving - Collective Group Behavior - Coordination and Cooperation - Distributed Intelligence - Distributed Search - Dynamics of Agent Groups and Populations - Efficiency and Complexity Issues - Market-Based Computing - Problem-Solving in Dynamic Environments * Autonomous Auctions and Negotiation - Agent-Based Marketplaces - Auction Markets - Combinatorial Auctions - Hybrid Negotiation - Integrative Negotiation - Mediating Agents - Pricing Agents - Thin Double Auctions * Applications - Agent-Based Assistants - Agent-Based Virtual Enterprise - Embodied Agents and Agent-Based Systems Applications - Interface Agents - Knowledge and Data Intensive Systems - Perceptive Animated Interfaces - Scalability - Social Simulation - Socially Situated Planning - Software and Pervasive Agents - Tools and Standards - Ubiquitous Systems and E-Technology Agents - Ubiquitous Software Services - Virtual Humans - XML-Based Agent Systems ++++++++++++++++++++++++++++++++++++ On-Line Submissions and Publication ++++++++++++++++++++++++++++++++++++ High-quality papers in all IAT related areas are solicited. Paper submissions should be limited to a maximum of 7 pages in the IEEE 2-column format, the same as the camera-ready format (see the Author Guidelines of last year at http://www.computer.org/portal/pages/cscps/cps/final/iat06.xml). All submitted papers will be reviewed by the Program Committee on the basis of technical quality, relevance, significance, and clarity. Note that IAT'07 will accept ONLY on-line submissions, containing PDF versions. Please use the Submission Form on the IAT'07 website to submit your paper. Accepted papers will be published in the conference proceedings by the IEEE Computer Society Press that are indexed by EI. Submissions accepted as regular papers will be allocated 7 pages in the proceedings and accorded oral presentation times in the main conference. Submissions accepted as short papers will be allocated 4 pages in the proceedings and will have a shorter presentation time at the conference than regular papers. All co-authors will be notified at all time, for the submission, notification, and confirmation on the attendance. Submitting a paper to the conference and workshops means that, if the paper is accepted, at least one author should attend the conference to present the paper. The acceptance list and no-show list will be openly published on-line. For no-show authors, their affiliations will receive a notification. A selected number of IAT'07 accepted papers will be expanded and revised for inclusion in Web Intelligence and Agent Systems: An International Journal (http://wi-consortium.org/journal.html) and in Annual Review of Intelligent Informatics (http://www.wi-consortium.org/annual.html) More detailed instructions and the On-Line Submission Form can be found from the IAT'07 homepage: http://www.cs.sjsu.edu/wi07/iat/. +++++++++++++++++++++++++ IAT'07 Best Paper Awards +++++++++++++++++++++++++ The best paper awards will be conferred at the conference on the authors of (1) the best research paper and (2) the best application paper. Application-oriented submissions will be considered for the best application paper award. The full author list and paper title will be announced on the Web Intelligence Consortium homepage: http://wi-consortium.org/html/wicawards.html ++++++++++++++++++++ Industry/Demo-Track ++++++++++++++++++++ We solicit Industry/Demo-Track papers by the following methods. (1) Industry papers of 4 pages can be submitted on the same schedule as the research track. (2) Separate 2 page demo proposals can submitted at a later schedule. (3) Full regular paper submissions can include a demo option. That is, a full paper submissions will be asked to specify if they would like to give a demonstration; choice of demonstrations (while utilizing information from the regular reviewing process) will be selected based on value as a demonstration. For options (1) and (2), please find more detailed instructions at the homepage: http://www.cs.sjsu.edu/wi07/wi/ We are planning to arrange the Industry/Demo track in the afternoon of November 3 (before and during the conference reception), jointly with the IAT'07 Demo sessions. Leading IT companies in Silicon Valley will be invited to attend this track. ++++++++++ Workshops ++++++++++ As an important part of the conference, the workshop program will focus on new research challenges and initiatives. All papers accepted for workshops will be included in the Workshop Proceedings published by the IEEE Computer Society Press that are indexed by EI, and will be available at the workshops. Detailed information is available at the conference homepage. Note: we will not have a separate workshop registration fee (i.e., only one conference registration covers everything). ---------------------- WI-IAT 2007 Workshops: ---------------------- Title: Second International Workshop on Communication between Human and Artificial Agents (CHAA-07) Organisers: Christel Kemke Email: ckemke@cs.umanitoba.ca Web page: http://www.cs.umanitoba.ca/~ckemke/CHAA-07/ Title: Rational, Robust, and Secure Negotiations in Multi-Agent Systems (RRS2007) Organisers: Takayuki Ito Email: ito.takayuki@nitech.ac.jp Web page: http://www-itolab.mta.nitech.ac.jp/RRS2007/ Title: P2P Computing and Autonomous Agents Organisers: Tarek Helmy, Khaled Ragab Email: helmy@ccse.kfupm.edu.sa; helmy@kfupm.edu.sa Web Page: http://www.ccse.kfupm.edu.sa/~helmy/P2PAA2007_WI.html Title: Multiagent systems in e-Business: concepts, technologies and applications Organisers: Costin Badica; Maria Ganzha; Marcin Paprzycki Email: badica_costin@software.ucv.ro; ganzha@euh-e.edu.pl; marcin.parzycki@swps.edu.pl Web page: http://software.ucv.ro/~badica_costin/maseb2007/ Title: Agent & Data Mining Interaction Organisers: Pericles A. Mitkas, Longbing Cao, Vladimir Gorodetsky, Justin Zhan Email: mitkas@eng.auth.gr; lbcao@it.uts.edu.au Web page: http://issel.ee.auth.gr/ADMI Title: Educating the Web-Generation Organisers: Elisabeth Heinemann Email: elisabeth.heinemann@googlemail.com Web page: http://www.effactory.com/Edu4WebGen/ Title: Collective Intelligence on Semantic Web Organisers: Geun Sik Jo; Jason J. Jung; Ngoc Thanh Nguyen Email: gsjo@inha.ac.kr; j2jung@intelligent.pe.kr; thanh@pwr.wroc.pl Web page: http://intelligent.pe.kr/CISW07/ Title: New Computing Paradigms for Web Intelligence and Brain Informatics Organisers: Dr. Yuefeng Li; Dr. Yulin Qin, Prof. Dieter Fensel Email: y2.li@qut.edu.au; dieter.fensel@deri.org Web page: http://www.maebashi-it.org/wimbi07/WImBI2007.htm Title: Web Personalization and Recommender Systems Organisers: Yue Xu Email: yue.xu@qut.edu.au Web page: http://www.wprs07.fit.qut.edu.au/ Title: Service Composition Organisers: M. Brian Blake; Dumitru Roman; Charles Petrie Email: blakeb@cs.georgetown.edu; dumitru.roman@deri.org Web site: http://events.deri.at/sercomp2007/ Title: Biomedicine applications of Web technologies Organisers: Chun-Nan Hsu; Vincent Shin-Mu Tseng; Wen-Hsiang Lu Email: chunnan@iis.sinica.edu.tw; tsengsm@mail.ncku.edu.tw; whlu@mail.ncku.edu.tw Web page: http://chunnan.iis.sinica.edu.tw/BMWT2007.html Title: Intelligent Web Interaction Workshop 2007 1st Organiser: Prof. Seiji YAMADA Email: seiji@nii.ac.jp Web site: http://ymd.ex.nii.ac.jp/ws/iwi/07/ Title: Cyberinfrastucture for e-Science Organisers: Prof. Vasant Honavar; A/prof. Kei Cheung Email: honavar@cs.iastate.edu; kei.cheung@yale.edu Web page: http://www.cild.iastate.edu/events/CyIneS2007/ Title: 2007 International Workshop on Social Media Analysis Organisers: Chun-hung Li, William K. Cheung, Quoping Qiu Email: sma@comp.hkbu.edu.hk Web page: http://www.comp.hkbu.edu.hk/~sma/ Title: Web Security, Integrity, Privacy and Trust Organisers: Dr. Yiuming Cheung, Prof. Michael Chau, and Prof. Yong Zhang Email: ymc@Comp.HKBU.Edu.HK; mchau@business.hku.hk; zhangyong076@gmail.com Web page: http://isec.hitsz.edu.cn/wsipt07/ For more information, please visit the conference website at http://www.maebashi-it.org/wi07/iat/?index=workshop. ++++++++++ Tutorials ++++++++++ IAT'07 also welcomes Tutorial proposals. IAT'07 will include tutorials providing in-depth background on subjects that are of broad interest to the intelligent agent community. Both short (2 hours) and long (half day) tutorials will be considered. The tutorials will be part of the main conference technical program. Detailed information is available at the conference homepage. Note: we will not have a separate tutorials registration fee (i.e., only one conference registration covers everything). ++++++++++++++++ Important Dates ++++++++++++++++ Workshop proposal submission: March 20, 2007 Electronic submission of full papers: ** June 1, 2007 ** Tutorial proposal submission: June 15, 2007 Notification of paper acceptance: July 22, 2007 Camera-ready copies of accepted papers: August 17, 2007 Conference: November 2-5, 2007 ++++++++++++++++++++++++ Conference Organization ++++++++++++++++++++++++ Conference Chair: * Andrei Broder, Yahoo! Research, USA Program Chair: * Tsau Young (T.Y.) Lin, San Jose State University/UC Berkeley, USA IAT Program Co-Chairs: * Jeffrey M. Bradshaw, UWF/Institute for Human and Machine Cognition, USA * Matthias Klusch, German Research Center for AI, Germany * Chengqi Zhang, University of Technology, Sydney, Australia WI Program Co-Chairs: * Laura Haas, IBM Almaden Research Center, USA * Janusz Kacprzyk, Polish Academy of Science, Poland * Rajeev Motwani, Stanford University, USA Organizing Chair: * Howard Ho, IBM Almaden Research Center, USA Workshop Co-Chairs: * Vijay Raghavan, University of Louisiana, USA * Yuefeng Li, Queensland University of Technology, Australia Tutorial Chair: * Pawan Lingras, Saint Mary's University, Canada Industry/Demo-Track Chair: * Jianchang Mao, Yahoo! Inc., USA Local Accommodations Co-Chairs: * David Scot Taylor, San Jose State University, USA * Tom Qi Zhang, Google, USA Publicity Chair: * James Wang, Clemson University, USA (chair) Publicity Co-Chairs: * Martine De Cock, Ghent University, Belgium * Jia Hu, International WIC Institute, China * Debajyoti Mukhopadhyay, West Bengal University of Technology, India IEEE-CS-TCII Chair: * Ning Zhong, Maebashi Institute of Technology, Japan ACM-SIGART Chair * Maria Gini, University of Minnesota, USA WIC Co-Chairs/Directors: * Ning Zhong, Maebashi Institute of Technology, Japan * Jiming Liu, University of Windsor, Canada WIC Advisory Board: * Edward A. Feigenbaum, Stanford University, USA * Setsuo Ohsuga, Waseda University, Japan * Benjamin Wah, University of Illinois, Urbana-Champaign, USA * Philip Yu, IBM Thomas J. Watson Research Center, USA * L.A. Zadeh, University of California Berkeley, USA WIC Tech. Committee & WI/IAT Steering Committee: * Jeffrey Bradshaw, UWF/Institute for Human and Machine Cognition, USA * Nick Cercone, York University, Canada * Dieter Fensel, University of Innsbruck, Austria * Georg Gottlob, Oxford University, UK * Lakhmi Jain, University of South Australia, Australia * Jianchang Mao, Yahoo! Inc., USA * Pierre Morizet-Mahoudeaux, Compiegne University of Technology, France * Hiroshi Motoda, Osaka University, Japan * Toyoaki Nishida, Kyoto University, Japan * Andrzej Skowron, Warsaw University, Poland * Jinglong Wu, Kagawa University, Japan * Xindong Wu, University of Vermont, USA * Yiyu Yao, University of Regina, Canada Webmaster: * Albert Sutojo, San Jose State University, USA *** Contact Information *** Jia Hu International WIC Institute, China E-mail: hujia@kis-lab.com From g9ks157k at acme.softbase.org Thu May 3 13:47:45 2007 From: g9ks157k at acme.softbase.org (Wolfgang Jeltsch) Date: Thu May 3 13:45:02 2007 Subject: [Haskell] Is Hackage becoming a centralistic approach? Message-ID: <200705031947.45281.g9ks157k@acme.softbase.org> Hello, on I read that there is the idea to make Hackage support bug tracking and project pages. This looks like Hackage should provide complete hosting of Haskell projects at some time. Is this really intended? Since any reasonable Haskell project should use Hackage now, this would mean that a Haskell software developer cannot use another hosting provider or whatever to host his project. I think this would be very bad since the decision about how and where to host a project shouldn?t be based primarily on what programming language it uses. Any comments? Best wishes, Wolfgang From allbery at ece.cmu.edu Thu May 3 13:50:23 2007 From: allbery at ece.cmu.edu (Brandon S. Allbery KF8NH) Date: Thu May 3 13:47:40 2007 Subject: [Haskell] Is Hackage becoming a centralistic approach? In-Reply-To: <200705031947.45281.g9ks157k@acme.softbase.org> References: <200705031947.45281.g9ks157k@acme.softbase.org> Message-ID: <02DA8A1B-63DE-4ACA-8458-7B737FC151D7@ece.cmu.edu> On May 3, 2007, at 13:47 , Wolfgang Jeltsch wrote: > on I read that there is > the idea to > make Hackage support bug tracking and project pages. This looks > like Hackage > should provide complete hosting of Haskell projects at some time. > Is this > really intended? Since any reasonable Haskell project should use > Hackage > now, this would mean that a Haskell software developer cannot use > another > hosting provider or whatever to host his project. I think this > would be very > bad since the decision about how and where to host a project > shouldn?t be > based primarily on what programming language it uses. My understanding is that yes, it will offer hosting eventually; but this will be an option, not a requirement. Many people don't have readily available hosting options, so this would make it easier for them to contribute. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH From jgoerzen at complete.org Thu May 3 16:06:33 2007 From: jgoerzen at complete.org (John Goerzen) Date: Thu May 3 16:03:51 2007 Subject: [Haskell] ANN: HDBC 1.1.2 Message-ID: <20070503200633.GA9267@katherina.lan.complete.org> Hi everyone, I've made a few improvements to HDBC since the release of 1.1.0 yesterday. HDBC 1.1.2 is posted, with these updates: * New data type that "wraps" the IConnection class in a way that's easier to use in Haskell and more backwards-compatible. * Updated docs for correct URLs for HDBC info Also, on the HDBC website: * Posted migration to 1.1.x information * Posted API docs for the database backend drivers HDBC is at http://software.complete.org/hdbc -- John Goerzen Author, Foundations of Python Network Programming http://www.amazon.com/exec/obidos/tg/detail/-/1590593715 From duncan.coutts at worc.ox.ac.uk Thu May 3 16:55:10 2007 From: duncan.coutts at worc.ox.ac.uk (Duncan Coutts) Date: Thu May 3 17:05:05 2007 Subject: [Haskell] Is Hackage becoming a centralistic approach? In-Reply-To: <02DA8A1B-63DE-4ACA-8458-7B737FC151D7@ece.cmu.edu> References: <200705031947.45281.g9ks157k@acme.softbase.org> <02DA8A1B-63DE-4ACA-8458-7B737FC151D7@ece.cmu.edu> Message-ID: <1178225710.9770.146.camel@localhost> On Thu, 2007-05-03 at 13:50 -0400, Brandon S. Allbery KF8NH wrote: > On May 3, 2007, at 13:47 , Wolfgang Jeltsch wrote: > > > on I read that there is > > the idea to > > make Hackage support bug tracking and project pages. This looks > > like Hackage > > should provide complete hosting of Haskell projects at some time. > > Is this > > really intended? Since any reasonable Haskell project should use > > Hackage > > now, this would mean that a Haskell software developer cannot use > > another > > hosting provider or whatever to host his project. I think this > > would be very > > bad since the decision about how and where to host a project > > shouldn?t be > > based primarily on what programming language it uses. > > My understanding is that yes, it will offer hosting eventually; but > this will be an option, not a requirement. Many people don't have > readily available hosting options, so this would make it easier for > them to contribute. Indeed. Also it's quite possible to host another hackage server instance and cabal-install can deal with multiple hackage servers so for example one could host a hackage server inside an organisation and cabal-install could get packages from both. Duncan From duongthaiha at gmail.com Sun May 6 12:03:00 2007 From: duongthaiha at gmail.com (Duong Thai Ha) Date: Sun May 6 12:00:44 2007 Subject: [Haskell] Monad and Monad transformer??? Message-ID: <463DFC34.0@gmail.com> hi I am a newbee to haskell so please forgive me if the question is not appropreate. I am trying to get the idea of using Monad and have to understand the following code. Can you please tell me is how different Monad and Monad transformer is? And what is mean by > newtype State s a = State { runState :: s -> (a, s) } --------------------------------- Define (State s) as a State monad > instance Monad (State s) where > return a = State $ \s -> (a,s) > m >>= k = State $ \s -> let (a,s') = runState m s in runState (k a) s' Thanks lot for your help I really do appreciate that Best regard From trebla at vex.net Sun May 6 20:54:58 2007 From: trebla at vex.net (Albert Y. C. Lai) Date: Sun May 6 20:52:03 2007 Subject: [Haskell] Monad and Monad transformer??? In-Reply-To: <463DFC34.0@gmail.com> References: <463DFC34.0@gmail.com> Message-ID: <463E78E2.3050005@vex.net> Duong Thai Ha wrote: > I am trying to get the idea of using Monad and have to understand the > following code. > > Can you please tell me is how different Monad and Monad transformer is? > And what is mean by > > > newtype State s a = State { runState :: s -> (a, s) } First I want to say the haskell-cafe mailing list is an even better place for this. The Haskell Wikibook has a large section on monads and monad transformers, including the State monad. I will just explain the newtype business, which is simple. The essence of the State monad is just functions of type s->(a,s). Due to a restriction on Haskell syntax (it is a good restriction, sometimes inconvenient but there are also benefits) we can't just write "s->(a,s)" into an instance declaration. The next best thing is to define our own data type with content "s->(a,s)", and then Haskell will allow our data type to be an instance. There are two ways: data MyType s a = MyConstructor (s->(a,s)) newtype MyType s a = MyConstructor (s->(a,s)) There are subtle differences between the two. For now I'll just cite the most shallow one: the "data" version may add runtime overhead (depending on compiler), the "newtype" version is guaranteed to add no runtime overhead. Next we rename the type from MyType to State: newtype State s a = MyConstructor (s->(a,s)) Next we recognize that the name of the constructor can be the same as the name of the type (they live in different namespaces, no clash), so we also rename MyConstructor: newtype State s a = State (s->(a,s)) Lastly, the record syntax applies to "newtype" definitions too. We can think of this type as a single-field record, the sole field being of type s->(a,s). We can give it a field name, and we choose "runState": newtype State s a = State { runState :: s->(a,s) } The net effect is that "s->(a,s)" and "State s a" are of the same essence, just formally different types, and we need create "State s a" just to satisfy some requirement. But they are mutually convertible. If you have f :: s->(a,s), you can convert it to the new type by writing "State f". Conversely, if you have g :: State s a, you can convert it back to a function by writing "runState g" or using pattern matching. (These conversions are just syntactic and cost nothing in execution.) From dons at cse.unsw.edu.au Mon May 7 01:53:24 2007 From: dons at cse.unsw.edu.au (Donald Bruce Stewart) Date: Mon May 7 01:50:32 2007 Subject: [Haskell] Haskell Weekly News: May 07, 2007 Message-ID: <20070507055324.GD26419@cse.unsw.EDU.AU> --------------------------------------------------------------------------- Haskell Weekly News http://sequence.complete.org/hwn/20070507 Issue 62 - May 07, 2007 --------------------------------------------------------------------------- Welcome to issue 62 of HWN, a weekly newsletter covering developments in the [1]Haskell community. This week sees the release of Atom, a hardware description language embedded in Haskell, along with the usual suite of new libraries and tools. In addition, The Monad.Reader Issue 7 was released, and the hackage upload festival continues unabated. 1. http://haskell.org/ Announcements Atom: Hardware Description in Haskell. Tom Hawkins [2]announced the release of [3]Atom, a high-level hardware description language embedded in Haskell, compiles conditional term rewriting systems into conventional HDL. 2. http://article.gmane.org/gmane.comp.lang.haskell.general/15209 3. http://www.funhdl.org/ The Monad.Reader: Issue 7. Wouter Swierstra [4]announced the latest issue of [5]The Monad.Reader. The Monad.Reader is a quarterly magazine about functional programming. It is less-formal than journal, but somehow more enduring than a wiki page or blog post. 4. http://article.gmane.org/gmane.comp.lang.haskell.cafe/22038 5. http://www.haskell.org/haskellwiki/The_Monad.Reader HDBC: Haskell Database Connectivity. John Goerzon [6]announced that [7]HDBC 1.1.2 is now released. HDBC provides an abstraction layer between Haskell programs and SQL relational databases. This lets you write database code once, in Haskell, and have it work with any number of backend SQL databases. 6. http://article.gmane.org/gmane.comp.lang.haskell.general/15227 7. http://software.complete.org/hdbc FileManip: Expressive Filesystem Manipulation. Bryan O'Sullivan [8]announced the [9]FileManip package provides expressive functions and combinators for searching, matching, and manipulating files. 8. http://article.gmane.org/gmane.comp.lang.haskell.cafe/22090 9. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/FileManip-0.1 photoname: manipulate photos using EXIF data. Dino Morelli [10]announced the release of [11]photoname, a command-line utility for renaming and moving photo image files. The new folder location and naming are determined by two things: the photo shoot date information contained within the file's EXIF tags and the usually-camera-assigned serial number, often appearing in the filename. 10. http://article.gmane.org/gmane.comp.lang.haskell.general/15187 11. http://ui3.info/d/proj/photoname.html RSA-Haskell: Command-line Cryptography. David Sankel [12]announced the release of [13]RSA-Haskell, a collection of command-line cryptography tools and a cryptography library written in Haskell. It is intended to be useful to anyone who wants to secure files or communications or who wants to incorporate cryptography in their Haskell application. 12. http://article.gmane.org/gmane.comp.lang.haskell.general/15207 13. http://www.netsuperbrain.com/rsa-haskell.html Haskell modes for Vim. Claus Reinke [14]summarised the various Haskell/Vim support currently available 14. http://article.gmane.org/gmane.comp.lang.haskell.general/15180 French Translation of Gentle Introduction to H98. The haskell-fr team [15]announced a completed a [16]translation into French of the 'Gentle Introduction to Haskell'. 15. http://article.gmane.org/gmane.comp.lang.haskell.general/15193 16. http://gorgonite.developpez.com/livres/traductions/haskell/gentle-haskell/ Haskell' This section covers the [17]Haskell' standardisation process. * [18]Polymorphic strict fields 17. http://hackage.haskell.org/trac/haskell-prime 18. http://thread.gmane.org/gmane.comp.lang.haskell.prime/2192 Hackage This week's new libraries in [19]the Hackage library database. 19. http://hackage.haskell.org/ * BitSyntax-0.2. Adam Langley. [20]A simple function for the construction of binary data. 20. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/BitSyntax-0.2 * filepath-1.0. Neil Mitchell. [21]Library for manipulating FilePath's in a cross platform way. 21. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/filepath-1.0 * Chart-2007.3.5. Tim Docker [22]A library for generating 2D Charts and Plots. 22. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Chart-2007.3.5 * FileManip-0.1. Bryan O'Sullivan [23]A Haskell library for working with files and directories. 23. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/FileManip-0.1 * hsns-0.5.2. Austin Seipp [24]A network sniffer written in a purely fun language. 24. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hsns-0.5.2 * template-0.1. Johan Tibell [25]Simple string substitution library that supports dollar-based substitution. 25. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/template-0.1 * ASN1-0.0.1. Dominic Steinitz [26]ASN.1 suppport for X.509 identity and attribute certificates, PKCS8, PKCS1v15. 26. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ASN1-0.0.1 Discussion The Proper Definition of (evaluate :: a -> IO a). Isaac Dupree [27]described a variant of evaluate with modified semantics to the current implementation. 27. http://article.gmane.org/gmane.comp.lang.haskell.libraries/6858 Why is Data.Set not a monad?. Dan Doel [28]documented the reasons why Data.Set is not currently an instance of Monad. 28. http://article.gmane.org/gmane.comp.lang.haskell.libraries/6861 Chaos. Andrew Coppin [29]announced chaos, a fun image generating mystery program. 29. http://thread.gmane.org/gmane.comp.lang.haskell.cafe/22177 The Functional Pearls. Don Stewart [30]collected the functional pearls known to be available online, on to a single page on the Haskell wiki. 30. http://thread.gmane.org/gmane.comp.lang.haskell.cafe/22171 Blog noise [31]Haskell news from the blogosphere. * [32]HUG: Nested Data Parallelism in Haskell * [33]HUG: London Haskell User Group * [34]New York Functional Programmers meeting: roundup * [35]Python-style string split in Haskell * [36]Thinking in types * [37]Using the Haskell package system * [38]Fixed precision, an update * [39]Use of Text.XHtml.Strict for Outputting XHTML * [40]Idiom: Plan for Currying * [41]Bowling in Haskell * [42]The Trivial Monad * [43]Homeland Security Threat Level Monad * [44]Monads as universe helpers * [45]Understanding comonads * [46]Coding in Haskell: conciseness * [47]Functional programming in Wall Street * [48]Phantom Types for Real Problems * [49]Haskell rocks * [50]Advertising the ICFP Programming Contest * [51]Haskell wikibook * [52]Roll Your Own Window Manager: Part 1: Defining and Testing a Model * [53]Haskell and the Type Calculus: or, the Good -> Bad -> Ugliness of Types * [54]FileManip, an expressive Haskell library for manipulating files * [55]Programming in Haskell * [56]Parsing JSON in Haskell * [57]Namespace confusion * [58]A Scheme parser in Haskell * [59]Simple performance analysis * [60]Playing with Haskell unsafely * [61]repeat and sequence * [62]Haskell and C: functions returning more than one value 31. http://planet.haskell.org/ 32. http://www.londonhug.net/2007/05/01/hug-update-nested-data-parallelism-in-haskell/ 33. http://www.phildawes.net/blog/2007/05/02/london-haskell-user-group/ 34. http://privosoft.blogspot.com/2007/05/new-york-functional-programmers-meeting.html 35. http://gimbo.org.uk/blog/2007/04/20/splitting-a-string-in-haskell/ 36. http://totherme.livejournal.com/3845.html 37. http://gimbo.org.uk/blog/2007/04/27/haskell-packages-gotcha-global-vs-per-user-package-databases/ 38. http://augustss.blogspot.com/2007/04/fixed-precision-update-so-i-was-bit.html 39. http://www.movethemarkets.com/richard/2007/04/14/use-of-textxhtmlstrict-for-outputting-xhtml/ 40. http://www.movethemarkets.com/richard/2007/04/28/functional-programming-idiom-plan-for-currying/ 41. http://www.randomhacks.net/articles/2007/04/28/bowling-in-haskell 42. http://sigfpe.blogspot.com/2007/04/trivial-monad.html 43. http://sigfpe.blogspot.com/2007/04/homeland-security-threat-level-monad.html 44. http://gelisam.blogspot.com/2006/10/monads-as-universe-helpers.html 45. http://gelisam.blogspot.com/2007/04/i-understand-comonads.html 46. http://defowl.blogspot.com/2007/04/coding-in-haskell.html 47. http://codemiscellany.blogspot.com/2007/04/functional-programming-in-wall-street.html 48. http://neilmitchell.blogspot.com/2007/04/phantom-types-for-real-problems.html 49. http://errantember.livejournal.com/50627.html 50. http://johanjeuring.blogspot.com/2007/05/advertising-icfp-programming-contest.html 51. http://koweycode.blogspot.com/2007/05/haskell-wikibook-now-featured.html 52. http://cgi.cse.unsw.edu.au/~dons/blog/2007/05/01#xmonad_part1_model 53. http://disparatemathematician.blogspot.com/2007/05/haskell-and-type-calculus-or-good-bad.html 54. http://www.serpentine.com/blog/2007/05/01/filemanip-an-expressive-haskell-library-for-manipulating-files/ 55. http://www.regdeveloper.co.uk/2007/05/03/programming_haskell/ 56. http://notes-on-haskell.blogspot.com/2007/05/parsing-json.html 57. http://notes-on-haskell.blogspot.com/2007/05/namespaces-confusion.html 58. http://sami.samhuri.net/articles/2007/05/03/a-scheme-parser-in-haskell-part-1 59. http://syntaxfree.wordpress.com/2007/05/04/lra/ 60. http://therning.org/magnus/archives/249 61. http://therning.org/magnus/archives/269 62. http://therning.org/magnus/archives/280 Quotes of the Week * Oleg K: So, `bind' is `let' and monadic programming is equivalent to programming in the A-normal form. That is indeed all there is to monads * kc5tja: Premature evil is the root of all optimization * Tommah: Remember, kids: if you program in a language with side effects, the terrorists win. * ndm: Comments are for people who can't sense what their code does from the indentation * jcreigh: GHC has lots of interesting features above Haskell98, I've noticed. 'You can take the red pill or the blue pill...' 'Hmm. What's the green pill?' 'What? Oh. That's GHC.' * schluehk: It's about a variant of the other big Haskell credo: once it compiles it works. Once you have written a prototype you have also a spec. If this is not agile I don't know what? It is a quite remarkable inversion. Formerly people wanted tools that are so versatile that they let them express almost everything with great ease and where they didn't care a lot about speed optimizations and corner cases in the early iterations. Now people want tools that restricts intentionally their expressivity to let them do big upfront design as source code. They want to be guided to initial perfection. Let's face it: Haskell has quite some momentum in the dialectic move. Code Watch Notable new features and bug fixes to the Haskell compilers. Thu May 3 06:19:55 PDT 2007. Simon Marlow. [63]Add history/trace functionality to the GHCi debugger. The debugger can now log each step of the evaluation without actually stopping, keeping a history of the recent steps (currently 50). When a (real) breakpoint is hit, you can examine previous steps in the history (and their free variables) using the :history, :back and :forward commands. 63. http://article.gmane.org/gmane.comp.lang.haskell.cvs.ghc/20551 Wed May 2 09:34:57 PDT 2007. Simon Peyton-Jones. [64]Make records work properly with type families. This fixes Trac #1204. There's quite a delicate interaction of GADTs, type families, records, and in particular record updates. 64. http://article.gmane.org/gmane.comp.lang.haskell.cvs.ghc/20522 About the Haskell Weekly News Each week, new editions are posted to [65]the Haskell mailing list as well as to [66]the Haskell Sequence and [67]Planet Haskell. [68]RSS is also available, and headlines appear on [69]haskell.org. Headlines are available as [70]PDF. To help create new editions of this newsletter, please see the [71]contributing information. Send stories to dons at cse.unsw.edu.au. The darcs repository is available at darcs get [72]http://www.cse.unsw.edu.au/~dons/code/hwn 65. http://www.haskell.org/mailman/listinfo/haskell 66. http://sequence.complete.org/ 67. http://planet.haskell.org/ 68. http://sequence.complete.org/node/feed 69. http://haskell.org/ 70. http://www.cse.unsw.edu.au/~dons/code/hwn/archives/20070507.pdf 71. http://haskell.org/haskellwiki/HWN 72. http://www.cse.unsw.edu.au/~dons/code/hwn From simonmarhaskell at gmail.com Mon May 7 03:31:10 2007 From: simonmarhaskell at gmail.com (Simon Marlow) Date: Mon May 7 03:28:44 2007 Subject: [Haskell] Fwd: CfP: Scheme and Functional Programming 2007 Message-ID: <463ED5BE.7000301@gmail.com> [ posting on behalf of Danny Dub? ] [Apologies of you receive multiple copies of this message] > (for-papers) ; call for papers 2007 Workshop on Scheme and Functional Programming http://sfp2007.ift.ulaval.ca/ Freiburg, Germany --- 30 September 2007 The 2007 Scheme Workshop is a forum for discussing experience with and future development of the Scheme programming language. The scope of the workshop includes all aspects of the design, implementation, theory, and application of Scheme. We encourage everyone interested in Scheme to participate. This workshop forms part of the 2007 International Conference on Functional Programming (ICFP) as an associated, ACM SIGPLAN sponsored event. Topics of interest for technical papers include (but are not limited to): Design. Language critiques and extensions, concurrency and distribution, components and composition, language embedding, object systems, type systems, exception handling, syntactic abstraction, module systems and libraries, multiparadigm programming, scripting. Implementation. Compilers, interpreters, runtime systems, virtual machines, resource management, program analysis and transformation, partial evaluation, compile-time and run-time optimization, foreign function and operating system interfaces, embedded systems. Development tools. Profilers, tracers, debuggers, program development environments, program understanding tools, performance and conformance test suites. Theory. Formal semantics, correctness of analyses and transformations, lambda calculus, continuations, program verification. Education. Teaching Scheme, teaching with Scheme. Topics of interest for experience papers include (but are not limited to): Applications. Domain-specific languages, graphical user interfaces, web programming, network applications, multimedia programming, systems programming, symbolic computing, large systems, use of Scheme as a scripting language. Practice and experience. Experience with Scheme in education and industry. Scheme pearls. Elegant, instructive uses of Scheme. Experience papers need not necessarily report original research results; they may instead 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! System Demonstrations. Authors of both technical and experience papers are invited to describe, in an appendix, proposals for system demonstrations to be given during the workshop. Panel Discussions. We also invite proposals for panel discussions on topics of interest to the Scheme community. Authors of accepted proposals will give a brief presentation on the topic and then moderate the discussion that follows. For submission details, please see http://sfp2007.ift.ulaval.ca/. Program committee John Clements (Cal Poly) Danny Dub?, chairman (Laval University) Martin Gasbichler (Z?hlke Engineering) Aubrey Jaffer (ClearMethods Inc.) Christian Queinnec (University Paris 6) Chung-chieh Shan (Rutgers University) Steering committee William D. Clinger (Northeastern University) Marc Feeley (University of Montr?al) Robby Findler (University of Chicago) Dan Friedman (Indiana University) Christian Queinnec (University Paris 6) Manuel Serrano (INRIA Sophia Antipolis) Olin Shivers (Northeastern University) Mitchell Wand (Northeastern University) Submission deadline June 22, 2007 Author notification August 3, 2007 Final paper due September 7, 2007 Workshop September 30, 2007 From wss at Cs.Nott.AC.UK Mon May 7 05:55:22 2007 From: wss at Cs.Nott.AC.UK (Wouter Swierstra) Date: Mon May 7 05:52:57 2007 Subject: [Haskell] The Monad.Reader - Call for copy Message-ID: <18F9A193-9E64-40AB-98EB-F97921D1820F@cs.nott.ac.uk> Call for Copy The Monad.Reader - Issue 8 I would like to welcome articles for the next issue of The Monad.Reader. * The Monad.Reader * The Monad.Reader is a electronic magazine about all things Haskell. It is less-formal than journal, but somehow more enduring than a wiki- page. There have been a wide variety of articles, including: exciting code fragments, intriguing puzzles, book reviews, tutorials, and even half-baked research ideas. * Submission Details * Get in touch with me if you intend to submit something -- the sooner you let me know what you're up to, the better. Please submit articles for the next issue by e-mail (wss at cs.nott.ac.uk) to me before ** July 27, 2007 ** Articles should be written according to the guidelines available from http://www.haskell.org/haskellwiki/The_Monad.Reader Please submit your article in PDF, together with any source files you used. The sources will be released together with the magazine under a BSD license. If you would like to submit an article, but have trouble with LaTeX please let me know and we'll sort something out. Looking forward to your submission, Wouter This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. From luke.evans at businessobjects.com Mon May 7 13:30:49 2007 From: luke.evans at businessobjects.com (Luke Evans) Date: Mon May 7 13:27:50 2007 Subject: [Haskell] Job Opportunity Message-ID: The Open Quark team at Business Objects is hiring. This is an opportunity to be working on and with the framework that includes the CAL language, a Haskell-like lazy functional language for the Java platform. Details of Open Quark can be found on the following page: http://labs.businessobjects.com/cal The position is located in Vancouver, Canada. The official job listing is here: http://www.recruitingcenter.net/clients/businessobjects/publicjobs/canada/co ntroller.cfm?jbaction=JobProfile&Job_Id=16831&esid=az Applications should be submitted via this page. From Jeremy.Gibbons at comlab.ox.ac.uk Wed May 9 04:17:38 2007 From: Jeremy.Gibbons at comlab.ox.ac.uk (Jeremy.Gibbons@comlab.ox.ac.uk) Date: Wed May 9 04:14:43 2007 Subject: [Haskell] Integrated Formal Methods 2007: Call for participation Message-ID: <200705090817.l498Hcdb020991@mercury.comlab.ox.ac.uk> IFM2007: INTEGRATED FORMAL METHODS CALL FOR PARTICIPATION 2nd to 5th July 2007 St Anne's College, Oxford, UK www.ifm2007.org The design and analysis of computing systems presents a significant challenge: systems need to be understood at many different levels of abstraction, and examined from many different perspectives. Formal methods - languages, tools, and techniques with a sound, mathematical basis - can be used to develop a thorough understanding, and to support rigorous examination. Further research into effective integration is required if these methods are to have a significant impact outside academia. The IFM series of conferences seeks to promote that research, to bring together the researchers carrying it out, and to disseminate the results of that research among the wider academic and industrial community. This is the sixth IFM conference. It will be held in the historic university town of Oxford, at St Anne's College - one of the larger colleges of the University, with excellent new conference facilities. Oxford is easily reached from most UK cities, and is 70 minutes from the country's largest airport. Earlier conferences in the series were held at York (1999), Schloss Dagstuhl (2000), Turku (2002), Kent (2004), and Eindhoven (2005). The conference runs for three full days, 3rd to 5th July. Invited speakers include Jifeng He on "UTP Semantics for Web Services" and Daniel Jackson on "Recent Advances in Alloy"; a third invited speaker is yet to be confirmed. There are 32 contributed papers, including a special session on Unifying Theories of Programming. In addition, there are four satellite events, taking place on 2nd and 3rd July - three workshops: * Refinement Workshop * C/C++ Verification * MeMoT (Methods, Models and Tools for Fault Tolerance) and a tutorial: * KeY (Integrating OO Design and Deductive Verification of Software) The full programme is available at: http://www.ifm2007.org/programme-ifm.html Registration for the conference is now open, at: http://www.ifm2007.org/registration.html Special early-registration fees apply until 1st June 2007. For more information, visit the conference web page: http://www.ifm2007.org/ or contact the local organisers: Jim Davies http://www.softeng.ox.ac.uk/Jim.Davies Jeremy Gibbons http://www.softeng.ox.ac.uk/Jeremy.Gibbons From ryani.spam at gmail.com Fri May 11 01:50:10 2007 From: ryani.spam at gmail.com (Ryan Ingram) Date: Fri May 11 01:47:03 2007 Subject: [Haskell] Newbie help with type-classes Message-ID: <2f9b2d30705102250o51d6dc58g8bb6a020bb218b39@mail.gmail.com> Here's a test case for the problem I'm having; I'm using runhaskell from ghc v6.6. Problem #1) Without -fallow-undecidable-instances, I get the following error: Constraint is no smaller than the instance head in the constraint: ConvertToInt a (Use -fallow-undecidable-instances to permit this) In the instance declaration for `ConvertToIntList a' Problem #2) With -fallow-undecidable-instances, I get this error instead: Overlapping instances for ConvertToIntList () arising from use of `convl' at testcase.hs:28:6-15 Matching instances: instance (ConvertToInt a) => ConvertToIntList a -- Defined at testcase.hs:15:0 instance ConvertToIntList () -- Defined at testcase.hs:18:0 In the expression: convl [()] In the definition of `xl2': xl2 = convl [()] I don't understand why there is an overlapping instances error; () is not an instance of ConvertToInt so how could that instance ever apply? Is there something basic about type-classes that I'm not understanding here? My actual problem is more complicated than this, but this test-case covers the basic issue; something being an instance of class A means that I can derive an instance of class B for it, but I want to implement other instances of class B as well. Code below: {-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-} module TestCase where class ConvertToInt a where conv :: a -> Int class ConvertToIntList a where convl :: [a] -> [Int] instance ConvertToInt Int where conv = id instance ConvertToInt a => ConvertToIntList a where convl = map conv instance ConvertToIntList () where convl x = [] x :: Int x = 5 xl :: [Int] xl = convl [x] xl2 :: [Int] xl2 = convl [()] -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/haskell/attachments/20070510/6e5b9a21/attachment.htm From klee at cs.tu-berlin.de Fri May 11 04:04:56 2007 From: klee at cs.tu-berlin.de (Dirk Kleeblatt) Date: Fri May 11 04:01:47 2007 Subject: [Haskell] ANNOUNCE: Harpy -- run-time code generation library Message-ID: <464423A8.40605@cs.tu-berlin.de> Hi everybody, we're pleased to announce the first release of Harpy. Harpy is a library for run-time code generation of x86 machine code. It provides not only a low level interface to code generation operations, but also a convenient domain specific language for machine code fragments, a collection of code generation combinators and a disassembler. Harpy homepage: http://uebb.cs.tu-berlin.de/harpy/ Kind regards, Martin Grabm?ller and Dirk Kleeblatt -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3212 bytes Desc: S/MIME Cryptographic Signature Url : http://www.haskell.org/pipermail/haskell/attachments/20070511/976e3c6c/smime-0001.bin From v.dijk.bas at gmail.com Fri May 11 06:03:27 2007 From: v.dijk.bas at gmail.com (Bas van Dijk) Date: Fri May 11 06:00:16 2007 Subject: [Haskell] Newbie help with type-classes In-Reply-To: <2f9b2d30705102250o51d6dc58g8bb6a020bb218b39@mail.gmail.com> References: <2f9b2d30705102250o51d6dc58g8bb6a020bb218b39@mail.gmail.com> Message-ID: Add: -fallow-overlapping-instances to your OPTIONS pragma and read about overlapping instances in the GHC User Guide: http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#instance-overlap regards, Bas van Dijk On 5/11/07, Ryan Ingram wrote: > Here's a test case for the problem I'm having; I'm using runhaskell from ghc > v6.6. > > Problem #1) Without -fallow-undecidable-instances, I get the following > error: > Constraint is no smaller than the instance head > in the constraint: ConvertToInt a > (Use -fallow-undecidable-instances to permit this) > In the instance declaration for `ConvertToIntList a' > > Problem #2) With -fallow-undecidable-instances, I get this error instead: > Overlapping instances for ConvertToIntList () > arising from use of `convl' at testcase.hs:28:6-15 > Matching instances: > instance (ConvertToInt a) => ConvertToIntList a > -- Defined at testcase.hs:15:0 > instance ConvertToIntList () -- Defined at testcase.hs:18:0 > In the expression: convl [()] > In the definition of `xl2': xl2 = convl [()] > > I don't understand why there is an overlapping instances error; () is not an > instance of ConvertToInt so how could that instance ever apply? > > Is there something basic about type-classes that I'm not understanding here? > My actual problem is more complicated than this, but this test-case covers > the basic issue; something being an instance of class A means that I can > derive an instance of class B for it, but I want to implement other > instances of class B as well. > > Code below: > > > {-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-} > > module TestCase > where > class ConvertToInt a where > conv :: a -> Int > > class ConvertToIntList a where > convl :: [a] -> [Int] > > instance ConvertToInt Int where > conv = id > > instance ConvertToInt a => ConvertToIntList a where > convl = map conv > > instance ConvertToIntList () where > convl x = [] > > x :: Int > x = 5 > > xl :: [Int] > xl = convl [x] > > xl2 :: [Int] > xl2 = convl [()] > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > > From v.dijk.bas at gmail.com Fri May 11 06:07:09 2007 From: v.dijk.bas at gmail.com (Bas van Dijk) Date: Fri May 11 06:04:01 2007 Subject: [Haskell] Newbie help with type-classes In-Reply-To: <2f9b2d30705102250o51d6dc58g8bb6a020bb218b39@mail.gmail.com> References: <2f9b2d30705102250o51d6dc58g8bb6a020bb218b39@mail.gmail.com> Message-ID: Maybe this is not what you want, but you can also put the 'convl' function in the 'ConvertToInt' class. class ConvertToInt a where conv :: a -> Int convl :: [a] -> [Int] With this approach you don't need any language extension. regards, Bas van Dijk On 5/11/07, Ryan Ingram wrote: > Here's a test case for the problem I'm having; I'm using runhaskell from ghc > v6.6. > > Problem #1) Without -fallow-undecidable-instances, I get the following > error: > Constraint is no smaller than the instance head > in the constraint: ConvertToInt a > (Use -fallow-undecidable-instances to permit this) > In the instance declaration for `ConvertToIntList a' > > Problem #2) With -fallow-undecidable-instances, I get this error instead: > Overlapping instances for ConvertToIntList () > arising from use of `convl' at testcase.hs:28:6-15 > Matching instances: > instance (ConvertToInt a) => ConvertToIntList a > -- Defined at testcase.hs:15:0 > instance ConvertToIntList () -- Defined at testcase.hs:18:0 > In the expression: convl [()] > In the definition of `xl2': xl2 = convl [()] > > I don't understand why there is an overlapping instances error; () is not an > instance of ConvertToInt so how could that instance ever apply? > > Is there something basic about type-classes that I'm not understanding here? > My actual problem is more complicated than this, but this test-case covers > the basic issue; something being an instance of class A means that I can > derive an instance of class B for it, but I want to implement other > instances of class B as well. > > Code below: > > > {-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-} > > module TestCase > where > class ConvertToInt a where > conv :: a -> Int > > class ConvertToIntList a where > convl :: [a] -> [Int] > > instance ConvertToInt Int where > conv = id > > instance ConvertToInt a => ConvertToIntList a where > convl = map conv > > instance ConvertToIntList () where > convl x = [] > > x :: Int > x = 5 > > xl :: [Int] > xl = convl [x] > > xl2 :: [Int] > xl2 = convl [()] > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > > From v.dijk.bas at gmail.com Fri May 11 06:44:16 2007 From: v.dijk.bas at gmail.com (Bas van Dijk) Date: Fri May 11 06:41:06 2007 Subject: [Haskell] ANNOUNCE: Harpy -- run-time code generation library In-Reply-To: <464423A8.40605@cs.tu-berlin.de> References: <464423A8.40605@cs.tu-berlin.de> Message-ID: Very nice! Regarding the use of labels, did you consider using "circular programming with recursive do" to define and reference labels like in: Russell O'Connor, Assembly: Circular Programming with Recursive do http://haskell.org/sitewiki/images/1/14/TMR-Issue6.pdf The advantage of that technique is that you don't have to create a bunch of labels at the start of your assembly-program. You just define them at the place where you need them. Using recursive do notation you can even reference (jmp) to labels _before_ you define them! Thanks, Bas van Dijk On 5/11/07, Dirk Kleeblatt wrote: > Hi everybody, > > we're pleased to announce the first release of Harpy. > > Harpy is a library for run-time code generation of x86 machine code. > It provides not only a low level interface to code generation > operations, but also a convenient domain specific language for machine > code fragments, a collection of code generation combinators and a > disassembler. > > Harpy homepage: > http://uebb.cs.tu-berlin.de/harpy/ > > Kind regards, > Martin Grabm?ller and Dirk Kleeblatt > > > > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > > > From klee at cs.tu-berlin.de Fri May 11 07:01:36 2007 From: klee at cs.tu-berlin.de (Dirk Kleeblatt) Date: Fri May 11 06:58:28 2007 Subject: [Haskell] ANNOUNCE: Harpy -- run-time code generation library In-Reply-To: References: <464423A8.40605@cs.tu-berlin.de> Message-ID: <46444D10.90706@cs.tu-berlin.de> Bas van Dijk wrote: > Regarding the use of labels, did you consider using "circular > programming with recursive do" to define and reference labels like in: > > Russell O'Connor, Assembly: Circular Programming with Recursive do > http://haskell.org/sitewiki/images/1/14/TMR-Issue6.pdf Yes, we considered this technique, but we came to the conclusion that it is not applicable in our setting: we are writing directly to malloc'ed memory, so our operations are strict in the label parameter. Thus, the fixpoint of the recursive mdo would be bottom. However, these were (up to now) only theoretical thoughts, maybe our hypothesis of strict operations can be weakened. Kind regards, Dirk -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3212 bytes Desc: S/MIME Cryptographic Signature Url : http://www.haskell.org/pipermail/haskell/attachments/20070511/f99ada76/smime.bin From derek.a.elkins at gmail.com Fri May 11 08:45:23 2007 From: derek.a.elkins at gmail.com (Derek Elkins) Date: Fri May 11 08:43:10 2007 Subject: [Haskell] Newbie help with type-classes In-Reply-To: <2f9b2d30705102250o51d6dc58g8bb6a020bb218b39@mail.gmail.com> References: <2f9b2d30705102250o51d6dc58g8bb6a020bb218b39@mail.gmail.com> Message-ID: <46446563.6080007@gmail.com> Ryan Ingram wrote: haskell-cafe@haskell.org is better for this type of question. Follow-up is set to it. > Here's a test case for the problem I'm having; I'm using runhaskell from > ghc v6.6. > > Problem #1) Without -fallow-undecidable-instances, I get the following > error: > Constraint is no smaller than the instance head This is bad. > Problem #2) With -fallow-undecidable-instances, I get this error instead: > Overlapping instances for ConvertToIntList () > I don't understand why there is an overlapping instances error; () is > not an instance of ConvertToInt so how could that instance ever apply? I write anywhere, instance ConvertToInt () where ... Now it is overlapping. > Is there something basic about type-classes that I'm not understanding > here? They are open (Open World Assumption). I can add a new instance anywhere at any time. > Code below: > {-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-} > > module TestCase > where > > class ConvertToInt a where > conv :: a -> Int > > class ConvertToIntList a where > convl :: [a] -> [Int] > > instance ConvertToInt Int where > conv = id > > instance ConvertToInt a => ConvertToIntList a where This is what it's complaining about in the first error; this doesn't work. > convl = map conv > > instance ConvertToIntList () where > convl x = [] From hz at inf.elte.hu Fri May 11 15:56:56 2007 From: hz at inf.elte.hu (HORVATH Zoltan) Date: Fri May 11 15:53:49 2007 Subject: [Haskell] Functional Programming School + PhD workshop, June 23-30, 2007 In-Reply-To: References: Message-ID: 2nd Central-European Functional Programming School CEFP 2007 Cluj-Napoca, June 23-30, 2007 http://cs.ubbcluj.ro/cefp2007/ Second Call for PhD student presentation - Call for participation PhD students are invited to submit the abstract of their presentations to be included in the workshop session of the summer school. The selected and reviewed workshop papers and the revised lectures will be published in the post-conference LNCS Volume of the Summer School. The deadline for registration and submissions is 1 June 2007. Aims and Scopes: The Central-European Functional Programming School (CEFP) is an intensive summer school series in the field of functional programming. The main goal is to bring together computer scientists, researchers, graduate and especially PhD students. The school would like to promote the research and the education of the functional programming languages, software technologies and programming methodologies. The second CEFP school will be organized by the Babe?-Bolyai University (Cluj-Napoca / Kolozsv?r / Klausenburg) between 23-30 June, 2007. The previous school was held in Budapest, Hungary, July, 2005 (LNCS 4164). The invited lecturers are prominent researchers in the field, and they will present state-of-the-art functional programming techniques. Beside the lectures practical courses will be held. The school includes a workshop for PhD students to present their work and get feed-back from the lecturers. Invited Lecturers: Rinus Plasmeijer (Radboud University Nijmegen, The Netherlands): iTasks: Defining Interactive Workflows for the Web Werner Kluge (Christian-Albrechts-Universit?t zu Kiel, Germany): Abstract Lambda Calculus Machines Marko van Eekelen (Radboud University Nijmegen, The Netherlands): Proving Properties of Lazy Functional Programs Tim Sheard (Portland State University, USA): The Omega Programming Language Ralf Hinze (Universit?t Bonn, Germany): Generic Programming, Now! Three additional short courses will be given: Zolt?n Horv?th (E?tv?s Lor?nd University, Budapest, Hungary): Refactoring Erlang Programs Zolt?n Cs?rnyei (E?tv?s Lor?nd University, Budapest, Hungary): Lambda-Calculus Horia F. Pop (Babe?-Bolyai University, Cluj-Napoca, Romania): A Tutorial on Object Orientedness in Functional Programming Submissions for the workshop session: Each presentation can be of max. 25 minutes. The full paper version can be submitted after the summer school for post-conference reviewing. Venue: Cluj-Napoca / Kolozsv?r / Klausenburg, formerly the capital of Transylvania, is one of the most beautiful medieval cities with a huge multicultural and historical inheritance. Surrounded by marvelous hills and mountains, the city provides fascinating environment for experiencing the unique ambience of a diversified culture, society and nature. Registration and costs: The registration fee (260 Euro) includes the course materials distributed during the school, the post-school volume, lunches, the excursion and the summer school banquet. For further information, accommodation possibilities and registration please visit the web-page of the event: http://www.cs.ubbcluj.ro/cefp2007. From apfelmus at quantentunnel.de Sat May 12 05:18:03 2007 From: apfelmus at quantentunnel.de (apfelmus) Date: Sat May 12 05:14:51 2007 Subject: [Haskell] Re: ANNOUNCE: Harpy -- run-time code generation library In-Reply-To: <46444D10.90706@cs.tu-berlin.de> References: <464423A8.40605@cs.tu-berlin.de> <46444D10.90706@cs.tu-berlin.de> Message-ID: Dirk Kleeblatt wrote: > Bas van Dijk wrote: >> Regarding the use of labels, did you consider using "circular >> programming with recursive do" to define and reference labels like in: >> >> Russell O'Connor, Assembly: Circular Programming with Recursive do >> http://haskell.org/sitewiki/images/1/14/TMR-Issue6.pdf > > Yes, we considered this technique, but we came to the conclusion that it > is not applicable in our setting: we are writing directly to malloc'ed > memory, so our operations are strict in the label parameter. Thus, the > fixpoint of the recursive mdo would be bottom. > > However, these were (up to now) only theoretical thoughts, maybe our > hypothesis of strict operations can be weakened. Note that even currently, your operations cannot be strict in the address a label refers to because this may be determined later than the first use of the label. In other words, your example code fac = do loopTest <- newLabel loopStart <- newLabel ensureBufferSize 160 push ecx mov ecx (Disp 8, esp) mov eax (1 :: Word32) (1) jmp loopTest loopStart @@ mul ecx sub ecx (1 :: Word32) (2) loopTest @@ cmp ecx (0 :: Word32) jne loopStart pop ecx ret already shows that the function jmp that generates a jmp-instruction may not be strict in the position it jumps to as the address behind loopTest is only known later at line (2). Also, the explicit declaration of labels has an inherent safety problem. Namely, nobody prevents you from using a label twice, like for example in loopStart @@ mul exc ... loopStart @@ cmp ecx (0 :: Word32) Declaring a label (via f.i.) loopStart <- mul exc at it's instruction doesn't have this problem. Furthermore, having to call 'ensureBufferSize 160' is very strange for this is data that can be calculated automatically. In short, it looks like the "CodeGen e s a"-monad eagerly writes code without doing much book-keeping. I think that changing this enables recursive do. I also think that having liftIO in the CodeGen-monad is plain wrong. I mean, CodeGen is a monad that generates code without any execution taking place. The execution part is already handled by runCodeGen. Having liftIO means that arbitrary Haskell programs can be intertwined with assembly generation and I doubt that you want that. Regards, apfelmus From jeremy.shaw at linspireinc.com Sat May 12 23:32:10 2007 From: jeremy.shaw at linspireinc.com (Jeremy Shaw) Date: Sat May 12 23:28:57 2007 Subject: [Haskell] ANNOUNCE: AGI library (Asterisk Gateway Interface) Message-ID: <3b21qtz9.wl%jeremy.shaw@linspireinc.com> Hello, I have uploaded a simple AGI interface to hackage. It is still very alpha, but that has never stopped me before :) http://hackage.haskell.org/cgi-bin/hackage-scripts/package/AGI-1.0 darcs get http://www.n-heptane.com/nhlab/repos/haskell-agi/ The best way to understand how to use it is to: 1. Refer to the documentation for AGI: http://www.voip-info.org/wiki-Asterisk+AGI 2. Look at GuessingGame in the examples directory. The guessing game is just a simple game where you try to guess a number between 0 and 9. It is not very exciting to play, but it does demonstrate how to use the library. j. From wss at Cs.Nott.AC.UK Mon May 14 03:59:47 2007 From: wss at Cs.Nott.AC.UK (Wouter Swierstra) Date: Mon May 14 03:57:51 2007 Subject: [Haskell] ANN: Foreign.AppleScript version 0.1 Message-ID: <0EA642F1-0046-45A2-989F-2BDC6468BC6F@cs.nott.ac.uk> * Foreign.AppleScript * version 0.1 I'd like to announce the first public release of Foreign.AppleScript, a library for compiling and executing AppleScript from Haskell. AppleScript is a scripting language available on all modern Apple computers. It can be used to script most applications on running on MacOS X. Using AppleScript you can, for instance: * write dirt-cheap GUIs; * use Apple's built-in text-to-speech to read out text; * play your favourite iTunes tracks; * open URLs in your standard webbrowser. Unfortunately, AppleScript isn't the world's greatest general purpose programming language. Using Foreign.AppleScript, however, you can pimp your Haskell apps with all neat stuff AppleScript can do. How to get it? Darcs: darcs get http://www.cs.nott.ac.uk/~wss/repos/ForeignAppleScript Tarball: www.cs.nott.ac.uk/~wss/repos/ForeignAppleScript/dist/ AppleScript-0.1.tar.gz Haddock: http://www.cs.nott.ac.uk/~wss/repos/ForeignAppleScript/dist/doc/ html/ Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ AppleScript-0.1 There are a few small examples included with the source files. Implementation: At the moment, the binding is very restricted. Essentially, there is a function: > runAppleScript :: String -> IO ExitCode That will compile and execute any String of AppleScript you pass it. The result is an ExitCode, indicating whether or not the script succeeded. I have some ideas about how to improve this simple interface, allowing you to access the result of executing the AppleScript. This still needs a bit of work, before I can release it. It would be pretty interesting to try and write a typed combinator library to help generate AppleScript code. If you have any ideas about this, please do get in touch. Patches and suggestions are very welcome. Finally, I'd like to thank Duncan Coutts for helping me cabalize the code. Have fun! Wouter This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. From magr at cs.tu-berlin.de Mon May 14 05:45:15 2007 From: magr at cs.tu-berlin.de (Martin Grabmueller) Date: Mon May 14 05:41:57 2007 Subject: [Haskell] Re: ANNOUNCE: Harpy -- run-time code generation library In-Reply-To: References: <464423A8.40605@cs.tu-berlin.de> <46444D10.90706@cs.tu-berlin.de> Message-ID: <46482FAB.9030105@cs.tu-berlin.de> apfelmus schrieb: > Also, the explicit declaration of labels has an inherent safety problem. > Namely, nobody prevents you from using a label twice, like for example in > > loopStart @@ mul exc > ... > loopStart @@ cmp ecx (0 :: Word32) Your are right. In the next version, Harpy *will* prevent you from defining a label twice. It was just an oversight on my part not to check for duplicate definitions. Thanks for spotting this problem. Martin -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://www.haskell.org/pipermail/haskell/attachments/20070514/a524f597/signature.bin From m at tel.netbeisser.de Mon May 14 06:26:34 2007 From: m at tel.netbeisser.de (Marcel Manthe) Date: Mon May 14 06:23:13 2007 Subject: [Haskell] Core language inlined? Message-ID: <10601250.post@talk.nabble.com> Hey, GHC seems to have a very powerful core language, which makes implementing language features less painful. As further applications of Core were mentioned: let other languages use it and build new features upon it. Here's a silly idea: Would it be possible to use Haskell and Core in parallel, in the same module or at least in the same program? Can Core integrate smoothly with Haskell? The benifitz of such feature would at least be: * Easy implementation and testing of new language features * Use language features that are used too seldom to justify an implementation in haskell * Some code may be easier to implement/understand, when it is in core form Any comments? Marcel Manthe -- View this message in context: http://www.nabble.com/Core-language-inlined--tf3751489.html#a10601250 Sent from the Haskell - Haskell mailing list archive at Nabble.com. From ctm at Cs.Nott.AC.UK Mon May 14 08:53:53 2007 From: ctm at Cs.Nott.AC.UK (Conor McBride) Date: Mon May 14 08:58:46 2007 Subject: [Haskell] Fun in the Afternoon (Cambridge, Thursday) Message-ID: <46485BE1.5000206@cs.nott.ac.uk> Relayed from Alan Mycroft: The "Fun in the afternoon" termly functional programming event takes place in Cambridge this thurday. For more details (including travel) see: http://sneezy.cs.nott.ac.uk/fun/ STOP PRESS: Microsoft are kindly providing a buffet lunch for those arriving for 12:30 (this is in the reception of the Microsoft Research building 100m behind (East of) the Computer Lab (turn left at our reception and go round the side of our building). First come first served! For those of us coming later, there will be a room in the Computer Laboratory to buy or eat our own sandwiches. Programme: 2.00pm Andy Gordon (MSR, Cambridge) Baltic: Service Combinators for Farming Virtual Machines We consider the problem of managing server farms largely automatically, in software. Automated management is gaining in importance with the widespread adoption of virtualization technologies, which allow multiple virtual machines per physical host. We consider the case where each server is service-oriented, in the sense that the services it provides, and the external services it depends upon, are explicitly described in metadata. We describe the design, implementation, and formal semantics of a library of combinators whose types record and respect server metadata. Our implementation consists of a typed functional script built with our combinators, in control of a Virtual Machine Monitor hosting a set of virtual machines. Our combinators support a range of operations including creation of virtual machines, their interconnection using typed endpoints, and the creation of intermediaries for tasks such as load balancing. Our combinators also allow provision and reconfiguration in response to events such as machine failures or spikes in demand. We describe a series of programming examples run on our implementation, based on existing server code for order processing, a typical data centre workload. To obtain a formal semantics for any script using our combinators, we provide an alternative implementation of our interface using a small concurrency library. Hence, the behaviour of the script plus our libraries can be interpreted within a statically typed process calculus. Assuming that server metadata is correct, a benefit of typing is that various server configuration errors are detected statically, rather than sometime during the execution of the script. [Based on joint work with Karthikeyan Bhargavan, Microsoft Research and Iman Narasamdya, University of Manchester] ========= 3.00 coffee ========= 3.30 Joao Fernando Ferreira, University of Nottingham Recounting the Rationals: Twice! In this talk we present an algorithm that enables the rationals to be enumerated in two different ways. One way is known and is called Calkin-Wilf-Newman enumeration; the second is new and corresponds to a flattening of the Stern-Brocot tree of rationals. We show that both enumerations stem from the same simple algorithm. In this way, we construct a Stern-Brocot enumeration algorithm with the same time and space complexity as Calkin-Wilf-Newman enumeration. ========= 4.00 Ben Rudiak-Gould, University of Cambridge Why eager and lazy are not quite dual Writing down a denotational semantics for strict and non-strict ML is a tricky business: in particular, it is not always clear what should be lifted or why. We have previously shown how a simple continuation-based intermediate language is useful for compiling strict and non-strict languages to a single virtual machine (_Haskell is Not Not ML_, ESOP '06). In this talk I will show how the negation-based type system of this language can usefully model the habitation of types in ML and Haskell, and in two variations of Haskell semantics: Haskell without seq, and "dual Haskell" where code is represented by data and data by code. ========= 4.30 Tarmo Uustalu, Institute of Cybernetics, Tallinn Firmly antifounded Recursive coalgebras are a simple formulation of wellfounded recursion and termination. In an attempt to learn about antifounded recursion and productivity, we play with their dual concept. Since Set is not self-dual, this is not without surprises. (Joint work with Venanzio Capretta and Varmo Vene.) See you for Fun on Thursday... Alan This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. From stefanor at cox.net Mon May 14 09:45:42 2007 From: stefanor at cox.net (Stefan O'Rear) Date: Mon May 14 09:42:20 2007 Subject: [Haskell] Core language inlined? In-Reply-To: <10601250.post@talk.nabble.com> References: <10601250.post@talk.nabble.com> Message-ID: <20070514134542.GA2876@localhost.localdomain> On Mon, May 14, 2007 at 03:26:34AM -0700, Marcel Manthe wrote: > > Hey, > > GHC seems to have a very powerful core language, which makes implementing > language features less painful. As further applications of Core were > mentioned: let other languages use it and build new features upon it. > > Here's a silly idea: Would it be possible to use Haskell and Core in > parallel, in the same module or at least in the same program? Can Core > integrate smoothly with Haskell? > > The benifitz of such feature would at least be: > > * Easy implementation and testing of new language features > * Use language features that are used too seldom to justify an > implementation in haskell > * Some code may be easier to implement/understand, when it is in core form GHC has a feature that theoretically allows you to link .hcr files along with .hs files; the External Core system. It has been broken since 6.0, but Aaron Tomb et al are busy fixing it, and it is expected to be usable this year. Stefan From klee at cs.tu-berlin.de Mon May 14 11:31:57 2007 From: klee at cs.tu-berlin.de (Dirk Kleeblatt) Date: Mon May 14 11:28:38 2007 Subject: [Haskell] Re: ANNOUNCE: Harpy -- run-time code generation library In-Reply-To: References: <464423A8.40605@cs.tu-berlin.de> <46444D10.90706@cs.tu-berlin.de> Message-ID: <464880ED.80503@cs.tu-berlin.de> apfelmus wrote: > Note that even currently, your operations cannot be strict in the > address a label refers to because this may be determined later than the > first use of the label. In other words, your example code > > fac = do [...] > (1) jmp loopTest [...] > (2) loopTest @@ cmp ecx (0 :: Word32) [...] > already shows that the function jmp that generates a jmp-instruction may > not be strict in the position it jumps to as the address behind loopTest > is only known later at line (2). When generating code for (1), the label loopTest is used as an index into a map, to see whether there's a code position associated with it. If it is, the code position is used to compute the jump offset for the jmp instruction, if not (as in this example), a dummy value is placed in the code buffer, and Harpy remembers this position to be patched later on. At (2), the label is defined, and this leads to patching all instructions that have been emitted before this definition. So, yes, the code position is only used after the definition of the label. But the "look up in a map"-part makes the jmp operation strict in the label parameter. We could omit the map, and just remember where to patch the code, but then we'd need to call explicitly some function after code generation that does the patching. We had implemented this, but found the current solution easier to use, since backpatching is completely automatic and hidden from the user. However, this is just a description of the current implementation, not an argument that there's no better implementation. Probably there is, maybe using the binary package. > Also, the explicit declaration of labels has an inherent safety problem. [...] > Declaring a label (via f.i.) > > loopStart <- mul exc > > at it's instruction doesn't have this problem. This looks quite elegant, I'll think about it... > Furthermore, having to call 'ensureBufferSize 160' is very strange for > this is data that can be calculated automatically. As I wrote at haskell-cafe, we require this only for performance reasons, to keep buffer overflow checks as seldom as possible. But there might be better ways to do this. > I also think that having liftIO in the CodeGen-monad is plain wrong. I > mean, CodeGen is a monad that generates code without any execution > taking place. The execution part is already handled by runCodeGen. > Having liftIO means that arbitrary Haskell programs can be intertwined > with assembly generation and I doubt that you want that. Feel free to doubt, but this is exactly what we want. :-) Also, note that runCodeGen runs the code _generation_, executing the generated code is done _within_ the CodeGen monad via the functions generated by callDecl (or the predefined functions in the Harpy.Call module). This is even more intertwined, but intentional. Of course, again a different design is possible, making runCodeGen return a binary code object, that can be called from the IO monad. But then, the user has to care about releasing code buffers, and not to have unevaluated closures having code pointers to already released run-time generated code. Kind regards, Dirk -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3212 bytes Desc: S/MIME Cryptographic Signature Url : http://www.haskell.org/pipermail/haskell/attachments/20070514/a2091758/smime-0001.bin From derek.a.elkins at gmail.com Mon May 14 13:15:28 2007 From: derek.a.elkins at gmail.com (Derek Elkins) Date: Mon May 14 13:13:08 2007 Subject: [Haskell] Re: ANNOUNCE: Harpy -- run-time code generation library In-Reply-To: <464880ED.80503@cs.tu-berlin.de> References: <464423A8.40605@cs.tu-berlin.de> <46444D10.90706@cs.tu-berlin.de> <464880ED.80503@cs.tu-berlin.de> Message-ID: <46489930.3060206@gmail.com> Dirk Kleeblatt wrote: > apfelmus wrote: >> Note that even currently, your operations cannot be strict in the >> address a label refers to because this may be determined later than the >> first use of the label. In other words, your example code >> >> fac = do > [...] >> (1) jmp loopTest > [...] >> (2) loopTest @@ cmp ecx (0 :: Word32) > [...] >> already shows that the function jmp that generates a jmp-instruction may >> not be strict in the position it jumps to as the address behind loopTest >> is only known later at line (2). > > When generating code for (1), the label loopTest is used as an index > into a map, to see whether there's a code position associated with it. > If it is, the code position is used to compute the jump offset for the > jmp instruction, if not (as in this example), a dummy value is placed in > the code buffer, and Harpy remembers this position to be patched later > on. At (2), the label is defined, and this leads to patching all > instructions that have been emitted before this definition. > > So, yes, the code position is only used after the definition of the > label. But the "look up in a map"-part makes the jmp operation strict in > the label parameter. > > We could omit the map, and just remember where to patch the code, but > then we'd need to call explicitly some function after code generation > that does the patching. We had implemented this, but found the current > solution easier to use, since backpatching is completely automatic and > hidden from the user. > > However, this is just a description of the current implementation, not > an argument that there's no better implementation. Probably there is, > maybe using the binary package. > >> Also, the explicit declaration of labels has an inherent safety problem. > [...] >> Declaring a label (via f.i.) >> >> loopStart <- mul exc >> >> at it's instruction doesn't have this problem. > > This looks quite elegant, I'll think about it... If this is what I think it is (tying the knot), then essentially the thunk becomes the field reference, backpatching is thunk update, and the Haskell environment is the Map. It should be possible to limit the laziness just to the "fields", but I'm not sure if it's possible to "limit the strictness". > >> Furthermore, having to call 'ensureBufferSize 160' is very strange for >> this is data that can be calculated automatically. > > As I wrote at haskell-cafe, we require this only for performance > reasons, to keep buffer overflow checks as seldom as possible. But there > might be better ways to do this. > >> I also think that having liftIO in the CodeGen-monad is plain wrong. I >> mean, CodeGen is a monad that generates code without any execution >> taking place. The execution part is already handled by runCodeGen. >> Having liftIO means that arbitrary Haskell programs can be intertwined >> with assembly generation and I doubt that you want that. > > Feel free to doubt, but this is exactly what we want. :-) > > Also, note that runCodeGen runs the code _generation_, executing the > generated code is done _within_ the CodeGen monad via the functions > generated by callDecl (or the predefined functions in the Harpy.Call > module). This is even more intertwined, but intentional. > > Of course, again a different design is possible, making runCodeGen > return a binary code object, that can be called from the IO monad. But > then, the user has to care about releasing code buffers, and not to have > unevaluated closures having code pointers to already released run-time > generated code. Having this as an option would be very nice I suspect. I'd like it. From ashley at semantic.org Tue May 15 01:35:43 2007 From: ashley at semantic.org (Ashley Yakeley) Date: Tue May 15 01:32:31 2007 Subject: [Haskell] Implicit Parameters in Instance Declarations Message-ID: Would horrible things happen if implicit parameters were allowed as contexts in instance declarations? instance (?limit :: Int) => Eq Thing where ... -- Ashley Yakeley From simonpj at microsoft.com Wed May 16 08:50:14 2007 From: simonpj at microsoft.com (Simon Peyton-Jones) Date: Wed May 16 08:46:47 2007 Subject: [Haskell] Commercial Users of Functional Programming: call for speakers Message-ID: Folks, This is just to remind you about the closing date for offers of talks at the 2007 Commercial Users of Functional Programming workshop http://cufp.galois.com/ The closing date is 1st June, in a couple of weeks. The workshop itself is on Oct 4, colocated with ICFP at Freiburg, Germany. CUFP is a workshop for people who use functional programming (in some guise), because it's the best way to get the job done, rather than because it's a cool research topic. It's a very informal workshop. No papers, no proceedings -- just stand up and tell us how it is for you. But you have to tell us in advance so we can plan the day. Please get in touch with me or Kathleen Fisher (details at the URL above). You can also nominate someone else. That's even easier. (But ask them first.) And plan to come, too! Simon From aeyakovenko at gmail.com Wed May 16 13:49:54 2007 From: aeyakovenko at gmail.com (Anatoly Yakovenko) Date: Wed May 16 13:46:40 2007 Subject: [Haskell] ANNOUNCE: Harpy -- run-time code generation library In-Reply-To: <464423A8.40605@cs.tu-berlin.de> References: <464423A8.40605@cs.tu-berlin.de> Message-ID: Any plans for ARM/Thumb machine code generation? On 5/11/07, Dirk Kleeblatt wrote: > Hi everybody, > > we're pleased to announce the first release of Harpy. > > Harpy is a library for run-time code generation of x86 machine code. > It provides not only a low level interface to code generation > operations, but also a convenient domain specific language for machine > code fragments, a collection of code generation combinators and a > disassembler. > > Harpy homepage: > http://uebb.cs.tu-berlin.de/harpy/ > > Kind regards, > Martin Grabm?ller and Dirk Kleeblatt > > > > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > > > From bjorn.buckwalter at gmail.com Wed May 16 22:43:31 2007 From: bjorn.buckwalter at gmail.com (=?ISO-8859-1?Q?Bj=F6rn_Buckwalter?=) Date: Wed May 16 22:40:04 2007 Subject: [Haskell] ANNOUNCE: Dimensional 0.4 -- Statically checked physical dimensions Message-ID: <8b2a1a960705161943x1dbb6164j883f9c4bb0b33b10@mail.gmail.com> Dear all, I am pleased to announce version 0.4 of Dimensional (working name). Dimensional is a library providing data types for performing arithmetic with physical quantities and units. Information about the physical dimensions of the quantities/units is embedded in their types and the validity of operations is verified by the type checker at compile time. The boxing and unboxing of numerical values as quantities is done by multiplication and division with units. The library is designed to, as far as is practical, enforce/encourage best practices [1] of unit usage. Since the previous formal announcement [2] (version 0.1) Dimensional has gone through several structural and stylistic improvements but usage remains fundamentally unchanged. Noteworthy changes are a vastly solidified 'NumType' module, a complete(?) set of elementary functions and a 'Prelude'-replacement for users' convenience. There is also an experimental 'Extensible' module supporting user-defined dimensions. Additional structural changes and additions (primarily of units) are planned and the library will continue to have an unstable API until the 1.0 release. However, apart from module reshuffling no changes are anticipated that would break user code. Additional information and code is available from the project web site [3]. Thank you, Bjorn Buckwalter [1] http://physics.nist.gov/Pubs/SP811/ [2] http://www.haskell.org/pipermail/haskell/2006-December/018993.html [3] http://code.google.com/p/dimensional/ From magr at cs.tu-berlin.de Fri May 18 04:20:53 2007 From: magr at cs.tu-berlin.de (Martin Grabmueller) Date: Fri May 18 04:17:22 2007 Subject: [Haskell] ANNOUNCE: Harpy -- run-time code generation library In-Reply-To: References: <464423A8.40605@cs.tu-berlin.de> Message-ID: <464D61E5.6020306@cs.tu-berlin.de> Anatoly Yakovenko schrieb: > Any plans for ARM/Thumb machine code generation? Currently: no. It would be possible to support other architectures by adding appropriate backend modules, but currently, the library is not really prepared for that. One reason is that we only develop for x86-machines (and don't own any ARM machines). The other is that currently more than 90% of the code are machine-dependant. For the future, we'd like to be able to support more architectures, but it's not very high on our priority list. Maybe interest of others could change that... Best regards, Martin -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://www.haskell.org/pipermail/haskell/attachments/20070518/806ad0b9/signature.bin From jeanphilippe.bernardy at gmail.com Fri May 18 07:54:13 2007 From: jeanphilippe.bernardy at gmail.com (Jean-Philippe Bernardy) Date: Fri May 18 07:50:40 2007 Subject: [Haskell] Announce: Yi 0.2.0 released Message-ID: <953e0d250705180454g82d2967k1fffdefc331d4080@mail.gmail.com> Hello folks, I'm very pleased to announce the 0.2.0 release of the Yi editor. Yi is a text editor written and extensible in Haskell. The goal of Yi is to provide a flexible, powerful and correct editor core dynamically scriptable in Haskell. Yi is not a finished product, but "release early, release often", and it's been way too long since last time :). Besides, Yi has interesting aspects that deserve wider exposure. * Yi is an haskell interpreter. Very much like emacs is a Lisp interpreter, this makes really easy to dynamically hack, experiment and modify Yi. All tools and goodies written in haskell are also readily available from the editor. This is implemented by binding to the GHC api. * Frontends. Yi can use either gtk2hs or vty as frontends, so users can choose their favourite interface. * "Emulation modes". The primary emulation modes for Yi are vim and emacs. Keybindings for vi, mg and nano and other are also provided. Other editor interfaces can be written by the user to extend Yi. Download from Hackage: http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Editor (please note that you need yi and either of the yi-vty or yi-gtk backends) More information is available on: http://haskell.org/haskellwiki/Yi Darcs repo: http://www.cse.unsw.edu.au/~dons/yi/ Yi homepage: http://www.cse.unsw.edu.au/~dons/yi.html Patches, comments, criticism welcome... as always! CREDITS: The following people have contributed to Yi: Allan Clark Alson Kemp Andrii Zvorygin Bastiaan Zapf Ben Moseley Cale Gibbard Don Stewart Duncan Coutts Harald Korneliussen Henning Guenther Jason Dagit Jean-Philippe Bernardy Mario Lang Mark Wotton Samuel Bronson Shae Erisson Simon Winwood Spencer Janssen Stefan O'Rear Suleiman Souhlal Taral Tim Newsham Tuomo Valkonen Vivian McPhail Yang Zhang (If I've forgotten you, please tell me -- there are a few patches I could not trace back to their author) This release also marks my taking over the maintenance of Yi. Many thanks to Donald Bruce Stewart for creating and bringing up Yi so far. -- Jean-Philippe Bernardy From fw at deneb.enyo.de Sat May 19 15:30:02 2007 From: fw at deneb.enyo.de (Florian Weimer) Date: Sat May 19 15:26:26 2007 Subject: [Haskell] ANNOUNCE: Harpy -- run-time code generation library In-Reply-To: <464D61E5.6020306@cs.tu-berlin.de> (Martin Grabmueller's message of "Fri, 18 May 2007 10:20:53 +0200") References: <464423A8.40605@cs.tu-berlin.de> <464D61E5.6020306@cs.tu-berlin.de> Message-ID: <87irao7gsl.fsf@mid.deneb.enyo.de> * Martin Grabmueller: > For the future, we'd like to be able to support more architectures, > but it's not very high on our priority list. Maybe interest > of others could change that... LLVM as a target could be interesting as well, and would avoid the need to write tons of optimizers. From wdmeuter at vub.ac.be Sun May 20 15:38:29 2007 From: wdmeuter at vub.ac.be (Wolfgang De Meuter) Date: Sun May 20 15:34:48 2007 Subject: [Haskell] not-so-newbie question Message-ID: <69C4F055-31AC-41A9-8E86-ECBD4DA7BBE2@vub.ac.be> Dear all, I used to be a Gofer freak on my Mac back in the mid-nineties. Recently I have regained interest in FP and I'm trying to get hold of an implementation of Haskell on my G4. I must say that this hunt has been quite frustrating until now. I don't know unix and I'm unwilling to learn it just to install a Haskell interpreter. Apart from an old GHC 6.4.2, *every* implementation that I have downloaded so far is full of installation scripts, and stuff like that. Does anyone know of a site where I can download a simple MacOsX binary application? Download&double-click is really the only thing I want to do before starting to program in Haskell. Cheers Wolf From rtharper at aftereternity.co.uk Sun May 20 16:41:58 2007 From: rtharper at aftereternity.co.uk (Tom Harper) Date: Sun May 20 16:38:16 2007 Subject: [Haskell] not-so-newbie question In-Reply-To: <69C4F055-31AC-41A9-8E86-ECBD4DA7BBE2@vub.ac.be> References: <69C4F055-31AC-41A9-8E86-ECBD4DA7BBE2@vub.ac.be> Message-ID: <22e57f680705201341y31161c7i4de088ec1e179fc8@mail.gmail.com> http://haskell.org/ghc/download_ghc_661.html#macosxppc On 5/20/07, Wolfgang De Meuter wrote: > Dear all, > > I used to be a Gofer freak on my Mac back in the mid-nineties. > Recently I have regained interest in FP and I'm trying to get hold of > an implementation of Haskell on my G4. I must say that this hunt has > been quite frustrating until now. I don't know unix and I'm unwilling > to learn it just to install a Haskell interpreter. Apart from an old > GHC 6.4.2, *every* implementation that I have downloaded so far is > full of installation scripts, and stuff like that. > > Does anyone know of a site where I can download a simple MacOsX > binary application? Download&double-click is really the only thing I > want to do before starting to program in Haskell. > > Cheers > Wolf > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > -- Tom Harper Computer Science Major '07 Syracuse University +1 949 235 0185 Public Key: http://aftereternity.co.uk/rth.asc From wdmeuter at vub.ac.be Sun May 20 16:53:22 2007 From: wdmeuter at vub.ac.be (Wolfgang De Meuter) Date: Sun May 20 16:49:39 2007 Subject: [Haskell] not-so-newbie question In-Reply-To: <22e57f680705201341y31161c7i4de088ec1e179fc8@mail.gmail.com> References: <69C4F055-31AC-41A9-8E86-ECBD4DA7BBE2@vub.ac.be> <22e57f680705201341y31161c7i4de088ec1e179fc8@mail.gmail.com> Message-ID: Exactly what I mean. When you download and unpack the file you get a unix folder with install stuff. After trying to follow the installation instructions, it complains that I don't have a gcc on my machine... Wolf On 20-mei-07, at 22:41, Tom Harper wrote: > http://haskell.org/ghc/download_ghc_661.html#macosxppc > > On 5/20/07, Wolfgang De Meuter wrote: >> Dear all, >> >> I used to be a Gofer freak on my Mac back in the mid-nineties. >> Recently I have regained interest in FP and I'm trying to get hold of >> an implementation of Haskell on my G4. I must say that this hunt has >> been quite frustrating until now. I don't know unix and I'm unwilling >> to learn it just to install a Haskell interpreter. Apart from an old >> GHC 6.4.2, *every* implementation that I have downloaded so far is >> full of installation scripts, and stuff like that. >> >> Does anyone know of a site where I can download a simple MacOsX >> binary application? Download&double-click is really the only thing I >> want to do before starting to program in Haskell. >> >> Cheers >> Wolf >> _______________________________________________ >> Haskell mailing list >> Haskell@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell >> > > > -- > Tom Harper > Computer Science Major '07 > Syracuse University > +1 949 235 0185 > Public Key: http://aftereternity.co.uk/rth.asc From taralx at gmail.com Sun May 20 17:22:56 2007 From: taralx at gmail.com (Taral) Date: Sun May 20 17:19:15 2007 Subject: [Haskell] not-so-newbie question In-Reply-To: References: <69C4F055-31AC-41A9-8E86-ECBD4DA7BBE2@vub.ac.be> <22e57f680705201341y31161c7i4de088ec1e179fc8@mail.gmail.com> Message-ID: You need to install Xcode (from your Mac OS disk) before you can use ghc. On 5/20/07, Wolfgang De Meuter wrote: > Exactly what I mean. When you download and unpack the file you get a > unix folder with install stuff. After trying to follow the > installation instructions, it complains that I don't have a gcc on my > machine... -- Taral "Please let me know if there's any further trouble I can give you." -- Unknown From taralx at gmail.com Sun May 20 17:25:11 2007 From: taralx at gmail.com (Taral) Date: Sun May 20 17:21:32 2007 Subject: [Haskell] not-so-newbie question In-Reply-To: References: <69C4F055-31AC-41A9-8E86-ECBD4DA7BBE2@vub.ac.be> <22e57f680705201341y31161c7i4de088ec1e179fc8@mail.gmail.com> Message-ID: Also note that this will install ghc into the underlying unix environment. If you want a pretty GUI, I don't know of any for Mac OS X. A quick search on google for "mac haskell ide" brings up http://www.hoovy.org/HaskellXcodePlugin/ -- this might help you. I will note that if you are developing applications for Mac, you need to know the OS. And the OS is a UNIX. On 5/20/07, Taral wrote: > You need to install Xcode (from your Mac OS disk) before you can use ghc. -- Taral "Please let me know if there's any further trouble I can give you." -- Unknown From flippa at flippac.org Mon May 21 12:13:32 2007 From: flippa at flippac.org (Philippa Cowderoy) Date: Mon May 21 12:10:06 2007 Subject: [Haskell] AngloHaskell 2007 Message-ID: I'd like to announce AngloHaskell 2007, or at least the start of the process of organising it! Last year there was a get-together organised around the interviews for the job of GHC maintainer. There were talks, with a largely pragmatic flavour, and there was plenty of socialising. It was fun, and doing it again seems a good idea. In the vein of last year's process, organising an event this year shall take place on the Haskell Wiki page at: http://www.haskell.org/haskellwiki/AngloHaskell and on IRC, in #anglohaskell on irc.freenode.net So far this is almost all the detail available, as neither date nor venue have been set - a summer date seems good though, and by the time we're organised I imagine late July or August looks most likely. Simon Peyton-Jones has offered to ask Microsoft Research for space to give talks in. This worked well last year, but if anyone else wants to offer a venue that's fine! -- flippa@flippac.org The task of the academic is not to scale great intellectual mountains, but to flatten them. From Alistair_Bayley at invescoperpetual.co.uk Tue May 22 04:23:10 2007 From: Alistair_Bayley at invescoperpetual.co.uk (Bayley, Alistair) Date: Tue May 22 04:19:26 2007 Subject: [Haskell] Inaugural London HUG meeting; attendee list suggestion Message-ID: <125EACD0CAE4D24ABDB4D148C4593DA901BDFA6B@GBLONXMB02.corp.amvescap.net> Tomorrow evening's London Haskell User Group meeting has a reasonable list of attendees (inferred from the comments): http://www.londonhug.net/2007/04/26/announcement-first-meeting-of-the-lo ndon-haskell-user-group/ I think it'd be a good idea to do what the BCS-SPA does, and maintain a wiki-page where attendees can add/remove themselves e.g. http://bcs-spa.org/cgi-bin/view/SPA/MakingSenseOfInformalInformation (scroll down to bottom of page, above map) This gives a current picture of who's planning to attend, which might be useful if you want to catch up with particular people. Should we start something here, perhaps? http://www.haskell.org/haskellwiki/London_Haskell_User_Group/Events/2007 0426 Alistair ***************************************************************** Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. ***************************************************************** From nhn at Cs.Nott.AC.UK Tue May 22 13:47:30 2007 From: nhn at Cs.Nott.AC.UK (Henrik Nilsson) Date: Tue May 22 13:44:23 2007 Subject: [Haskell] Final APLAS'07 CFP Message-ID: <46532CB2.7060005@cs.nott.ac.uk> On Behalf of Zhong Shao. Sorry for any duplicates! /Henrik ---------- Title: Final APLAS 2007 CFP (Deadline: June 15, 2007) [Recent updates: (1) Submission site is now open: (2) New info about invited speakers. (3) Deadline is just 3-week away. ] -------------------------------------------------------------------------- The Fifth ASIAN Symposium on Programming Languages and Systems (APLAS 2007) CALL FOR PAPERS Singapore November 29 - December 1, 2007 http://flint.cs.yale.edu/aplas2007/ APLAS aims at stimulating programming language research by providing a forum for the presentation of recent results and the exchange of ideas and experience in topics concerned with programming languages and systems. APLAS is based in Asia, but is an international forum that serves the worldwide programming languages community. The APLAS series is sponsored by the Asian Association for Foundation of Software (AAFS), which has recently been founded by Asian researchers in cooperation with many researchers from Europe and the USA. The past formal APLAS symposiums were successfully held in Sydney (2006, Australia), Tsukuba (2005, Japan), Taipei (2004, Taiwan) and Beijing (2003, China) after three informal workshops held in Shanghai (2002, China), Daejeon (2001, Korea) and Singapore (2000). Proceedings of the past symposiums were published in Springer-Verlag's LNCS 2895, 3302, 3780, and 4279. TOPICS: The symposium is devoted to both foundational and practical issues in programming languages and systems. Papers are solicited on, but not limited, to the following topics: * semantics, logics, foundational theory * type systems, language design * program analysis, optimization, transformation * software security, safety, verification * compiler systems, interpreters, abstract machines * domain-specific languages and systems * programming tools and environments Original results that bear on these and related topics are solicited. Papers investigating novel uses and applications of language systems are especially encouraged. Authors concerned about the appropriateness of a topic are welcome to consult with the program chair prior to submission. INVITED SPEAKERS: Vincent Danos (University of Paris VII & CNRS, France) Sriram Rajamani (Microsoft Research, India) Vijay Saraswat (IBM TJ Watson Research Lab, USA) IMPORTANT DATES: Paper Submission Deadline: 11:00 AM (in Samoan Time), June 15, 2007 Author Notification: August 17, 2007 Camera Ready: September 7, 2007 Conference: November 29-December 1, 2007 SUBMISSIONS INFORMATION: Papers should be submitted electronically online via the conference submission web page at URL . Acceptable formats are PostScript or PDF, viewable by Ghostview or Acrobat Reader. Submissions should not exceed 16 pages in LNCS format, including bibliography and figures. Submitted papers will be judged on the basis of significance, relevance, correctness, originality, and clarity. They should clearly identify what has been accomplished and why it is significant. Submitted papers must be unpublished and not submitted for publication elsewhere. The proceedings of the symposium is planned to be published as a volume in Springer-Verlag's Lecture Notes in Computer Science series. GENERAL CHAIR Joxan Jaffar (National University of Singapore, Singapore) PROGRAM CHAIR Zhong Shao (Yale University, USA) PROGRAM COMMITTEE Lars Birkedal (IT University of Copenhagen, Denmark) Martin Hofmann (Univ of Munich, Germany) Kohei Honda (Queen Mary, University of London, UK) Atsushi Igarashi (Kyoto University, Japan) Suresh Jagannathan (Purdue University, USA) Annie Liu (State University of New York at Stony Brook, USA) Shin-Cheng Mu (Academia Sinica, Taiwan) Henrik Nilsson (University of Nottingham, UK) Michael Norrish (NICTA, Australia) Jens Palsberg (University of California, Los Angeles, USA) G. Ramalingam (Microsoft Research, India) Zhong Shao (Yale University, USA) Zhendong Su (University of California, Davis, USA) Martin Sulzmann (National University of Singapore, Singapore) Eijiro Sumii (Tohoku University, Japan) J?r?me Vouillon (CNRS, France) Kwangkeun Yi (Seoul National University, Korea) Jian Zhang (Chinese Academy of Sciences, China) LOCAL ARRANGEMENT CHAIR Wei-Ngan Chin (National University of Singapore, Singapore) -- Henrik Nilsson School of Computer Science and Information Technology The University of Nottingham nhn@cs.nott.ac.uk This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. From sebastian.setzer.ext at siemens.com Tue May 22 14:55:28 2007 From: sebastian.setzer.ext at siemens.com (Setzer, Sebastian (ext)) Date: Tue May 22 14:52:39 2007 Subject: [Haskell] Composing channels Message-ID: Hi, Suppose you've got two tasks, A and B, A wants sends a request to B, B sends a response. Both are sent through Control.Concurrent.Chan: +---+ +---+ | A |<--aChan bChan-->| B | +---+ +---+ A writes to bChan, B writes to aChan. Because B gets requests from several tasks, the request (and the type of bChan) includes aChan. As long as these tasks are threads of the same process, that's fine. But what can you do if there's a network (or some other kind of IPC) in between? If you didn't need to respond, you could try something like this: +---+ +---+ +---+ +---+ | A | cChan-->| C |--network--| D | bChan-->| B | +---+ +---+ +---+ +---+ A sends to cChan. C serializes the request, D deserializes it and sends to bChan. If you want to respond, it gets difficult. In order to send aChan through the network, you have to serialize it. When deserializing it, you have to create a channel in the process of D and B, which you can write into bChan and which B uses to respond. This channel will be read by a task which serializes the response, sends it through the network to the process of A and C, where it will be deserialized and written to aChan. Of course, you need to keep the serializing/deserializing in both processes consistent. For example by using the same shared object. Looks quite difficult. Are there any simpler solutions for typesafe network-communications? Are there plans to include some kind of "network transparent channels" in the haskell library (or are they already there and I overlooked them)? Sebastian Setzer From bos at serpentine.com Tue May 22 18:07:52 2007 From: bos at serpentine.com (Bryan O'Sullivan) Date: Tue May 22 18:06:33 2007 Subject: [Haskell] Composing channels In-Reply-To: References: Message-ID: <465369B8.4060703@serpentine.com> Setzer, Sebastian (ext) wrote: > If you want to respond, it gets difficult. I have a two-way serialising network channel socked away somewhere that uses Data.Binary and lazy ByteStrings, but it's not complete. > Looks quite difficult. Are there any simpler solutions for typesafe > network-communications? Are there plans to include some kind of "network > transparent channels" in the haskell library (or are they already there > and I overlooked them)? There's an old paper about port-based distributed Haskell, but the code available from the authors is rather complicated and has long since bit-rotted. Consider this module for a blog entry that I will want to put in various generic collections that require Ord {-# OPTIONS -fglasgow-exts #-} module Blog.Types where import Data.Typeable import Data.Generics data BlogEntry = Entry EpochSeconds Name Email Title Body deriving (Eq,Ord,Read,Show,Typeable) newtype Name = Name String deriving (Eq,Ord,Read,Show,Typeable) newtype Title = Title String deriving (Eq,Ord,Read,Show,Typeable) newtype Body = Body String deriving (Eq,Ord,Read,Show,Typeable) It seems really unnecessarily verbose. Having to add the OPTION header AND import Data.Typeable and Data.Generics just to derive Typeable is a beat-down. It is even more of a beat-down to have to add a deriving clause for every newtype to make this all work nicely. Is there a way to make all types automatically derive everything unless there is an explicit instance declaration otherwise? {-# OPTIONS -fglasgow-exts -fgenerics -fderiving#-} module Blog.Types where data BlogEntry = Entry EpochSeconds Name Email Title Body newtype Name = Name String newtype Title = Title String newtype Body = Body String Isn't that much nicer? -Alex- From isaacdupree at charter.net Tue May 22 19:26:45 2007 From: isaacdupree at charter.net (Isaac Dupree) Date: Tue May 22 19:21:33 2007 Subject: [Haskell] boilerplate boilerplate In-Reply-To: <465377AE.1000501@alexjacobson.com> References: <465377AE.1000501@alexjacobson.com> Message-ID: <46537C35.5020603@charter.net> Alex Jacobson wrote: > Consider this module for a blog entry that I will want to put in various > generic collections that require Ord > > {-# OPTIONS -fglasgow-exts #-} > module Blog.Types where > import Data.Typeable > import Data.Generics > > data BlogEntry = Entry EpochSeconds Name Email Title Body > deriving (Eq,Ord,Read,Show,Typeable) > > newtype Name = Name String deriving (Eq,Ord,Read,Show,Typeable) > newtype Title = Title String deriving (Eq,Ord,Read,Show,Typeable) > newtype Body = Body String deriving (Eq,Ord,Read,Show,Typeable) > > > It seems really unnecessarily verbose. Having to add the OPTION header > AND import Data.Typeable and Data.Generics just to derive Typeable is a > beat-down. It works for me removing the Data.Generics import - I think that's just for generics/deriving Data, which is different from Typeable. > It is even more of a beat-down to have to add a deriving > clause for every newtype to make this all work nicely. Is there a way > to make all types automatically derive everything unless there is an > explicit instance declaration otherwise? No, not with separate compilation, not in a practical way anyway. And sometimes you don't _want_ a newtype to be an instance of those classes that the inside type is instances of (for abstraction/encapsulation). > > {-# OPTIONS -fglasgow-exts -fgenerics -fderiving#-} > module Blog.Types where > > data BlogEntry = Entry EpochSeconds Name Email Title Body > newtype Name = Name String newtype Title = Title String newtype > Body = Body String > Isn't that much nicer? A little nicer, but wouldn't you like to get rid of those words "newtype" and duplicate names too? >:) (For your second, desired code sample, I have a feeling this is where DrIFT or Data.Derive are going to come in... I'm not going to mention those external things!) Isaac From lennart at augustsson.net Tue May 22 19:26:53 2007 From: lennart at augustsson.net (Lennart Augustsson) Date: Tue May 22 19:23:48 2007 Subject: [Haskell] boilerplate boilerplate In-Reply-To: <465377AE.1000501@alexjacobson.com> References: <465377AE.1000501@alexjacobson.com> Message-ID: Oh, so you want the original behaviour of type declarations back. :) In Haskell 1.0, if you didn't specify any deriving, you got as much derived as possible. I quite liked it, but it was changed. -- Lennart On Tue, 22 May 2007, Alex Jacobson wrote: > Date: Tue, 22 May 2007 19:07:26 -0400 > From: Alex Jacobson > To: haskell@CS.YALE.EDU > Subject: [Haskell] boilerplate boilerplate > > Consider this module for a blog entry that I will want to put in various > generic collections that require Ord > > {-# OPTIONS -fglasgow-exts #-} > module Blog.Types where > import Data.Typeable > import Data.Generics > > data BlogEntry = Entry EpochSeconds Name Email Title Body > deriving (Eq,Ord,Read,Show,Typeable) > > newtype Name = Name String deriving (Eq,Ord,Read,Show,Typeable) > newtype Title = Title String deriving (Eq,Ord,Read,Show,Typeable) > newtype Body = Body String deriving (Eq,Ord,Read,Show,Typeable) > > > It seems really unnecessarily verbose. Having to add the OPTION header AND > import Data.Typeable and Data.Generics just to derive Typeable is a > beat-down. It is even more of a beat-down to have to add a deriving clause > for every newtype to make this all work nicely. Is there a way to make all > types automatically derive everything unless there is an explicit instance > declaration otherwise? > > {-# OPTIONS -fglasgow-exts -fgenerics -fderiving#-} > module Blog.Types where > > data BlogEntry = Entry EpochSeconds Name Email Title Body > newtype Name = Name String newtype Title = Title String newtype Body = > Body String > Isn't that much nicer? > > -Alex- > > > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > -- Lennart From ndmitchell at gmail.com Tue May 22 19:50:03 2007 From: ndmitchell at gmail.com (Neil Mitchell) Date: Tue May 22 19:46:14 2007 Subject: [Haskell] boilerplate boilerplate In-Reply-To: <465377AE.1000501@alexjacobson.com> References: <465377AE.1000501@alexjacobson.com> Message-ID: <404396ef0705221650j521cb819jb67078a0f7efb16e@mail.gmail.com> Hi > {-# OPTIONS -fglasgow-exts #-} > module Blog.Types where > import Data.Typeable > import Data.Generics > > data BlogEntry = Entry EpochSeconds Name Email Title Body > deriving (Eq,Ord,Read,Show,Typeable) > > newtype Name = Name String deriving (Eq,Ord,Read,Show,Typeable) > newtype Title = Title String deriving (Eq,Ord,Read,Show,Typeable) > newtype Body = Body String deriving (Eq,Ord,Read,Show,Typeable) First off, never use OPTIONS, use OPTIONS_GHC instead. OPTIONS is the old way of doing it. Secondly, if you add {-# OPTIONS_DERIVE --derive=Eq,Ord,Read,Show,Typeable #-} then running your code through with Derive should give you the magic that you require. Plus it will also work on Hugs, and not require your OPTIONS_GHC anyway. Derive: http://www-users.cs.york.ac.uk/~ndm/derive/ Thanks Neil From claus.reinke at talk21.com Tue May 22 20:01:15 2007 From: claus.reinke at talk21.com (Claus Reinke) Date: Tue May 22 19:57:30 2007 Subject: [Haskell] boilerplate boilerplate References: <465377AE.1000501@alexjacobson.com> <46537C35.5020603@charter.net> Message-ID: <026001c79ccd$7c57dc30$3b038351@cr3lt> > (For your second, desired code sample, I have a feeling this is where > DrIFT or Data.Derive are going to come in... I'm not going to mention > those external things!) it wouldn't help to get rid of deriving, but perhaps the new 'standalone deriving' might help to separate out all that deriving stuff, keeping the data type definitions themselves less cluttered? http://hackage.haskell.org/trac/ghc/wiki/Status/October06 claus ps why the odd mailing list address? From ajb at spamcop.net Tue May 22 20:39:05 2007 From: ajb at spamcop.net (ajb@spamcop.net) Date: Tue May 22 20:35:16 2007 Subject: [Haskell] boilerplate boilerplate In-Reply-To: <465377AE.1000501@alexjacobson.com> References: <465377AE.1000501@alexjacobson.com> Message-ID: <20070522203905.x1nw8wgocs8c8g0c@webmail.spamcop.net> G'day all. Quoting Alex Jacobson : > It seems really unnecessarily verbose. Having to add the OPTION header ...which you don't need; this could go on the command line... > It is even more of a beat-down to have to add a deriving > clause for every newtype to make this all work nicely. One neat fix would be for newtype-deriving to work with one of the typeclass synonym extensions (which aren't implemented yet). Cheers, Andrew Bromage From alex at alexjacobson.com Wed May 23 00:31:28 2007 From: alex at alexjacobson.com (Alex Jacobson) Date: Wed May 23 00:28:04 2007 Subject: [Haskell] boilerplate boilerplate In-Reply-To: <404396ef0705221650j521cb819jb67078a0f7efb16e@mail.gmail.com> References: <465377AE.1000501@alexjacobson.com> <404396ef0705221650j521cb819jb67078a0f7efb16e@mail.gmail.com> Message-ID: <4653C3A0.8010103@alexjacobson.com> I'm not sure I understand how this solves my problem. Its possible that I can use Derive not to need all the newtype declarations at all, but, if I do need them, I'm not sure how Derive reduces the overall amount of boilerplate here. Perhaps I should define a TH function that takes $(newtype' Name String) And converts it to a newtype Name = Name String deriving (Eq,Ord,Read,Show,Typeable) -Alex- Neil Mitchell wrote: > Hi > >> {-# OPTIONS -fglasgow-exts #-} >> module Blog.Types where >> import Data.Typeable >> import Data.Generics >> >> data BlogEntry = Entry EpochSeconds Name Email Title Body >> deriving (Eq,Ord,Read,Show,Typeable) >> >> newtype Name = Name String deriving (Eq,Ord,Read,Show,Typeable) >> newtype Title = Title String deriving (Eq,Ord,Read,Show,Typeable) >> newtype Body = Body String deriving (Eq,Ord,Read,Show,Typeable) > > First off, never use OPTIONS, use OPTIONS_GHC instead. OPTIONS is the > old way of doing it. > > Secondly, if you add {-# OPTIONS_DERIVE > --derive=Eq,Ord,Read,Show,Typeable #-} then running your code through > with Derive should give you the magic that you require. Plus it will > also work on Hugs, and not require your OPTIONS_GHC anyway. > > Derive: http://www-users.cs.york.ac.uk/~ndm/derive/ > > Thanks > > Neil From dons at cse.unsw.edu.au Wed May 23 03:01:28 2007 From: dons at cse.unsw.edu.au (Donald Bruce Stewart) Date: Wed May 23 02:57:46 2007 Subject: [Haskell] New book: Real-World Haskell! Message-ID: <20070523070128.GG31760@cse.unsw.EDU.AU> Bryan O'Sullivan, Don Stewart and John Goerzen are pleased, and frankly, very excited to announce that were developing a new book for O'Reilly, on practical Haskell programming. The working title is Real-World Haskell. The plan is to cover the major techniques used to write serious, real-world Haskell code, so that programmers can just get to work in the language. By the end of the book readers should be able to write real libraries and applications in Haskell, and be able to: * design data structures * know how to write, and when to use, monads and monad transformers * use Haskells concurrency and parallelism abstractions * be able to write parsers for custom formats in Parsec. * be able to do IO and binary IO of all forms * be able to bind Haskell to foreign functions in C * be able to do database, network and gui programming * know how to do exception and error handling in Haskell * have a good knowledge of the core libraries * be able to use the type system to track and prevent errors * take advantage of tools like QuickCheck, Cabal and Haddock * understand advanced parts of the language, such as GADTs and MPTCs. That is, you should be able to just write Haskell! The existing handful of books about Haskell are all aimed at teaching programming to early undergraduate audiences, so they are ill-suited to people who already know how to code. And while theres a huge body of introductory material available on the web, you have to be both tremendously motivated and skilled to find the good stuff and apply it to your own learning needs. The time has come for the advanced, practical Haskell book. Heres the proposed chapter outline: 1. Why functional programming? Why Haskell? 2. Getting started: compiler, interpreter, values, simple functions, and types 3. Syntax, type system basics, type class basics 4. Write a real library: the rope data structure, cabal, building projects 5. Typeclasses and their use 6. Bringing it all together: file name matching and regular expressions 7. All about I/O 8. I/O case study: a DSL for searching the filesystem 9. Code case study: barcode recognition 10. Testing the Haskell way: QuickCheck 11. Handling binary files and formats 12. Designing and using data structures 13. Monads 14. Monad case study: refactoring the filesystem seacher 15. Monad transformers 16. Using parsec: parsing a bioinformatics format 17. Interfacing with C: the FFI 18. Error handling 19. Haskell for systems programming 20. Talking to databases: Data.Typeable 21. Web client programming: client/server networking 22. GUI programming: gtk2hs 23. Data mining and web applications 24. Basics of concurrent and parallel Haskell 25. Advanced concurrent and parallel programming 26. Concurrency case study: a lockless database with STM 27. Performance and efficiency: profiling 28. Advanced Haskell: MPTCs, TH, strong typing, GADTs 29. Appendices We're seeking technical reviewers from both inside and outside the Haskell community, to help review and improve the content, with the intent that this text will become the standard reference for those seeking to learn serious Haskell. If you'd like to be a reviewer, please drop us a line at book-review-interest@realworldhaskell.org, and let us know a little about your background and areas of interest. Finally, a very exciting aspect of this project is that O'Reilly has agreed to publish chapters online, under a Creative Commons License! Well be publishing chapters incrementally, and seeking feedback from our reviewers and readers as we go. You can find more details and updates at the following locations: * The web site, http://www.realworldhaskell.org/blog/welcome/ * The authors, http://www.realworldhaskell.org/blog/about/ * The blog, http://www.realworldhaskell.org/blog/ -- Bryan O'Sullivan, Don Stewart and John Goerzen. From gmh at Cs.Nott.AC.UK Wed May 23 03:01:11 2007 From: gmh at Cs.Nott.AC.UK (Graham Hutton) Date: Wed May 23 02:58:17 2007 Subject: [Haskell] PhD Studentship in Functional Programming Message-ID: <3614.1179903671@cs.nott.ac.uk> ---------------------------------------------------------------------+ PHD STUDENTSHIP IN FUNCTIONAL PROGRAMMING School of Computer Science and IT University of Nottingham, UK Applications are invited for a fully-funded PhD studentship on the EPSRC project "Reasoning About Exceptions and Interrupts", starting on 1st October 2007 for a period of three years. Most modern programming languages provide special features for detecting and managing unexpected events, in the form of exception and interrupt handling primitives. Despite their importance, the issue of provable correctness for programs involving these features has received little attention, but is particularly crucial given the difficulty of writing correct programs in this setting. The aim of this project is to address this problem within the context of a modern functional programming language such as Haskell and Epigram. Applicants for this position will require a first-class Honours degree (or equivalent) in Computer Science and/or Mathematics, some experience in functional programming, and an aptitude for mathematical subjects. Additional desirable attributes include a higher degree (e.g. Masters), and/or some experience in formal semantics, program verification, concurrency theory, or theorem provers. The successful applicant will work under the supervision of Dr Graham Hutton in the Foundations of Programming group in Nottingham, a leading centre for research on formal approaches to software construction and verification. The group currently comprises 7 academic staff, 5 research staff, and 13 PhD students. The position is open to UK and EU applicants, but particularly strong candidates from outside the EU may also be considered, subject to additional funding being available. Further details regarding the position and how to apply are available from Dr Graham Hutton, http://www.cs.nott.ac.uk/~gmh. Closing date for applications: 15th June 2007 +--------------------------------------------------------------------+ | Dr Graham Hutton Email : gmh@cs.nott.ac.uk | | School of Computer Science and IT | | University of Nottingham Web : www.cs.nott.ac.uk/~gmh | | Jubilee Campus, Wollaton Road | | Nottingham NG8 1BB, UK Phone : +44 (0)115 951 4220 | +--------------------------------------------------------------------+ This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. From list at atmarama.org Wed May 23 04:07:29 2007 From: list at atmarama.org (Gour) Date: Wed May 23 04:03:59 2007 Subject: [Haskell] Re: [Haskell-cafe] New book: Real-World Haskell! In-Reply-To: <20070523070128.GG31760@cse.unsw.EDU.AU> References: <20070523070128.GG31760@cse.unsw.EDU.AU> Message-ID: <20070523100729.058604ae@gaura-nitai.dyndns.org> On Wed, 23 May 2007 17:01:28 +1000 dons@cse.unsw.edu.au (Donald Bruce Stewart) wrote: Hi! Congratualtions for your effort? > Bryan O'Sullivan, Don Stewart and John Goerzen are pleased, and > frankly, very excited to announce that were developing a new book for > O'Reilly, on practical Haskell programming. The working title is > Real-World Haskell. Anticipating great demand for the book and the fact I like to hold dead-tree version in my hands, I'm interested whether one can pre-order the book? I'd not like to miss a copy ;) Sincerely, Gour -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://www.haskell.org/pipermail/haskell/attachments/20070523/7cbafa02/signature.bin From alex at alexjacobson.com Wed May 23 16:51:50 2007 From: alex at alexjacobson.com (Alex Jacobson) Date: Wed May 23 16:48:23 2007 Subject: [Haskell] boilerplate boilerplate In-Reply-To: <026001c79ccd$7c57dc30$3b038351@cr3lt> References: <465377AE.1000501@alexjacobson.com> <46537C35.5020603@charter.net> <026001c79ccd$7c57dc30$3b038351@cr3lt> Message-ID: <4654A966.9070107@alexjacobson.com> Actually independent deriving would help a lot but am not sure of the syntax. could it be something like derive (Ord,Eq,Read,Show,Typeable) (BlogEntry Name Title Body Emai) Perhaps this is what Neil Mitchell was suggesting with Derive that I was not understanding. If I can use derive like this without a pre-processor that would be very nice. -Alex- Claus Reinke wrote: >> (For your second, desired code sample, I have a feeling this is where >> DrIFT or Data.Derive are going to come in... I'm not going to mention >> those external things!) > > it wouldn't help to get rid of deriving, but perhaps the new > 'standalone deriving' might help to separate out all that deriving > stuff, keeping the data type definitions themselves less cluttered? > > http://hackage.haskell.org/trac/ghc/wiki/Status/October06 > > claus > > ps why the odd mailing list address? From ndmitchell at gmail.com Wed May 23 17:02:03 2007 From: ndmitchell at gmail.com (Neil Mitchell) Date: Wed May 23 16:58:15 2007 Subject: [Haskell] boilerplate boilerplate In-Reply-To: <4654A966.9070107@alexjacobson.com> References: <465377AE.1000501@alexjacobson.com> <46537C35.5020603@charter.net> <026001c79ccd$7c57dc30$3b038351@cr3lt> <4654A966.9070107@alexjacobson.com> Message-ID: <404396ef0705231402u15ff1784j5f41f830fd3ba0ee@mail.gmail.com> :: Follow ups to haskell-cafe@ is probably best Hi Alex, {-# OPTIONS_DERIVE --derive=Ord,Eq,Read... #-} That would apply to all definitions in the module, so you don't have to repeat it for each type. You can attach a deriving annotation to each type individually, but that's obviously not what you want. > Actually independent deriving would help a lot but am not sure of the > syntax. > > could it be something like > > derive (Ord,Eq,Read,Show,Typeable) (BlogEntry Name Title Body Emai) We can already do: $( derive makeOrd ''Name ) Which doesn't require a preprocessor on GHC, using template haskell. I guess the following may work in Template Haskell: $( [derive typ cls | typ <- [makeOrd, makeEq, makeRead, makeShow], typ <- [''BlogEntry, ''Name ...] ) But ask a TH expert for the details! Thanks Neil From claus.reinke at talk21.com Wed May 23 19:18:33 2007 From: claus.reinke at talk21.com (Claus Reinke) Date: Wed May 23 19:14:45 2007 Subject: [Haskell] boilerplate boilerplate References: <465377AE.1000501@alexjacobson.com> <46537C35.5020603@charter.net><026001c79ccd$7c57dc30$3b038351@cr3lt> <4654A966.9070107@alexjacobson.com> Message-ID: <01ed01c79d90$b034f2e0$541a7ad5@cr3lt> > Actually independent deriving would help a lot but am not sure of the > syntax. > > could it be something like > > derive (Ord,Eq,Read,Show,Typeable) (BlogEntry Name Title Body Emai) according to the most recent status report, the syntax is not quite settled yet, so what is in ghc head might still change. more info here: http://haskell.org/haskellwiki/GHC/StandAloneDeriving > Perhaps this is what Neil Mitchell was suggesting with Derive that I was > not understanding. If I can use derive like this without a > pre-processor that would be very nice. there are various different methods to help with deriving. i think Neil was referring to Data.Derive: http://www-users.cs.york.ac.uk/~ndm/derive/ claus From isaacdupree at charter.net Thu May 24 15:56:21 2007 From: isaacdupree at charter.net (Isaac Dupree) Date: Thu May 24 15:51:15 2007 Subject: [Haskell] New book: Real-World Haskell! In-Reply-To: <20070523070128.GG31760@cse.unsw.EDU.AU> References: <20070523070128.GG31760@cse.unsw.EDU.AU> Message-ID: <4655EDE5.1030507@charter.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Donald Bruce Stewart wrote: > Finally, a very exciting aspect of this project is that O'Reilly has > agreed to publish chapters online, under a Creative Commons License! Neat! "Which one?" (see e.g. Creative Commons in http://www.gnu.org/philosophy/license-list.html#OtherLicenses , http://en.wikipedia.org/wiki/Creative_Commons_licenses ) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGVe3kHgcxvIWYTTURAhDQAJ4oJteAFibZuvjSSh06HAALR2HgxwCeJcqp /nRWFsPKLqh0IQRD72h3Uus= =3Sry -----END PGP SIGNATURE----- From O.Chitil at kent.ac.uk Fri May 25 07:04:07 2007 From: O.Chitil at kent.ac.uk (Olaf Chitil) Date: Fri May 25 07:00:31 2007 Subject: [Haskell] IFL 2007: Symposium on Implementation and Application of Functional Languages Message-ID: <4656C2A7.5080808@kent.ac.uk> ********************************************************************** Announcement and Call for Papers for the 19th International Symposium on Implementation and Application of Functional Languages IFL 2007 27th-29th September 2007, Freiburg, Germany co-located with ICFP 2007 http://proglang.informatik.uni-freiburg.de/IFL2007/ ********************************************************************** The aim of the IFL symposium is to bring together researchers actively engaged in the implementation and application of functional and function-based programming languages. The symposium provides an open forum for researchers who wish to present and discuss new ideas and concepts, work in progress, preliminary results, etc. related primarily but not exclusively to the implementation and application of functional languages. Topics of interest include (but are not limited to): * language concepts * type checking * compilation techniques * (abstract) interpretation * generic programming techniques * automatic program generation * array processing * concurrent/parallel programming * concurrent/parallel program execution * heap management * runtime profiling * performance measurements * debugging and tracing * (abstract) machine architectures * verification * formal aspects * tools and programming techniques Papers on applications or tools demonstrating the suitability of novel ideas in any of the above areas and contributions on related theoretical work are also welcome. The change of the symposium name adding the term "application", introduced in 2004, reflects the broader scope IFL has gained over the years. Contributions Prospective authors are encouraged to submit papers to be published in the draft proceedings and present them at the symposium. All contributions must be written in English, conform to the Springer-Verlag LNCS series format and not exceed 16 pages. The draft proceedings will appear as a technical report. Every attendee of IFL 2007 will have the opportunity to submit a revised version of their paper for post-symposium reviewing. As in previous years, selected papers will be published by Springer Verlag in the Lecture Notes in Computer Science (LNCS) Series. Important Dates Submission for Draft Proceedings 31 August 2007 Early Registration Deadline 1 September 2007 Symposium 27-29 September 2007 Submission for post-refereeing 2 November 2007 Notification of acceptance / rejection 14 December 2007 Submission of camera-ready version 25 January 2008 Programme Committee Peter Achten Radboud University Nijmegen, The Netherlands Kenichi Asai Ochanomizu University, Japan Manuel Chakravarty The University of New South Wales, Australia Olaf Chitil (chair) University of Kent, UK Martin Erwig Oregon State University, Oregon, USA Marc Feeley Universit? de Montr?al, Canada Martin Gasbichler Z?hlke Engineering AG, Switzerland Kevin Hammond University of St. Andrews, Scotland Zolt?n Horv?th E?tv?s Lor?nd University, Budapest, Hungary John Hughes Chalmers University of Technology, Sweden Ken Friis Larsen University of Copenhagen, Denmark Rita Loogen Philipps-Universit?t Marburg, Germany Michel Mauny ENSTA, France Sven-Bodo Scholz University of Hertfordshire, UK Clara Segura Universidad Complutense de Madrid, Spain Tim Sheard Portland State University, Oregon, USA Glenn Strong Trinity College, Dublin, Ireland Doaitse Swierstra Utrecht University, The Netherlands Malcolm Wallace The University of York, UK Local Organisation Markus Degen Universit?t Freiburg, Germany Peter Thiemann Universit?t Freiburg, Germany Stefan Wehr Universit?t Freiburg, Germany Further Information http://proglang.informatik.uni-freiburg.de/IFL2007/ From weel at ugcs.caltech.edu Fri May 25 11:47:35 2007 From: weel at ugcs.caltech.edu (Jaap Weel) Date: Fri May 25 11:47:51 2007 Subject: [Haskell] Piffle, a Packet Filter Language Message-ID: <200705251747.36922.weel@ugcs.caltech.edu> I have written a compiler for a packet filter language in Haskell. I think this is a good example of how Haskell can be used in an application domain (low level computer networking) where people tend to use C for everything, including writing compilers. The language itself is not very fancy, from a Haskell programmer's point of view, but maybe you will still find this worth having at least a glance at. This is a very early release. Expect it to blow up in your face, or, more likely, fail to compile. Please report bugs. Thanks. /jaap --------------------------------------------------------------------------- PIFFLE, A PACKET FILTER LANGUAGE http://code.google.com/p/piffle What is Piffle? * "Piffle" is a pronounceable form of PFL, that is, Packet Filter Language. ("Piffle" is also an obscure word for "chatter".) * Piffle is a programming language for writing network packet filters. * The Piffle compiler accepts resource limits on the processor time and memory used for processing each packet of input; simply pass the -C or -M option, and it will check at compile time that your program cannot not exceed the limits you specify. * Piffle is easy to learn, because it is built around the familiar abstractions of procedural languages such as C and Pascal. * Piffle programs can be compiled with interchangeable back-ends called "boilerplates". The pcap boilerplate, which comes with the Piffle compiler, allows Piffle programs to read and write pcap/tcpdump dump files, to read packets from network devices, and to preprocess packets with Berkeley Packet Filters. You can write your own boilerplates to talk to other network monitoring interfaces, such as tun/tap. * Piffle runs on GNU/Linux systems, and is designed to be portable to other POSIX-compliant systems that run the GNU C Compiler gcc and the Glasgow Haskell Compiler ghc. * Hopefully, Piffle will in the future become available as an operation in Streamline, an advanced network monitoring framework, formerly known as FFPF, the fairly fast packet filter. Streamline is being developed at the VU Amsterdam Computer Systems Section. Within Streamline, Piffle will coexist with Ruler, a regular-expression based packet rewriting language. The author Piffle was designed and implemented by Jaap Weel as part of the Compiler Construction Practical course at the VU Amsterdam CS department. Read the code Feel free to have a look at the source and do with it as you please (within the bounds of the GPL, of course). Download the code For the most recent tarball release, which may still be broken, check the downloads page. For the latest (and even more possibly broken) version of Piffle, you will have to use subversion. Read the documentation Be sure to have a look at the latest published version of the manual. Contribute I would very much appreciate if people could try to compile and run Piffle (in particular make test) on their own machines, and report any problems on the issues page or by e-mail. Get in touch with the author You can contact the author at weel at ugcs dot caltech dot edu , or visit his web site at http://www.ugcs.caltech.edu/~weel. From waldmann at imn.htwk-leipzig.de Fri May 25 13:56:59 2007 From: waldmann at imn.htwk-leipzig.de (Johannes Waldmann) Date: Fri May 25 13:53:04 2007 Subject: [Haskell] Haskell Meeting in Leipzig, Germany, July 10th Message-ID: <4657236B.7030300@imn.htwk-leipzig.de> The second HAL (Haskell in Leipzig) meeting: Tuesday, July 10th. Including the release party for the Cohatoe project (= contributing Haskell to Eclipse), presented by author Leif Frenzel. More info, registration: http://www.iba-cg.de/haskell.html Looking forward to seeing you (again), Alf Richter, iba consulting; and Johannes Waldmann, HTWK Leipzig. From ndmitchell at gmail.com Sun May 27 17:59:46 2007 From: ndmitchell at gmail.com (Neil Mitchell) Date: Sun May 27 17:55:43 2007 Subject: [Haskell] ANN: Data.Derive 0.1 Message-ID: <404396ef0705271459y2e55c2fck9abd1037ce012447@mail.gmail.com> Hi I am pleased to announce Data.Derive. Webpage: http://www-users.cs.york.ac.uk/~ndm/derive/ Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/derive-0.1 Manual: http://www.cs.york.ac.uk/fp/darcs/derive/derive.htm >From the Manual: "Data.Derive is a library and a tool for deriving instances for Haskell programs. It is designed to work with custom derivations, SYB and Template Haskell mechanisms. The tool requires GHC, but the generated code is portable to all compilers. We see this tool as a competitor to DrIFT." To take a very small example, imagine you define your data structure: data Foo = ... Now you can derive instances using derive with --derive=Eq,Data,Serial etc. You can also use deriving ({-! Typeable, Show !-}) and $( derive makeEq ''Foo ). Advantages over DrIFT: * No need for a preprocessor with GHC * Easy to add new derivations outside of the library * Can often automatically infer instances from examples (see the manual) * A different set of instance derivations Thanks Neil (Co-authored with Stefan O'Rear, thanks to many others for code contributions!) From g9ks157k at acme.softbase.org Mon May 28 11:41:18 2007 From: g9ks157k at acme.softbase.org (Wolfgang Jeltsch) Date: Mon May 28 11:37:14 2007 Subject: [Haskell] ambiguous record field names which actually =?utf-8?q?aren?= =?utf-8?b?4oCZdA==?= ambigious Message-ID: <200705281741.18938.g9ks157k@acme.softbase.org> Hello, I have the following modules: module A where data A = A { label :: Int } module B where data B = B { label :: Int } b :: B b = B { label = 0 } x :: B -> () x B { label = 0 } = () GHC reports an ambiguity for both usages of label. However, it should be clear that both usages can only refer to B.label since a field name in record syntax can only be one that is defined in the same module as the corresponding record type. Hugs accepts the above code. Is there a way to make GHC accept it too? Best wishes, Wolfgang From g9ks157k at acme.softbase.org Mon May 28 14:19:17 2007 From: g9ks157k at acme.softbase.org (Wolfgang Jeltsch) Date: Mon May 28 14:15:12 2007 Subject: [Haskell] ambiguous record field names which actually =?utf-8?q?aren=E2=80=99t?= ambigious In-Reply-To: <200705281741.18938.g9ks157k@acme.softbase.org> References: <200705281741.18938.g9ks157k@acme.softbase.org> Message-ID: <200705282019.17684.g9ks157k@acme.softbase.org> Am Montag, 28. Mai 2007 17:41 schrieb Wolfgang Jeltsch: > Hello, > > I have the following modules: > > module A where > data A = A { label :: Int } > > module B where > data B = B { label :: Int } > > b :: B > b = B { label = 0 } > > x :: B -> () > x B { label = 0 } = () Oops, the indentation of the declarations of b and x was too small. Both b and x are meant to be defined in module B. > [?] Best wishes, Wolfgang From jim at sdf-eu.org Tue May 29 06:05:59 2007 From: jim at sdf-eu.org (Jim Burton) Date: Tue May 29 06:01:49 2007 Subject: [Haskell] Doubt about recursive functions In-Reply-To: <10846647.post@talk.nabble.com> References: <10846647.post@talk.nabble.com> Message-ID: <10851169.post@talk.nabble.com> Eduardo01 wrote: > > Hi! First, nice to meet you guys. > My name's Eduardo(or call me Edward, easier for you). > Hi Eduardo, > I'm brazilian and computation science student. > I'm at first period and the main language i'm learning is Haskell and i > will learn C 'till the end of this period. > Great! Please use the haskell-cafe mailing list for these kind of questions, this one is used more for announcements and that sort of thing. > So, as the title suggest, my doubt about haskell is on recursive > functions, especifically where you have two arguments. Like this: > > Build a function that sum all the even numbers between the interval of n > and k, where n < k. > > I was doing this: > > somapar :: Int -> Int -> Int > somapar n k = if even n && even k > then somapar (n+1) (k-1) + n + k > else if even n && not(even k) > then somapar (n+1) (k-1) + n > else if not (even n) && even k > then somapar (n+1) (k-1) + k > else somapar (n+1) (k-1) > > I checked this out and think that is allright, but I don't have the stop > condition. So when i execute it, the function falls into an infinite loop. > The other thing is that I think that there are a lot of "ifs" in the > function, tell me if i could remove some of them. > You're right, somapar never returns a value -- at what point do you think it should? Try to work it out on pencil and paper for some small values. How do you keep track of what the current sum is? Also, check out some Haskell list functions, if you're allowed to use them for this -> http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html . You can do away with the "ifs" with guards like f x | x > 0 = 1 | otherwise = 0 > > Well, that's it. Sorry by the so so english and thank you. > -- View this message in context: http://www.nabble.com/Doubt-about-recursive-functions-tf3831290.html#a10851169 Sent from the Haskell - Haskell mailing list archive at Nabble.com. From federico.squartini at googlemail.com Wed May 30 04:54:35 2007 From: federico.squartini at googlemail.com (Federico Squartini) Date: Wed May 30 04:50:22 2007 Subject: [Haskell] ST vs State Message-ID: <197499360705300154o1d80e880w3ea531efd3f499f0@mail.gmail.com> Hello dear Haskellers, Could someone be kind and explain with some detail what are the differences between the two monads: Control.Monad.ST And Control.Monad.State ? They are both meant to model stateful computation but they are not the same monad. The first one represents state with in place update? Regards, Federico From dons at cse.unsw.edu.au Wed May 30 05:01:51 2007 From: dons at cse.unsw.edu.au (Donald Bruce Stewart) Date: Wed May 30 04:57:41 2007 Subject: [Haskell] ST vs State In-Reply-To: <197499360705300154o1d80e880w3ea531efd3f499f0@mail.gmail.com> References: <197499360705300154o1d80e880w3ea531efd3f499f0@mail.gmail.com> Message-ID: <20070530090150.GD25170@cse.unsw.EDU.AU> federico.squartini: > Hello dear Haskellers, > > Could someone be kind and explain with some detail what are the > differences between the two monads: > > Control.Monad.ST > And > Control.Monad.State > ? > > They are both meant to model stateful computation but they are not the > same monad. The first one represents state with in place update? > Very very different. The former is for filling memory blocks in a pure manner, the latter models threaded state. -- Don From federico.squartini at googlemail.com Wed May 30 05:59:55 2007 From: federico.squartini at googlemail.com (Federico Squartini) Date: Wed May 30 05:55:46 2007 Subject: [Haskell] ST vs State In-Reply-To: <20070530090150.GD25170@cse.unsw.EDU.AU> References: <197499360705300154o1d80e880w3ea531efd3f499f0@mail.gmail.com> <20070530090150.GD25170@cse.unsw.EDU.AU> Message-ID: <197499360705300259l73c9e670vcee05372004a0428@mail.gmail.com> But they are very similar! At least superficially. They are both based on the notion of state transformer. Moreover in the original paper about the ST monad: http://www.dcs.gla.ac.uk/fp/papers/lazy-functional-state-threads.ps.Z The authors say: "In this paper we describe a way to express stateful algorithms in non-strict, purely functional languages". And almost everywhere in the paper looks as if they are talking about a normal State monad. I suppose there is something "under the hood" which makes them different, but I cannot figure out what. Federico > Very very different. > > -- Don > From joelkoerwer at gmail.com Wed May 30 07:18:53 2007 From: joelkoerwer at gmail.com (Joel Koerwer) Date: Wed May 30 07:14:39 2007 Subject: [Haskell] ST vs State In-Reply-To: <197499360705300259l73c9e670vcee05372004a0428@mail.gmail.com> References: <197499360705300154o1d80e880w3ea531efd3f499f0@mail.gmail.com> <20070530090150.GD25170@cse.unsw.EDU.AU> <197499360705300259l73c9e670vcee05372004a0428@mail.gmail.com> Message-ID: <34e5cfb80705300418l5ca82febq1f4e4ae1caf5dbce@mail.gmail.com> Hi Frederico, I had the exact same problem when I first started with Haskell. Quite simply, State uses get/put to handle passing state, whereas ST uses STRefs and STArrays. In State s a, the s has meaning, for example it could be a random number generator or key-value mapping you want to pass around. However in ST s a, the s only exists in the type. The actual state is stored in references and arrays. Perhaps someone more knowledgeable should add something to the Haddock comments; I think this confuses a lot of people at first. Joel From allbery at ece.cmu.edu Wed May 30 08:09:04 2007 From: allbery at ece.cmu.edu (Brandon S. Allbery KF8NH) Date: Wed May 30 08:04:53 2007 Subject: [Haskell] ST vs State In-Reply-To: <197499360705300259l73c9e670vcee05372004a0428@mail.gmail.com> References: <197499360705300154o1d80e880w3ea531efd3f499f0@mail.gmail.com> <20070530090150.GD25170@cse.unsw.EDU.AU> <197499360705300259l73c9e670vcee05372004a0428@mail.gmail.com> Message-ID: <5CF1B532-A3A1-4F2C-BC9A-518013E1CE04@ece.cmu.edu> On May 30, 2007, at 5:59 , Federico Squartini wrote: > I suppose there is something "under the hood" which makes them > different, but I cannot figure out what. For one thing, ST uses existential types to prevent values from leaking outside the monad. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH From mfn-haskell at cs.york.ac.uk Wed May 30 11:29:03 2007 From: mfn-haskell at cs.york.ac.uk (Matthew Naylor) Date: Wed May 30 11:29:08 2007 Subject: [Haskell] ANNOUNCE: The Reduceron Message-ID: <20070530152903.GA16973@pc149.cs.york.ac.uk> Dear Haskellers, You may be interested in the Reduceron: http://www-users.cs.york.ac.uk/~mfn/reduceron/index.html Here is a flavour: "The Reduceron is a processor for executing Haskell programs on FPGA with the aim of exploring how custom architectural features can improve the speed in which Haskell functions are evaluated. Being described entirely in Haskell (using Lava), the Reduceron also serves as an interesting application of functional languages to the design of complex control circuits such as processors. To program the Reduceron we provide a basic Haskell compiler, called Tred, that translates Yhc.Core programs into codes of the Reduceron's instruction set. The Tred compiler and Reduceron processor are in the early stages of development: they are both fairly naive, inefficient, and lacking in many important features. But they represent a good start, already capable of correctly compiling and executing (on FPGA) a reasonable range of Haskell programs." See webpage for more details. Matthew. From hcar at haskell.org Wed May 30 15:32:28 2007 From: hcar at haskell.org (Andres Loeh) Date: Wed May 30 15:26:01 2007 Subject: [Haskell] ANNOUNCE: Haskell Communities & Activities Report (12th ed., May 2007) Message-ID: <20070530193228.GL26272@iai.uni-bonn.de> On behalf of the many, many contributors, I am pleased to announce that the Haskell Communities and Activities Report (12th edition, May 2007) http://www.haskell.org/communities/ is now available from the Haskell Communities home page in several PDF and HTML formats. Many thanks go to all the people that contributed to this report, both directly, by sending in descriptions, and indirectly, by doing all the interesting things that are reported. I hope you will find it as interesting a read as we did. If you haven't encountered the Haskell Communities and Activities Reports before, you may like to know that the first of these reports was published in November 2001. Their goal is to improve the communication between the increasingly diverse groups, projects and individuals working on, with, or inspired by Haskell. The idea behind these reports is simple: Every six months, a call goes out to all of you enjoying Haskell to contribute brief summaries of your own area of work. Many of you respond (eagerly, unprompted, and well in time for the actual deadline ;) ) to the call. The editor collects all the contributions into a single report and feeds that back to the community. When we try for the next update, six months from now, you might want to report on your own work, project, research area or group as well. So, please put the following into your diaries now: ---------------------------------------- End of October 2007: target deadline for contributions to the November 2007 edition of the HC&A Report ---------------------------------------- Unfortunately, many Haskellers working on interesting projects are so busy with their work that they seem to have lost the time to follow the Haskell related mailing lists and newsgroups, and have trouble even finding time to report on their work. If you are a member, user or friend of a project so burdened, please find someone willing to make time to report and ask them to `register' with the editor for a simple e-mail reminder in the middle of April (you could point me to them as well, and we can then politely ask if they want to contribute, but it might work better if you do the initial asking). Of course, they will still have to find the ten to fifteen minutes to draw up their report, but maybe we can increase our coverage of all that is going on in the community. Feel free to circulate this announcement further in order to reach people who might otherwise not see it. Enjoy! Andres Loeh -- Haskell Communities and Activities Report (http://haskell.org/communities) From dons at cse.unsw.edu.au Wed May 30 20:26:17 2007 From: dons at cse.unsw.edu.au (Donald Bruce Stewart) Date: Wed May 30 20:22:11 2007 Subject: [Haskell] ANNOUNCE: The Reduceron In-Reply-To: <20070530152903.GA16973@pc149.cs.york.ac.uk> References: <20070530152903.GA16973@pc149.cs.york.ac.uk> Message-ID: <20070531002617.GA25344@cse.unsw.EDU.AU> mfn-haskell: > Dear Haskellers, > > You may be interested in the Reduceron: > > http://www-users.cs.york.ac.uk/~mfn/reduceron/index.html > > Here is a flavour: > > "The Reduceron is a processor for executing Haskell programs on FPGA > with the aim of exploring how custom architectural features can > improve the speed in which Haskell functions are evaluated. Being > described entirely in Haskell (using Lava), the Reduceron also serves > as an interesting application of functional languages to the design of > complex control circuits such as processors. Wow! Great work. -- Don From sjanssen at cse.unl.edu Wed May 30 21:45:28 2007 From: sjanssen at cse.unl.edu (Spencer Janssen) Date: Wed May 30 21:41:45 2007 Subject: [Haskell] ANNOUNCE: xmonad 0.2 Message-ID: <20070530204528.2873569b@localhost> The xmonad dev team is pleased to announce the 0.2 release of: xmonad: a tiling window manager http://xmonad.org About: Xmonad is a tiling window manager for X. Windows are arranged automatically to tile the screen without gaps or overlap, maximising screen use. All features of the window manager are accessible from the keyboard: a mouse is strictly optional, greatly increasing productivity in X. Xmonad is written and extensible in Haskell, and custom layout algorithms, and other extesions, may be implemented by the user in config files. Layouts may be applied dynamically, and separate layouts can be used on each workspace. A guiding principle of the user interface is predictability: users should know in advance precisely the window arrangement that will result from any action, leading to an intuitive user interface. Features: * Automatic window tiling and management * First class keyboard support: a mouse is unnecessary * Full multihead/Xinerama support * XRandR support to rotate, add or remove monitors * Per-workspace layout algorithms * Per-screen non-built in status bars, with arbitrary geometry * Dynamic restart/reconfigure preserving workspace state * Tiny code base (~500 lines of Haskell) * Fast, small and simple. No interpreters, no heavy extension languages Since 0.1, the following notable features and bug fixes have appeared: New features: * XRandR support, for dynamically adding, removing or rotating monitors * State-preserving dynamic restart * Popup, customisable status bar support * Multiple clients may appear in the master pane * mod-shift-j/k, to swap windows with their neighbours * mod-n, to resize windows * User-specified layout algorithms may be written in config files * All layouts may be 'mirrored' (rotated) * configurable window border size and colour Design changes: * Reimplemented core of xmonad with a 'zipper' data type to track focus by construction. We believe this is a first. * Use of Neil Mitchell's 'catch' program to verify pattern match safety * Use of ReaderT and StateT to partition read-only and modifiable values * Custom layout messages handled with open data type simulation * More QuickCheck properties Bug fixes: * numlock handling is fixed More information, screenshots, documentation and community resources are available from: http://xmonad.org Xmonad is available from hackage, and via darcs. Happy hacking! The Xmonad Team: Spencer Janssen Don Stewart Jason Creighton Xmonad has also received patches from: Alec Berryman Chris Mears Daniel Wagner David Glasser David Lazar David Roundy Joe Thornber Miikka Koskinen Neil Mitchell Nick Burlett Robert Marlow Sam Hughes Shae Erisson From zednenem at psualum.com Thu May 31 00:54:40 2007 From: zednenem at psualum.com (David Menendez) Date: Thu May 31 00:50:27 2007 Subject: [Haskell] ST vs State In-Reply-To: <197499360705300154o1d80e880w3ea531efd3f499f0@mail.gmail.com> Message-ID: Federico Squartini writes: > Hello dear Haskellers, > > Could someone be kind and explain with some detail what are the > differences between the two monads: > > Control.Monad.ST > And > Control.Monad.State > ? > > They are both meant to model stateful computation but they are not the > same monad. The first one represents state with in place update? Conceptually, the difference is in the API. State can be thought of as an ST with a single, implicit reference cell. Alternately, ST can be thought of as a State which manipulates a store of values. Here's a simple implementation of State using ST: newtype State s a = State { unState :: forall r. ReaderT (STRef r s) (ST r) a } runState :: State s a -> s -> (a,s) runState m s0 = runST (do r <- newSTRef s0 a <- runReaderT (unState m) r s <- readSTRef r return (a,s)) instance Monad (State s) where return a = State (return a) m >>= f = State (unState m >>= unState . f) instance MonadState s (State s) where get = State (ask >>= lift . readSTRef) put x = State (ask >>= \s -> lift (writeSTRef s x)) It's also possible to write ST in terms of State. Assume we have a Store ADT with this interface: data Store r data STRef r a withStore :: (forall r. Store r -> a) -> a newRef :: a -> Store r -> (STRef r a, Store r) readRef :: STRef r a -> Store r -> a writeRef :: STRef r a -> a -> Store r -> Store r (The 'r' parameter is to make sure that references are only used with the Store that created them. The signature of withStore effectively gives every Store a unique value for r.) Then we can define ST like so: newtype ST r a = ST { unST :: State (Store r) a } deriving Monad runST :: (forall r. ST r a) -> a runST m = withStore (evalState (unST m)) newSTRef :: a -> ST r (STRef r a) newSTRef a = ST $ do s <- get let (r,s') = newRef a s put s' return r readSTRef :: STRef r a -> ST r a readSTRef r = ST $ gets (readRef r) writeSTRef :: STRef r a -> a -> ST r () writeSTRef r a = ST $ modify (writeRef r a) There are two subtleties. The first is that you can't implement Store without cheating at some level (e.g., unsafeCoerce). The second is that the real ST implementation uses in-place update, which is only safe because the Store is implicit and used single-threadedly. -- David Menendez | "In this house, we obey the laws | of thermodynamics!" From zednenem at psualum.com Thu May 31 01:29:37 2007 From: zednenem at psualum.com (David Menendez) Date: Thu May 31 01:25:23 2007 Subject: [Haskell] ST vs State In-Reply-To: Message-ID: David Menendez writes: > It's also possible to write ST in terms of State. > > Assume we have a Store ADT with this interface: > > data Store r > data STRef r a > withStore :: (forall r. Store r -> a) -> a > newRef :: a -> Store r -> (STRef r a, Store r) > readRef :: STRef r a -> Store r -> a > writeRef :: STRef r a -> a -> Store r -> Store r > > (The 'r' parameter is to make sure that references are only used with > the Store that created them. The signature of withStore effectively > gives every Store a unique value for r.) Rats. The rank-2 type isn't enough to guarantee type-safety. You need a monad (or linear types) to make sure that the Store is used single-threadedly. Using the API above, you can defeat the type checker. coerce :: a -> b coerce a = withStore (\s0 -> let (r1,s1) = newRef a s0 (r2,s2) = newRef undefined s0 in readRef r2 s1) (Of course, you would have needed a function like coerce to implement the API in the first place.) -- David Menendez | "In this house, we obey the laws | of thermodynamics!" From g9ks157k at acme.softbase.org Thu May 31 03:59:31 2007 From: g9ks157k at acme.softbase.org (Wolfgang Jeltsch) Date: Thu May 31 03:55:18 2007 Subject: [Haskell] ST vs State In-Reply-To: <5CF1B532-A3A1-4F2C-BC9A-518013E1CE04@ece.cmu.edu> References: <197499360705300154o1d80e880w3ea531efd3f499f0@mail.gmail.com> <197499360705300259l73c9e670vcee05372004a0428@mail.gmail.com> <5CF1B532-A3A1-4F2C-BC9A-518013E1CE04@ece.cmu.edu> Message-ID: <200705310959.31559.g9ks157k@acme.softbase.org> Am Mittwoch, 30. Mai 2007 14:09 schrieb Brandon S. Allbery KF8NH: > On May 30, 2007, at 5:59 , Federico Squartini wrote: > > I suppose there is something "under the hood" which makes them > > different, but I cannot figure out what. > > For one thing, ST uses existential types to prevent values from > leaking outside the monad. ST uses universally-quantified types. Also note that an important difference between State and ST is that State can be implemented in pure Haskell while ST has to be hard-wired into the compiler/interpreter or implemented in Haskell using unsafe features. Best wishes, Wolfgang From simonpj at microsoft.com Thu May 31 04:17:03 2007 From: simonpj at microsoft.com (Simon Peyton-Jones) Date: Thu May 31 04:12:49 2007 Subject: [Haskell] ANNOUNCE: Haskell Communities & Activities Report (12th ed., May 2007) In-Reply-To: <20070530193228.GL26272@iai.uni-bonn.de> References: <20070530193228.GL26272@iai.uni-bonn.de> Message-ID: | On behalf of the many, many contributors, I am pleased to announce | that the | | Haskell Communities and Activities Report | (12th edition, May 2007) | | http://www.haskell.org/communities/ | | is now available from the Haskell Communities home page in several | PDF and HTML formats. And on behalf of the many, many contributors I'd like to thank the one and only Andres for his work in putting the HCAR together. It *is* a lot of work, but the HCAR is terrific glue for the Haskell community. It's always a blast reading about the interesting things everyone else is up to. Thanks, Andres! Simon From taralx at gmail.com Thu May 31 13:02:53 2007 From: taralx at gmail.com (Taral) Date: Thu May 31 12:58:35 2007 Subject: [Haskell] ANNOUNCE: Haskell Communities & Activities Report (12th ed., May 2007) In-Reply-To: References: <20070530193228.GL26272@iai.uni-bonn.de> Message-ID: On 5/31/07, Simon Peyton-Jones wrote: > And on behalf of the many, many contributors I'd like to thank the one and only Andres for his work in putting the HCAR together. It *is* a lot of work, but the HCAR is terrific glue for the Haskell community. It's always a blast reading about the interesting things everyone else is up to. Hear, hear. Thank you very much Andres! -- Taral "Please let me know if there's any further trouble I can give you." -- Unknown From westondan at imageworks.com Thu May 31 13:23:02 2007 From: westondan at imageworks.com (Dan Weston) Date: Thu May 31 13:31:44 2007 Subject: [Haskell] ST vs State In-Reply-To: <200705310959.31559.g9ks157k@acme.softbase.org> References: <197499360705300154o1d80e880w3ea531efd3f499f0@mail.gmail.com> <197499360705300259l73c9e670vcee05372004a0428@mail.gmail.com> <5CF1B532-A3A1-4F2C-BC9A-518013E1CE04@ece.cmu.edu> <200705310959.31559.g9ks157k@acme.softbase.org> Message-ID: <465F0476.6040405@imageworks.com> I thought the types were *existentially* quantified because the constructor arguments were *universally* quantified. Or did I get it backwards? Dan Wolfgang Jeltsch wrote: > Am Mittwoch, 30. Mai 2007 14:09 schrieb Brandon S. Allbery KF8NH: >> On May 30, 2007, at 5:59 , Federico Squartini wrote: >>> I suppose there is something "under the hood" which makes them >>> different, but I cannot figure out what. >> For one thing, ST uses existential types to prevent values from >> leaking outside the monad. > > ST uses universally-quantified types. > > Also note that an important difference between State and ST is that State can > be implemented in pure Haskell while ST has to be hard-wired into the > compiler/interpreter or implemented in Haskell using unsafe features. > > Best wishes, > Wolfgang > _______________________________________________ > Haskell mailing list > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > > From dmhouse at gmail.com Thu May 31 13:47:52 2007 From: dmhouse at gmail.com (David House) Date: Thu May 31 13:43:43 2007 Subject: [Haskell] ST vs State In-Reply-To: <465F0476.6040405@imageworks.com> References: <197499360705300154o1d80e880w3ea531efd3f499f0@mail.gmail.com> <197499360705300259l73c9e670vcee05372004a0428@mail.gmail.com> <5CF1B532-A3A1-4F2C-BC9A-518013E1CE04@ece.cmu.edu> <200705310959.31559.g9ks157k@acme.softbase.org> <465F0476.6040405@imageworks.com> Message-ID: On 31/05/07, Dan Weston wrote: > I thought the types were *existentially* quantified because the > constructor arguments were *universally* quantified. Or did I get it > backwards? That'd be right, if the situation actually involved constructors. I.e., when people talk about existential types, they normally mean: data Foo = forall a. F a Which is isomorphic to: data Foo = F (exists a. a) Hence 'existential'. However, in this instance, it's just the higher-rank polymorphism that makes things work. For further detail, you might want to check out the Wikibook chapter on existentials (yes, it's a stupid place for such an explanation, as I've just realised!), which has a section on ST: http://en.wikibooks.org/wiki/Haskell/Existentially_quantified_types#Example:_runST -- -David House, dmhouse@gmail.com