[Haskell-cafe] Re: Difficult memory leak in array processing

2006-11-23 Thread apfelmus
. The strictness analyzer likes Udo more than Niko, does it? Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: aggressiveness of functional dependencies

2006-11-11 Thread apfelmus
on (perhaps in a different module), things will break. The flexibility comes at a price: Gofer's type class system was unsound and I don't know how much Hugs comes close to this. Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

[Haskell-cafe] Re: don't: a 'do' for comonads?

2006-11-09 Thread apfelmus
14:43 dons yes! 14:44 pkhuong- mm. the opposite of do, eh? do for comonads? :) So now a prize to the person who comes up with the best use for the identifier: don't :: ? -- Don don't :: IO a - a example :: () example = don't (do erase /dev/hda) Regards, apfelmus

[Haskell-cafe] Re: aggressiveness of functional dependencies

2006-11-09 Thread apfelmus
depending on s. Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: optimization help

2006-10-18 Thread apfelmus
#When_can_I_rely_on_full_laziness.3F I think the reason given there is wrong, it's not about efficiency but about space leaks. The map showcase suggests that (map (`elem` tags) cols) is computed only once, though personally, I don't rely on that (yet). Regards, apfelmus

[Haskell-cafe] Re: Lexically scoped type variables

2006-10-18 Thread apfelmus
appear on the lhs of a let or a lambda. In the definition of f above, (f :: Int - Int) and (x+1 :: a) are judgments and (f :: a - a) is a variable binding. Any confusion between judgment and binding is just like a confusion between constructor application and pattern. Regards, apfelmus

[Haskell-cafe] Re: optimization help

2006-10-18 Thread apfelmus
not gain additional clarity. Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: optimization help

2006-10-17 Thread apfelmus
space time= (inject sf) . (inject sf') and the same for all other operations you provide besides `o`. Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: optimization help

2006-10-14 Thread apfelmus
Paul Hudak wrote: In fact avoiding space leaks was one of the motivations for our moving to an arrow framework for FRP (now called Yampa). Arrows amount to a point-free coding style, although with arrow syntax the cumbersomeness of programming in that style is largely alleviated. I think

[Haskell-cafe] Re: function result caching

2006-10-13 Thread apfelmus
be constructed by hand in plain Haskell. To apply this to Ints, one should view them as type Int = [Digit] data Digit = Zero | One Also note that there is absolutely no balancing involved (which would break infinite and lazy stuff). Regards, apfelmus

[Haskell-cafe] Re: optimization help

2006-10-13 Thread apfelmus
The (almost) point-free versions run faster than my fast imperative version and take up significantly less heap space-- even the version which reads everything and then writes takes up about 1/3 the heap space as my version. That was not intended, though I'm very pleased :-D I get the

[Haskell-cafe] Re: optimization help

2006-10-12 Thread apfelmus
be interleaved lazily, this has to be simulated with appendFile. We can read files lazily but we cannot output them lazily. Can this be remedied? Can there be a version of writeFile which is, in a sense, dual to getContents? Regards, apfelmus ___ Haskell-Cafe

[Haskell-cafe] Re: tail-recursing through an associative list

2006-10-12 Thread apfelmus
) Just v' - (k', v') : tail where v' = bestKey k (key x) should be (?) where k' = bestKey k (key x) | otherwise = (k, v) : (myFunction tail x) Regards, apfelmus

[Haskell-cafe] Re: optimization help

2006-10-12 Thread apfelmus
) is a pure function. I think some kind of lazy writeFile could allow this. thanks for your help, No problem. :) Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Haskell performance (again)!

2006-10-08 Thread apfelmus
-rounding Finger Tree, see also Finger Trees: A Simple General-purpose Data Structure Ralf Hinze and Ross Paterson. in Journal of Functional Programming16:2 (2006), pages 197-217 http://www.soi.city.ac.uk/~ross/papers/FingerTree.pdf Regards, apfelmus

[Haskell-cafe] Re: irrefutable patterns for existential types / GADTs

2006-10-04 Thread apfelmus
proposed by Löh and Hinze http://www.informatik.uni-bonn.de/~ralf/publications/OpenDatatypes.pdf Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: irrefutable patterns for existential types / GADTs

2006-10-03 Thread apfelmus
because the latter would in principle allow to supply different dictionaries for one and the same type. Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: question - which monad to use?

2006-10-02 Thread apfelmus
as unfoldr iterate f x0 = unfoldr g x0 where g x = let x' = f x in Just (x',x') Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: How would you replace a field in a CSV file?

2006-10-02 Thread apfelmus
are *the* natural data structure for (in)finite maps in functional languages, see also Ralf Hinze. Generalizing generalized tries. Journal of Functional Programming, 10(4):327-351, July 2000 http://www.informatik.uni-bonn.de/~ralf/publications/GGTries.ps.gz Regards, apfelmus

