Re: [Haskell-cafe] Re: Time for a new logo?

2008-12-17 Thread wren ng thornton
Jeff Wheeler wrote: On Dec 16, 2008, at 10:08 PM, Ryan Grant wrote: nice. the first is better. in the second, i don't even see the lambda. Thanks the feedback. I just uploaded a new version [1] that is icon-sized, although the font used is Helvetica Neue, which is non-free. I have no free

intimidating terminology (was: Re: [Haskell-cafe] Time for a new logo?)

2008-12-18 Thread wren ng thornton
quoth Andrew Coppin: quoth Tristan Seligmann: quoth Andrew Coppin: Sure, there are many concepts in Haskell which just aren't found anywhere else. But monads? Catamorphisms? Coroutines? Couldn't we think up some less intimidating terminology? The problem is that less

Re: [Haskell-cafe] lengthOP rewrite rules

2008-12-18 Thread wren ng thornton
Luke Palmer wrote: This does not answer your question, but you can solve this problem without rewrite rules by having length return a lazy natural: data Nat = Zero | Succ Nat And defining lazy comparison operators on it. And if you want to go that route, then see

Re: [Haskell-cafe] Detecting system endianness

2008-12-18 Thread wren ng thornton
In a similar vein, is there already a function available to give the size of Word in bytes? Or should I write the usual Ptr conversion tricks to figure it out? Holger Siegel wrote: On Thursday 18 December 2008 13:40:47 Ryan Ingram wrote: Actually, this is probably safer: import

[Haskell-cafe] ANN: bytestring-trie 0.1.0

2008-12-19 Thread wren ng thornton
-- Announcing: bytestring-trie 0.1.0 (beta) An efficient finite map from (byte)strings to values. The implementation is based on big-endian patricia trees, like Data.IntMap. We first trie on the Word8

Re: [Haskell-cafe] Re: Detecting system endianness

2008-12-19 Thread wren ng thornton
Maurí­cio wrote: But why would you want that? I understand the only situation when talking about number of bytes makes sense is when you are using Foreign and Ptr. Besides that, you can only guess the amount of memory you need to deal with your data (taking laziness, GC etc. into account).

Re: [Haskell-cafe] Re: Detecting system endianness

2008-12-23 Thread wren ng thornton
Maurí­cio wrote: But why would you want that? I understand the only situation when talking about number of bytes makes sense is when you are using Foreign and Ptr. (...) Because I'm using both Ptr and Foreign? ;) See my recent announcement for bytestring-trie. One of the

Re: [Haskell-cafe] Is this related to monomorphism restriction?

2008-12-23 Thread wren ng thornton
Maurí­cio wrote: Hi, Why isn't the last line of this code allowed? f :: (TestClass a) = a - Integer f = const 1 a = (f,f) g = fst a Just to make explicit what other folks have brought up in passing. The real type of @f@ (that is without syntactic sugar) is: f :: forall a. TestClass a

Re: [Haskell-cafe] Type classes vr.s functions

2008-12-23 Thread wren ng thornton
Brian Hurt wrote: So, style question for people, if I can. I have a certain problem- basically, I have a bunch of functions which need a special function, of type a - Foo say. And a bunch of other functions which can define that function on some type of interest, and then what to call the

Re: [Haskell-cafe] ANN: Control.Monad.IfElse 0.85

2008-12-29 Thread wren ng thornton
Jeff Heard wrote: Updated Control.Monad.IfElse to include Wren Thornton's Control.Monad.Extras, unlessM, ncond (unless-else chaining), ncondM, and more binary conditional operators. Hackage's Haddock seems to have eaten the documentation for the new functions (though some should have less

Re: [Haskell-cafe] Timing difference

2008-12-29 Thread wren ng thornton
Aai wrote: Hi Bulat, That I (can) understand, but of course the main question is: is point free in (some/several/all) cases faster than the more readable lambda construction? That's to say when executed in GHCi. I noticed this behavior before (pity I haven't other examples at hand). In prog.

Re: [Haskell-cafe] Don't make 'show*' functions

2008-12-29 Thread wren ng thornton
Thomas DuBuisson wrote: Jeff Heard proclaimed: There are multiple distinct reasons people use Show, and this gets confusing. This is exactly what I was getting at. I see four uses being discussed: Indeed, though I think the situation is even worse. It seems to me that there are a number

Re: [Haskell-cafe] What are side effects in Haskell?

