Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread mm
On Tue, Mar 06, 2007 at 10:19:12PM +, David House wrote: On 06/03/07, Nicolas Frisby [EMAIL PROTECTED] wrote: Composition with (.) builds a function, but you eventually want an Int, so we can't just use (.), but we can come pretty close. (sum . IntMap.elems . IntMap.IntersectionWith (\x

Re: [Haskell-cafe] Haskell Cookbook?

2007-03-07 Thread Andy Georges
Hi, On 1 Feb 2007, at 00:50, Alexy Khrabrov wrote: Also see that sequence.complete.org has many code snippets in the blog section. What would be a good way to systematize all such snippets together with hpaste.org and those scrolling through the mailing list? Perhaps some kind of ontology of

[Haskell-cafe] Re: MPTCs and rigid variables

2007-03-07 Thread apfelmus
Claus Reinke wrote: ps. i was somewhat shocked to read that SPJ wants FDs gone. Why? Simon has good taste. :) de gustibus non est disputandum ;) FD have uses and problems and AT have uses and problems. starting anew with the latter doesn't fix the problems, it just changes their form.

[Haskell-cafe] Re: [Haskell] Haddock not being able to read interface file

2007-03-07 Thread Simon Marlow
Wolfgang Jeltsch wrote: Am Dienstag, 6. März 2007 12:09 schrieben Sie: Wolfgang Jeltsch wrote: […] However, Haddock outputs the following: haddock: Warning: The interface file base.haddock could not be read. Maybe it's from a later version of Haddock? This happens with Haddock 0.8

Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread Thomas Conway
On 3/7/07, mm [EMAIL PROTECTED] wrote: f . g . h $ x Alternativly, (f . g . h) x will work, too. It always irks me that you don't actually save any horizontal space using $. That is, (e) x has the same number of characters (incl spaces) as e $ x T. -- Dr Thomas Conway You are

Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread Thomas Davie
On 7 Mar 2007, at 09:44, Thomas Conway wrote: On 3/7/07, mm [EMAIL PROTECTED] wrote: f . g . h $ x Alternativly, (f . g . h) x will work, too. It always irks me that you don't actually save any horizontal space using $. That is, (e) x has the same number of characters (incl spaces)

[Haskell-cafe] Re: Takusen and strictness, and perils of getContents

2007-03-07 Thread Simon Marlow
[EMAIL PROTECTED] wrote: Simon Marlow wrote: Anyway, I just wanted to point out that nowadays we have the option of using imprecise exceptions to report errors in lazy I/O. Is this really a solution? Currently, getContents reports no errors but does perfect error recovery: the result of the

Re: [Haskell-cafe] LGPL libraries

2007-03-07 Thread Duncan Coutts
On Tue, 2007-03-06 at 10:31 +0100, Udo Stenzel wrote: Neil Mitchell wrote: As others have said though, I wouldn't worry overly about it. The whole concept of static linking being wrong, but dynamic linking being fine, when you can flip between the modes just by changing compiler, is just

Re: [Haskell-cafe] LGPL libraries

2007-03-07 Thread Michael T. Richter
On Wed, 2007-07-03 at 11:11 +, Duncan Coutts wrote: Once GHC supports dynamic linking on linux windows (as it does currently on OSX) I think people will stop worrying/complaining. About this issue. ;) -- Michael T. Richter [EMAIL PROTECTED] Disclaimer: Any people who think that

Re: [Haskell-cafe] Haskell File reading

2007-03-07 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 cornmouse wrote: I have a txt file, which contains a paragraph. I am trying to read the file, and pass the contents of the file as a string to another function called createIndex. createIndex is a function to generate index of the input string.

Re: [Haskell-cafe] LGPL libraries

2007-03-07 Thread Duncan Coutts
On Tue, 2007-03-06 at 03:00 +, Neil Mitchell wrote: The whole concept of static linking being wrong, but dynamic linking being fine, when you can flip between the modes just by changing compiler, is just silly. You don't infringe (or uninfringe) copyright with a command line flag. Just

Re: [Haskell-cafe] ANN: Bugfixes for regex-posix and regex-pcre ByteString use

