Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Don, Thursday, August 28, 2008, 10:32:43 AM, you wrote: > Seems like you can make a pure hashtable by unsafePerformIO on the > impure one, and exporting only 'lookup'.. probably yes, but it will lose a bit of performance due to incremental building of hashtable. actually, writing HT module

Re: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Don Stewart
ketil: > Aaron Tomb <[EMAIL PROTECTED]> writes: > > >> Huh? Type safety buys [...] nothing about dereferencing null > >> pointers, which are the moral equivalent of Nothing. > > > What type safety buys you, in my mind, is that Nothing is only a valid > > value for explicit Maybe types. In cases w

Re: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Ketil Malde
Aaron Tomb <[EMAIL PROTECTED]> writes: >> Huh? Type safety buys [...] nothing about dereferencing null >> pointers, which are the moral equivalent of Nothing. > What type safety buys you, in my mind, is that Nothing is only a valid > value for explicit Maybe types. In cases where you don't use Ma

Re: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Don Stewart
bulat.ziganshin: > Hello Richard, > > Thursday, August 28, 2008, 5:28:46 AM, you wrote: > > >>> trie: O(len)*O(width) > >>> hashed trie: O(len) > >>> hash: O(len) > > > If "width" here refers to the branching factor of the trie, > > it's actually O(len.lg(width)), and the width that matters > >

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Richard, Thursday, August 28, 2008, 5:28:46 AM, you wrote: >>> trie: O(len)*O(width) >>> hashed trie: O(len) >>> hash: O(len) > If "width" here refers to the branching factor of the trie, > it's actually O(len.lg(width)), and the width that matters > is not the *possible* number of choices

Re: [Haskell-cafe] Is there GHC 6.8.3 on Ubuntu?

2008-08-27 Thread Ketil Malde
"Rafael Gustavo da Cunha Pereira Pinto" <[EMAIL PROTECTED]> writes: > Is there anyone packing GHC 6.8.3 for Ubuntu Hardy? The next Ubuntu release (8.10 Intrepid), seems to come with 6.8.2 as well. If you want to pack 6.8.3, go for it! If you just wanted to use it, I've had success using the b

Re: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Jules Bean
Jason Dusek wrote: I would much rather have a pure Trie that is foldable. If we have a Trie, we get a space efficient sorted list, too. Well, Data.Sequence can be used as a space efficient sorted list which is Foldable - if you make the decision to insert elements into it in a sorted way

Re: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Johannes Waldmann
The ECMA Eiffel standard has ?Teither a void reference or a reference to an instance of T !Ta reference to an instance of T Tsame as !T in ECMA Eiffel; used to be same as ?T similarly, C# "invented" Maybe and called it Nullable: http://msdn.microsoft.com/en-us/library/

Re: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Jason Dusek
I would much rather have a pure Trie that is foldable. If we have a Trie, we get a space efficient sorted list, too. -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] dangling symbolic links

2008-08-27 Thread Brandon S. Allbery KF8NH
On 2008 Aug 28, at 0:46, Nicolas Frisby wrote: I think I've exhausted my options without catching exceptions. If I have an invalid symbolic link, how can I identify that it exists? getSymbolicLinkStatus vs. getFileStatus? The former will return if the link exists, the latter if its target

[Haskell-cafe] Re: dangling symbolic links

2008-08-27 Thread Nicolas Frisby
Ah the magic of using a mailing list... I just realized that using getDirectoryContents lists the entry. Still, a "doesLinkExist" function might be nice... On Wed, Aug 27, 2008 at 11:46 PM, Nicolas Frisby <[EMAIL PROTECTED]> wrote: > I think I've exhausted my options without catching exceptions.

[Haskell-cafe] dangling symbolic links

2008-08-27 Thread Nicolas Frisby
I think I've exhausted my options without catching exceptions. If I have an invalid symbolic link, how can I identify that it exists? (Sorry about the line wrap.) tmp$ ls -l# no tricks up my sleeve, empty directory tmp$ touch foo tmp$ ln -s foo bar tmp$ ls -l total 8 lrwxr-xr-x 1 n

Re: [Haskell-cafe] Parsec and network data

2008-08-27 Thread Ryan Ingram
On Tue, Aug 26, 2008 at 1:35 PM, brian <[EMAIL PROTECTED]> wrote: > One unworkable approach I tried is to get a lazy String from the > handle with hGetContents. > [...] > The OP had the same problem I did, so he made a variant of > hGetContents with timeout support. The problem: he used something f

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread John Meacham
On Thu, Aug 28, 2008 at 12:15:10AM +0100, Lennart Augustsson wrote: > I didn't say NetBSD doesn't use global variables, I said the device > driver model doesn't use global variables. And quite a few things > that used to be in global variables have been moved into allocated > variables and are bei