2008-12-29 Thread wren ng thornton
Hans van Thiel wrote: However, there is a mechanism (sometimes) to compose functions using an extra type m a, m b, m c etc. instead of types a, b, c... This does not solve the problem concerning side effects, but it does provide a sort of 'Chinese boxes' to contain them within these type

Re: [Haskell-cafe] Don't make 'show*' functions

2009-01-02 Thread wren ng thornton
Henning Thielemann wrote: I think, that a user who uses GHCi becomes a developer. For me a user is someone who calls compiled Haskell programs. GHCi makes for a great calculator. I agree that, to a first approximation, users call compiled binaries and developers use GHCi. But there's a big

[Haskell-cafe] ANN: bytestring-trie 0.1.1 (bugfix)

2009-01-03 Thread wren ng thornton
-- bytestring-trie 0.1.1 (bugfix) An efficient finite map from (byte)strings to values. The implementation is based on big-endian patricia trees, like Data.IntMap. We first trie on the Word8 elements of a

[Haskell-cafe] [Fwd: Re: ANN: bytestring-trie 0.1.1 (bugfix)]

2009-01-04 Thread wren ng thornton
Original Message Message-ID: 496176cf.3090...@freegeek.org Date: Sun, 04 Jan 2009 21:56:15 -0500 From: wren ng thornton w...@freegeek.org User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-Version: 1.0 To: ChrisK hask...@list.mightyreason.com Subject: Re: ANN

[Haskell-cafe] ANN bytestring-trie 0.1.2 (bugfix)

2009-01-05 Thread wren ng thornton
-- bytestring-trie 0.1.2 (bugfix) Another bugfix release for efficient finite maps from (byte)strings to values. Release early, release often. -- Changes

[Haskell-cafe] Staged evaluation, names?

2009-01-07 Thread wren ng thornton
Dear Cafe, Every now and then I find myself in the position where I'd like to define some hairy value as a CAF instead of a literal, but I'd like for it to be fully evaluated at compile-time rather than postponed until runtime. It'd be possible to bludgeon the CPP into doing this, but it

Re: [Haskell-cafe] data declarations should provide fold functions

2009-01-07 Thread wren ng thornton
Tim Newsham wrote: I know the short-term answer is use TH to derive folds if I want them, but I think such an important concept should probably be part of the language. If you don't mind the hairy code, there's always this generic answer from #haskell almost a year ago:

Re: [Haskell-cafe] Staged evaluation, names?

2009-01-09 Thread wren ng thornton
Andrea Vezzosi wrote: On Thu, Jan 8, 2009 at 5:25 AM, wren ng thornton w...@freegeek.org wrote: The question for y'all is what should I call it? I've been calling the template-function qaf (for Compiled Applicative Form ;) and the type class with that function would be the only thing

Re: [Haskell-cafe] Staged evaluation, names?

2009-01-09 Thread wren ng thornton
Henning Thielemann wrote: wren ng thornton schrieb: Every now and then I find myself in the position where I'd like to define some hairy value as a CAF instead of a literal, but I'd like for it to be fully evaluated at compile-time rather than postponed until runtime. It'd be possible

Re: [Haskell-cafe] Staged evaluation, names?

2009-01-09 Thread wren ng thornton
wren ng thornton wrote: Andrea Vezzosi wrote: On Thu, Jan 8, 2009 at 5:25 AM, wren ng thornton w...@freegeek.org wrote: The question for y'all is what should I call it? I've been calling the template-function qaf (for Compiled Applicative Form ;) and the type class with that function would

[Haskell-cafe] ANN: bytestring-trie 0.1.4

2009-01-11 Thread wren ng thornton
-- bytestring-trie 0.1.4 Another release for efficient finite maps from (byte)strings to values. Equal parts bugfix release and real release. This upgrade is suggested for all users and is what 0.1.0

Re: [Haskell-cafe] ANN: bytestring-trie 0.1.4

2009-01-12 Thread wren ng thornton
Don Stewart wrote: Do you have any benchmarks comparing dictionaries against Map ByteString Int, or Map String Int? I haven't personally run them, but Mark Wotton has compared [(ByteString,Int)] vs (Map ByteString Int) vs (Trie Int) version 0.1.1 or 0.1.2 and using data from

Re: [Haskell-cafe] Real World Haskell: confusion

2009-01-13 Thread wren ng thornton
Anton van Straaten wrote: Derek Elkins wrote: * A related annoyance is people who talk about languages supporting currying and/or partial application. Unless one means that the language supports higher order functions at all by that, it doesn't make any sense. Haskell has no support for

Re: [Haskell-cafe] real haskell difficulties (at least for me)