2007-03-07 Thread Thomas Hartman
I'm having trouble building regex-pcre from http://darcs.haskell.org/packages/regex-unstable/regex-pcre/ [EMAIL PROTECTED]:~/haskellInstalls/regex-pcre$ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.6 First (after darcs pulling) it complained [EMAIL

[Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-07 Thread Thomas Hartman
In the spirit of making easy things easy, here is a haskell from shell one-line grepper, that uses regexen. Now, if only I could get pcre-regex installed I would be quite content. (Still stuck using posix RE for now.) ** [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ time

Re: [Haskell-cafe] Re: Takusen and strictness, and perils of getContents

2007-03-07 Thread Claus Reinke
Is this really a solution? Currently, getContents reports no errors but does perfect error recovery: the result of the computation prior to the error is preserved and reported to the caller. Imprecise exceptions give us error reporting -- but no error recovery. All previously computed results are

Re: [Haskell-cafe] ANN: Bugfixes for regex-posix and regex-pcre ByteString use

2007-03-07 Thread Brandon S. Allbery KF8NH
On Mar 7, 2007, at 7:02 , Thomas Hartman wrote: I'm having trouble building regex-pcre from http://darcs.haskell.org/packages/regex-unstable/regex-pcre/ [EMAIL PROTECTED]:~/haskellInstalls/regex-pcre$ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.6 First (after

Re: [Haskell-cafe] ANN: Bugfixes for regex-posix and regex-pcre ByteString use

2007-03-07 Thread Thomas Hartman
1) Chris was correct, I wasn't pulling from unstable, but stable. My bad. [EMAIL PROTECTED]:~/haskellInstalls/regex-pcre$ darcs pull Pulling from http://darcs.haskell.org/packages/regex-pcre;... No remote changes to pull in! 2) When I did as brandon suggested, it seems to have built ok.

[Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-07 Thread Thomas Hartman
with PCRE. now (and yep, it's a lot faster than posix): *** [EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ./q-words.sh q qua quack quacked quackery quackery's quacking quacks quad quad's real0m6.691s user0m2.460s

Re: [Haskell-cafe] Re: MPTCs and rigid variables

2007-03-07 Thread mm
F, FD, FC, AT, SPJ ;) WTH does it mean? On Wed, Mar 07, 2007 at 10:12:11AM +0100, [EMAIL PROTECTED] wrote: Claus Reinke wrote: ps. i was somewhat shocked to read that SPJ wants FDs gone. Why? Simon has good taste. :) de gustibus non est disputandum ;) FD have uses and problems

[Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-07 Thread Thomas Hartman
Okay, so much for PCRE match. Can someone show me give me pointers on PCRE replace? Ideal would be something with all the =~ s/// semantics from perl. (Not sure if this is included in Text.Regex.PCRE. is it?) In other words, how to do this with (preferrably) Text.Regex.PCRE ? Of course in

[Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-07 Thread Thomas Hartman
Just noticed a comment in http://www.serpentine.com/blog/2007/02/27/a-haskell-regular-expression-tutorial/ which says there's no perl-like regex replace in the library, and links to http://hpaste.org/697 which is an attempt at providing one. Not sure if this is useful or not. 2007/3/7,

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-07 Thread Chris Kuklewicz
Thomas Hartman wrote: Just noticed a comment in http://www.serpentine.com/blog/2007/02/27/a-haskell-regular-expression-tutorial/ which says there's no perl-like regex replace in the library, and links to http://hpaste.org/697 which is an attempt at providing one. Not sure if this

Re: [Haskell-cafe] Re: MPTCs and rigid variables

2007-03-07 Thread Claus Reinke
hi mm (?-), F, FD, FC, AT, SPJ ;) WTH does it mean? sorry about this acronymitis :) there was a lengthy debate about some of these things in the context of haskell' a year or so ago, and i just fell back into the mood, forgetting to explain my acronyms before using them again F: System

Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread Steve Schafer
On Wed, 7 Mar 2007 20:44:42 +1100, you wrote: It always irks me that you don't actually save any horizontal space using $. That is, (e) x has the same number of characters (incl spaces) as e $ x Parentheses require you to maintain a mental general-purpose push-down stack as you read the

Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread Dougal Stanton
Quoth Steve Schafer, nevermore, Parentheses require you to maintain a mental general-purpose push-down stack as you read the code. $, on the other hand, while it also requires you to maintain a sort of stack, it's a monotonic stack: you may need to push an arbitrary number of items, but you