Re: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Richard A. O'Keefe
On 28 Aug 2008, at 8:34 am, Aaron Tomb wrote: What type safety buys you, in my mind, is that Nothing is only a valid value for explicit Maybe types. In cases where you don't use Maybe, the "null" situation just can't occur. In languages with null pointers, any pointer could possibly be null

Re: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Richard A. O'Keefe
Someone wrote: trie: O(len)*O(width) hashed trie: O(len) hash: O(len) If "width" here refers to the branching factor of the trie, it's actually O(len.lg(width)), and the width that matters is not the *possible* number of choices but the *actual* number. The great problem with hash tables is d

RE: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Tim Docker
Dan Weston wrote: > Tim Docker wrote: > > > That differs from my experience. Most segfaults that *I've* caused (in > > C or C++) have been due to dereferencing null pointers. Type safety > > does help you here, in that Maybe lets you distinguish the types of > > things that are optionally pres

Re: [Haskell-cafe] xmonad on the openmoko mobile phone

2008-08-27 Thread John Meacham
On Wed, Aug 27, 2008 at 02:15:48PM -0700, Don Stewart wrote: > john: > > On Sun, Aug 10, 2008 at 08:36:27PM +0400, Miguel Mitrofanov wrote: > > > > > > On 9 Aug 2008, at 23:43, Don Stewart wrote: > > > > > >> Haskell on the iphone next? > > > > > > Did that. Hugs compiles well; GHC will probably to

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Brandon S. Allbery KF8NH
On 2008 Aug 27, at 12:12, Jonathan Cast wrote: * I wonder why that name was chosen? The design doesn't seem to have anything to do with IO, it's more of a `we have this in C so we want it in Haskell too' monad. As I understand it, "IO" means "anything not encompassed by equationally-reas

Re: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Brandon S. Allbery KF8NH
On 2008 Aug 27, at 16:39, Jonathan Cast wrote: The last `case' is a catch-all, so you do know the result of the mplus's is a Just, but you still need the Maybe. I have to admit my thought here is that the problem isn't the Maybe, it's the fromJust. Make it go away, force people to explicit

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Lennart Augustsson
I didn't say NetBSD doesn't use global variables, I said the device driver model doesn't use global variables. And quite a few things that used to be in global variables have been moved into allocated variables and are being passed around instead. That's simply a better way to structure the code.

[Haskell-cafe] Re: Haskell Propaganda

2008-08-27 Thread Ben Franksen
Brandon S. Allbery KF8NH wrote: > On 2008 Aug 27, at 16:49, Daniel Fischer wrote: >> Am Mittwoch, 27. August 2008 22:34 schrieb Aaron Tomb: >>> When you do use Maybe, you have to explicitly handle the Just and >>> Nothing cases separately. Pattern matching reminds you that both are >>> possible. I

Re: Re[6]: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Jonathan Cast
On Wed, 2008-08-27 at 23:00 +0100, Lennart Augustsson wrote: > IMO, there's no justification for having IORefs etc in the IO monad. > They should be in a separate monad. There could then be an operation > to lift that monad to the IO monad, if you so wish. > But wait, we already have that, it's th

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread John Meacham
On Wed, Aug 27, 2008 at 12:17:46PM -0500, Derek Elkins wrote: > On Wed, 2008-08-27 at 02:35 -0700, John Meacham wrote: > > However, note the weasel words. Those are in there on purpose, every > > design calls for different solutions. To blanketly say certain > > constructs are just wrong to the poi

Re: [Haskell-cafe] Building SDL-image package on Windows

2008-08-27 Thread Garrick Chin
Hello, Adding the main macro undef has solved the linker errors and both SDL_image and SDL_ttf build and install correctly now. For both SDL_image and SDL_ttf only the ./Graphics/UI/SDL/Image/Version.hsc file needed to be changed, pasting in the undef macro under "#include SDL_image.h" and "#incl

Re: Re[6]: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Lennart Augustsson
IMO, there's no justification for having IORefs etc in the IO monad. They should be in a separate monad. There could then be an operation to lift that monad to the IO monad, if you so wish. But wait, we already have that, it's the ST monad! (So there is no justification.) -- Lennart On Wed, A