2009-01-17 Thread wren ng thornton
Duncan Coutts wrote: It may well be tempting to plague maintainers until they fix their packages however in practise it will not work. We want a low barrier to entry for packages on hackage and we do not want to annoy package maintainers to the point where they decide to stop using hackage at

Re: [Haskell-cafe] Slow Text.JSON parser

2009-01-17 Thread wren ng thornton
Ketil Malde wrote: Sjoerd Visscher sjo...@w3future.com writes: JSON is a UNICODE format, like any modern format is today. ByteStrings are not going to work. Well, neither is String as used in the code I responded to. I'm not intimately familiar with JSON, but I believe ByteStrings would

Re: [Haskell-cafe] Re: Comments from OCaml Hacker Brian Hurt

2009-01-18 Thread wren ng thornton
John Lato wrote: Here is the current complete documentation for Data.Monoid 'mappend', which happens to be a good example of which I speak: An associative operation That could mean anything. There are lots of associative operations. Yes. In combination with the definition of mempty (the

Re: [Haskell-cafe] Factoring into type classes

2009-01-20 Thread wren ng thornton
Luke Palmer wrote: On Mon, Jan 19, 2009 at 3:58 AM, Patai Gergely patai_gerg...@fastmail.fmwrote: However, there are other type classes that are too general to assign such concrete uses to. For instance, if a data structure can have more than one meaningful (and useful) Functor or Monoid

Re: [Haskell-cafe] Factoring into type classes

2009-01-20 Thread wren ng thornton
Patai Gergely wrote: Hi everyone, I have a general program design question, but I can't really think of good examples so it will be a bit vague. There was a discussion on Show not long ago which brought up the problem that there are several ways to show a data structure, and it depends on the

Re: [Haskell-cafe] Elevator pitch for functional programming

2009-01-20 Thread wren ng thornton
Jim Burton wrote: Hi, I will be a TA on a comparative PL course and I'm looking for small examples (ammunition) which motivate the use of Haskell and functional programming generally. The course is for 1st year Software Engineers, none of whom are likely to have used a functional language. They

Re: [Haskell-cafe] Quite confused by simple transformations on this code not working

2009-01-20 Thread wren ng thornton
Andrew Wagner wrote: Strange little bit of code: http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=829#a829 If I do any of the following, all of which seem natural to me, it fails to typecheck: 1. move f out of the 'where' clause (with or without a type signature) 2. put the same

Re: [Haskell-cafe] Generic typeclass for converting between types

2009-01-24 Thread wren ng thornton
John Goerzen wrote: Magnus Therning wrote: John Goerzen wrote: It's hard to remember all the functions to use to do these. I often resort to a chart I made for numeric conversions. Not the type of response you want, but would you publish that chart somewhere, please ;-) Sure :-)

Re: [Haskell-cafe] Fold that quits early?

2009-01-24 Thread wren ng thornton
On Saturday 24 January 2009 11:39:13 am Andrew Wagner wrote: This is almost a fold, but seemingly not quite? I know I've seem some talk of folds that potentially quit early. but not sure where I saw that, or if it fits. Were thinking of Elgot algebras

Re: [Haskell-cafe] ANN: convertible (first release)

2009-01-27 Thread wren ng thornton
John Goerzen wrote: Hi folks, I have uploaded a new package to Haskell: convertible. At its heart, it's a very simple typeclass that's designed to enable a reasonable default conversion between two different types without having to remember a bunch of functions. I once again point out that

Re: [Haskell-cafe] How outdated is Hugs?

2009-01-28 Thread wren ng thornton
Bryan O'Sullivan wrote: On Tue, Jan 27, 2009 at 1:18 PM, Duncan Coutts duncan.cou...@worc.ox.ac.ukwrote: Not since then, no. However a lot of things work fine, especially if you use a newer Cabal version. I've been unable to figure out how to build Cabal with Hugs 2006.09.04: $ *runhugs

Re: [Haskell-cafe] How outdated is Hugs?

2009-01-28 Thread wren ng thornton
wren ng thornton wrote: Bryan O'Sullivan wrote: On Tue, Jan 27, 2009 at 1:18 PM, Duncan Coutts duncan.cou...@worc.ox.ac.ukwrote: Not since then, no. However a lot of things work fine, especially if you use a newer Cabal version. I've been unable to figure out how to build Cabal with Hugs

[Haskell-cafe] Bugs in Hugs

2009-01-28 Thread wren ng thornton
In testing some of my packages against Hugs, I've uncovered bugs[1]. Unfortunately the bug tracker at: http://hackage.haskell.org/trac/hugs/newticket?type=defect doesn't seem to allow normal users to submit tickets. Does anyone know how to submit bug reports to Hugs these days? [1]

Re: [Haskell-cafe] ANN: convertible (first release)

2009-01-28 Thread wren ng thornton
John Goerzen wrote: wren ng thornton wrote: I once again point out that realToFrac is *wrong* for converting from Float or Double. realToFrac (1/0::Float) ::Double 3.402823669209385e38 Yes, I understand what you are saying and agree with you. But there is nothing better

Re: [Haskell-cafe] ANN: convertible (first release)

2009-01-28 Thread wren ng thornton
John Goerzen wrote: wren ng thornton wrote: John Goerzen wrote: wren ng thornton wrote: I once again point out that realToFrac is *wrong* for converting from Float or Double. Yes, I understand what you are saying and agree with you. But there is nothing better in the standard

Re: [Haskell-cafe] ANN: convertible (first release)

2009-01-28 Thread wren ng thornton
Duncan Coutts wrote: Michael D. Adams wrote: Is there a good reason why Rational is defined in a way that it can not represent Nan, Inf and -Inf? (Any other exceptional values I forgot?) Would fixing the definition so that it can represent those values be sufficient to fix this entire

[Haskell-cafe] ANN: logfloat 0.10, 0.11

2009-01-29 Thread wren ng thornton
-- logfloat 0.10, 0.11 This package provides a type for storing numbers in the log-domain, primarily useful for preventing underflow when multiplying many probabilities as in HMMs and other probabilistic

Re: [Haskell-cafe] type and data constructors in CT

2009-01-31 Thread wren ng thornton
Gregg Reynolds wrote: Hi, I think I've finally figured out what a monad is, but there's one thing I haven't seen addressed in category theory stuff I've found online. That is the relation between type constructors and data constructors. As I understand it, a type constructor Tcon a is

Re: [Haskell-cafe] type and data constructors in CT

2009-02-02 Thread wren ng thornton
Gregg Reynolds wrote: On Sat, Jan 31, 2009 at 4:26 PM, wren ng thornton w...@freegeek.org wrote: But a data constructor Dcon a is an /element/ mapping taking elements (values) of one type to elements of another type. So it too can be construed as a functor, if each type itself

Re: [Haskell-cafe] type metaphysics

2009-02-02 Thread wren ng thornton
Gregg Reynolds wrote: Hi, The concept of type seems to be a little like porno: I know it when I see it, but I can't define it (apologies to Justice Stewart). I've picked through lots of documents that discuss types in various ways, but I have yet to find one that actually says what a type

Re: [Haskell-cafe] Bytestrings vs String?

2009-02-02 Thread wren ng thornton
Marc Weber wrote: A lot of people are suggesting using Bytestrings for performance, strictness whatsoever reasons. However how well do they talk to other libraries? I'm not sure how you mean? For passing them around: If someone's trying to combine your library (version using ByteStrings)

Re: [Haskell-cafe] Elegant powerful replacement for CSS

2009-02-03 Thread wren ng thornton
Thomas Davie wrote: I can imagine the styling language having the meaning function from documents onto geometry, but the document description language is harder. Ideally what I'd like to do with it is to make it describe *only* the logical structure of the information being conveyed –

Re: [Haskell-cafe] Bytestrings vs String? parameters within package names?

2009-02-03 Thread wren ng thornton
Marc Weber wrote: wren ng thornton wrote: I'd just stick with one (with a module for hiding the conversions, as desired). Duplicating the code introduces too much room for maintenance and compatibility issues. That's the big thing. The more people that use ByteStrings the less need

Re: [Haskell-cafe] type metaphysics

2009-02-03 Thread wren ng thornton
Gregg Reynolds wrote: On Mon, Feb 2, 2009 at 2:25 PM, Ketil Malde ke...@malde.org wrote: Gregg Reynolds d...@mobileink.com writes: Just shorthand for something like data Tcon a = Dcon a, applied to Int. Any data constructor expression using an Int will yield a value of type Tcon Int.

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread wren ng thornton
Gregg Reynolds wrote: Right, but that's only because the compiler either somehow knows about side effects or there is some other mechanism - e.g. an implicit World token that gets passed around - that prevents optiimization. As far as the formal semantics of the language are concerned, there's

Re: [Haskell-cafe] Purely funcional LU decomposition

2009-02-05 Thread wren ng thornton
Rafael Gustavo da Cunha Pereira Pinto wrote: What I miss most is a data structure with O(1) (amortized) direct access. Finger trees get close, O(log(min(i,n-i))): http://hackage.haskell.org/packages/archive/containers/latest/doc/html/Data-Sequence.html (And Theta(1) amortized for all

Re: [Haskell-cafe] Switching from Mercurial to Darcs

2009-02-05 Thread wren ng thornton
Roman Cheplyaka wrote: * Peter Verswyvelen bugf...@gmail.com [2009-02-05 16:35:34+0100] On Thu, Feb 5, 2009 at 4:32 PM, Ketil Malde ke...@malde.org wrote: Peter Verswyvelen bugf...@gmail.com writes: 1) hg st darcs cha -s That seems to list all changes in the history. hg st lists local

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread wren ng thornton
Gregg Reynolds wrote: On Thu, Feb 5, 2009 at 7:19 PM, wren ng thornton w...@freegeek.org wrote: Gregg Reynolds wrote: as the formal semantics of the language are concerned, there's no essential difference between getChar = \x - getChar and Foo 3 = \x - Foo 7 for some data constructor Foo