Re: [Haskell-cafe] Google summer of code

2007-03-07 Thread David House
On 06/03/07, Malcolm Wallace [EMAIL PROTECTED] wrote: Well, our wiki to gather ideas is now up-and-running again: http://hackage.haskell.org/trac/summer-of-code We should probably remove projects that were succeessfully completed last year, along with the lists of interested students on

Re: [Haskell-cafe] Re: MPTCs and rigid variables

2007-03-07 Thread Iavor Diatchki
Hello, On 3/7/07, Claus Reinke [EMAIL PROTECTED] wrote: AT: associated types, as in GHC ATs are not in any of the official GHC releases... Are they in the CVS head? -Iavor ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Re: MPTCs and rigid variables

2007-03-07 Thread Claus Reinke
ATs are not in any of the official GHC releases... Are they in the CVS head? darcs, these days;-) but yes, from 6.7. see: announcement http://article.gmane.org/gmane.comp.lang.haskell.general/14447 main? info page http://haskell.org/haskellwiki/GHC/Indexed_types ghc status, with new features

Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread Nicolas Frisby
Which is the longer way of saying you don't need to count to make sure you closed all the brackets you opened! ;-) Dougal Stanton 1) Emacs does the counting for me 2) parens don't surprise me if I happen to use rank-2 types. i was bit enough times when learning why $ and runST don't like

RE: [Haskell-cafe] Re: MPTCs and rigid variables

2007-03-07 Thread Simon Peyton-Jones
| ATs are not in any of the official GHC releases... Are they in the CVS head? The HEAD has fully-implemented associated *data types*, but not associated *type synonyms*. We're working on the latter, quite hard. As Claus says, the place to look is here

Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread David House
On 07/03/07, Nicolas Frisby [EMAIL PROTECTED] wrote: 1) Emacs does the counting for me 2) parens don't surprise me if I happen to use rank-2 types. i was bit enough times when learning why $ and runST don't like each other that I've grown averse of $. I also like thinking of building a

Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread David House
On 07/03/07, Thomas Conway [EMAIL PROTECTED] wrote: Of course, what really gets me, is when I start trying to use $ in type signatures and declarations: ... Map ByteString $ foo (bar baz) qux It's almost possible! GHC gives us infix type synonyms: type a $ b = a b (Probably needs

Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread Nicolas Frisby
I don't use rank-2 types that often and when I do I'm aware of the restriction on ($) and similar hofs. I tend to use ($) only when the right-hand side gets very messy; a multiple-line do or similar. For example: blah = fromMaybe $ do x - blah1 y - blah2 guard (x == f y) g x The closing

Re: [Haskell-cafe] Usage of . and $

2007-03-07 Thread Dougal Stanton
Quoth Nicolas Frisby, nevermore: Other than look at Darcs or GHC, has there been any efforts for (very general, libertarian even) coding guidelines? Suggestions tips might be a better word. I think the unwritten word so far has been if you wouldn't hang it on a wall in the Tate Modern then

[Haskell-cafe] A different Maybe maybe

