Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-25 Thread Colin Adams
On 26 April 2011 00:53, Ryan Ingram wrote: > I've been working on Haskell for quite a while and it's not too often that > a beginner shows me a new trick--this trick with trace seems really cool and > I hadn't seen it before. > > f x | trace ("f " ++ show x) False = undefined > f ... -- rest of r

[Haskell-cafe] plugins and cabal build

2011-04-25 Thread Michael Snoyman
Hi all, I'm experimenting with using the plugins package for yesod devel server. The basic approach is to use cabal for building the object files, and then load them with plugins. I can get everything to work when I compile with "ghc --make", but I believe name mangling is getting in the way with

[Haskell-cafe] -- Extension for "Pearls of Functional Algorithm Design" by Richard Bird, 2010, page 25 #Haskell

2011-04-25 Thread caseyh
-- Extension for "Pearls of Functional Algorithm Design" by Richard Bird, -- 2010, page 25 #Haskell -- This version assumes 3 disjoint ordered sets represented as lists. -- So either: xy -- Since it uses lists it is no faster than the divide and conquer approach. -- I might try to convert this v

Re: [Haskell-cafe] Data.Enumerator.Text.utf8 not constant memory?

2011-04-25 Thread Skirmantas Kligys
John, Thanks for a very quick fix, and thanks for making the enumerator library. I tried to learn iteratees first from iteratee library but got hopelessly confused within minutes. Now with your library and Snoyman's 3 part tutorial (http://www.yesodweb.com/blog/enumerators-tutorial-part-1) I at

Re: [Haskell-cafe] Data.Enumerator.Text.utf8 not constant memory?

2011-04-25 Thread Felipe Almeida Lessa
On Tue, Apr 26, 2011 at 12:06 AM, John Millikin wrote: > *sigh* > > Another fine entry for john-millikin-is-an-idiot.txt > > Thank you for the patch Felipe, and for the bug report Skirmantas. I > have uploaded 0.4.10 to Hackage. > > My sincere apologies for the inconvenience. But I am sure that j

Re: [Haskell-cafe] Data.Enumerator.Text.utf8 not constant memory?