[Haskell-cafe] Re: Problematic irrefutable pattern matching of existentials

2006-10-02 Thread apfelmus
. Indeed, the above shows the subtle difference: with type classes, one may not pass an undefined dictionary as this is an unresolved overloading. Irrefutable patterns for existential types somehow disturb things. Regards, apfelmus ___ Haskell-Cafe

[Haskell-cafe] Re: irrefutable patterns for existential types / GADTs

2006-10-01 Thread apfelmus
in ((a, b:bs) : rs, m') To summarize, the problem can be solved without irrefutable patterns for GADTs: the code above works for infinite lists. Yet, they are handy and can be introduced safely in the case where the type indices are known in advance and no type refinement happens. Regards, apfelmus

[Haskell-cafe] Re: irrefutable patterns for existential types / GADTs

2006-09-30 Thread apfelmus
, strictness is not absolutely necessary (see upcoming mail on this thread). Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: irrefutable patterns for existential types / GADTs

2006-09-30 Thread apfelmus
falls into the more haste, less speed category) while staying more type safe. @Conor: how does this issue look like in Epigram? Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: irrefutable patterns for existential types / GADTs

2006-09-30 Thread apfelmus
safe _|_ instead of a nasty unsafe segfault? I agree. The only practical problem I can imagine is that GHC internally treats existentials as GADTs. Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

[Haskell-cafe] irrefutable patterns for existential types / GADTs

2006-09-29 Thread apfelmus
Ross Paterson wrote: The story so far: apfelmus: why are there no irrefutable patterns for GADTs? Conor: because you could use them to write unsafeCoerce Ross: how about irrefutable patterns (or newtypes) for existential types? Simon: Try giving the translation into System F + (existential

[Haskell-cafe] Re: Optimization problem

2006-09-19 Thread apfelmus
a)) is the best type for insertdelete. Here, it is clear that insertdelete likely can do a fast uninsert. Btw, why are there no irrefutable patterns for GADTs? I mean, such a sin should be shame for a non-strict language... Regards, apfelmus ___ Haskell-Cafe

[Haskell-cafe] Re: Optimization problem

2006-09-19 Thread apfelmus
on, but otherwise, for this special splitSeq-problem, one runs into the more haste less speed dilemma (i mean Wadler's paper ). Bertram's lazy algorithm actually is an online-algorithm and it should remain one when making it type safe. Regards, apfelmus ___ Haskell

[Haskell-cafe] Re: Optimization problem

2006-09-17 Thread apfelmus
on the map'. uninsert does not have information about the single steps that have been done, it only knows what should come out. From that, it would have to reconstruct quickly what happened, if it wants to be fast. Regards, apfelmus ___ Haskell-Cafe mailing

[Haskell-cafe] Re: Optimization problem

2006-09-15 Thread apfelmus
to wait on them. Also, if your argument would have been correct, then the version without balancing wouldn't work either because insert already exchanges Leafs for Nodes in m. So the top of the map would be unavailable until all Leafs have been exchanged. Regards, apfelmus

[Haskell-cafe] Re: foreach

2006-09-15 Thread apfelmus
Bulat Ziganshin wrote: because REAL code is somewhat larger than examples. try to rewrite the following: directory_blocks - (`mapM` splitBy (opt_group_dir command) files_to_archive) ( \filesInOneDirectory - do datablocks - (`mapM` splitToSolidBlocks filesInOneDirectory)

[Haskell-cafe] Re: Optimization problem

2006-09-15 Thread apfelmus
) a map map'= (if Map.member a map then id else Map.insert a (sz+1)) map Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Optimization problem

2006-09-14 Thread apfelmus
a bimap then id else insert a (sz+1)) bimap Note that update actually generates fresh constructors, so the structure of our tails-Imp is not really static. But this is no problem as the form of the constructors is completely known: there is only one. Regards, apfelmus

[Haskell-cafe] Re: evaluate vs seq

2006-09-13 Thread apfelmus
, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: evaluate vs seq

2006-09-11 Thread apfelmus
x) can be implemented as follows: evaluate x = catch (x `seq` return x) throw Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: evaluate vs seq

2006-09-10 Thread apfelmus
a) is not _|_, but does throw an exception when executed. The appended code shows the differences. Regards, apfelmus import Prelude hiding (return,catch) import qualified Control.Monad as M import Control.Exception a = undefined :: () return = M.return :: a - IO a e 0 = return a e 1 = a `seq

[Haskell-cafe] Re: Monad laws

2006-09-08 Thread apfelmus
to be void of the intended meaning. Regards, apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: practice problems?

2006-09-04 Thread apfelmus
Haskell challenge is of course the ICFP contest http://icfpcontest.org/ There is also the International ACM Programming Contest http://acm.uva.es/problemset/ Your country surely has some kind of high school computing science competition to get problems from. Regards, apfelmus

<    4   5   6   7   8   9