Re: [Haskell-cafe] Musings on type systems

2010-11-19 Thread wren ng thornton
On 11/19/10 10:05 PM, Ryan Ingram wrote: Not exactly; in the phantom type case, the two sets ARE disjoint in a way; there are no objects that are both Foo Int and Foo Bool (although there may be objects of type forall a. Foo a -- more on that later). Whereas the type keyword really creates two

Re: [Haskell-cafe] Musings on type systems

2010-11-21 Thread wren ng thornton
On 11/20/10 6:33 AM, Ketil Malde wrote: Andrew Coppinandrewcop...@btinternet.com writes: Now here's an interesting thought. Haskell has algebraic data types. Algebraic because they are sum types of product types (or, equivilently, product types of sum types). Now I don't actually know what

Re: [Haskell-cafe] doesDirectoryExist is always returning False

2010-11-21 Thread wren ng thornton
On 11/20/10 9:55 AM, Marcelo Sousa wrote: Hi, I'm having currently a problem with System.Directory in my mac os. System Version: Mac OS X 10.6.5 Kernel Version: Darwin 10.5.0 Prelude System.Directory let dirTest = do {dir- getCurrentDirectory; doesDirectoryExist dir} Prelude

Re: [Haskell-cafe] Transparent identity instances

2010-11-28 Thread wren ng thornton
On 11/28/10 9:59 AM, Jafet wrote: But GHC does not accept type synonym instances unless they are fully applied. That's precisely the problem, and why a newtype is used. More than GHC implementation details, there's the deeper problem that allowing general type-level functions causes

Re: [Haskell-cafe] Categorical description of systems with dependent types

2010-12-03 Thread wren ng thornton
On 12/2/10 4:47 PM, Iavor Diatchki wrote: Hi, You have it exactly right, and I don't think that there's a particularly deep reason to prefer the one over the other. It seems that computer science people tend to go with the (product-function) terminology, while math people seem to prefer the

Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-04 Thread wren ng thornton
On 12/4/10 11:31 AM, Dan Knapp wrote: With Hackage down, now seemed like a good time to push this issue again. It's such an important site to us that it's really rather a shame there are no mirrors of it. I have a personal-and-business server in a data center in Newark, with a fair chunk of

Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-04 Thread wren ng thornton
On 12/4/10 2:21 PM, Riad S. Wahby wrote: Ozgur Akgunozgurak...@gmail.com wrote: This is a very generous offer. However, I must say I like the following idea more: http://www.reddit.com/r/haskell/comments/efw38/ reminder_hackagehaskellorg_outage_tomorrow_due_to/c17u7nk That sounds like a

Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-05 Thread wren ng thornton
On 12/4/10 10:34 PM, wren ng thornton wrote: FWIW, I've been on the board of directors for a 501(c)(3), helped write their bylaws, and know a few people in the business (lawyers, etc). I'm willing to offer advice, effort, and references whenever the committee decides to do this. I tried cc-ing

Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-05 Thread wren ng thornton
On 12/5/10 11:23 AM, Ketil Malde wrote: Florian Lengyelflorian.leng...@gmail.com writes: Why is there even any consideration of some committee if someone wants to mirror the Hackage site? Why not mirror the site? +1 Alright, Mr. Wiseguy, she said, if you're so clever, you tell us

Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-06 Thread wren ng thornton
On 12/6/10 2:35 AM, Vincent Hanquez wrote: I would really like mirrors too. But before that happens it would be nice to have signed packages on Hackage, preventing a mirror to distribute compromised stuff (intentionally or unintentionally). +1. This should be done during sdist, before

Re: [Haskell-cafe] need help with syntax...

2010-12-06 Thread wren ng thornton
On 12/6/10 7:26 PM, Daryoush Mehrtash wrote: I am having hard time understanding the following code. The code is from Applicative Parser library: http://hackage.haskell.org/packages/archive/uu-parsinglib/2.5.5.2/doc/html/src/Text-ParserCombinators-UU-BasicInstances.html instance (Show a,

Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-11 Thread wren ng thornton
On 12/9/10 4:04 PM, Richard O'Keefe wrote: On 10/12/2010, at 12:18 AM, Markus Läll wrote: My take on the issue is that we should make it possible to easily mirror hackage (what the OP asked for), so that people could use it when they wanted to, and have a list of the mirrors on the wiki.

Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-11 Thread wren ng thornton
On 12/11/10 5:59 AM, wren ng thornton wrote: On 12/9/10 4:04 PM, Richard O'Keefe wrote: As long as the material from Y replicated at X is *supposed* to be publicly available, I don't see a security problem here. Only Y accepts updates from outside, and it continues to do whatever authentication

Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-13 Thread wren ng thornton
On 12/13/10 8:25 AM, Paul Sargent wrote: How about, as a cheep and cheerful method to get up running. If the premise is that the original server is trustworthy and the mirrors aren't, then: 1) Hash all packages on the original server. 2) Hash goes into a side car file (e.g.packagename.sha) that