2011-04-25 Thread John Millikin
*sigh* Another fine entry for john-millikin-is-an-idiot.txt Thank you for the patch Felipe, and for the bug report Skirmantas. I have uploaded 0.4.10 to Hackage. My sincere apologies for the inconvenience. On Mon, Apr 25, 2011 at 19:03, Felipe Almeida Lessa wrote: > [CC'ing John Millikin, enum

Re: [Haskell-cafe] Data.Enumerator.Text.utf8 not constant memory?

2011-04-25 Thread Skirmantas Kligys
Yay, much better! Now iterLinesWc works within 4 kilobytes, and iterLinesMine within 22 kilobytes, both nicely bounded. Thanks a lot for your help, Felipe! On Mon, Apr 25, 2011 at 7:03 PM, Felipe Almeida Lessa wrote: > [CC'ing John Millikin, enumerator's maintainer] > > On Mon, Apr 25, 2011 at

Re: [Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-25 Thread Ryan Ingram
Mail fail, haha. Code fixed. For example: -- Library functions for a hypothetical FRP system pollEvent :: IO [a] -> Event a behavior :: a -> Event a -> Behavior a accumB :: b -> (b -> a -> b) -> Event a -> Behavior b accumE :: b -> (b -> a -> b) -> Event a -> Event b union :: Event a -> Event a -

Re: [Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-25 Thread Ryan Ingram
Of course, you could have the 'interpretation' function be non-pure. For example: -- Library functions for a hypothetical FRP system pollEvent :: IO [a] -> Event a behavior :: a -> Event a -> Behavior a accumB :: b -> (b -> a -> b) -> Event a -> Behavior b accumE :: b -> (b -> a -> b) -> Event a

Re: [Haskell-cafe] Data.Enumerator.Text.utf8 not constant memory?

2011-04-25 Thread Felipe Almeida Lessa
[CC'ing John Millikin, enumerator's maintainer] On Mon, Apr 25, 2011 at 7:10 PM, Skirmantas Kligys wrote: > I expected to be able to do what SAX does in Java, i.e. to avoid loading the > whole 2 gigabytes into memory.  For warm-up, I wrote an iteratee to count > lines > in the file, and it does

[Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-25 Thread Edward Amsden
As far as I can tell, with classic FRP implementations (those which use behaviors as a first-class abstraction), the only way to create a behavior or event based on some external input (for instance keypresses or microphone input) is to do something with unsafePerformIO or unsafeInterleaveIO. A beh

Re: [Haskell-cafe] ANN: Leksah 0.10.0

2011-04-25 Thread Hamish Mackenzie
On 26 April 2011 11:03, Daniel Fischer wrote: > Decreasing indentation via backspace goes one column per backspace, how can > I configure it to go to the next (previous) tab position on backspace in > the leading whitespace of a line? works, but it is a bit dumb. Changing is on my wish list to

Re: [Haskell-cafe] errors while installing yesod 0.8

2011-04-25 Thread Michael Litchard
In case this ever gets googled ... I'm pretty sure this problem had to do with my environment. I removed $HOME/.cabal and $HOME/.ghc, and upgraded to the latest stable haskell platform. yesod 0.8 has installed fine. I'm not sure what the exact problem was however.

Re: [Haskell-cafe] ANN: Leksah 0.10.0

2011-04-25 Thread jutaro
Daniel Fischer wrote: > > On Friday 22 April 2011 12:40:17, Hamish Mackenzie wrote: >> Yesterday we uploaded our official 0.10.0 release (0.10.0.4) to Hackage > > I'm trying to try it, but I run into a couple of problems. > Most are probably me looking in the wrong places, so let's begin with >

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-25 Thread Ryan Ingram
I've been working on Haskell for quite a while and it's not too often that a beginner shows me a new trick--this trick with trace seems really cool and I hadn't seen it before. f x | trace ("f " ++ show x) False = undefined f ... -- rest of regular definition Makes it really easy to add the trace

Re: [Haskell-cafe] ANN: Leksah 0.10.0

2011-04-25 Thread Daniel Fischer
On Friday 22 April 2011 12:40:17, Hamish Mackenzie wrote: > Yesterday we uploaded our official 0.10.0 release (0.10.0.4) to Hackage I'm trying to try it, but I run into a couple of problems. Most are probably me looking in the wrong places, so let's begin with those. By default, the editor pane

Re: [Haskell-cafe] errors while installing yesod 0.8

2011-04-25 Thread Bas van Dijk
On 26 April 2011 00:20, Rogan Creswick wrote: > It would be nice to figure out what is depending on that version of > JSONb so we could better determine if upgrading will break anything. Maybe the following helps: http://bifunctor.homelinux.net/~roel/cgi-bin/hackage-scripts/revdeps/JSONb Bas _

Re: [Haskell-cafe] errors while installing yesod 0.8

2011-04-25 Thread Rogan Creswick
On Mon, Apr 25, 2011 at 3:10 PM, Michael Litchard wrote: > I think something that yesod uses, uses JSONb. Odd. I just checked the transitive dependencies of yesod-0.8.0 (with cab) and it doesn't seem to have that dependency. It could be system-specific, though. It would be nice to figure out w

Re: [Haskell-cafe] errors while installing yesod 0.8

2011-04-25 Thread Michael Litchard
Oh yeah, this began while trying to install by hand authenticate-0.8.2.2 On Mon, Apr 25, 2011 at 3:10 PM, Michael Litchard wrote: > I think something that yesod uses, uses JSONb. Also, I think I have > borked my haskell  environment to the point where it may be best to > zap it and start over. >

[Haskell-cafe] Data.Enumerator.Text.utf8 not constant memory?

2011-04-25 Thread Skirmantas Kligys
Hi, I am learning iteratees, and as a starter project I wanted to use expat- enumerator to parse a 2 gigabyte XML file. I expected to be able to do what SAX does in Java, i.e. to avoid loading the whole 2 gigabytes into memory. For warm-up, I wrote an iteratee to count lines in the file, and it

Re: [Haskell-cafe] errors while installing yesod 0.8

2011-04-25 Thread Michael Litchard
I think something that yesod uses, uses JSONb. Also, I think I have borked my haskell environment to the point where it may be best to zap it and start over. On Mon, Apr 25, 2011 at 3:05 PM, Rogan Creswick wrote: > On Mon, Apr 25, 2011 at 2:44 PM, Michael Litchard wrote: >> So it appears this i

Re: [Haskell-cafe] errors while installing yesod 0.8

2011-04-25 Thread Rogan Creswick
On Mon, Apr 25, 2011 at 2:44 PM, Michael Litchard wrote: > So it appears this is a bug with JSONb-1.0.2. There's a new version > out. IS the answer to use that, or to patch this version? If there is a new version, and you indeed need JSONb for something, then you should use the newer version (yes

Re: [Haskell-cafe] errors while installing yesod 0.8

2011-04-25 Thread Michael Litchard
So it appears this is a bug with JSONb-1.0.2. There's a new version out. IS the answer to use that, or to patch this version? On Mon, Apr 25, 2011 at 1:48 PM, Michael Litchard wrote: > Following the install trail I run into this problem > > mlitchard@apotheosis:~$ cab install JSONb-1.0.2 > Resolv

Re: [Haskell-cafe] errors while installing yesod 0.8

2011-04-25 Thread Michael Litchard
Following the install trail I run into this problem mlitchard@apotheosis:~$ cab install JSONb-1.0.2 Resolving dependencies... Configuring JSONb-1.0.2... Preprocessing library JSONb-1.0.2... Preprocessing executables for JSONb-1.0.2... Building JSONb-1.0.2... [1 of 7] Compiling Text.JSON.Escape ( T

Re: [Haskell-cafe] errors while installing yesod 0.8

2011-04-25 Thread Michael Litchard
I started mindlessly pasting in the output, and the following lept out at me: , package authenticate-0.8.2.2-cc3ed2c523ecbf1ad123c3468785149e is unusable due to missing or recursive dependencies: http-enumerator-0.3.1-719bcd77e1dcb62efc9cf9b4f0b72271 package http-enumerator-0.3.1-719bcd77e1dc

Re: [Haskell-cafe] Storing failing testcases for QuickCheck

2011-04-25 Thread Sönke Hahn
Roel van Dijk wrote: > On 24 April 2011 01:49, wren ng thornton wrote: >> I would *love* there to be a tool which (a) automatically saves failing >> QuickCheck values to disk, and (b) automates using HUnit to load those in >> and test them. I'm not so sure that QuickCheck should be doing the seco

Re: [Haskell-cafe] Trouble with currying and uncurrying...

2011-04-25 Thread Angel de Vicente
Hi, On 25/04/11 14:21, Stephen Tetley wrote: On 25 April 2011 14:11, Angel de Vicente wrote: curry :: ((a,b) -> c) -> (a -> b -> c) curry g x y = g (x,y) Is expressing curry this way more illuminating? curry :: ((a,b) -> c) -> (a -> b -> c) curry g = \x y -> g (x,y) That is, curr

Re: [Haskell-cafe] Trouble with currying and uncurrying...

2011-04-25 Thread Angel de Vicente
Hi, On 25/04/11 14:20, Ozgur Akgun wrote: On 25 April 2011 14:11, Angel de Vicente mailto:ang...@iac.es>> wrote: curry :: ((a,b) -> c) -> (a -> b -> c) is the same as: curry :: ((a,b) -> c) -> a -> b -> c thanks, it makes sense now. Somehow I thought that adding the parenthesis in ...

Re: [Haskell-cafe] Trouble with currying and uncurrying...

2011-04-25 Thread Benedict Eastaugh
On 25 April 2011 14:11, Angel de Vicente wrote: > OK, I have tried it and it works, but I don't understand the syntax for > curry. Until now I have encountered only functions that take the same number > of arguments as the function definition or less (partial application), but > this syntax looks

Re: [Haskell-cafe] Trouble with currying and uncurrying...

2011-04-25 Thread Stephen Tetley
On 25 April 2011 14:11, Angel de Vicente wrote: > curry :: ((a,b) -> c) -> (a -> b -> c) > curry g x y = g (x,y) Is expressing curry this way more illuminating? curry :: ((a,b) -> c) -> (a -> b -> c) curry g = \x y -> g (x,y) That is, curry is a function taking one argument that produces a res

Re: [Haskell-cafe] Trouble with currying and uncurrying...

2011-04-25 Thread Ozgur Akgun
On 25 April 2011 14:11, Angel de Vicente wrote: > curry :: ((a,b) -> c) -> (a -> b -> c) > is the same as: curry :: ((a,b) -> c) -> a -> b -> c HTH, Ozgur ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/

[Haskell-cafe] Trouble with currying and uncurrying...

2011-04-25 Thread Angel de Vicente
Hi, I'm reading "The Craft of Functional Programming" and I found something I don't understand in page 185. It says: "Suppose first that we want to write a curried version of a function g, which is itself uncurried and of type (a,b) -> c. curry g This funtion expects its arguments as a pa

Re: [Haskell-cafe] How to keep cabal and ghci package versions in sync?

2011-04-25 Thread Henning Thielemann
Gracjan Polak schrieb: > Hi all, > > I have a project with a .cabal file listing package dependencies using > the usual version constraints ==X.Y.* =K.J syntax. > Standard route cabal configure; cabal build works correctly as it is able > to select working set of package versions. You can manuall

Re: [Haskell-cafe] A small Darcs anomoly

2011-04-25 Thread Andrew Coppin
On 24/04/2011 06:33 PM, Jason Dagit wrote: On Sun, Apr 24, 2011 at 2:05 AM, Andrew Coppin mailto:andrewcop...@btinternet.com>> wrote: So I was a little surprised to discover that... Darcs doesn't actually support doing this. Darcs is only really interested in the result of applying

Re: [Haskell-cafe] More ideas for controlled mutation

2011-04-25 Thread Heinrich Apfelmus
Edward Z. Yang wrote: Laziness can be viewed as a form of controlled mutation, where we overwrite a thunk with its actual value, thus only running the code once and reaping great time benefits. [..] Hash tables take advantage of this fact by simply chaining together values in a linked list if t

[Haskell-cafe] converting prefixes of CString <-> String

2011-04-25 Thread Eric Stansifer
I have been reading Foreign.C.String but it does not seem to provide the functionality I was looking for. Let 'c2h' convert CStrings to Haskell Strings, and 'h2c' convert Haskell Strings to CStrings. (If I understand correctly, c2h . h2c === id, but h2c . c2h is not the identity on all inputs; o