Re: [Haskell-cafe] Monad explanation

2009-02-06 Thread wren ng thornton
Tim Newsham wrote: The only difference with IO then is that to get IO programs to run, you have to do it inside another IO program. Almost. Add to your mental model a runIO that is invoked when your program runs as: runIO main. Your haskell compiler or interpretter arranges this for

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread wren ng thornton
Gregg Reynolds wrote: Tillmann Rendel wrote: An example where it would be wrong to ignore e: sum ([1, 2] = const [21]) This expression should evaluate to sum [21, 21] = 42, not sum [21] = 21. Sigh. I hate it when this happens. Just when I thought I had it figured out, it turns out I'm

Re: [Haskell-cafe] Monad explanation

2009-02-10 Thread wren ng thornton
Richard O'Keefe wrote: Gregg Reynolds wrote: Sure, you can treat a morphism as an object, but only by moving to a higher (or different) level of abstraction. False as a generalisation about mathematics. False about functional programming languages, the very essence of which is treating

Re: [Haskell-cafe] Painting logs to get a coloured tree

2009-02-10 Thread wren ng thornton
minh thu wrote: Joachim Breitner: I thought about Zippers, but I understand that they improve _navigating_ in a Tree-like structure, or to refrence _one_ position in a tree. But if I would deconstruct my tree to the list of _all_ locations, with type Loc a = (Tree a, Cxt a) and then run

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-10 Thread wren ng thornton
Alberto G. Corona wrote: forwarded: Yes! if no state is passed, the optimization makes sense and the term is not executed, like any lazy evaluation. For example, I used the debugger (that is, without optimizations) to verify it with the Maybe monad: op x= x+x print $ Just (op 1) = \y- return

