Re: [Haskell-cafe] What's this pattern called?

2009-10-23 Thread Edward Kmett
I've often seen it referred to as the base functor for a recursive data type. You can then fix that functor in interesting ways i.e. with (Fix, Free, Cofree) and having the explicit base functor allows you to define general purpose recursion schemes over the data type. All of that extra machinery

Re: [Haskell-cafe] why cannot i get the value of a IORef variable ?

2009-10-23 Thread Martijn van Steenbergen
Anton van Straaten wrote: On the plus side, this does make for a slogan with high market appeal: Haskell: Kittens inside Thanks. Now I have trouble getting this image of lambda-shaped bonsai kittens out of my head. ;-) Martijn. ___

[Haskell-cafe] Lazy problem ?

2009-10-23 Thread zaxis
ssqHitNum.txt contains data as below: 6 7 18 24 30 32 9 4 12 20 25 28 29 16 3 5 11 12 31 32 11 2 9 13 15 19 24 3 5 17 21 25 27 32 14 5 9 15 21 26 31 13 12 16 25 26 27 31 05 ... good_ssq_red:: IO [Int] good_ssq_red = withFile ssqHitNum.txt ReadMode (\h - do { samp - fmap str2Ints $

[Haskell-cafe] FW: Free Pizza, C++, and Haskell

2009-10-23 Thread Simon Peyton-Jones
You may enjoy this interesting blog post by Bartosz Milewski about understanding C++ template metaprogramming by starting with Haskell. http://bartoszmilewski.wordpress.com/2009/10/21/what-does-haskell-have-to-do-with-c/ Bartosz gave the talk at the Northwest C++ users group; the video for the

Re: [Haskell-cafe] Lazy problem ?

2009-10-23 Thread Bulat Ziganshin
Hello zaxis, Friday, October 23, 2009, 11:15:01 AM, you wrote: good_ssq_red = withFile ssqHitNum.txt ReadMode (\h - do { samp - fmap str2Ints $ hGetContents h; print samp;--without this line, the result will always [1..16] return $ statis samp; }) withFile

[Haskell-cafe] Re: ANN: Data.Stream 0.4

2009-10-23 Thread Heinrich Apfelmus
Bas van Dijk wrote: 1) What's the difference between your: tail ~(Cons _ xs) = xs and the more simple: tailStrict (Cons _ xs) = xs ? I know they're desugared to: tail ys = let Cons _ xs = ys in xs and: tailStrict ys = case ys of Cons _ xs - xs respectively. But aren't they

Re: [Haskell-cafe] Lazy problem ?

2009-10-23 Thread zaxis
good_ssq_red:: IO [Int] good_ssq_red =do { samp - fmap str2Ints $ readFile ssqHitNum.txt; return $ statis samp; } It works now ! thank you Bulat Ziganshin-2 wrote: Hello zaxis, Friday, October 23, 2009, 11:15:01 AM, you wrote: good_ssq_red = withFile ssqHitNum.txt ReadMode

Re[2]: [Haskell-cafe] Lazy problem ?

2009-10-23 Thread Bulat Ziganshin
Hello zaxis, Friday, October 23, 2009, 12:02:57 PM, you wrote: btw, good_ssq_red = fmap (statis.str2Ints) $ readFile ssqHitNum.txt or good_ssq_red = (statis.str2Ints) `fmap` readFile ssqHitNum.txt good_ssq_red:: IO [Int] good_ssq_red =do { samp - fmap str2Ints $ readFile

[Haskell-cafe] Re: Time and space complexity of take k . sort

2009-10-23 Thread Heinrich Apfelmus
Paul Johnson wrote: Paul Johnson wrote: takeLargest k = take k . sort Because sort is lazily evaluated this only does enough sorting to find the first k elements. I guess the complexity is something like O(n*k*log(k)). Correction: O(n*log(k)) It's O(n + k log k) (which is the same

Re: Re[2]: [Haskell-cafe] Lazy problem ?

2009-10-23 Thread Gregory Crosswhite
Or good_ssq_red = readFile ssqHitNum.txt = return . statis . str2Ints I personally prefer this because I like how the = illustrates that the result is being fed into return . statis . str2Ints, but it is a matter of style. :-) Cheers, Greg On Oct 23, 2009, at 1:09 AM, Bulat Ziganshin

[Haskell-cafe] TimeZone bug?

2009-10-23 Thread Magicloud Magiclouds
Hi, As we know, CST could mean both +8 or -6 time zone. So I got a problem. In the same envoironment. When a ZonedTime is shown, I got x CST. Now it means +8 time zone. Then I read it, stupidly, it turns into -6 time zone. How could I fix this? I am using ghc 6.10.4 in rhel 5. --

Re: [Haskell-cafe] What's this pattern called?

2009-10-23 Thread Martijn van Steenbergen
Thanks for all the pointers, guys. You've been very helpful. I also found Type-indexed data types (Hinze et al) to be a good source. Much appreciated! Martijn. Martijn van Steenbergen wrote: data ExprF r ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] ANN: Data.Stream 0.4

2009-10-23 Thread Wouter Swierstra
1) What's the difference between your: tail ~(Cons _ xs) = xs and the more simple: tailStrict (Cons _ xs) = xs ? I'm no expert - but I can't think of any difference at all. 2) Why don't you also use an irrefutable pattern in take? take is now defined as: This is a trickier question: should