2007-03-07 Thread Joachim Breitner
[Also on http://www.joachim-breitner.de/blog/archives/229-A-different-Maybe-maybe.html] Hi, For a while I have been thinking: Isn’t there a way to get rid of the intermediate Maybe construct in a common expression like “fromMaybe default . lookup”. It seems that a way to do that would be to

Re: [Haskell-cafe] A different Maybe maybe

2007-03-07 Thread Neil Mitchell
Hi For a while I have been thinking: Isn't there a way to get rid of the intermediate Maybe construct in a common expression like fromMaybe default . lookup. It seems that a way to do that would be to pass more information to the Maybe-generating function: What to do with a Just-Value, and what

Re: [Haskell-cafe] A different Maybe maybe

2007-03-07 Thread Jeremy Shaw
Hello, Your definition for Bool reminds me a bit of the definition for booleans in Robert Dockins pure, untyped lambda calculus evaluator: http://www.eecs.tufts.edu/~rdocki01/lambda/prelude.lam http://www.eecs.tufts.edu/~rdocki01/lambda.html j. ___

[Haskell-cafe] Re: A different Maybe maybe

2007-03-07 Thread Chung-chieh Shan
Joachim Breitner [EMAIL PROTECTED] wrote in article [EMAIL PROTECTED] in gmane.comp.lang.haskell.cafe: [Also on http://www.joachim-breitner.de/blog/archives/229-A-different-Maybe-maybe.html] This is known as the Church encoding of algebraic data types. In this generality, it seems to be

Re: [Haskell-cafe] A different Maybe maybe

2007-03-07 Thread Stefan O'Rear
On Wed, Mar 07, 2007 at 11:32:08PM +0100, Joachim Breitner wrote: [Also on http://www.joachim-breitner.de/blog/archives/229-A-different-Maybe-maybe.html] Hi, For a while I have been thinking: Isn???t there a way to get rid of the intermediate Maybe construct in a common expression like

Re: [Haskell-cafe] A different Maybe maybe

2007-03-07 Thread Dan Piponi
Joachim, Don't stop at the booleans. Next you can define the natural numbers by newtype Number = N (forall a.(a-a) - (a-a)) -- Dan On 3/7/07, Joachim Breitner [EMAIL PROTECTED] wrote: For a while I have been thinking: Isn't there a way to get rid of the intermediate Maybe construct in a

Re: [Haskell-cafe] A different Maybe maybe

2007-03-07 Thread Lennart Augustsson
Hey, welcome to to the group who have reinvented Church encoding of data types. :) -- Lennart On Mar 7, 2007, at 22:32 , Joachim Breitner wrote: [Also on http://www.joachim-breitner.de/blog/archives/229-A- different-Maybe-maybe.html] Hi, For a while I have been thinking: Isn’t

[Haskell-cafe] LDFLAGS

2007-03-07 Thread Dave
I have built ghc-6.6 twice for 64-bit OpenBSD 4.0 with LDFLAGS=-L/usr/local/lib set as an environmental variable. Both times the built ghc did not find -lgmp until I modified lib/ghc-6.6/package.conf by adding -L/usr/local/lib to ldOptions. What do I set in order to have ldOptions set properly at

[Haskell-cafe] TVars throw

2007-03-07 Thread Thomas Conway
Hi All, Consider the following: foo = do v - newTVar hi there! throwDyn v main = do catchDyn (atomically foo) \v - do x - atomically (readTVar v) putStr x I.e. throw information that gets rolled back from inside a transaction, catch it and use it. This looks like bad.

Re: [Haskell-cafe] TVars throw

2007-03-07 Thread Stefan O'Rear
On Thu, Mar 08, 2007 at 12:25:15PM +1100, Thomas Conway wrote: Hi All, Consider the following: foo = do v - newTVar hi there! throwDyn v main = do catchDyn (atomically foo) \v - do x - atomically (readTVar v) putStr x I.e. throw information that gets

RE: [Haskell-cafe] Usage of . and $

2007-03-07 Thread Simon Peyton-Jones
| type a $ b = a b | | (Probably needs -fglasgow-exts.) Sadly we don't have a fixity system | for type operators :( Actually GHC lets you give fixity declarations for type operators too. NB that infix type constructors must start with :, just like infix data constructors. Simon

Re: [Haskell-cafe] A different Maybe maybe

2007-03-07 Thread Dan Weston
Congratulations! You've just reinvented Church encoding. Do not let the multiple responses of how you apparently wasted your time reinventing (or do they mean stealing?) something Church did long ago dampen your enthusiasm to learn exciting things and then share them. I for one am always

[Haskell-cafe] lhs2TeX

2007-03-07 Thread Thomas Conway
Hi all, I noticed that in the polycode mode, lhs2TeX produces odd looking output for hex constants. E.g. \begin{code} wibble = 0x7F \end{code} It produces a nice little gap between the 0 and the x. Inspecting the latex source, it even goes to some effort to do so: \mathrm{0}\;\Varid{x7F} I