Re: [Haskell-cafe] Changing version numbering schemes for HackageDB packages?

2009-02-11 Thread wren ng thornton
Corey O'Connor wrote: Part of the reason they seem awkward to me is that I expect the difference between version numbers to indicate something about what has changed between the two versions. This only ends up being a heuristic but a useful one. Date based version numbers don't communicate much

Re: [Haskell-cafe] Can this be done?

2009-02-11 Thread wren ng thornton
Cristiano Paris wrote: Manlio Perillo wrote: Cristiano Paris ha scritto: I'm interested in the possibility of stopping/pickling/unpickling/resuming a computation. Not sure this is a good thing in a web application. I'm thinking of complex workflows and inversion of control. A

Re: [Haskell-cafe] Re: [Haskell] Google Summer of Code 2009

2009-02-12 Thread wren ng thornton
Matthew Elder wrote: would love to see this. basic features first i suppose. here are some of my ideas: 1. browseable change history with preview pane (preview pane shows diff and patch message) Extending this idea, I'd like to see some 3D visualization of the file hierarchy and the

Re: [Haskell-cafe] Re: Can this be done?

2009-02-14 Thread wren ng thornton
Chung-chieh Shan wrote: wren ng thornton wrote: It's ugly, but one option is to just reify your continuations as an ADT, where there are constructors for each function and fields for each variable that needs closing over. Serializing that ADT should be simple (unless some of those

Re: [Haskell-cafe] Re: Overloading functions based on arguments?

2009-02-14 Thread wren ng thornton
John A. De Goes wrote: On Feb 13, 2009, at 2:11 PM, Jonathan Cast wrote: The compiler should fail when you tell it two mutually contradictory things, and only when you tell it two mutually contradictory things. By definition, it's not a contradiction when the symbol is unambiguously