Re: [Haskell-cafe] (Co/Contra)Functor and Comonad

2010-12-24 Thread wren ng thornton
On 12/23/10 11:46 PM, Mario Blažević wrote: On Thu, Dec 23, 2010 at 11:25 PM, Tony Morristonymor...@gmail.com wrote: ...regardless of the utility of a contravariant functor type-class, I strongly advocate for calling it Contrafunctor and not Cofunctor. I have seen numerous examples of

Re: [Haskell-cafe] (Co/Contra)Functor and Comonad

2010-12-24 Thread wren ng thornton
On 12/24/10 12:26 AM, C. McCann wrote: As far as I understand (which may not actually be all that far), contravariant functors just go to or from an opposite category, a distinction that is purely a matter of definition, not anything intrinsic. Yes. On the other hand, Applicative and Monad

Re: [Haskell-cafe] (Co/Contra)Functor and Comonad

2010-12-24 Thread wren ng thornton
On 12/23/10 9:41 PM, Daniel Peebles wrote: For me, mostly naming. Cofunctor isn't the right name for it, and comap, while short, feels wrong. Contrafunctor feels better but is also cumbersome. No problems with Comonad, though. It is wrong. Cofunctors are exactly functors. It's unfortunate that

Re: [Haskell-cafe] Ratification for my understanding of functors

2011-01-08 Thread wren ng thornton
On 1/8/11 5:23 AM, C K Kashyap wrote: Hi, Thanks to Luke Palmer's explanation. I got a better idea of functors. I just want to ratify my understanding of what a functor is - according to category theory, functors are arrows between categories ... these arrows map objets and arrows from one

Re: [Haskell-cafe] A question about monad based on http://en.wikipedia.org/wiki/Monad_(category_theory)

2011-01-19 Thread wren ng thornton
On 1/17/11 10:46 PM, C K Kashyap wrote: Hi, I was going through http://en.wikipedia.org/wiki/Monad_(category_theory) - under Formal Definition I notice that monad is a Functor T:C - C My question is - when we think of Maybe as a functor T:C - C should we think that C here refers to

Re: [Haskell-cafe] Computing a sorted list of products lazily

2009-04-17 Thread wren ng thornton
Jason Dagit wrote: Hello, A colleague of mine recently asked if I knew of a lazy way to solve the following problem: Given two sets of sorted floating point numbers, can we lazily generate a sorted list of the products from their Cartesian product? The algorithm should return the same result

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread wren ng thornton
Bulat Ziganshin wrote: Hello R.A., Sunday, April 19, 2009, 11:46:53 PM, you wrote: Does anybody know if there are any plans to incorporate some of these extensions into GHC - specifically the existential typing ? it is already here, but you should use forall keyword instead odf exists

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread wren ng thornton
Dan Doel wrote: On Sunday 19 April 2009 4:56:29 pm wren ng thornton wrote: Bulat Ziganshin wrote: Hello R.A., Sunday, April 19, 2009, 11:46:53 PM, you wrote: Does anybody know if there are any plans to incorporate some of these extensions into GHC - specifically the existential

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-21 Thread wren ng thornton
Dusan Kolar wrote: Dear all, reading that according the several style guides, lines shouldn't be too long (longer than 78 characters). http://www.cs.caltech.edu/courses/cs11/material/haskell/misc/haskell_style_guide.html http://www.haskell.org/haskellwiki/Programming_guidelines I

Re: [Haskell-cafe] Functor and Haskell

2009-04-21 Thread wren ng thornton
Daryoush Mehrtash wrote: I am not sure I follow how the endofunctor gave me the 2nd functor. As I read the transformation there are two catagories C and D and two functors F and G between the same two catagories. My problem is that I only have one functor between the Hask and List catagories.

[Haskell-cafe] Where to Cabal Install (was: Re: ANNOUNCE: Utrecht Haskell Compiler (UHC) --first release)

2009-04-22 Thread wren ng thornton
Claus Reinke wrote: Installing executable(s) in /home/david/.cabal/bin why the hell would cabal install binaries in a subdirectory of a hidden directory. Why not /home/david/bin or /home/david/local/bin ? Yes, this is clearly suboptimal but getting agreement on where to put it has not proved

Re: [Haskell-cafe] Re: Is 78 characters still a good option? Was: breaking too long lines