[Haskell-cafe] Newbie has trouble using QuickCheck

2009-10-23 Thread steenreem
Hello. I have made a simple test.hs file that imports the module QuickCheck. However, when I load this module in ghci, it says that the module QuickCheck is not found. I have looked in my haskell platform folder and find the folder QuickCheck 1.2.0.0. I also tried to :set -package QuickCheck.

Re: [Haskell-cafe] Newbie has trouble using QuickCheck

2009-10-23 Thread Roel van Dijk
What's wrong? The package is called QuickCheck. The package consists of a number of modules. The main module is called Test.QuickCheck. So import Test.QuickCheck should bring all relevant symbols in scope. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Time Typeable Instances

2009-10-23 Thread Duncan Coutts
On Tue, 2009-10-13 at 08:48 -0500, John Goerzen wrote: Now I'm getting complaints from people using 6.10.4 saying that there are now missing instances of Typeable with time 1.1.2.4. Right, because 1.1.2.4 is an earlier version than 1.1.3 which is the random intermediate snapshot version

Re: [Haskell-cafe] FW: Free Pizza, C++, and Haskell

2009-10-23 Thread Peter Verswyvelen
Nice article from Bartosz , thanks for sharing this. The best comment (and oh so true IMO) on his article is: I agree, however, a little more familiarity than that may result in the desire never to see another line of C++ again, so you have to be careful. Although learning Haskell improved my

[Haskell-cafe] Re: Help me improve design of my project.

2009-10-23 Thread Andy Stewart
Andy Stewart lazycat.mana...@gmail.com writes: Hi all, Okay, question is, IORefObject module and most module reference each other, so i will got `recursive reference problem` (looks how many .hs-boot in my project). Current version compile fine. The key is design of IORefObject, It's too

[Haskell-cafe] ANN: haskell-src-exts-1.2.0

2009-10-23 Thread Niklas Broberg
Fellow Haskelleers, I'm pleased to announce the release of haskell-src-exts-1.2.0! * On hackage: http://hackage.haskell.org/package/haskell-src-exts * Via cabal: cabal install haskell-src-exts * Darcs repo: http://code.haskell.org/haskell-src-exts Version 1.2.0 is a new major release, following

[Haskell-cafe] Re: ANN: haskell-src-exts-1.2.0

2009-10-23 Thread Niklas Broberg
* On hackage: http://hackage.haskell.org/package/haskell-src-exts * Via cabal: cabal install haskell-src-exts Actually, it seems something went awry. I got a 500 Internal Server Error on my cabal upload, the package is there on hackage but it seems it was never added to the list of packages.

[Haskell-cafe] Re: \Statically checked binomail heaps?

2009-10-23 Thread Okasaki, C. DR EECS
Maciej Kotowicz asked about implementing binomial heaps using types to enforce the shape invariants. I dug up an old email from 1998 talking about how to do this with nested types, and posted it to my blog: http://okasaki.blogspot.com/2009/10/binomial-queues-as-nested-type.html -- Chris

[Haskell-cafe] Announcing: PastePipe -- a CLI for hpaste instances

2009-10-23 Thread Rogan Creswick
I'm happy to announce PastePipe (v1.3)! PastePipe reads from stdin and publishes whatever it reads to the hpaste instance of your choice (defaulting to hpaste.org). This makes it trivial to. * post a file to hpaste.org: `cat file | pastepipe' * turn a terminal into a pastebin

Re: [Haskell-cafe] Re: ANN: haskell-src-exts-1.2.0

2009-10-23 Thread Martijn van Steenbergen
Niklas Broberg wrote: Actually, it seems something went awry. I got a 500 Internal Server Error on my cabal upload, the package is there on hackage but it seems it was never added to the list of packages. This means cabal update doesn't know about it, nor is it listed on the What's New page.

[Haskell-cafe] What does :*: mean again?

2009-10-23 Thread Günther Schmidt
Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] What does :*: mean again?

2009-10-23 Thread Jake McArthur
Nothing by itself. It's just a definable constructor of some sort. - Jake ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] What does :*: mean again?

2009-10-23 Thread Don Stewart
gue.schmidt: Günther Usually it is a strict product. It's just a type constructor of some sort though ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Haskell Weekly News: Issue 136 - October 24, 2009

2009-10-23 Thread jfredett
--- Haskell Weekly News http://sequence.complete.org/hwn/20091024 Issue 136 - October 24, 2009 --- Welcome to issue 136 of HWN, a newsletter covering