Re: [Haskell-cafe] ANNOUNCE: pqueue-mtl, stateful-mtl

2009-02-15 Thread wren ng thornton
Louis Wasserman wrote: I follow. The primary issue, I'm sort of wildly inferring, is that use of STT -- despite being pretty much a State monad on the inside -- allows access to things like mutable references? That's exactly the problem. The essential reason for ST's existence are STRefs

Re: [Haskell-cafe] Re: [Haskell] ANN: The Typeclassopedia, and request for feedback

2009-02-16 Thread wren ng thornton
Isaac Dupree wrote: Natural numbers under min don't form a monoid, only naturals under max do (so you can have a zero element) Though, FWIW, you can use Nat+1 with the extra value standing for Infinity as the identity of min (newtype Min = Maybe Nat). I bring this up mainly because it can

Re: [Haskell-cafe] A typeclass for Data.Map etc?

2009-02-19 Thread wren ng thornton
Eugene Kirpichov wrote: Looks like such a thing would be useful; as for now, I see at least two applications: Data.Map and Data.Trie (bytestring-trie) - it's a pity that they have rather similar interfaces, but the latter lacks many methods and some are named in a different way. Are there any

Re: [Haskell-cafe] Re: A typeclass for Data.Map etc?

2009-02-21 Thread wren ng thornton
Achim Schneider wrote: wren ng thornton w...@freegeek.org wrote: (b) allows instances to have a fixed type for keys (like Data.Trie and Data.IntMap have), Can't we do some type magic to automagically select Data.Trie if the key is a (strict) bytestring? Uh, sure. I was thinking more

Re: [Haskell-cafe] Re: Hoogle and Network.Socket

2009-02-23 Thread wren ng thornton
Achim Schneider wrote: Thomas DuBuisson thomas.dubuis...@gmail.com wrote: I still prefer showing all platform results sorted into separate sections with headers, but understand that I am in the minority. You aren't alone. Labelling them prominently with POSIX, UNIX, Linux, *BSD, OSX resp.

Re: [Haskell-cafe] Stacking StateTs

2009-02-23 Thread wren ng thornton
Luis O'Shea wrote: One way to do this is to stack two StateTs on top of m. Another way, what might be easier to reason about, is to crush those two layers together and use a tuple for the state: StateT s1 (StateT s2 m) a == StateT (s1,s2) m a Then the only thing you'll have to worry

Re: [Haskell-cafe] memory-efficient data type for Netflix data - UArray Int Int vs UArray Int Word8

2009-02-23 Thread wren ng thornton
Kenneth Hoste wrote: Well, I'm using UArray, but I'm willing to consider other suitable containers... As long as they are memory efficient. :-) The typical usage of a UArray will be getting all it's contents, and converting it to a list to easily manipulate (filter, ...). So, maybe another

Re: [Haskell-cafe] Data.Binary poor read performance

2009-02-23 Thread wren ng thornton
Neil Mitchell wrote: 2) The storage for String seems to be raw strings, which is nice. Would I get a substantial speedup by moving to bytestrings instead of strings? If I hashed the strings and stored common ones in a hash table is it likely to be a big win? Bytestrings should help. The big

Re: [Haskell-cafe] Translating an imperative algorithm - negascout