2009-04-22 Thread wren ng thornton
Maurí­cio wrote: We have one: urchin.earth.li/~ian/style/haskell.html Yes, it's good. We should publicise it more. Just a tought: I would like to see a guide talking about the code itself, not about the presentation. Maybe this is ignored because it's difficult. It's easy to get bad code

Re: [Haskell-cafe] Functor and Haskell

2009-04-24 Thread wren ng thornton
Daryoush Mehrtash wrote: Thanks this was helpful. In many of Conal Elliot's writings I see that he shows that his semantic function is a natural transformation. Is that just basically showing the polymorphic nature of his semantic functions, or are there other benifits you get by showing a

Re: [Haskell-cafe] compilation to C, not via-C

2009-04-24 Thread wren ng thornton
Sam Martin wrote: In short, I'd like to use Haskell as a code-generator. I can't see that this would be unachievable, particularly given it's generating C already. Have I missed something? For the case of GHC at least, you may be. The C that GHC compiles Haskell into isn't C in the normal

Re: [Haskell-cafe] Dynamically altering sort order

2009-04-24 Thread wren ng thornton
Denis Bueno wrote: Hi all, Suppose I have the following interface to a sorting function: sort :: (Ord a) = [a] - IO [a] -- sort large, on-disk array of records but I don't have a sortBy where you can simply pass a compare function. Why don't you have sortBy? Wrapped around this is a

Re: [Haskell-cafe] name for monad-like structure?

2009-04-28 Thread wren ng thornton
Michael Vanier wrote: Luke Palmer wrote: Michael Vanier wrote: Are you sure it supports () :: m a - m b - m b and not mplus :: m a - m a - m a ? Yeah, you're right. It's basically a monad where the type a is fixed to be (), so you just have ()

Re: [Haskell-cafe] Re: Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)

2009-05-05 Thread wren ng thornton
Chris Forno (jekor) wrote: The idea is that I spent years studying different languages, generally with a textbook. The textbooks tend to focus on teaching rules and grammar, with a little bit of vocabulary and dialog each chapter. I think the focus should be reversed. This varies wildly by

Re: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)

2009-05-06 Thread wren ng thornton
FFT wrote: Anton van Straaten wrote: The app is written for a client under NDA, so a blog about it would have to be annoyingly vague. No doubt the potential for encountering space leaks goes up as one writes less pure code, persist more things in memory, and depend on more libraries.

Re: [Haskell] Re[2]: [Haskell-cafe] Is Haskell a Good Choice for WebApplications? (ANN: Vocabulink)

2009-05-07 Thread wren ng thornton
John Lask wrote: Well this is interesting. So what you are saying is that if your haskell application requires a peek memory utilisation of (for example) 1GB, after the memory intesive computation has completed and the GC has run (assuming all references have been dropped) the GHC RTS will

Re: [Haskell-cafe] GC

2009-05-07 Thread wren ng thornton
Daniel Fischer wrote: Am Donnerstag 07 Mai 2009 22:01:11 schrieb Andrew Coppin: Simon Marlow wrote: http://hackage.haskell.org/trac/ghc/ticket/698 I presume that the reason for this is to avoid handing memory back only to immediately need it again? (I.e., we don't want to be constantly

Re: [Haskell-cafe] How difficult would creating a collaborative multi-user online virtual world application be in Haskell?

2009-05-07 Thread wren ng thornton
Benjamin L.Russell wrote: Unfortunately, Smalltalk is an object-oriented language. If possible, I would like to see something similar in a functional programming language such as Haskell. Does anybody know whether duplicating this project in Haskell would be feasible? In terms of technical

Re: [Haskell] Re[2]: [Haskell-cafe] Is Haskell a Good Choice for WebApplications? (ANN: Vocabulink)

2009-05-10 Thread wren ng thornton
Ketil Malde wrote: wren ng thornton w...@freegeek.org writes: FWIW, the JVM also fails to release memory resources back to the OS. Given all the problems I've seen that one cause for long-running processes, I'm definitely in support of correcting any behavior like this in the GHC RTS. I'm

[Haskell-cafe] Re: OT: Languages

2009-05-10 Thread wren ng thornton
Kalman Noel wrote: wren ng thornton schrieb: Chris Forno (jekor) wrote: That being said, Esperanto, and even Japanese sentence structure perhaps is not as different as an agglutinative language like German. I'll need to study it more to find out. Actually, Japanese is agglutinative too

Re: [Haskell-cafe] Re: OT: Languages

2009-05-12 Thread wren ng thornton
Tillmann Rendel wrote: wren ng thornton wrote: Indeed. The proliferation of compound words is noteworthy, but it's not generally considered an agglutinative language. From what (very little) German I know compounds tend to be restricted to nouns, as opposed to languages like Turkish

