Re: [Haskell-cafe] overloaded overloading?

2010-01-12 Thread Brad Larsen
Alberto, On Tue, Jan 12, 2010 at 7:17 PM, Alberto G. Corona wrote: > Hi, > > I sometimes strumble on the same quiestion that forces me to insert > functions that process objects of a certain class inside their class > definition.  This occurs when a computation uses the object internally, > neite

Re: Re[6]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-16 Thread Brad Larsen
On Wed, Dec 16, 2009 at 11:27 AM, Don Stewart wrote: [...] >> The bug described in Ticket #650, AFAICS, prevents implementation of a >> reasonable, generic hash table in Haskell.  :-( > > You can certainly implement it, it just requires that you increase the > heap size to a bit bigger than your h

Re: Re[6]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-15 Thread Brad Larsen
Serguey, On Tue, Dec 15, 2009 at 1:07 PM, Serguey Zefirov wrote: now i see what you mean. no, i mean trivial transformation. #650 says about slow GC. why it's slow? because once you made any update to the array, the entire array is marked as updated and scanned on next minor GC >>>

Re: [Haskell-cafe] Boxed Mutable Arrays

2009-12-15 Thread Brad Larsen
On Tue, Dec 15, 2009 at 12:00 PM, Gregory Collins wrote: > Bulat Ziganshin writes: > >> now i see what you mean. no, i mean trivial transformation. #650 says >> about slow GC. why it's slow? because once you made any update to the >> array, the entire array is marked as updated and scanned on nex

Re: Re[6]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-15 Thread Brad Larsen
On Tue, Dec 15, 2009 at 11:33 AM, Serguey Zefirov wrote: >>> If the number of buckets was fixed, one could use an array of STRefs >>> to lists.  I believe this would avoid the bug from Ticket #650? >> now i see what you mean. no, i mean trivial transformation. #650 says >> about slow GC. why it's

Re: Re[4]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-15 Thread Brad Larsen
On Tue, Dec 15, 2009 at 11:00 AM, Bulat Ziganshin wrote: > Hello Brad, > > Tuesday, December 15, 2009, 6:53:14 PM, you wrote: > How about a fast STHashTable? >>> >>> you can use array of arrays instead of large array > >> Can you elaborate? > > what exactly? how to implement this or why it wi

Re: Re[2]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-15 Thread Brad Larsen
Bulat, On Tue, Dec 15, 2009 at 1:51 AM, Bulat Ziganshin wrote: > Hello Brad, > > Tuesday, December 15, 2009, 1:55:41 AM, you wrote: > >> How about a fast STHashTable? > > you can use array of arrays instead of large array > > -- > Best regards, >  Bulat                            mailto:bulat.zig

Re: [Haskell-cafe] Boxed Mutable Arrays

2009-12-14 Thread Brad Larsen
On Mon, Dec 14, 2009 at 4:34 PM, Don Stewart wrote: > brad.larsen: >> The vector package on haskell has boxed arrays.  Is DPH *really* only >> for primitive, unboxed types?  If so, that's unfortunate. > > No, it's not only, but all the uses I've seen have been related to > numerics, represented wi

Re: [Haskell-cafe] Boxed Mutable Arrays

2009-12-14 Thread Brad Larsen
Don, On Mon, Dec 14, 2009 at 4:16 PM, Don Stewart wrote: > brad.larsen: >> Is anyone working on fixing ticket #650 >> ?  In short, STArray >> and the garbage collector don't play well together, resulting in array >> updates being non-constant time o

[Haskell-cafe] Boxed Mutable Arrays

2009-12-14 Thread Brad Larsen
Is anyone working on fixing ticket #650 ? In short, STArray and the garbage collector don't play well together, resulting in array updates being non-constant time operations. This bug makes it very difficult/impossible to write efficient array algor

Re: [Haskell-cafe] Simple hash table creation

2009-11-17 Thread Brad Larsen
On Tue, Nov 17, 2009 at 4:22 PM, michael rice wrote: > > So, what you're telling me is, my dummy hash function IS being used, and > because of collisions the other values are placed in different locations? > > Michael [...] If Data.HashTable is implemented using separate chaining, then all the k

Re: [Haskell-cafe] Simple hash table creation

2009-11-17 Thread Brad Larsen
On Tue, Nov 17, 2009 at 4:00 PM, michael rice wrote: > > Hi Gregory, > > I was wondering about that, because of the following: > > [1 of 1] Compiling Main ( hash1.hs, interpreted ) > Ok, modules loaded: Main. > *Main> ht <- new (==) dummy :: IO MyHashTable > *Main> dummy "mike" > 7 > *