2009-02-27 Thread wren ng thornton
Holger Siegel wrote: loop alpha b (c:cs) = let alpha' = max(alpha, - negascout c d (-b) (-alpha)) in if alpha' = beta then alpha' else if alpha' = b then let alpha'' = - negascout c d (-beta) (-alpha') in if

Re: [Haskell-cafe] Stacking State on State.....

2009-03-01 Thread wren ng thornton
Phil wrote: | After some googling it looked like the answer may be Monad Transformers. | Specifically we could add a StateT transform for our Box Muller state to our | VanDerCorput State Monad. | Google didn¹t yield a direct answer here ­ so I¹m not even sure if my | thinking is correct,

Re: [Haskell-cafe] type universes (was Re: MPTC inheritance

2009-03-01 Thread wren ng thornton
Larry Evans wrote: Except that a kind sounds like a universe at level 2 or 3. IOW, I guess haskell types are at level 1, and kines at level 2? Then I guess values would be at level 0? Exactly. Is there some version of haskell that has more levels in its type universe. If not, it there some

Re: [Haskell-cafe] Supplying a default implementation for a typeclass based on another class

2009-03-01 Thread wren ng thornton
Svein Ove Aas wrote: Martin Huschenbett wrote: instance (Show a,Read a) = Binary a where put = put . show get = fmap read get But then you will need the following language extensions: FlexibleInstances, OverlappingInstances, UndecidableInstances Well, isn't there a good chance it'll end

Re: [Haskell-cafe] Stacking State on State.....

2009-03-01 Thread wren ng thornton
Phil wrote: Again I understand that foldl' is the strict version of foldl, and as we are summing elements we can use either foldl or foldr. I'm assuming this is another thunk optimisation. Does foldl not actually calculate the sum, but moreover it creates an expression of the form

Re: [Haskell-cafe] DSLs with {in,}equalities

2009-03-02 Thread wren ng thornton
Andrew Hunter wrote: Several times now I've had to define an EDSL for working with (vaguely) numeric expressions. For stuff like 2*X+Y, this is easy, looking pretty much like: data Expr = Const Integer | Plus Expr Expr | Times Expr Expr instance Num Expr where fromInterger = Const (+) = Plus

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

2009-03-06 Thread wren ng thornton
Gleb Alexeyev wrote: Here's my attempt though it's not really different from using built-in lists: viewCL CatNil = Nothing viewCL (Wrap a) = Just (a, CatNil) viewCL (Cat a b) = case viewCL a of Nothing - viewCL b Just (x, xs) - Just (x, Cat xs b) My

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)

Re: [Haskell-cafe] Cabal and package changelog

2009-03-08 Thread wren ng thornton
Manlio Perillo wrote: Duncan Coutts ha scritto: On Sun, 2009-03-08 at 10:00 -0400, Gwern Branwen wrote: http://hackage.haskell.org/trac/hackage/ticket/244 http://hackage.haskell.org/trac/hackage/ticket/299 Thanks Gwern. Yes, we're looking for a volunteer to work on implementing this.

Re: [Haskell-cafe] STG's? [was: I want to write a compiler]

2009-03-08 Thread wren ng thornton
Rick R wrote: Where can I find more information on STGs? Google search doesn't bring up anything too enlightening. My curiosity was piqued by http://www.cs.chalmers.se/~gedell/ssc/index.html. Of course it doesn't indicate how these should be built or the format. Perhaps

Re: [Haskell-cafe] Design Patterns by Gamma or equivalent

2009-03-14 Thread wren ng thornton
Mark Spezzano wrote: Because Haskell is not OO, it is functional, I was wondering if there is some kind of analogous “design pattern”/”template” type concept that describe commonly used functions that can be “factored out” in a general sense to provide the same kind of usefulness that Design

Re: [Haskell-cafe] A systematic method for deriving a defintion of foldl using foldr?

2009-03-14 Thread wren ng thornton
R J wrote: 2. I believe that the reverse implementation--namely, implementing foldr in terms of foldl--is impossible. What's the proof of that? As others have said, foldr in terms of foldl is impossible when infinite lists are taken into account. For finite lists it's easy though: (\f z

Re: [Haskell-cafe] Most elegant funciton for removing adjacent duplicates from a list using foldl and foldr

2009-03-15 Thread wren ng thornton
R J wrote: I need to write an implementation using foldl, and a separate implementation using foldr, of a function, remdups xs, that removes adjacent duplicate items from the list xs. For example, remdups [1,2,2,3,3,3,1,1]= [1,2,3,1]. My approach is first to write a direct recursion, as

Re: [Haskell-cafe] What unsafeInterleaveIO is unsafe

2009-03-15 Thread wren ng thornton
Yusaku Hashimoto wrote: Hello, I was studying about what unsafeInterleaveIO is.I understood unsafeInterleaveIO takes an IO action, and delays it. But I couldn't find any reason why unsafeInterleaveIO is unsafe. I have already read an example in

Re: [Haskell-cafe] Design Patterns by Gamma or equivalent

2009-03-16 Thread wren ng thornton
a...@spamcop.net wrote: G'day all. Quoting wren ng thornton w...@freegeek.org: Most of the (particular) problems OO design patterns solve are non-issues in Haskell because the language is more expressive. ...and vice versa. Some of the design patterns that we use in Haskell, for example

[Haskell-cafe] Re: categories and monoids

2009-03-17 Thread wren ng thornton
Wolfgang Jeltsch wrote: Am Dienstag, 17. März 2009 10:54 schrieben Sie: I'm reading the Barr/Wells slides at the moment, and they say the following: Thus a category can be regarded as a generalized monoid, What is a “generalized monoid”? According to the grammatical construction (adjective

Re: [Haskell-cafe] Design Patterns by Gamma or equivalent

2009-03-17 Thread wren ng thornton
Gregg Reynolds wrote: Imperative programmers also used it to describe programming patterns. Implementations of things like Observer/VIsitor etc. are ad-hoc, informal constructions; the equivalent in a functional language is a mathematical structure (feel free to fix my terminology). I don't

Re: [Haskell-cafe] symbolic evaluator for Haskell?

2009-03-17 Thread wren ng thornton
Tim Newsham wrote: Is there a symbolic evaluator for Haskell that will perform all applications except on specified functions? Ie. I would love something that would take foldr (+) (6 `div` 5) [1,2,3*4] and (+) (*) and return 1 + (2 + (3*4 + 1)) by performing all the applications

Re: [Haskell-cafe] Re: A guess on stack-overflows - thunks build-up and tail recursion

2009-03-20 Thread wren ng thornton
GüŸnther Schmidt wrote: the point I wanted to stress though is that the stack overflow does actually not occur doing the recursive algorithm, just a build-up of thunks. The algorithm itself will eventually complete without the stack overflow. The problem occurs when the result value is

Re: [Haskell-cafe] ACM Task for C++ and Java programmers in Haskell. How to make code faster?

2009-03-22 Thread wren ng thornton
Vasyl Pasternak wrote: The entire code I placed on http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2764 Could someone help me to make this code faster? I'd like to see solution that will be elegant and fast, without heavy optimizations, that will make code unreadable. Also, if it possible,

Re: [Haskell-cafe] Use unsafePerformIO to catch Exception?

2009-03-23 Thread wren ng thornton
Xiao-Yong Jin wrote: Hi, I just feel it is not comfortable to deal with exceptions only within IO monad, so I defined tryArith :: a - Either ArithException a tryArith = unsafePerformIO . try . evaluate [...] However, I guess unsafePerformIO definitely has a reason for its name. As I read

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread wren ng thornton
Manlio Perillo wrote: But this may be really a question of personal taste or experience. What is more natural? 1) pattern matching 2) recursion or 1) function composition 2) high level functions Which is more natural: * C-style for-loops (aka assembly while-loops), or * any modern language's

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-25 Thread wren ng thornton
Thomas Hartman wrote: sorry, wrong function. should be partitions [] xs = [] partitions (n:parts) xs = let (beg,end) = splitAt n xs in beg : ( case end of [] - [] xs - partitions parts xs) It's not tail recursive, FWIW. The recursive expression has (:) as

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-25 Thread wren ng thornton
Manlio Perillo wrote: The main problem, here, is that: - recursion and pattern matching are explained in every tutorial about functional programming and Haskell. This is the reason why I find them more natural. - high level, Haskell specific, abstractions, are *not* explained in normal

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-25 Thread wren ng thornton
Dan Weston wrote: So to be clear with the terminology: inductive = good consumer? coinductive = good producer? So fusion should be possible (automatically? or do I need a GHC rule?) with inductive . coinductive Or have I bungled it? Not quite. Induction means starting from base cases