Re: Re[6]: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Jonathan Cast
On Wed, 2008-08-27 at 14:50 -0700, Jonathan Cast wrote: > On Thu, 2008-08-28 at 01:23 +0400, Bulat Ziganshin wrote: > > Hello Jonathan, > > > > Thursday, August 28, 2008, 1:11:35 AM, you wrote: > > >> IORefs got their names because they are implemented in IO monad :) > > > > > But why are they im

Re: Re[6]: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Jonathan Cast
On Thu, 2008-08-28 at 01:23 +0400, Bulat Ziganshin wrote: > Hello Jonathan, > > Thursday, August 28, 2008, 1:11:35 AM, you wrote: > >> IORefs got their names because they are implemented in IO monad :) > > > But why are they implemented in the IO monad? > > because they need its features. but i/

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Jonathan Cast
On Wed, 2008-08-27 at 23:20 +0200, Daniel Fischer wrote: > Am Mittwoch, 27. August 2008 22:57 schrieb Jonathan Cast: > > On Thu, 2008-08-28 at 00:53 +0400, Bulat Ziganshin wrote: > > > Hello Jonathan, > > > > > > Wednesday, August 27, 2008, 8:12:42 PM, you wrote: > > > > * I wonder why that name wa

Re: [Haskell-cafe] Re: problem with cabal for syb-with-class

2008-08-27 Thread Duncan Coutts
On Wed, 2008-08-27 at 12:33 +0100, Claus Reinke wrote: > >> Cabal doesn't have to pass on ghc's messages uninterpreted. That's > >> a lot like implementing a map as a list and complaining about empty > >> list instead of element not found. > > > > I see what you're saying, but in practise it's jus

Re: [Haskell-cafe] Compiler's bane

2008-08-27 Thread Jeremy Apthorp
2008/8/28 Lennart Augustsson <[EMAIL PROTECTED]>: > You can get rid of all recursive bindings by transforming them into a > use of a fixpoint combinator. > And then you can use a non-recursive definition of the fixpoint > combinator, and never worry about recursive bindings again. This[1] might be

Re: [Haskell-cafe] Associative Commutative Unification

2008-08-27 Thread Matthieu Sozeau
Le 12 juil. 08 à 04:02, John D. Ramsdell a écrit : CIMe[1] might be useful to solve the generated diophantine equations. It also has AC unification, and it probably wouldn't be all that hard to translate our code into OCaml. I think CiME isn't supported anymore. Still it's worth considering

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Ganesh Sittampalam
On Wed, 27 Aug 2008, Jonathan Cast wrote: * I wonder why that name was chosen? The design doesn't seem to have anything to do with IO, it's more of a `we have this in C so we want it in Haskell too' monad. The 'C' in ACIO says that it commutes with any operation in the IO monad. Without that

Re: [Haskell-cafe] Haskell Propaganda

2008-08-27 Thread Brandon S. Allbery KF8NH
On 2008 Aug 27, at 16:49, Daniel Fischer wrote: Am Mittwoch, 27. August 2008 22:34 schrieb Aaron Tomb: When you do use Maybe, you have to explicitly handle the Just and Nothing cases separately. Pattern matching reminds you that both are possible. I tend to view fromJust as a function you should

Re: [Haskell-cafe] Compiler's bane

2008-08-27 Thread Lennart Augustsson
You can get rid of all recursive bindings by transforming them into a use of a fixpoint combinator. And then you can use a non-recursive definition of the fixpoint combinator, and never worry about recursive bindings again. -- Lennart On Wed, Aug 27, 2008 at 8:59 PM, Andrew Coppin <[EMAIL PROTE

Re[6]: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Bulat Ziganshin
Hello Jonathan, Thursday, August 28, 2008, 1:11:35 AM, you wrote: >> IORefs got their names because they are implemented in IO monad :) > But why are they implemented in the IO monad? because they need its features. but i/o may be implemented w/o IORefs. so sequence was: searching for a was to m

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Daniel Fischer
Am Mittwoch, 27. August 2008 22:57 schrieb Jonathan Cast: > On Thu, 2008-08-28 at 00:53 +0400, Bulat Ziganshin wrote: > > Hello Jonathan, > > > > Wednesday, August 27, 2008, 8:12:42 PM, you wrote: > > > * I wonder why that name was chosen? The design doesn't seem to have > > > anything to do with

Re: [Haskell-cafe] xmonad on the openmoko mobile phone

2008-08-27 Thread Don Stewart
john: > On Sun, Aug 10, 2008 at 08:36:27PM +0400, Miguel Mitrofanov wrote: > > > > On 9 Aug 2008, at 23:43, Don Stewart wrote: > > > >> Haskell on the iphone next? > > > > Did that. Hugs compiles well; GHC will probably too, I just didn't have > > time for this. No haskell-specific hacks, only jai

Re: Re[4]: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Jonathan Cast
On Thu, 2008-08-28 at 01:09 +0400, Bulat Ziganshin wrote: > Hello Jonathan, > > Thursday, August 28, 2008, 12:57:19 AM, you wrote: > > >> s/it/exchange with external world, i.e., essentially, I/O/ > > > Bald assertion. I don't buy it. What do IORefs have to do with > > exchange with the extern

Re[4]: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Bulat Ziganshin
Hello Jonathan, Thursday, August 28, 2008, 12:57:19 AM, you wrote: >> s/it/exchange with external world, i.e., essentially, I/O/ > Bald assertion. I don't buy it. What do IORefs have to do with > exchange with the external world? IORefs got their names because they are implemented in IO monad

Re: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Robert Greayer
--- On Wed, 8/27/08, Dan Weston <[EMAIL PROTECTED]> wrote: > > Failure to handle a null pointer is just like using > fromJust and results > in the same program termination (undefined). > > Dan > Well, not (IMHO) 'just like': 'fromJust Nothing' turns into a 'catchable' exception in the IO Mona

Re: Re[2]: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Jonathan Cast
On Thu, 2008-08-28 at 00:53 +0400, Bulat Ziganshin wrote: > Hello Jonathan, > > Wednesday, August 27, 2008, 8:12:42 PM, you wrote: > > > * I wonder why that name was chosen? The design doesn't seem to have > > anything to do with IO, it's more of a `we have this in C so we want it > > in Haskell

Re: [Haskell-cafe] xmonad on the openmoko mobile phone

2008-08-27 Thread John Meacham
On Sun, Aug 10, 2008 at 08:36:27PM +0400, Miguel Mitrofanov wrote: > > On 9 Aug 2008, at 23:43, Don Stewart wrote: > >> Haskell on the iphone next? > > Did that. Hugs compiles well; GHC will probably too, I just didn't have > time for this. No haskell-specific hacks, only jailbreak. jhc cross com

Re[2]: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Bulat Ziganshin
Hello Jonathan, Wednesday, August 27, 2008, 8:12:42 PM, you wrote: > * I wonder why that name was chosen? The design doesn't seem to have > anything to do with IO, it's more of a `we have this in C so we want it > in Haskell too' monad. s/it/exchange with external world, i.e., essentially, I/O/

[Haskell-cafe] Problem building the plugins package

2008-08-27 Thread Emmanuel
Hello I am having troubles building the plugins package : manu:~/Desktop/tmp manu$ cabal install plugins Resolving dependencies... cabal: cannot configure plugins-1.2. It requires ghc >=6.8 There is no available version of ghc that satisfies >=6.8 I am on a Mac PPC (OS X 10.4) with ghc-6.8.2 an

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Jules, Wednesday, August 27, 2008, 7:59:55 PM, you wrote: >>> To get "much better efficient" than a trie, the hash function has to be >>> so fast that it is faster than following (log n) pointers >> >> afaiu, trie search follows n pointers > No. > "n" is the number of strings in my data

Re: [Haskell-cafe] Haskell Propaganda

2008-08-27 Thread Daniel Fischer
Am Mittwoch, 27. August 2008 22:34 schrieb Aaron Tomb: > On Aug 27, 2008, at 12:23 PM, Dan Weston wrote: > > Huh? Type safety buys you not having to worry about dereferencing > > stale nonnull pointers (lifetime of reference exceeding lifetime of > > referent), but nothing about dereferencing null

Re: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Jonathan Cast
On Wed, 2008-08-27 at 13:34 -0700, Aaron Tomb wrote: > On Aug 27, 2008, at 12:23 PM, Dan Weston wrote: > > > Huh? Type safety buys you not having to worry about dereferencing > > stale nonnull pointers (lifetime of reference exceeding lifetime of > > referent), but nothing about dereferencing

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Jan-Willem, Wednesday, August 27, 2008, 4:06:11 PM, you wrote: > One obvious way to make non-modifiable hash tables useful is to "eat > your own tail" non-strictly--- aggregate a set of hash table entries, > construct a hash table from them, and plumb the resulting hash table > into the o

Re: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Aaron Tomb
On Aug 27, 2008, at 12:23 PM, Dan Weston wrote: Huh? Type safety buys you not having to worry about dereferencing stale nonnull pointers (lifetime of reference exceeding lifetime of referent), but nothing about dereferencing null pointers, which are the moral equivalent of Nothing. What

Re: [Haskell-cafe] Cleaning up the Debian act (report from the trenches)

2008-08-27 Thread David Bremner
Ketil Malde wrote: >Another Debian question, once I've populated the debian/ directory one >way or another, how should this be integrated with the rest of the >project? Should it be part of the darcs archive, or a separate >archive (foo-debian), or what? How do people organize this? [EMAIL PRO

Re: [Haskell-cafe] Compiler's bane

2008-08-27 Thread John Meacham
On Wed, Aug 27, 2008 at 08:59:28PM +0100, Andrew Coppin wrote: > let y = 5 in (f x) y > > ...and x is now a free variable. OOPS! > > Trying to tease out exactly under which conditions you can and cannot > perform the substitution is utterly maddening. Since this is a Haskell > mailing list and

Re: [Haskell-cafe] Compiler's bane

2008-08-27 Thread Neil Mitchell
Hi > I'm writing a simple interpretter for a small extended-lambda-calculus sort > of language. And I'd just like to say... RECURSIVE LET-BINDS! GH!!! >_< Agreed :-) > To illustrate: > > let x = f x; y = 5 in x y > > A simple-minded interpretter might try to replace every occurrance of "x"

Re: [Haskell-cafe] Cleaning up the Debian act (report from the trenches)

2008-08-27 Thread Don Stewart
ketil: > "Jason Dagit" <[EMAIL PROTECTED]> writes: > > >> 2) Compile GHC yourself. > > > I find with Debian this is the way to go. > > Ouch. Okay, I've compiled GHC once. But I would like end-users to be > able to use my software, and I simply cannot require them to go > through this. Yes, s

[Haskell-cafe] Compiler's bane

2008-08-27 Thread Andrew Coppin
Hi guys. I'm writing a simple interpretter for a small extended-lambda-calculus sort of language. And I'd just like to say... RECURSIVE LET-BINDS! GH!!! >_< No other part of the program has consumed nearly as much brain power as me trying to figure out when it is and isn't safe to replac

Re: [Haskell-cafe] Haskell symbol ~

2008-08-27 Thread C.M.Brown
I personally think it's bad to start using "let-patterns" as a synonym for general pattern bindings when explaining these concepts. It may be true that it's all transformed into the same thing at core level, but a let expression binds a definition at the expression level, rather than at the equati

Re: [Haskell-cafe] 2 modules in one file

2008-08-27 Thread Yitzchak Gale
I have submitted this as Feature Request #2550 http://hackage.haskell.org/trac/ghc/ticket/2550 Please add any comments as appropriate. Thanks, Yitz ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-c

Re: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Jonathan Cast
On Wed, 2008-08-27 at 12:23 -0700, Dan Weston wrote: > Tim Docker wrote: > > > > David Roundy wrote: > > > >> Which illustrates the point that it's not type safety > >> that protects us from segfaults, so much as bounds checking, > >> and that's got a non-trivial runtime cost. At least, most >

Re: [Haskell-cafe] Haskell Propeganda

2008-08-27 Thread Dan Weston
Tim Docker wrote: David Roundy wrote: Which illustrates the point that it's not type safety that protects us from segfaults, so much as bounds checking, and that's got a non-trivial runtime cost. At least, most segfaults that *I've* caused (in C or C++) have been from overwriting the bounds

Re: [Haskell-cafe] Haskell symbol ~

2008-08-27 Thread Jonathan Cast
On Wed, 2008-08-27 at 20:14 +0100, C.M.Brown wrote: > Hi, > > I may be wrong here, but I don't belive it's just let-patterns that have > this property. I.e. what's the difference between... > > (Just x) = _|_ > > f = x > > vs. > > f = let (Just x) = _|_ in x > > vs. > > f = x where (Just x)

Re: [Haskell-cafe] Haskell symbol ~

2008-08-27 Thread C.M.Brown
Hi, I may be wrong here, but I don't belive it's just let-patterns that have this property. I.e. what's the difference between... (Just x) = _|_ f = x vs. f = let (Just x) = _|_ in x vs. f = x where (Just x) = _|_ I believe Haskell uses Normal Order Reduction in all these cases. Why is it j

Re: [Haskell-cafe] Haskell symbol ~

2008-08-27 Thread Ryan Ingram
Here is another example: > f1 n ~(x:xs) = (n, x) > f2 n (x:xs) = (n,x) f1 5 [] = (5, error "irrefutable pattern match failure") f2 5 [] = error "pattern match failure" In particular: fst (f1 5 []) = 5 fst (f2 5 []) = error "pattern match failure" The "~" delays the pattern match until evaluati

Re: [Haskell-cafe] Haskell symbol ~

2008-08-27 Thread Benja Fallenstein
Hi Maurí­cio, I've got one thing to add to the replies so far: On Wed, Aug 27, 2008 at 8:23 PM, Maurí­cio <[EMAIL PROTECTED]> wrote: > What does '~' mean in Haskell? I > read in haskell.org/haskellwiki/Keywords > that "(...) Matching the pattern ~pat > against a value always suceeds, and > matchi

Re: [Haskell-cafe] Haskell symbol ~

2008-08-27 Thread Neil Mitchell
Hi > At the same place, I found that example, > but wasn't wise enough to figure out > what it does: > > (f *** g) ~(x,y) = (f x, g y) > > Can you help me understand it? It means exactly the same as: (f *** g) xy = (f (fst xy), g (snd xy)) i.e. if you call (f *** g) undefined, you will get (f u

[Haskell-cafe] timer_create revisited

2008-08-27 Thread Brandon S. Allbery KF8NH
I'm trying to build GHC 6.8.2 (6.8.3 once I get all this nailed down...) from an old bootstrap ghc on SuSE 9.3-64 (yes, I know) because the 6.6.1 and newer binary tarballs for amd64 Linux doesn't work with the "timer_create" issue. The problem is, having built a shiny new 6.8.2 both stage1

Re: [Haskell-cafe] Haskell symbol ~

2008-08-27 Thread Brandon S. Allbery KF8NH
On 2008 Aug 27, at 14:23, Maurí cio wrote: What does '~' mean in Haskell? I read in haskell.org/haskellwiki/Keywords that “(...) Matching the pattern ~pat against a value always suceeds, and matching will only diverge when one of the variables bound in the pattern is used.” Isn't that true for an

[Haskell-cafe] Haskell symbol ~

2008-08-27 Thread Maurí­cio
Hi, What does '~' mean in Haskell? I read in haskell.org/haskellwiki/Keywords that “(...) Matching the pattern ~pat against a value always suceeds, and matching will only diverge when one of the variables bound in the pattern is used.” Isn't that true for any variable, due to lazyness? At the sa

[Haskell-cafe] Is there GHC 6.8.3 on Ubuntu?

2008-08-27 Thread Rafael Gustavo da Cunha Pereira Pinto
Is there anyone packing GHC 6.8.3 for Ubuntu Hardy? Thanks -- Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Cleaning up the Debian act (report from the trenches)

2008-08-27 Thread David Bremner
Ketil Malde wrote: >Neither do I have an Etch system around, but I should probably >install a virtual machine or something. Ideally, I should >work out the minimal requirements (including for dependencies, and for >dependencies' dependencies), but in practice, I end up depending on >whatever is i

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Derek Elkins
On Wed, 2008-08-27 at 02:35 -0700, John Meacham wrote: [cut] > > However, note the weasel words. Those are in there on purpose, every > design calls for different solutions. To blanketly say certain > constructs are just wrong to the point of disallowing them in the > language, especially when the

Re: [Haskell-cafe] Cleaning up the Debian act (report from the trenches)

2008-08-27 Thread Ketil Malde
"David House" <[EMAIL PROTECTED]> writes: >> 1. Etch comes with ghc-6.6, and that didn't work with my .cabal file. > Is it not an option to make your software work with the > not-quite-latest compiler? Yes it is, although I don't have the details either. Neither do I have an Etch system aroun

[Haskell-cafe] ANNOUNCE: Wired 0.1.1

2008-08-27 Thread Emil Axelsson
Hello, This is to announce the first release of the hardware description library Wired. Wired can be seen as an extension to Lava that targets (not exclusively) semi-custom VLSI design. A particular aim of Wired is to give the designer more control over the routing wires' effects on performanc

[Haskell-cafe] Re: Parsec and network data

2008-08-27 Thread brian
I made a small example related to the problem: http://hpaste.org/9957 It's my attempt to run data from the network directly into Parsec without having to fear deadlock due to blocking. The idea is that we feed Parsec from a timeout-enabled Stream based on Handle. As long as Parsec is able to read

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Stephan, Wednesday, August 27, 2008, 1:52:23 PM, you wrote: > and on the other and, its implementation uses hash functions and arrays > as well. IIRC it does that in a state monad that keeps the array mutable > and finally freezes it before usage, which might be a good idea for pure > hash t

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Daniel, Wednesday, August 27, 2008, 8:01:24 PM, you wrote: >> trie: O(len)*O(width) >> hashed trie: O(len) >> hash: O(len) > Wouldn't the hashtable have lookup time O(len+bucketsize)? i suppose that bucketsize=O(1): constructor should get [approximate] size of hashed assoclist and it will

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Jonathan Cast
On Wed, 2008-08-27 at 11:53 +0100, Adrian Hey wrote: > John Meacham wrote: > > As with all design decisions, it is sometimes the right thing and > > sometimes the wrong one. And sometimes the most expedient. (which, > > occasionally, is a perfectly valid driving force behind a certain bit of > > co

Re: [Haskell-cafe] HEq and Context reduction stack overflow, non optimal ghc behaviour ?

2008-08-27 Thread Marc Weber
> -- packages: HList > {-# OPTIONS_GHC -fallow-undecidable-instances -XEmptyDataDecls > -XMultiParamTypeClasses #-} > module Main where > import Data.HList > import HAppS.Data > import System.Environment > > > class TypeTo

Re: [Haskell-cafe] Cleaning up the Debian act (report from the trenches)

2008-08-27 Thread David House
2008/8/25 Ketil Malde <[EMAIL PROTECTED]>: > 1. Etch comes with ghc-6.6, and that didn't work with my .cabal file. Is it not an option to make your software work with the not-quite-latest compiler? 6.8 is less than a year old, so I imagine 6.6 is still in quite a few major distro's stable reposito

Re: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Jules Bean
Bulat Ziganshin wrote: Hello Jules, Wednesday, August 27, 2008, 7:21:46 PM, you wrote: given these constraints, it should be just a 10-20 lines of code, and provide much better efficiency than any tree/trie implementations Prove it. To get "much better efficient" than a trie, the hash f

Re: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Daniel Fischer
Am Mittwoch, 27. August 2008 17:36 schrieb Bulat Ziganshin: > Hello Jules, > > Wednesday, August 27, 2008, 7:21:46 PM, you wrote: > >> given these constraints, it should be just a 10-20 lines of code, and > >> provide much better efficiency than any tree/trie implementations > > > > Prove it. > > >

Re: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Jed Brown
On Wed 2008-08-27 16:21, Jules Bean wrote: > Bulat Ziganshin wrote: >> Hello haskell-cafe, >> >> solving one more task that uses English dictionary, i've thought: why we >> don't yet have pure hashtable library? There is imperative hashtables, >> pretty complex as they need to rebuild entire tabl

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Jules, Wednesday, August 27, 2008, 7:21:46 PM, you wrote: >> given these constraints, it should be just a 10-20 lines of code, and >> provide much better efficiency than any tree/trie implementations > Prove it. > To get "much better efficient" than a trie, the hash function has to be >

Re: [Haskell-cafe] 2 modules in one file

2008-08-27 Thread Henrik Nilsson
Hi, Yitzchak Gale wrote: > But for large and complex projects, this policy really complicates > the task of the project manager who wants to be able to > present various views of the source to teams working on > different subprojects, while juggling the version control > in an intelligent way. D

Re: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Jules Bean
Bulat Ziganshin wrote: Hello haskell-cafe, solving one more task that uses English dictionary, i've thought: why we don't yet have pure hashtable library? There is imperative hashtables, pretty complex as they need to rebuild entire table as it grows. There is also simple assoc lists and tree

Re: [Haskell-cafe] Re: [Haskell] Another First course in Haskell

2008-08-27 Thread Johannes Waldmann
Neil Mitchell wrote: >> If you want to program Haskell, get the basics sorted. Once you have >> sorted the basics of functional programming, you can move on to the >> Haskell specific bits. The course I learnt from at York left out >> things such as modules, type classes (beyond slight Eq/Ord >> s

Re: [Haskell-cafe] 2 modules in one file

2008-08-27 Thread Yitzchak Gale
Maurí­cio wrote: >> Is it allowed to write two >> different modules in a single >> file? That would be a really nice feature, especially since modules are Haskell's only encapsulation tool. You want it to be a lightweight as possible. Malcolm Wallace wrote: > Some compilers permit it (e.g. Freja)

Re: [Haskell-cafe] Re: apparent minor bug in "Getting started" tutorial at "Haskell Hacking: a journal of Haskell programming"

2008-08-27 Thread Brandon S. Allbery KF8NH
On 2008 Aug 27, at 3:28, Benjamin L.Russell wrote: On Wed, 27 Aug 2008 16:22:56 +0900, Benjamin L.Russell <[EMAIL PROTECTED]> wrote: Sorry, what I really meant was not to update the reference to "a.out" to be changed to "main.exe", but to change the following line: This produces a new executabl

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Adrian Hey
Lennart Augustssom wrote: Since at some point you have to interface with the hardware you are forced to obey whatever convention is used for interrupts etc. At that point you may very well have to use global variables. But you can quickly abstract away from that in stay in the safe land without

[Haskell-cafe] HEq and Context reduction stack overflow

2008-08-27 Thread Marc Weber
On Mon, Aug 25, 2008 at 09:17:19PM -0400, jeff p wrote: > The HList paper (http://homepages.cwi.nl/~ralf/HList/) presents a Thanks Jeff -- packages: HList {-# OPTIONS_GHC -fallow-undecidable-instances -XEmptyDataDecls -XMultiParamTypeClasses #-} module Main where

Re: [Haskell-cafe] best runProcess solution to work with windows and linux

2008-08-27 Thread Philip Weaver
On Wed, Aug 27, 2008 at 5:40 AM, Andrew U. Frank <[EMAIL PROTECTED] > wrote: > i use System.POSIX.IO to run a process and access the handles (after due > transformation) to get the values back. > this solution is unfortunately not portable and works only on unix (or > cygwin) but not for plain win

Re: [Haskell-cafe] Re: [Haskell] Another First course in Haskell

2008-08-27 Thread Neil Mitchell
> That book is about teaching Haskell, not advertising it. If I wanted > to advertise how cool Haskell was, I probably wouldn't dwell on lists. > But to learn Haskell, I spent the first few years doing either list > processing or very simple algebraic data types, and I think it made me > a better p

Re: [Haskell-cafe] Re: [Haskell] Another First course in Haskell

2008-08-27 Thread Johannes Waldmann
Darrin Thompson wrote: > If functions on lists isn't the thing, what is the thing? "Data structures" > isn't a very satisfactory answer for a n00b like me, because it doesn't > capture Haskell's distinctive. [...] Well indeed you can (should) have problem-specific (algebraic) data types in any la

Re: [Haskell-cafe] Re: [Haskell] Another First course in Haskell

2008-08-27 Thread Neil Mitchell
Hi > (*) that's the main problem I see with Hutton's book > http://www.cs.nott.ac.uk/~gmh/book.html : > it has "Declaring types and classes" as chapter 10 (of 13 total). > I think that's way off - and it leaves readers (students) > with the impression that declarative programming > basically deals

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread John Meacham
I think a strong advantage of the straight up ACIO formulation (rather than a one-shot IO based thing) is that it can be fully, correctly, and safely be defined without referencing the IO monad or its interaction with the IO monad at all. In practice, ACIO will be generally be used to interact with

Re: [Haskell-cafe] Re: [Haskell] Another First course in Haskell

2008-08-27 Thread Darrin Thompson
On Sat, Aug 23, 2008 at 8:41 AM, Johannes Waldmann < [EMAIL PROTECTED]> wrote: > (*) that's the main problem I see with Hutton's book > http://www.cs.nott.ac.uk/~gmh/book.html: > it has "Declaring types and classes" as chapter 10 (of 13 total). > I think

Re: [Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Adrian Hey
Judah Jacobson wrote: I've been wondering: is there any benefit to having top-level ACIO'd <- instead of just using runOnce (or perhaps "oneshot") as the primitive for everything? For example: oneshot uniqueRef :: IO (MVar Integer) uniqueRef =< newMVar 0 I've been wondering about something li

[Haskell-cafe] best runProcess solution to work with windows and linux

2008-08-27 Thread Andrew U. Frank
i use System.POSIX.IO to run a process and access the handles (after due transformation) to get the values back. this solution is unfortunately not portable and works only on unix (or cygwin) but not for plain windows. there seems to be a somewhat comparable package in system.win32.process. is ther

Re: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Jan-Willem Maessen
On Aug 27, 2008, at 3:41 AM, Bulat Ziganshin wrote: Hello haskell-cafe, solving one more task that uses English dictionary, i've thought: why we don't yet have pure hashtable library? There is imperative hashtables, pretty complex as they need to rebuild entire table as it grows. There is

[Haskell-cafe] Re: [Haskell] Top Level <-

2008-08-27 Thread Adrian Hey
Ashley Yakeley wrote: Adrian Hey wrote: Maybe it would be safest to just say anything with a finaliser can't be created at the top level. Do you have an example of something that is correctly ACIO to create, but has a problematic finaliser? Sorry for the delay in getting my attention. I've

Re: [Haskell-cafe] Re: problem with cabal for syb-with-class

2008-08-27 Thread Claus Reinke
Cabal doesn't have to pass on ghc's messages uninterpreted. That's a lot like implementing a map as a list and complaining about empty list instead of element not found. I see what you're saying, but in practise it's just not possible. GHC can return a non-zero exit code for a multitude of reaso

  1   2   >