Re: [Haskell-cafe] Structural sharing in haskell data structures?

2009-05-13 Thread wren ng thornton
Don Stewart wrote: wagner.andrew: Purity allows our data structures to have a lot of sharing. This is separate to laziness. Ah, so haskell does do it. Interesting that it so rarely comes up, whereas it's frequently mentioned in clojure. I think it is just assumed, since that's been the

Re: [Haskell-cafe] Removing mtl from the Haskell Platform

2009-05-13 Thread wren ng thornton
rocon...@theorem.ca wrote: I wanted to pass this idea around the cafe to get some thoughts before submitting a trac on this topic. I'd like to see the mtl removed from the Haskell Platform. The mtl was a tremendous step forward when it was developed. However, we have learned a few things

Re: [Haskell-cafe] forall vs =

2009-05-13 Thread wren ng thornton
Daryoush Mehrtash wrote: What is the difference between forall as in: runST :: (forall s. ST s a) - a and the = as in evalStateT :: Monad m = StateT s m a - s - m a The forall is Rank-2 polymorphism (the argument must be polymorphic in s). The = is for typeclass constraints (restricting

Re: [Haskell-cafe] Structural sharing in haskell data structures?

2009-05-13 Thread wren ng thornton
Jan-Willem Maessen wrote: I wanted to clear up one misconception here... wren ng thornton wrote: In heavily GCed languages like Haskell allocation and collection is cheap, so we don't mind too much; but in Java and the like, both allocation and collection are expensive so the idea of cheap

Re: [Haskell-cafe] Re: List of exports of a module - are there alternatives?

2009-05-13 Thread wren ng thornton
Maurício wrote: I would like a keyword we could add to a single declaration, like: hidden a :: Int - Int a = (...) The 200 names is not the best example. It's more a question of proportion: if you export 5 declarations in a module with 20, it's OK, but if you export 19 declarations in a module

Re: [Haskell-cafe] Pretty printing a tree

2009-05-15 Thread wren ng thornton
José Romildo Malaquias wrote: Hello. I would like to pretty print a tree in a way that its structure is easily perceived. For instance, consider the declarations: data Node a = Node a [Node a] type Tree a = [ Node a ] t = [ Node a [ Node b [] , Node c [ Node c1 []

Re: [Haskell-cafe] conflicting variable definitions in pattern

2009-05-15 Thread wren ng thornton
Conor McBride wrote: Hi Sittampalam, Ganesh wrote: Martin Hofmann wrote: It is pretty clear, that the following is not a valid Haskell pattern: foo (x:x:xs) = x:xs My questions is _why_ this is not allowed. IMHO, the semantics should be clear: The pattern is expected to succeed,

Re: [Haskell-cafe] conflicting variable definitions in pattern

2009-05-15 Thread wren ng thornton
Conor McBride wrote: Rumblings about funny termination behaviour, equality for functions, and the complexity of unification (which isn't the proposal anyway) But unification is what you get by adding non-linearity. Sure, all terms are ground; would you prefer I said testing for membership in

Re: [Haskell-cafe] import qualified?

2009-05-22 Thread wren ng thornton
Vasili I. Galchin wrote: Hello, I am working with some somewhat legacy code. I understand what import qualified Blah as B means but what does import qualified Blah mean? Is this a deprecated feature? I saw with user defined module as well as with import qualified System for example. It

Re: [Haskell-cafe] hackage version scheme survey

2009-05-23 Thread wren ng thornton
br...@lorf.org wrote: On Saturday, 23.05.09 at 17:26, Don Stewart wrote: http://haskell.org/haskellwiki/Package_versioning_policy ? That helps a lot. I should have found that. But putting the policy on a web page doesn't seem to be working; there are a lot of non-compliant packages. I guess

Re: [Haskell-cafe] Haskell type system and the lambda cube

2009-05-25 Thread wren ng thornton
vo...@tcs.inf.tu-dresden.de wrote: 2009/5/24 Petr Pudlak d...@pudlak.name: If all Haskell had would be HM, it would be System F. That cannot be quite right, can it? System F has more powerful polymorphism than HM. As I recall HM is along the edge to \lambda^2. Haskell 98 is typically

Re: [Haskell-cafe] How to implement this? A case for scoped record labels?

2009-05-25 Thread wren ng thornton
ntu...@googlemail.com wrote: This however does not work because record selectors have module scope, so the compiler will complain that channel et. al. are defined multiple times. As a workaround I could put each type into its own module, but at least GHC requires a file per module (which is

Re: [Haskell-cafe] How to implement this? A case for scoped record labels?

2009-05-26 Thread wren ng thornton
ntu...@googlemail.com wrote: wren ng thornton wrote: A better approach would probably be to use GADTs or the new data families which give a sort of dual of typeclasses (typeclasses give a small set of functions for a large set of types; GADTs give a large set of functions for a small set

Re: [Haskell-cafe] I love purity, but it's killing me.

2009-05-26 Thread wren ng thornton
Conal Elliott wrote: Hi Tom, I've been working on another code-generating graphics compiler, generating GPU code. As always, I run into the problem of efficient common subexpression elimination. In Pan, Vertigo Pajama, I used lazy memoization, using stable pointers and weak references, to

Re: [Haskell-cafe] Timing pure functions?

2009-05-27 Thread wren ng thornton
Johan Tibell wrote: austin s wrote: Perhaps benchpress would be more to your liking: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/benchpress Note that since benchpress measures every single invocation of the provided IO action in order to compute percentiles it's not good at

Re: [Haskell-cafe] I love purity, but it's killing me.

2009-05-27 Thread wren ng thornton
Conal Elliott wrote: Hi Wren, I considered the idea of hashing, but not *perfect* hashing. I don't know how to hash perfectly with something like expressions, which have infinitely many values. An imperfect hash can work. You'll need a memo table with a source of unique symbols (e.g.

Re: [Haskell-cafe] Type class context propagation investigation

2009-05-27 Thread wren ng thornton
Ryan Ingram wrote: Think of classes like data declarations; an instance with no context is a constant, and one with context is a function. Here's a simple translation of your code into data; this is very similar to the implementation used by GHC for typeclasses: data EqDict a = EqDict { eq ::

Re: [Haskell-cafe] Re: Error message reform

2009-05-27 Thread wren ng thornton
Max Rabkin wrote: Jeff Wheeler wrote: I absolutely agree about expected/inferred. I always forget which is which, because I can figure both could apply to each. That's actually true for me too. When you say it like that, I remember times when I've had the same confusion. [...] My

Re: [Haskell-cafe] What's the problem with iota's type signature?

2009-05-27 Thread wren ng thornton
michael rice wrote: Still exploring monads. I don't understand why the type signature for double is OK, It isn't. The |a| and |b| variables must unify: Prelude :t \x - Just (x+x) \x - Just (x+x) :: (Num a) = a - Maybe a Prelude :t (\x - Just (x+x)) :: Num a = a - Maybe b

Re: [Haskell-cafe] What's the problem with iota's type signature?

2009-05-28 Thread wren ng thornton
michael rice wrote: Yeah, I went back and tried double again, though I'd swear I got the dang thing to compile (and run) w/o errors. I guess I meant Num. So Num is a class and Int and Integer are types? What are the other classes? Docs? Unification, for me, is pattern matching ala Prolog.

Re: [Haskell-cafe] Re: Error message reform

2009-05-28 Thread wren ng thornton
Claus Reinke wrote: Still, I would really like a just the facts, please mode for GHC, with less text and more type signatures (especially for the contexts of type mismatches). Error messages simply not including the information I need has become my main issue with GHC messages, and seems to be

Re: [Haskell-cafe] Ensuring Type Class instances follow the 'rules'

2009-05-29 Thread wren ng thornton
Eugene Kirpichov wrote: Use QuickCheck. Also use SmallCheck or lazy SmallCheck. All of these are automatic tools that allow you to specify laws[1] and automatically generate values for testing the law. QuickCheck generates values randomly, which can be useful but is very often insufficient.

Re: [Haskell-cafe] Re: Error message reform

2009-05-31 Thread wren ng thornton
Tillmann Rendel wrote: wren ng thornton wrote: (Though it doesn't necessarily generalize to cover similar messages like: Prelude :t (\x - x) :: a - b interactive:1:7: Couldn't match expected type `b' against inferred type `a' `b' is a rigid type variable bound

Re: [Haskell-cafe] Parsec float

2009-05-31 Thread wren ng thornton
Jason Dusek wrote: 2009/05/30 Bartosz Wójcik bar...@sudety.it: ...reading RWH I could not memorize what those liftM funtions meant. The basic one, `liftM`, means `fmap`, though specialized for functors that are monads. Prelude Control.Monad :t liftM liftM :: forall a b (m :: * -

Re: [Haskell-cafe] Trouble with types

2009-06-02 Thread wren ng thornton
Vladimir Reshetnikov wrote: Hi Daniel, Could you please explain what does mean 'monomorphic' in this context? I thought that all type variables in Haskell are implicitly universally quantified, so (a - a) is the same type as (forall a. a - a) At the top level (i.e. definition level), yes.

Re: [Haskell-cafe] Possible Haskell Project

2009-06-02 Thread wren ng thornton
Tom Hawkins wrote: At the core, the fundamental problem is not that complicated. It's just storing and retrieving a person's various health events: checkups, prescriptions, procedures, test results, etc. The main technical challenges are database distribution and patient security. Both are fun

Re: [Haskell-cafe] Checking a value against a passed-in constructor?

2009-06-02 Thread wren ng thornton
Ryan Ingram wrote: Dan danielkc...@gmail.com wrote: I figured there would be a clever Haskell idiom that would give me a similarly concise route. Does it really require Template Haskell? I can barely parse regular Haskell as it is.. [...] Alternatively, you can define a fold[1] once:

Re: [Haskell-cafe] Functors and the Visitor Pattern

2009-06-04 Thread wren ng thornton
Tom.Amundsen wrote: So, last night, I was having this problem with my Java code where I couldn't figure out for the life of me how to write a piece of code without a big if {} else if {} else if {} ... else {} structure. I was Googling Java Reflection to try to determine how to cast to the most

Re: [Haskell-cafe] type checking that I can't figure out ....

2009-06-04 Thread wren ng thornton
Daniel Peebles wrote: Yeah, in a way similar to ArrowPlus/ArrowZero. Then again, I'm not sure whether it would be meaningful to split up MonadPlus like that. Well, we could always have: class MonadZero m = MonadPlus m The suggestion is just to broaden the scope of mzero so that you can have

Re: [Haskell-cafe] Functors and the Visitor Pattern

2009-06-04 Thread wren ng thornton
Johan Tibell wrote: wren ng thornton wrote: [2] For the recursive Visitor pattern I use most often, that is. For the non-recursive version it's usually fmap. This is the part where the pattern gets a bit shaky because there are actually many different patterns all called Visitor. The main

Re: [Haskell-cafe] Monad transformer responsibilities

2009-06-05 Thread wren ng thornton
Martijn van Steenbergen wrote: Hello, Suppose I have two projects: 1) one that defines a monad transformer and an accompanying type class that captures my monad-specific operations and 2) one that uses the other project, combining the monad transformer with, say, Parsec. Now while writing

Re: [Haskell-cafe] ghci: can't load .so/.DLL for: m (addDLL: could not load DLL) / is there a libm.dll for Windows

2009-06-07 Thread wren ng thornton
Mark Wassell wrote: Hello, I get this when using the logfloat package via ghci on Windows. For example *Main :m + Data.Number.LogFloat *Main Data.Number.LogFloat logFloat (1.0::Float) Loading package syb ... linking ... done. Loading package array-0.2.0.0 ... linking ... done. Loading package

Re: [Haskell-cafe] Slow documentation generation on Hackage

2009-06-08 Thread wren ng thornton
Thomas ten Cate wrote: Niemeijer, R.A. wrote: which, face it, is going to be all of them; I doubt Haskell is popular enough yet to be the target of DoS attacks Second that. I think this is a good case in which some security should be traded in for usability. Those who would trade security

Re: [Haskell-cafe] Building a tree?

2009-06-10 Thread wren ng thornton
michael rice wrote: Here's a function from Data.Tree: unfoldTree :: (b - (a, [b])) - b - Tree a Build a tree from a seed value Could someone please give me a brief example of usage. Data.Tree let t = unfoldTree (\i - (show i, [i`div`2..i-1])) Data.Tree putStr . drawTree $ t 8 --

Re: [Haskell-cafe] Building a tree?

2009-06-10 Thread wren ng thornton
michael rice wrote: Here's a function from Data.Tree: unfoldTree :: (b - (a, [b])) - b - Tree a Build a tree from a seed value Could someone please give me a brief example of usage. In as far as understanding it, it may be easier if you look at the generalized version of the anamorphism:

Re: [Haskell-cafe] Building a tree?

2009-06-11 Thread wren ng thornton
michael rice wrote: Example understood. Thanks. Is there a module for binary trees? Not that I know of off hand. Trees are one of those data structures with so many different variants that people end up rolling their own based on whatever they need at the time. Hence Data.Tree,

Re: [Haskell-cafe] Performance of functional priority queues

2009-06-17 Thread wren ng thornton
Richard O'Keefe wrote: There's a current thread in the Erlang mailing list about priority queues. I'm aware of, for example, the Brodal/Okasaki paper and the David King paper. I'm also aware of James Cook's priority queue package in Hackage, have my own copy of Okasaki's book, and have just

Re: [Haskell-cafe] Confusion on the third monad law when using lambda abstractions

2009-06-19 Thread wren ng thornton
Hans van Thiel wrote: On Wed, 2009-06-17 at 21:26 -0500, Jake McArthur wrote: Jon Strait wrote: I'm reading the third (bind associativity) law for monads in this form: m = (\x - k x = h) = (m = k) = h Arguably, that law would be better stated as: (h = k) = m = h = (k = m) This

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-20 Thread wren ng thornton
Thomas Hartman wrote: could someone explain sharing? In the code below, allstrings2 is 6X as fast as allstrings. I assume because of sharing, but I don't intuitively see a reason why. can someone give me some pointers, perhaps using debug.trace or other tools (profiling?) to show where the

Re: [Haskell-cafe] Optimizing spelling correction program

2009-06-24 Thread wren ng thornton
Kamil Dworakowski wrote: The timing per expression however showed something useful, 70% of the time was being spent around determining membership in the known words dictionary (Data.Map). There are about 30 000 items in the dictionary. Right... Python uses hashtables while here I have a tree

Re: [Haskell-cafe] Re: Optimizing spelling correction program

2009-06-24 Thread wren ng thornton
Kamil Dworakowski wrote: On Jun 22, 10:03 am, Eugene Kirpichov ekirpic...@gmail.com wrote: Hey, you're using String I/O! nWORDS - fmap (train . map B.pack . words) (readFile big.txt) This should be WORDS - fmap (train . B.words) (B.readFile big.txt) By the way, which exact file do you use

Re: [Haskell-cafe] coding standard question

2009-06-24 Thread wren ng thornton
Magnus Therning wrote: Erik de Castro Lopo wrote: In Haskell there is an easy way around this. Variables can be name a, a', a'' and so on. Since these aid in clarity without forcing you to think up new variable names, I would suggest that its a good idea to fix these warnings. +1 (depending

Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature

2009-06-24 Thread wren ng thornton
Luke Palmer wrote: On Tue, Jun 23, 2009 at 2:20 AM, papa.e...@free.fr wrote: Simple: the definition of MonadState uses those extensions. Thanks, yes it helps and explains all. :^) I suppose then that if -XFlexibleContexts is indeed required by the standard libraries, it is a safe extension,

Re: [Haskell-cafe] Error in array index.

2009-06-24 Thread wren ng thornton
Jason Dusek wrote: Why is `Int` used in so many places where it is semantically wrong? Not just here but also in list indexing... Indices/offsets can only be positive and I can't see any good reason to waste half the address space -- yet we encounter this problem over and over again.

Re: [Haskell-cafe] lazy data structure for best-first search

2009-06-24 Thread wren ng thornton
Martin Hofmann wrote: Thanks for the quick and short answer. Maybe I am already thinking too complicated. However, exactly your given preconditions I can not satisfy. The preconditions for bestFirst rate edges xs are: map rate xs must be nondecreasing, Here lies my problem, because edges

Re: [Haskell-cafe] GHCi infers a type but refuses it as type signature

2009-06-25 Thread wren ng thornton
Bulat Ziganshin wrote: Hello wren, Thursday, June 25, 2009, 6:35:36 AM, you wrote: Rank2Types, RankNTypes, ExistentialQuantification, ScopedTypeVariables, and GADTs are fairly benign ---though this is where you start loosing compatibility with non-GHC compilers. afair, except for GADTs

Re: [Haskell-cafe] combining monads with IO

2009-06-25 Thread wren ng thornton
Richard Silverman wrote: Hi all, I'm puzzled by something. Suppose I have some code that does lots of IO, and also occasionally refers to some global state. No problem, use ReaderT for the state, combining with the IO monad. Except... since IO is on the bottom, simple uses of do-notation

Re: [Haskell-cafe] Haskell on JVM

2009-06-30 Thread wren ng thornton
Claus Reinke wrote: |Basically, the JVM lacks a native ability to do tail calls. It does |not have an instruction to remove/replace a stack frame without |executing an actual return to the calling method/function. There is a conflict between preserving stack layout and efficient tail calls.

Re: [Haskell-cafe] Network.CGI -- practical web programming example.

2009-07-02 Thread wren ng thornton
Brandon S. Allbery KF8NH wrote: Some Haskell programmers use fmap (because most Monads are also Functors), others use liftM. Both have the same effect: given a monadic computation m a, liftM f turns f into a function that operates on the enclosed a instead of the entire m a. That is,

Re: [Haskell-cafe] [ghc] kind of the function arrow

2009-07-02 Thread wren ng thornton
Dominic Orchard wrote: I was just playing around and noticed that the kind of the function arrow in GHC is (?? - ? - *) when I (naively) expected it to be (* - * - *). After looking at (http://hackage.haskell.org/packages/archive/ghc/6.10.2/doc/html/Type.html#5) I see that the kind of (-)

Re: [Haskell-cafe] ANN: TernaryTrees-0.1.1.1 - An efficient ternary tree implementation of Sets and Maps

2009-07-02 Thread wren ng thornton
Don Stewart wrote: wren: Alex Mason wrote: TernaryTrees is a package that extends Data.Set ad Data.Map with some ternary tree structures, based on the article [http://www.pcplus.co.uk/node/3074/] . For the string (or rather ByteString) version:

Re: [Haskell-cafe] Flipping *-*-* kinds, or monadic finally-tagless madness

2009-07-03 Thread wren ng thornton
Kim-Ee Yeoh wrote: type VarCount = int newtype Y b a = Y {unY :: VarCount - (b, VarCount)} Hi Edward, Your runPretty version fits the bill nicely, thank you. I might still retain the state monad version because it allows generalizations beyond pretty-printing. As for fixing the original

Re: [Haskell-cafe] Cont, ContT and IO()

2009-07-03 Thread wren ng thornton
Günther Schmidt wrote: Hi, I've got an IO action, some file system IO, traversing one level only and iterating over files found. I wish to build in an early exit, ie. if an IO action in the loop encounters a particular value I want it to abort the loop. Now so far, pls don't shoot, I have

Re: [Haskell-cafe] Leaner Haskell.org frontpage

2009-07-09 Thread wren ng thornton
Ignoring the rest of the thread, but jumping in here... hask...@kudling.de wrote: For the hompage we're talking about, glancing is even simpler since everything is on the same page and you can scroll it quite easily. I don't agree that everything on one page makes comprehension easier. I'm

Re: [Haskell-cafe] Leaner Haskell.org frontpage

2009-07-09 Thread wren ng thornton
Rick R wrote: As an aside, in the current homepage, the Haskell description is outweighed by the link menu on the left. IMO the reader's eyes should move from the title, to the description, then either down or left. Currently my attention is split evenly between the link menu and the

Re: [Haskell-cafe] Leaner Haskell.org frontpage

2009-07-09 Thread wren ng thornton
Don Stewart wrote: ttencate: On Thu, Jul 9, 2009 at 18:33, Don Stewartd...@galois.com wrote: ttencate: Are there any kind of hard statistics and analytics that we can base this discussion upon? There is always room for improvement, but stumbling around in the dark making blind guesses may not

Re: [Haskell-cafe] Leaner Haskell.org frontpage

2009-07-09 Thread wren ng thornton
Jeff Wheeler wrote: I suspect most people who like the Ruby page see the Ruby is... section as especially effective at introducing the language, and the random snippet is a simple way to show off a bit of code before they dive into a tutorial. I'll agree that that part is slick. The rest of

Re: [Haskell-cafe] Problems with nested Monads

2009-07-10 Thread wren ng thornton
Job Vranish wrote: Yeah, I think the problem with my case is that while M is a specific monad (essentially StateT), N can be an arbitrary monad, which I think destroys my changes of making a valid joinInner/joinOuter/distribute. Maybe someday Haskell will infer valid joinInner/joinOuter for

Re: [Haskell-cafe] Circular pure data structures?

2009-07-14 Thread wren ng thornton
John Dorsey wrote: John, Is it possible to create a circular pure data structure in Haskell? For example: Creating the data structure is easy; as other respondents have pointed out. A simple example is this... ones = 1 : ones ones' = 1 : ones' Comparing these values is harder. All of

Re: [Haskell-cafe] Re: [Haskell] Re: 20 years ago

2009-07-18 Thread wren ng thornton
Richard O'Keefe wrote: On Jul 15, 2009, at 5:25 PM, Benjamin L.Russell wrote: it interesting that you should use the biological term disease; according to a post [1] entitled Re: Re: Smalltalk Data Structures and Algorithms, by K. K. Subramaniam, dated Mon, 29 Jun 2009 11:25:34 +0530, on the

Re: [Haskell-cafe] Re: [Haskell] Re: 20 years ago

2009-07-18 Thread wren ng thornton
Richard O'Keefe wrote: On Jul 15, 2009, at 5:25 PM, Benjamin L.Russell wrote: it interesting that you should use the biological term disease; according to a post [1] entitled Re: Re: Smalltalk Data Structures and Algorithms, by K. K. Subramaniam, dated Mon, 29 Jun 2009 11:25:34 +0530, on the

Re: [Haskell-cafe] Haskell Zippers on Wikibooks: teasing! :)

2009-07-18 Thread wren ng thornton
Peter Verswyvelen wrote: After my colleague explained me about zippers and how one could derive the datatype using differential rules, I had to read about it. So I started reading http://en.wikibooks.org/wiki/Haskell/Zippers#Mechanical_Differentiation This page contains the sentence: *For a

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