[Haskell-cafe] [OT] Japanese (was: Re: about Haskell code written to be too smart)

2009-03-25 Thread wren ng thornton
Zachary Turner wrote: On Tue, Mar 24, 2009 at 10:32 PM, wren ng thornton w...@freegeek.orgwrote: Both of these conclusions seem quite natural to me, even from before learning Haskell. It seems, therefore, that naturality is not the proper metric to discuss. It's oft overlooked, but the fact

Re: [Haskell-cafe] Use unsafePerformIO to catch Exception?

2009-03-25 Thread wren ng thornton
Henning Thielemann wrote: Jonathan Cast wrote: Xiao-Yong Jin wrote: Could you elaborate more about why this kind of breakage wouldn't happen if 'try' is used in an IO monad as intended? It would. But it would happen in IO, which is allowed to be non-deterministic. Pure Haskell is not

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-26 Thread wren ng thornton
Colin Adams wrote: 2009/3/25 wren ng thornton w...@freegeek.org: Most of the documentation is in research papers, and a normal programmer don't want to read these papers. Yes, and no. There is quite a bit of documentation in research papers, and mainstream programmers don't read

Re: [Haskell-cafe] Use unsafePerformIO to catch Exception?

2009-03-26 Thread wren ng thornton
Jules Bean wrote: wren ng thornton wrote: I have long been disappointed by a number of `error`s which shouldn't be. For example, the fact that `head` and `div` are not total strikes me as a (solvable) weakness of type checking, rather than things that should occur as programmer errors

<    1   2   3   4   5   6   7   8   9   10   >