Re: [Haskell-cafe] help with Haskell performance

2009-11-10 Thread Brad Larsen
On Tue, Nov 10, 2009 at 8:20 PM, Gokul P. Nair wrote: > --- On Sat, 11/7/09, Don Stewart wrote: > > General notes: > > > > * unpack is almost always wrong. > > * list indexing with !! is almost always wrong. > > * words/lines are often wrong for parsing large files (they build large > list st

Re: [Haskell-cafe] Exponential complexity of type checking (Was: Type-level naturals & multiplication)

2009-10-13 Thread Brad Larsen
On Tue, Oct 13, 2009 at 12:32 PM, Serguey Zefirov wrote: > 2009/10/13 Lennart Augustsson : >> Yes, there are simple H-M examples that are exponential. >> x0 = undefined >> x1 = (x1,x1) >> x2 = (x2,x2) >> x3 = (x3,x3) >> ... >> >> xn will have a type with 2^n type variables so it has size 2^n. > >

[Haskell-cafe] Exponential complexity of type checking (Was: Type-level naturals & multiplication)

2009-10-13 Thread Brad Larsen
at least very bad. Are there any simple, well-known examples where Haskell type inference has exponential complexity? Or Hindley-Milner type inference, for that matter? (Haskell 98 is not quite Hindley-Milner?) Sincerely, Brad Larsen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Type-level naturals & multiplication

2009-10-13 Thread Brad Larsen
On Tue, Oct 13, 2009 at 3:37 AM, Simon Peyton-Jones wrote: [...] > It's also worth noting that while "undecidable" instances sound scary, but > all it means is that the type checker can't prove that type inference will > terminate.  We accept this lack-of-guarantee for the programs we *run*, and

Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-10 Thread Brad Larsen
On Sat, Oct 10, 2009 at 5:11 PM, Don Stewart wrote: > brad.larsen: >> John, >> >> On Thu, Oct 8, 2009 at 3:20 PM, John A. De Goes wrote: >> [...] >> > JVM is cross-platform, and contains sufficient typing information to >> > permit one to write something like, "import foreign jvm >> > java.list.C

[Haskell-cafe] Type-level naturals & multiplication

2009-10-10 Thread Brad Larsen
Suppose we implement type-level naturals as so: data Zero data Succ a Then, we can reflect the type-level naturals into a GADT as so (not sure if ``reflect'' is the right terminology here): data Nat :: * -> * where Zero :: Nat Zero Succ :: Nat a -> Nat (Succ a) Using type families, we can t

Re: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-10 Thread Brad Larsen
John, On Thu, Oct 8, 2009 at 3:20 PM, John A. De Goes wrote: [...] > JVM is cross-platform, and contains sufficient typing information to > permit one to write something like, "import foreign jvm > java.list.Collection", and have typed access to the whole class and all of > its methods. [...] Ha

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Brad Larsen
On Mon, Oct 5, 2009 at 10:36 AM, Miguel Mitrofanov wrote: [...] > Of course, it's OK to call anything "numbers" provided that you stated > explicitly what exactly you would mean by that. But then you have to drop > all kind of stuff mathematicians developed for the usual notion of numbers. > In th

Re: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.

2009-09-29 Thread Brad Larsen
Don, On Mon, Sep 28, 2009 at 11:52 PM, Don Stewart wrote: > brad.larsen: >> On Mon, Sep 28, 2009 at 11:11 PM, Hong Yang wrote: >> [...] >> > Maybe later on we can add an Example section to Description, Synopsis, and >> > Documentation sections produced by Haddock. >> > >> > Also, having a sectio

Re: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.

2009-09-28 Thread Brad Larsen
On Mon, Sep 28, 2009 at 11:11 PM, Hong Yang wrote: [...] > Maybe later on we can add an Example section to Description, Synopsis, and > Documentation sections produced by Haddock. > > Also, having a section for comments is helpful. This is the case especially > when there are several similar packa

Re: [Haskell-cafe] A proposals

2009-09-27 Thread Brad Larsen
On Sun, Sep 27, 2009 at 5:29 PM, Louis Wasserman wrote: > I'd like to see something resembling as-patterns in type signatures. > Specifically, there are cases where I'm inclined to use > (m ~ pat) in a type context when m isn't otherwise constrained, just so I > can use m as an abbreviation for pa

Re: [Haskell-cafe] An issue with EDSLs in the ``finally tagless'' tradition

2009-09-26 Thread Brad Larsen
Edward, On Sat, Sep 26, 2009 at 11:41 AM, Edward Kmett wrote: > I would just like to add that Oleg and Chung-chieh made sure in their > finally tagless paper to use monomorphic lifting of literals explicitly to > avoid this sort of ambiguity. Using Num or another typeclass is fine as long > as al

[Haskell-cafe] Re: Beginning of a meta-Haskell [was: An issue with the ``finally tagless'' tradition]

2009-09-25 Thread Brad Larsen
Oleg, On Thu, Sep 24, 2009 at 1:54 AM, wrote: > > The topic of an extensible, modular interpreter in the tagless final > style has come up before. A bit more than a year ago, on a flight from > Frankfurt to San Francisco I wrote two interpreters for a trivial > subset of Haskell or ML (PCF actua

Re: [Haskell-cafe] An issue with EDSLs in the ``finally tagless'' tradition

2009-09-24 Thread Brad Larsen
Wren, On Thu, Sep 24, 2009 at 8:36 PM, wren ng thornton wrote: > Brad Larsen wrote: >> >> The modularity problem I speak of is that to add a new interpretation of >> the >> DSL, I will likely have to modify the EDSL definition to add additional >> constraints.

Re: [Haskell-cafe] An issue with EDSLs in the ``finally tagless'' tradition

2009-09-24 Thread Brad Larsen
Bruno, On Thu, Sep 24, 2009 at 1:20 AM, Bruno Oliveira wrote: > Hello Brad, > > I believe that the problem you encountered is not quite the expression > problem (which is about adding new constructors and functions modularly), > but rather about refining *existing* constructs with more specific t

Re: [Haskell-cafe] An issue with EDSLs in the ``finally tagless'' tradition

2009-09-24 Thread Brad Larsen
modules, without having to go back and change the EDSL definition. Regards, Bradford Larsen On Sep 24, 2009 2:15 AM, "Luke Palmer" wrote: On Wed, Sep 23, 2009 at 10:24 PM, Brad Larsen wrote: > On Wed, Sep 23, 2009 ... >> I would like to see an example of this unmodularity

Re: [Haskell-cafe] An issue with EDSLs in the ``finally tagless'' tradition

2009-09-23 Thread Brad Larsen
Peter, On Thu, Sep 24, 2009 at 12:22 AM, Peter Gammie wrote: [...] > Ambiguity is IMHO best handled with a judicious application of type (or > data) families, but you can get surprisingly far by simply requiring that > every class member mention all type variables in the class head. YMMV of > co

Re: [Haskell-cafe] An issue with EDSLs in the ``finally tagless'' tradition

2009-09-23 Thread Brad Larsen
Luke, On Wed, Sep 23, 2009 at 11:12 PM, Luke Palmer wrote: > On Wed, Sep 23, 2009 at 7:59 PM, Brad Larsen wrote: >> The trouble comes in when defining a more general arithmetic >> expression type class. Suppose we want polymorphic arithmetic >> expressions: >> >&g

Re: [Haskell-cafe] An issue with EDSLs in the ``finally tagless'' tradition

2009-09-23 Thread Brad Larsen
Luke, On Wed, Sep 23, 2009 at 11:12 PM, Luke Palmer wrote: > On Wed, Sep 23, 2009 at 7:59 PM, Brad Larsen wrote: >> The trouble comes in when defining a more general arithmetic >> expression type class. Suppose we want polymorphic arithmetic >> expressions: >> >&g

[Haskell-cafe] An issue with EDSLs in the ``finally tagless'' tradition

2009-09-23 Thread Brad Larsen
I seem to have run into an instance of the expression problem [1], or something very similar, when experimenting with ``finally tagless'' EDSLs, and don't see a good way to work around it. I have been experimenting with embedded DSLs, using the techniques described in a couple recent papers [2,3].

Re: [Haskell-cafe] Re: cabal: : openFile: does not exist (No such file or directory)

2009-09-02 Thread Brad Larsen
I had the same issue, using the ghc 6.10.4 "generic linux" tarball on Ubuntu Jaunty x86_64. I attempted to install a newer Haskell Platform over the older one. I'm not sure what causes the issue. After several attempts to remedy it without success, I ended up completely reinstalling ghc and ghc-

[Haskell-cafe] Painful Data Abstraction

2009-04-07 Thread Brad Larsen
ly have to write the type signatures on the properties in one place, but it is still less than ideal. Is there a better way of doing this, or is Haskell simply not good at this kind of data abstraction? Best, Brad Larsen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Haskell as a religion

2008-12-18 Thread Brad Larsen
laziness anytime soon, nor Python compile-time type inference. > > I think perl6 is specced with pervasive laziness, although I'm not > sure it's actually implemented anywhere. I'm not sure about pervasive, but I read somewhere that Perl 6's lists are hea

Re: [Haskell-cafe] Re: Go Haskell! -> array libraries

2008-11-29 Thread Brad Larsen
t my attention, and now I'm curious. Surely you don't mean C-style arrays. :-D Regards, Brad Larsen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Very silly

2008-10-13 Thread Brad Larsen
to your > join. > > Now, as to what C++ templates have to do with Haskell type classes, I > dunno... In the next C++ standard, type checking capabilities are being added to templates---"concepts" specify a set of operations a templated type must support. See <http://en

Re: [Haskell-cafe] timing question

2008-08-03 Thread Brad Larsen
low foldl1' from Data.List is strict in its function argument, and is probably what you want. See also <http://www.haskell.org/haskellwiki/Stack_overflow>. Regards, Brad Larsen On Sun, 03 Aug 2008 07:06:40 -0400, Arie Groeneveld <[EMAIL PROTECTED]> wrote: > Sorry, should go th

Re: [Haskell-cafe] a really dumb posting question ;^(

2008-07-30 Thread Brad Larsen
Vasili, You respond to whatever message interests you, just like normal email. Make sure the message is CC'd or addressed to haskell-cafe@haskell.org to allow everyone to see it. Regards, Brad Larsen 2008/7/31 Galchin, Vasili <[EMAIL PROTECTED]>: > Hello, > > What do I

Re: [Haskell-cafe] More fun with micro-benchmarks and optimizations. (GHC vs Perl)

2008-07-23 Thread Brad Larsen
s compared to the Corey's perl version: $ time perl Sum.pl Duration (sec): 3155.6266438 real0m0.181s user0m0.164s sys 0m0.012s Regards, Brad Larsen On Wed, 23 Jul 2008 15:01:24 -0400, Don Stewart <[EMAIL PROTECTED]> wrote: > coreyoconnor: >> I have the need

Re: [Haskell-cafe] Integer = infinite precision integer? How?

2008-07-03 Thread Brad Larsen
placingGMPNotes>). Regards, Brad Larsen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Type issues for a foldable trie in Haskell

2008-01-20 Thread Brad Larsen
bling :-). How might I rewrite my datatypes to do what I want, preferably without using ghc extensions? Thanks! Brad Larsen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Type System (Was: Currying and Partial Evaluation)

2008-01-08 Thread Brad Larsen
u referring to the type of y being described with 'b' instead of 'a'? Cheers, Brad Larsen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] A Foldable binary search tree

2007-12-23 Thread Brad Larsen
On Sun, 23 Dec 2007 06:42:52 -0500, Neil Mitchell <[EMAIL PROTECTED]> wrote: Hi Brad, > Experience has taught me to _never_ put class contexts on data > definitions. Now you can't write something as simple as "Empty" - you > have to give it a class context. This is just plain annoying. With

Re: [Haskell-cafe] A Foldable binary search tree

2007-12-22 Thread Brad Larsen
On Sat, 22 Dec 2007 22:41:37 -0500, Neil Mitchell <[EMAIL PROTECTED]> wrote: Hi data (Ord a) => BST a = Empty | BST (BST a) a (BST a) Experience has taught me to _never_ put class contexts on data definitions. Now you can't write something as simple as "Empty" - you have to give it a class

[Haskell-cafe] A Foldable binary search tree

2007-12-22 Thread Brad Larsen
econd line of the foldr definition. If I remove the (Ord a) context from the BST data definition, ghc accepts my code. However, I'd like to keep that context. How does one do this? Thanks! Brad Larsen P.S. Does that definition of foldr look reasonable, i.e. is it associating in the

Re: [Haskell-cafe] Why does this blow the stack?

2007-12-21 Thread Brad Larsen
_ = error "Prelude.!!: index too large" (x:_) !! 0 = x (_:xs) !! n = xs !! (n-1) Isn't this tail recursive? What is eating up the stack? Brad Larsen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http:

Re: [Haskell-cafe] Creating a type for a subset of the integers

2007-12-20 Thread Brad Larsen
On Wed, 19 Dec 2007 02:00:53 -0500, Jules Bean <[EMAIL PROTECTED]> wrote: Brad Larsen wrote: Hi there list, How would one go about creating a new type for a subset of the integers, for (contrived) example just the even integers? I was thinking of making a new type newtype E

[Haskell-cafe] Creating a type for a subset of the integers

2007-12-18 Thread Brad Larsen
prevent this, the module does not export the constructor for it---rather, the module exports a function `mkEvenInt' that creates an EvenInt if the given value is acceptable or raises an error otherwise. What's the right way to do this? Thanks! B