Re: [Haskell-cafe] STAMP benchmark in Haskell?
Some Haskell-STM benchmarks can be found here: Dissecting Transactional Executions in Haskell Cristian Perfumo et al http://www.cs.rochester.edu/meetings/TRANSACT07/ Martin -Willem Maessen writes: On Mar 1, 2008, at 6:41 PM, Tom Davies wrote: I'm experimenting with STM (in CAL[1] rather than Haskell) and want to run the STAMP[2] benchmarks. Hmm, I don'tknow of a particularly good STM-in-Haskell benchmark, but I'd say that the STAMP benchmarks are written in a rather imperative, object-oriented style. You wouldn't get very meaningful data about anything if you were to naively translate them to Haskell; you'd instead have to rewrite them completely (at which point head-to-head comparisons are difficult). Is there a Haskell translation available, or can anyone suggest a better/different benchmark suite for STM? Good question. Because we tend to eschew mutable state in Haskell, I'd expect the characteristics of such an application to be *very* different. -Jan-Willem Maessen Thanks, Tom [1] http://openquark.org/Open_Quark/Welcome.html [2] http://stamp.stanford.edu/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ICFP08 Final CFP
Final Call for Papers ICFP 2008: International Conference on Functional Programming Victoria, BC, Canada, 22-24 September 2008 http://www.icfpconference.org/icfp2008 Submission deadline: 2 April 2008 ICFP 2008 seeks original papers on the art and science of functional programming. Submissions are invited on all topics from principles to practice, from foundations to features, from abstraction to application. The scope includes all languages that encourage functional programming, including both purely applicative and imperative languages, as well as languages with objects and concurrency. Particular topics of interest include * Applications and Domain-Specific Languages * Foundations * Design * Implementation * Transformation and Analysis * Software-development Techniques * Functional Pearls * Practice and Experience Important Dates (at 09:00 Apia time, UTC-11) ~~~ Submission: 2 April 2008 Author response: 21 May 2008 Notification: 16 June 2008 Final papers due: 7 July 2008 Call for Papers (full text) ~~~ http://www.icfpconference.org/icfp2008/cfp/cfp.html The submission URL will be available from the above page shortly. Program Chair ~ Peter Thiemann Albert-Ludwigs-Universität Georges-Köhler-Allee 079 79110 Freiburg, Germany Email: [EMAIL PROTECTED] Phone: +49 761 203 8051 Fax: +49 761 203 8052 Mail sent to the address above is filtered for spam. If you send mail and do not receive a prompt response, particularly if the deadline is looming, feel free to telephone and reverse the charges. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Failing to make `par`
I've used Control.Parallel and Control.Parallel.Strategies extensively in the past, and I thought I knew what I was doing. I declared the following function: findSupernodes' :: S.Set Name - Int - Tree - Protein.Tree - S.Set Name findSupernodes' set size (Node i _ _ s il ir) (Protein.Node _ pl pr _ g) | S.size g size = (Name (fromIntegral i)) `S.insert` set | otherwise = leftNodes `S.union` rightNodes where leftNodes = (findSupernodes' set size il pl) rightNodes = (findSupernodes' set size il pl) findSupernodes' set size (Leaf _ _) (Protein.Gene _ _ _) = set and then simply wrote the following as an initial stab at parallelizing it, because actually calling this function causes the program to execute an absurd number of string comparisons: findSupernodes = findSupernodes' S.empty findSupernodes' :: S.Set Name - Int - Tree - Protein.Tree - S.Set Name findSupernodes' set size (Node i _ _ s il ir) (Protein.Node _ pl pr _ g) | S.size g size = (Name (fromIntegral i)) `S.insert` set | otherwise = leftNodes `par` rightNodes `seq` leftNodes `S.union` rightNodes where leftNodes = (findSupernodes' set size il pl) rightNodes = (findSupernodes' set size il pl) findSupernodes' set size (Leaf _ _) (Protein.Gene _ _ _) = set The thing is, these two functions don't return the same thing. The parallel version is returning an empty set, while the sequential version returns what it should return. Any clue what I did wrong? -- Jeff ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Issues(Bugs?) with GHC Type Families
Hi all, I have recently tried to replicate some examples from in the articles about type families but found some possible bugs. In [2], the example class C a where type S a (k :: * - *) :: * instance C [a] where type S [a] k = (a,k a) does not compile under the claim that the type variable k is not in scope. However, if we extract the type family from the class type family S a (k :: * - *) :: * type instance S [a] k = (a, k a) class C a it compiles correctly. According to [3], the difference is purely syntactic sugar, does that mean that both examples should compile and behave the same or is there some subtlety that justifies the class example not to compile? Another issue is that data kinds (used in both [2] and [3]) do not seem to be supported at all by the compiler, are they already implemented in GHC? Simple examples such as datakind Nat = Zero or datakind Nat = Zero | Succ Nat fail to compile. Perhaps some of these should be submitted to the GHC Bug Tracker. I have tested both GHC 6.8.2 and 6.9.20080218. References: 1. Associated Types with Class.http://www.cse.unsw.edu.au/~chak/papers/CKPM05.html Manuel M. T. Chakravarty, Gabriele Keller, Simon Peyton Jones, and Simon Marlow. In *Proceedings of The 32nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'05)*, pages 1-13, ACM Press, 2005. 2. Associated Type Synonyms.http://www.cse.unsw.edu.au/~chak/papers/CKP05.html Manuel M. T. Chakravarty, Gabriele Keller, and Simon Peyton Jones. In *Proceedings of The Tenth ACM SIGPLAN International Conference on Functional Programming *, ACM Press, pages 241-253, 2005. 3. Towards Open Type Functions for Haskell.http://www.cse.unsw.edu.au/~chak/papers/SSPC07.html Tom Schrijvers, Martin Sulzmann, Simon Peyton-Jones, and Manuel M. T. Chakravarty. Unpublished manuscript, 2007. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Issues(Bugs?) with GHC Type Families
2008/3/3 Hugo Pacheco [EMAIL PROTECTED]: class C a where type S a (k :: * - *) :: * instance C [a] where type S [a] k = (a,k a) does not compile under the claim that the type variable k is not in scope. It's not entirely syntactical sugar; I believe that when a type family is a member of a type-class it makes the assertion that only the class variables are part of the function. In the class declaration: class C a where type S a (k :: * - *) :: * there are two arguments to the type function S, but the class C only provides one. Contrast with the following type Pair a k = (a, k a) class C a where type S a :: (* - *) - * instance C [a] where type S [a] = Pair a datakind Nat = Zero or datakind Nat = Zero | Succ Nat datakinds are listed under future work in the papers I have read; they aren't implemented yet. -- ryan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: static constants -- ideas?
jason.dusek: I have an awkward programming problem -- I need to take a dictionary, parse it, build a bunch of intermediate lists and then make maps and tries out of the list. A programming problem because it's taken me a fair amount of effort to pull together the parser and list generator -- and awkward because a 69000 item list, [(String, [(String, String)])], does not compile under GHC (stack overflow). (It's not likely to compile under anything else, either!) Here's an example of the approach Bryan outlined, which does seem to work for files as large as gcc can handle: * generate your big Haskell Map * serialise it with Data.Binary, and Codec.Compression.GZip to a file * compile the data into a C const array, and link that into Haskell * decode it on startup, ressurecting the Haskell data. The C source looks like: const uint8_t beowulf[] = { 31, 139, 8, 0, 0, 0, 0, 0, 0, 3, 124, 189, 75, 150, 46, 54, 93, 193, 96, 144, 241, 168, 172, 238, 214, 0, ... http://code.haskell.org/~dons/code/compiled-constants/cbits/constants.c which is the gzip, Data.Binary encoded version of a Map ByteString Int. Then the Haskell code need only access this array as a Ptr Word8, wrap that as a Bytestring, then run Data.Binary over the result to rebuild the Map. As you can see here: http://code.haskell.org/~dons/code/compiled-constants/Constants.hs I've put a couple of examples of how to access C-side serialised Haskell values in a package here: http://code.haskell.org/~dons/code/compiled-constants/ Cheers, Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Annotating GHC assembler output?
I'm interested in seeing what kind of assembler my functions turn into. Is there a means of annotating assembler output, similar to the {#- CORE -#} pragma? Is there a trickier way of doing it? Justin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (flawed?) benchmark : sort
Hi I was playing with various versions of sorting algorithms. I know it's very easy to create flawed benchmark and I don't claim those are good ones. However, it really seems strange to me, that sort - library function - is actually the worse measured function. I can hardly belive it, and I'd rather say I have made a mistake preparing it. The overall winner seems to be qsort_iv - which is nothing less but old sort replaced by mergesort now. Any clues? Regards Christopher Skrzętnicki --- cut here --- [EMAIL PROTECTED] haskell]$ ghc -O2 --make qsort.hs ./qsort +RTS -sstderr -RTS /dev/null [1 of 1] Compiling Main ( qsort.hs, qsort.o ) Linking qsort ... ./qsort +RTS -sstderr (1.0,iv) (1.1896770400256864,v) (1.3091609772011856,treeSort) (1.592515715933153,vii) (1.5953543402198838,vi) (1.5961286512637272,iii) (1.8175480563244177,i) (1.8771604568641642,ii) (2.453160634439497,mergeSort) (2.6627090768870216,sort) 26,094,674,624 bytes allocated in the heap 12,716,656,224 bytes copied during GC (scavenged) 2,021,104,592 bytes copied during GC (not scavenged) 107,225,088 bytes maximum residency (140 sample(s)) 49773 collections in generation 0 ( 21.76s) 140 collections in generation 1 ( 23.61s) 305 Mb total memory in use INIT time0.00s ( 0.00s elapsed) MUT time 20.39s ( 20.74s elapsed) GCtime 45.37s ( 46.22s elapsed) EXIT time0.00s ( 0.00s elapsed) Total time 65.76s ( 66.96s elapsed) %GC time 69.0% (69.0% elapsed) Alloc rate1,279,723,644 bytes per MUT second Productivity 31.0% of total user, 30.5% of total elapsed --- cut here --- {-# OPTIONS_GHC -O2 #-} module Main where import System.CPUTime import System.IO import System.Environment import System.Random import Data.List( partition, sort ) data Tree a = Node (Tree a) a (Tree a) | Leaf qsort_i [] = [] qsort_i (x:xs) = qsort_i (filter ( x) xs) ++ [x] ++ qsort_i (filter (= x) xs) qsort_ii [] = [] qsort_ii (x:xs) = let (ls,gt) = partition ( x) xs in qsort_ii ls ++ [x] ++ qsort_ii gt qsort_iii xs = qsort_iii' [] xs qsort_iii' acc [] = acc qsort_iii' acc (x:xs) = let (ls,gt) = partition ( x) xs in let acc' = (x:(qsort_iii' acc gt)) in qsort_iii' acc' ls qsort_v [] = [] qsort_v (x:xs) = let (xlt, xgt ) = foldl (\ (lt,gt) el - case compare x el of GT - (el:lt, gt) _ - (lt, el:gt) ) ([],[]) xs in qsort_v xlt ++ [x] ++ qsort_v xgt -- zmodyfikowany i qsort_vi [] = [] qsort_vi (x:xs) = qsort_vi (filter (\y- compare x y == GT) xs) ++ [x] ++ qsort_vi (filter (\y- compare x y /= GT) xs) -- zmodyfikowany iii qsort_vii xs = qsort_vii' [] xs qsort_vii' acc [] = acc qsort_vii' acc (x:xs) = let (ls,gt) = partition (\y- compare x y == GT) xs in let acc' = (x:(qsort_vii' acc gt)) in qsort_vii' acc' ls -- qsort is stable and does not concatenate. qsort_iv xs = qsort_iv' (compare) xs [] qsort_iv' _ [] r = r qsort_iv' _ [x]r = x:r qsort_iv' cmp (x:xs) r = qpart cmp x xs [] [] r -- qpart partitions and sorts the sublists qpart cmp x [] rlt rge r = -- rlt and rge are in reverse order and must be sorted with an -- anti-stable sorting rqsort_iv' cmp rlt (x:rqsort_iv' cmp rge r) qpart cmp x (y:ys) rlt rge r = case cmp x y of GT - qpart cmp x ys (y:rlt) rge r _ - qpart cmp x ys rlt (y:rge) r -- rqsort is as qsort but anti-stable, i.e. reverses equal elements rqsort_iv' _ [] r = r rqsort_iv' _ [x]r = x:r rqsort_iv' cmp (x:xs) r = rqpart cmp x xs [] [] r rqpart cmp x [] rle rgt r = qsort_iv' cmp rle (x:qsort_iv' cmp rgt r) rqpart cmp x (y:ys) rle rgt r = case cmp y x of GT - rqpart cmp x ys rle (y:rgt) r _ - rqpart cmp x ys (y:rle) rgt r -- code by Orcus -- Zadanie 9 - merge sort mergeSort :: Ord a = [a] - [a] mergeSort []= [] mergeSort [x] = [x] mergeSort xs= let(l, r) = splitAt (length xs `quot` 2) xs in mergeSortP (mergeSort l) (mergeSort r) -- funkcja pomocnicza scalajÄ…ca dwie listy uporzÄ…dkowane w jednÄ… mergeSortP :: Ord a = [a] - [a] - [a] mergeSortP xs []= xs mergeSortP [] ys= ys mergeSortP (x:xs) (y:ys) | x = y = x:(mergeSortP xs (y:ys)) | otherwise = y:(mergeSortP (x:xs) ys) -- Zadanie 10 - tree sort treeSort :: Ord a = [a] - [a] -- pointless po raz drugi treeSort = (treeSortInorder . treeSortToTree) treeSortToTree :: Ord a = [a] - Tree a treeSortToTree [] = Leaf treeSortToTree (x:xs) = let (xlt, xgt) = foldl (\ (lt,gt) el - case compare x el of GT - (el:lt, gt) _ - (lt, el:gt) ) ([],[]) xs in Node (treeSortToTree xlt) x (treeSortToTree xgt) treeSortInorder :: Ord a = Tree a - [a] treeSortInorder Leaf
Re: [Haskell-cafe] Annotating GHC assembler output?
Hi Justin. try: ghc -c file -ddump-to-file -ddump-asm You should get a .dump.asm file in the same place as file which still has symbols named after the source functions. Keep in mind though that the continuation passing style (CPS) conversion done in the back end of GHC causes the code not to look like something you might get out of, say GCC. Ben. Justin Bailey wrote: I'm interested in seeing what kind of assembler my functions turn into. Is there a means of annotating assembler output, similar to the {#- CORE -#} pragma? Is there a trickier way of doing it? Justin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Annotating GHC assembler output?
And to answer your actual question.. No - notes in the core language get stripped out during conversion to STG. Ben. Justin Bailey wrote: I'm interested in seeing what kind of assembler my functions turn into. Is there a means of annotating assembler output, similar to the {#- CORE -#} pragma? Is there a trickier way of doing it? Justin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Issues(Bugs?) with GHC Type Families
Hugo Pacheco: I have recently tried to replicate some examples from in the articles about type families but found some possible bugs. In [2], the example class C a where type S a (k :: * - *) :: * instance C [a] where type S [a] k = (a,k a) does not compile under the claim that the type variable k is not in scope. However, if we extract the type family from the class type family S a (k :: * - *) :: * type instance S [a] k = (a, k a) class C a it compiles correctly. According to [3], the difference is purely syntactic sugar, does that mean that both examples should compile and behave the same or is there some subtlety that justifies the class example not to compile? I am sorry for the confusion this causes, but we wrote the paper before the implementation in GHC was finalised. Hence, the implementation deviates from the paper in some aspects. Generally, please use http://haskell.org/haskellwiki/GHC/Type_families (which will be integrated into GHC's Users Manual for 6.10) as the definite guide to the implementation. Here a brief rational for this change in design. We originally intended to distinguish between type parameters that do use type indexing (the a in (S a k)) and those that do not (the k in (S a k)).However, we found later that this leads to implementation problems. The new rule is that any explicitly named parmeters, eg, s and k in type family S a (k :: * - *) :: * are indexed. If you don't want to use the second parameter as an index, write type S a :: (* - *) - * This is also simpler to explain, as simply *all* explicitly named parameters in a type family declaration are indicies. Another issue is that data kinds (used in both [2] and [3]) do not seem to be supported at all by the compiler, are they already implemented in GHC? Simple examples such as datakind Nat = Zero or datakind Nat = Zero | Succ Nat fail to compile. No, datakinds aren't supported yet. We still intend to add them, but our first priority is to thoroughly debug the existing functionality and especially to make sure the interaction with GADTs works well. Thanks for the feedback. Manuel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ID3 tagging
I was wondering if there are any haskell packages for tagging ID3 frames in mp3 files. Or perhaps if there were any plans for developing them... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ID3 tagging
baseballfurlife: I was wondering if there are any haskell packages for tagging ID3 frames in mp3 files. Or perhaps if there were any plans for developing them... hpodder includes the ability to write id3 tags, iirc, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hpodder if you can't find a specific library for it, an id3 binding would make a great introductory haskell programming exercise. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Doubting Haskell
Many thanks for the explanations when I was first experimenting with Haskell. I managed to finish translating a C++ wxWidgets program into Haskell wxHaskell, and am certainly impressed. I've written up some reflections on my newbie experience together with both versions, which might be helpful to people interested in popularizing Haskell, at: http://the-programmers-stone.com/2008/03/04/a-first-haskell-experience/ Regards, Alan -- ... the PA system was moaning unctuously, like a lady hippopotamus reading A. E. Housman ... -- James Blish, They Shall Have Stars ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe