Re: [Haskell-cafe] Interesting problem from Bird (4.2.13)

2009-03-07 Thread Bas van Dijk
2009/3/4 R J rj248...@hotmail.com: Could someone provide an elegant solution to Bird problem 4.2.13? Here are the problem and my inelegant solution: Problem --- Since concatenation seems such a basic operation on lists, we can try to construct a data type that captures concatenation

[Haskell-cafe] Running HUnit tests when pushing to darcs on haskell.org

2009-03-07 Thread Colin Paul Adams
Hello cafe, I've just followed the instructions at http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program to create my first library project on haskell.org, using darcs. I tried using the darcs setpref test command to execute: runhaskell tests/*.hs (which works locally) but it

[Haskell-cafe] Mystified by Cabal

2009-03-07 Thread Colin Paul Adams
I have just attempted Cabal-izing my program (splitting it into a library and main program as well), and I'm mystified by some problems I am having. First, when I try to build the library I get: [co...@susannah game-tree]$ runhaskell Setup build Preprocessing library game-tree-1.0.0.0...

Re: [Haskell-cafe] Mystified by Cabal

2009-03-07 Thread Svein Ove Aas
On Sat, Mar 7, 2009 at 6:18 PM, Colin Paul Adams co...@colina.demon.co.uk wrote: I have just attempted Cabal-izing my program (splitting it into a library and main program as well), and I'm mystified by some problems I am having. First, when I try to build the library I get: [co...@susannah

Re: [Haskell-cafe] Mystified by Cabal

2009-03-07 Thread Colin Paul Adams
Svein == Svein Ove Aas svein@aas.no writes: Preprocessing library game-tree-1.0.0.0... Building game-tree-1.0.0.0... Data/Tree/Game/Negascout.hs:31:0: Unrecognised pragma [1 of 2] Compiling Data.Tree.Game.Tree ( Data/Tree/Game/Tree.hs,

Re: [Haskell-cafe] FRP + physics / status of hpysics

2009-03-07 Thread Peter Verswyvelen
On Fri, Mar 6, 2009 at 10:39 PM, Roman Cheplyaka r...@ro-che.info wrote: The blog seems to be inactive since december 2008; has development ceased? Sort of. One reason is that DPH does not seem to be ready for hpysics yet, another one is that I don't see any potential users around (read: I

Re[2]: [Haskell-cafe] Mystified by Cabal

2009-03-07 Thread Bulat Ziganshin
Hello Colin, Saturday, March 7, 2009, 8:30:43 PM, you wrote: Data/Tree/Game/Tree.hs:1:0:    Failed to load interface for `Prelude':      it is a member of package base-3.0.3.0, which is hidden build-depends: base = 4 and which ghc version you are running? :) -- Best

Re: [Haskell-cafe] Mystified by Cabal

2009-03-07 Thread Robin Green
On Sat, 07 Mar 2009 17:30:43 + Colin Paul Adams co...@colina.demon.co.uk wrote: Svein == Svein Ove Aas svein@aas.no writes: Preprocessing library game-tree-1.0.0.0... Building game-tree-1.0.0.0... Data/Tree/Game/Negascout.hs:31:0: Unrecognised pragma [1 of 2]

Re: [Haskell-cafe] Mystified by Cabal

2009-03-07 Thread Colin Paul Adams
Robin == Robin Green gree...@greenrd.org writes: Robin The build-depends line needs to go in the Library section, Robin I think. It doesn't seem to be having any effect in its Robin current location. Likewise for ghc-options. Thanks everyone - it's working now. -- Colin Adams

Re: [Haskell-cafe] FRP + physics / status of hpysics

2009-03-07 Thread Felipe Lessa
2009/3/6 Peter Verswyvelen bugf...@gmail.com: Do alternatives exist? Maybe good wrappers (hopefully pure...)  around existing engines? There's Hipmunk, but it is not pure and not that good ;). But if you don't mess with the global variables (which you normally wouldn't mess anyway) then you can

Re: [Haskell-cafe] FRP + physics / status of hpysics

2009-03-07 Thread Roman Cheplyaka
* Peter Verswyvelen bugf...@gmail.com [2009-03-07 18:34:10+0100] On Fri, Mar 6, 2009 at 10:39 PM, Roman Cheplyaka r...@ro-che.info wrote: The blog seems to be inactive since december 2008; has development ceased? Sort of. One reason is that DPH does not seem to be ready for hpysics

Re: [Haskell-cafe] Mystified by Cabal

2009-03-07 Thread Don Stewart
colin: I have just attempted Cabal-izing my program (splitting it into a library and main program as well), and I'm mystified by some problems I am having. First, when I try to build the library I get: [co...@susannah game-tree]$ runhaskell Setup build Preprocessing library

[Haskell-cafe] Re: Zippers

2009-03-07 Thread Heinrich Apfelmus
Cristiano Paris wrote: Heinrich Apfelmus wrote: ... Such self-reference is usually called tying the knot, see also http://www.haskell.org/haskellwiki/Tying_the_Knot I didn't know. Would you call this Tying the knot as well?

[Haskell-cafe] Ambiguous type with PolymorphicComponents

2009-03-07 Thread Maurí­cio
Hi, When reading this code in ghci, I get an ambiguous type at last line: {-# LANGUAGE PolymorphicComponents #-} {-# LANGUAGE RankNTypes #-} import Graphics.UI.Gtk data Test = Test (forall w. WidgetClass w = w) toAction (Test w) = toWidget w It's interesting that if I replace 'Integral' for

[Haskell-cafe] Re: a newbies confusion with repositories - darcs or git

2009-03-07 Thread Eric Kow
Hi again, I wanted to echo Iavor's comment that you shouldn't feel 'obliged' to use darcs out of Haskell brand loyalty. Try both systems out and see how they feel. My enthusiasm is really about what I find to be a great and very comfortable workflow. You'll have to see for yourself what suits

[Haskell-cafe] serializing large data structures, stack overflow

2009-03-07 Thread friggin friggin
I'm playing around with Netflix, implementing a simple KNN-algorithm, I will later try SVD which seems to be the most successful approach. Using a database like Postgresqk is to slow so I want to serialize a datastructure containing the ratings. I'm not sure about the representation I will use

Re: [Haskell-cafe] serializing large data structures, stack overflow

2009-03-07 Thread Don Stewart
Increase the stack size, or use a different serialiser (they're only a half dozen lines to write), or different data structure? -- Don frigginfriggins: I'm playing around with Netflix, implementing a simple KNN-algorithm, I will later try SVD which seems to be the most successful approach.

Re: [Haskell-cafe] serializing large data structures, stack overflow

2009-03-07 Thread Don Stewart
import Data.Binary and then write a variant of something like how Maps are currently serialised: instance (Ord k, Binary k, Binary e) = Binary (Map.Map k e) where put m = put (Map.size m) mapM_ put (Map.toAscList m) get = liftM Map.fromDistinctAscList get So you might

Re: [Haskell-cafe] Ambiguous type with PolymorphicComponents

2009-03-07 Thread Daniel Fischer
Am Samstag, 7. März 2009 20:28 schrieb Maurí­cio: Hi, When reading this code in ghci, I get an ambiguous type at last line: {-# LANGUAGE PolymorphicComponents #-} {-# LANGUAGE RankNTypes #-} import Graphics.UI.Gtk data Test = Test (forall w. WidgetClass w = w) toAction (Test w) =

Re: [Haskell-cafe] serializing large data structures, stack overflow

2009-03-07 Thread Bulat Ziganshin
Hello friggin, Saturday, March 7, 2009, 10:57:04 PM, you wrote: dec = B.decodeFile C:/users/saftarn/desktop/bintest.txt = \a -   return $ (a :: M.Map (Int,Int) Int) just a quick style hack: dec = B.decodeFile C:/users/saftarn/desktop/bintest.txt :: IO (M.Map (Int,Int) Int) -- Best

[Haskell-cafe] Re: Ambiguous type with PolymorphicComponents

2009-03-07 Thread Maurí­cio
(...) When you have data Test = Test (forall w. (C1 w, C2 w, ..., Cn w) = w) and function (Test w) = classmethod w, there is no way to decide which instance to use, hence the type variable is ambiguous. (...) But, then, how can I reach the data inside a polymorphic component? Or,

Re: [Haskell-cafe] Re: Ambiguous type with PolymorphicComponents

2009-03-07 Thread Daniel Fischer
Am Samstag, 7. März 2009 21:48 schrieb Maurí­cio: (...) When you have data Test = Test (forall w. (C1 w, C2 w, ..., Cn w) = w) and function (Test w) = classmethod w, there is no way to decide which instance to use, hence the type variable is ambiguous. (...) But, then,

[Haskell-cafe] Converting list comprehensions to combinatory style

2009-03-07 Thread R J
Can anyone help with this problem from Bird: a. Convert the following list comprehensions to combinatory style: i. [(x, y) | x - [1..n], odd x, y - [1..n]] ii. [(x, y) | x - [1..n], y - [1..n], odd x] b. Are they equal? c. Compare the costs of evaluating the two expressions. I

Re: [Haskell-cafe] do you have to use fix with forkio?

2009-03-07 Thread Martijn van Steenbergen
Derek Elkins wrote: Both are poorish style. reader - forkIO $ forever $ do (nr', line) - readChan; when (nr /= nr') $ putStrLn hdl line This is fine assuming you always want to re-enter the loop. If you want to loop conditionally (which is most often the case), forever isn't going to work,

[Haskell-cafe] Naturality condition for inits

2009-03-07 Thread R J
Here's another Bird problem that's stymied me: The function inits computes the list of initial segments of a list; its type is inits :: [a] - [[a]]. What is the appropriate naturality condition for inits? The only discussion in the text concerning naturality conditions concerns map, where

Re: [Haskell-cafe] do you have to use fix with forkio?

2009-03-07 Thread Derek Elkins
On Sat, 2009-03-07 at 23:12 +0100, Martijn van Steenbergen wrote: Derek Elkins wrote: Both are poorish style. reader - forkIO $ forever $ do (nr', line) - readChan; when (nr /= nr') $ putStrLn hdl line This is fine assuming you always want to re-enter the loop. If you want to loop

Re: [Haskell-cafe] do you have to use fix with forkio?

2009-03-07 Thread Martijn van Steenbergen
Derek Elkins wrote: If you are doing something else, use something else. This makes it clear that you -aren't- going to break out (non-exceptionally), i.e. the control flow is more obvious in this code than in the other versions. Oh yes, of course! I wasn't saying forever is bad; in fact I

Re: [Haskell-cafe] Converting list comprehensions to combinatory style

2009-03-07 Thread Daniel Fischer
Am Samstag, 7. März 2009 23:06 schrieb R J: Can anyone help with this problem from Bird: a. Convert the following list comprehensions to combinatory style: i. [(x, y) | x - [1..n], odd x, y - [1..n]] ii. [(x, y) | x - [1..n], y - [1..n], odd x] b. Are they equal? c. Compare the

Re: [Haskell-cafe] Naturality condition for inits

2009-03-07 Thread Derek Elkins
On Sat, 2009-03-07 at 22:18 +, R J wrote: Here's another Bird problem that's stymied me: The function inits computes the list of initial segments of a list; its type is inits :: [a] - [[a]]. What is the appropriate naturality condition for inits? A natural transformation is between two

Re: [Haskell-cafe] Naturality condition for inits

2009-03-07 Thread Daniel Fischer
Am Samstag, 7. März 2009 23:18 schrieb R J: Here's another Bird problem that's stymied me: The function inits computes the list of initial segments of a list; its type is inits :: [a] - [[a]]. What is the appropriate naturality condition for inits? The only discussion in the text

[Haskell-cafe] Purely Functional Data Structures

2009-03-07 Thread Gü?nther Schmidt
Hi, is the above mentioned book still *the* authority on the subject? I bought the book, read about 10 pages and then put it back on the shelf. Um. In my app I have to deal with 4 csv files, each between 5 - 10 mb, and some static data. I had put all that data into an Sqlite3 database and

Re: [Haskell-cafe] Purely Functional Data Structures

2009-03-07 Thread Don Stewart
gue.schmidt: Hi, is the above mentioned book still *the* authority on the subject? I bought the book, read about 10 pages and then put it back on the shelf. Um. In my app I have to deal with 4 csv files, each between 5 - 10 mb, and some static data. I had put all that data into an

Re: [Haskell-cafe] Purely Functional Data Structures

2009-03-07 Thread G?uenther Schmidt
Hi Don, damn, that was quick! And thx, I'll look into that. The reading it in wasn't much of a problem, I had been able to use MS-ODBC for that, there's a driver for ODBC files. The problem is more the type of data structure I'd be reading it into. In SQL I would have the data indexed by

[Haskell-cafe] Re: a newbies confusion with repositories - darcs or git

2009-03-07 Thread Trent W. Buck
Eric Kow ko...@darcs.net writes: One of the darcs team members, Thorkil Naur, felt that in my enthusiasm I was not being sufficiently forthright about darcs's shortcomings. As for me, I tend to start any review with a list of all the problems I have with technology, on the basis that it's a

[Haskell-cafe] Haskell Weekly News: Issue 108 - March 7, 2009

2009-03-07 Thread Brent Yorgey
--- Haskell Weekly News http://sequence.complete.org/hwn/20090307 Issue 108 - March 07, 2009 --- Welcome to issue 108 of HWN, a newsletter covering

[Haskell-cafe] I want to write a compiler

2009-03-07 Thread Loup Vaillant
This is a homework question. I am mainly looking for guidance or pointers. Source code, even. (Not GHC's, though, it is too complicated for me right now. The AST of STG is fine, but the rest kinda scares me.) Ideally, I would very much like to compile to C. The requirements are easily stated. My

Re: [Haskell-cafe] I want to write a compiler

2009-03-07 Thread Rick R
http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours Not sure if this is exactly what you want, but you could certainly fufill all of your requirements using this as a baseline. Instead of evaluating the actual statements in your eval function, you could simply render them to C. As

Re: [Haskell-cafe] Purely Functional Data Structures

2009-03-07 Thread Jeremy Shaw
At Sun, 08 Mar 2009 00:13:14 +0100, G?uenther Schmidt wrote: In SQL I would have the data indexed by several different columns, if I use maps I'd only have one key, so if I need to lookup data in the map by a value that is not the key the lookups will become quite expensive.

Re: [Haskell-cafe] I want to write a compiler

2009-03-07 Thread Jeremy Shaw
Hello, This book is pretty good IMO: http://research.microsoft.com/en-us/um/people/simonpj/papers/slpj-book-1987/ It does not cover STG, but it does cover a ton of useful stuff and is very well written. I can say from experience that the spineless-tagless-gmachine paper you referenced does

Re: [Haskell-cafe] Purely Functional Data Structures

2009-03-07 Thread G?uenther Schmidt
Hi Jeremy, I had used HAppS-IxSet before and was very happy with it, it offered pretty much everything I needed. I switched (back) to SQL once I had hit a bump in the road that I wasn't able to fix, a stack-overflow that occurred once I ran the code against the largest sample data I had. It

Re: [Haskell-cafe] I want to write a compiler

2009-03-07 Thread Austin Seipp
Hi, (Please note this is coming from my own experience working with the LHC haskell compiler, as well as a compiler I'm currently working on in SML. I'm not an authority, but as another greenhorn compiler hacker I thought I might give some advice.) Excerpts from Loup Vaillant's message of Sat

[Haskell-cafe] cabal-install 0.6.2 does not bootstrap with ghc-6.10.1 debian distribution

2009-03-07 Thread Ahn, Ki Yung
Dear Haskellers and especially who are working on cabal-install and debian packaging, I sometimes clean up .ghc and .cabal in my home directory to start from scratch because of dependency loopholes (cabal-install does not have remove option yet, so it's hard to fix when such loophole happens).

[Haskell-cafe] Re: cabal-install 0.6.2 does not bootstrap with ghc-6.10.1 debian distribution

2009-03-07 Thread Ahn, Ki Yung
Ahn, Ki Yung 쓴 글: Dear Haskellers and especially who are working on cabal-install and debian packaging, I sometimes clean up .ghc and .cabal in my home directory to start from scratch because of dependency loopholes (cabal-install does not have remove option yet, so it's hard to fix when

Re: [Haskell-cafe] Purely Functional Data Structures

2009-03-07 Thread Jeremy Shaw
At Sun, 08 Mar 2009 02:28:43 +0100, G?uenther Schmidt wrote: [1 text/plain; windows-1252 (quoted-printable)] Hi Jeremy, I had used HAppS-IxSet before and was very happy with it, it offered pretty much everything I needed. I switched (back) to SQL once I had hit a bump in the road that

Re: [Haskell-cafe] I want to write a compiler

2009-03-07 Thread wren ng thornton
Loup Vaillant wrote: - support algebraic data types and case expressions (unless I can get away with encoding them as functions), Which you always can, data Foo = A a1...an | B b1...bn |... == type Foo :: forall r. (a1-...-an - r) - (b1-...-bn - r)

[Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Alexander Dunlap
Hi all, For a while now, we have had Data.ByteString[.Lazy][.Char8] for our fast strings. Now we also have Data.Text, which does the same for Unicode. These seem to be the standard for dealing with lists of bytes and characters. Now we also have the storablevector, uvector, and vector packages.

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Bryan O'Sullivan
On Sat, Mar 7, 2009 at 10:23 PM, Alexander Dunlap alexander.dun...@gmail.com wrote: Hi all, For a while now, we have had Data.ByteString[.Lazy][.Char8] for our fast strings. Now we also have Data.Text, which does the same for Unicode. These seem to be the standard for dealing with lists of

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Austin Seipp
Excerpts from Alexander Dunlap's message of Sun Mar 08 00:23:01 -0600 2009: For a while now, we have had Data.ByteString[.Lazy][.Char8] for our fast strings. Now we also have Data.Text, which does the same for Unicode. These seem to be the standard for dealing with lists of bytes and

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Austin Seipp
Excerpts from Bryan O'Sullivan's message of Sun Mar 08 00:45:03 -0600 2009: uvector is, if my memory serves me correctly, a fork of the vector library. It uses modern stream fusion, but is under active development and is a little scary. I'm a little unclear on the exact difference between

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Don Stewart
bos: On Sat, Mar 7, 2009 at 10:23 PM, Alexander Dunlap alexander.dun...@gmail.com wrote: Hi all, For a while now, we have had Data.ByteString[.Lazy][.Char8] for our fast strings. Now we also have Data.Text, which does the same for Unicode. These seem to be the standard