Re: [Haskell-cafe] Types

2009-11-26 Thread John Dorsey
ul of things that are unfamiliar (type classes, defaulting, tricky numeric literals), while doing the most basic things (arithmetic). Don't despair; it'll make sense soon if it doesn't yet. Regards, John Dorsey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Pattern Matching

2009-11-12 Thread John Dorsey
Casey, > Why in a pattern match like > > score (1 3) = 7 You probably mean > score 1 3 = 7 which applies the function 'score' to two arguments. With the parentheses, it looks like an application of '1' to the argument '3'. But to answer your actual question... > can I not have > > sizeMax =

Re: [Haskell-cafe] NetSnmp problem.

2009-10-22 Thread John Dorsey
> I am trying to use NetSnmp to get some information from my switch. > And I met this problem. > After initialize, I used snmpWalk to get some information, and > dealed with it. Everything is fine. Then I sleep for 5 mins. SnmpWalk > again. But this time, all asnValues were unsupported format,

Re: [Haskell-cafe] Need help with ghc static compile for cgi using mysql

2009-10-15 Thread John Dorsey
> lambdabot is currently hosted on the lowest end linode. The biggest hurdle I [...] +1. I use linode for (most of) my Haskell work. John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.

2009-10-01 Thread John Dorsey
Andrew Coppin said: >> Sure. But what is a computer program? then Richard O'Keefe said: > A computer program, in short, is *whatever we want it to be*. > (Within reasonable limits.) I agree with Richard's conclusion. >From where I sit, the critical point is that, unless you're breadboarding, pr

Re: [Haskell-cafe] I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.

2009-09-30 Thread John Dorsey
> Well, try this: Go ask a random person how you add up a list of numbers. > Most of them will say something about adding the first two together, > adding the third to that total, and so forth. In other words, the step > by step instructions. You word the (hypothetical) question with a bias

Re: [Haskell-cafe] Typeclasses vs simple functions?

2009-09-15 Thread John Dorsey
> perimeter :: Geometry -> Double > perimeter (Sphere _ r) = 0.0 > perimeter (Circle _ r) = 2.0 * pi * r > > The latter is even simpler because there is no need in extraction of Double > value from Maybe. I'd strongly advise against this last one on style grounds. (0 :: Double) isn't nearly as s

Re: [Haskell-cafe] Where does documentation get installed with cabal?

2009-08-20 Thread John Dorsey
> >> I'm trying to find the API documentation for happstack 0.3 > >> (online is for 0.2). [...] > Max> In most cases it is installed in > Max> ~/.cabal/share/doc/happstack*/html. Is there any files at > Max> that directory? > > There are now, but only a very few. And very litt

Re: [Haskell-cafe] Proposal: TypeDirectedNameResolution

2009-07-27 Thread John Dorsey
Cale et al, I have a concern about the implementation of the proposed TypeDirectedNameResolution. (I'm not familiar with the internals of any of the compilers, so it could be that my concern isn't well founded.) I'm assuming that name resolution is currently independent of type inference, and wi

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

2009-07-14 Thread John Dorsey
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 (ones), (ones'), (tail

Re: Re[2]: [Haskell-cafe] Re: Error message reform (was: Strange type error with associated type synonyms)

2009-05-27 Thread John Dorsey
> I like the "expected/inferred" vocabulary. Maybe it comes from being a > native English speaker, but to me, it says "this is what we expected > to get, but instead (through type inference), we got this type for > this term". As another native English speaker, I found "expected/inferred" very int

Re: [Haskell-cafe] [ANNOUNCE] Bindings for libguestfs

2009-05-12 Thread John Dorsey
Richard, > I added some partial bindings for libguestfs[1] here: > http://git.et.redhat.com/?p=libguestfs.git;a=blob;f=haskell/Guestfs.hs;hb=HEAD Terrific! Partial bindings are great. Thanks for releasing it. I haven't taken the time to look at your code, but... > BTW, I found the documentati

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread John Dorsey
> > Does that also mean that you could write: > > > > if 3 - 4 then ... else ...  (= if (fromInteger 3 :: Bool) - (fromInteger 4 > > :: Bool) then ... else ...) > > No. 3 - 4 is an Integer, the proposal is to convert Bools to Ints, not > Ints to Bools. Rather, (3 - 4) is a "(Num t) => t", so yes,

Re: [Haskell-cafe] fromInteger for Lists

2009-05-01 Thread John Dorsey
Paul, > There's nothing better than making a data type an instance of Num. In > particular, fromInteger is a joy. But how about lists? Do you mean something like Blargh below, only useful? John dor...@elwood:~/src/scratch$ cat list.hs class Blargh f where fromList :: [a] -> f a data Foo a

Re: [Haskell-cafe] General function to count list elements?

2009-04-18 Thread John Dorsey
Michael, > I had a count function that worked fine for an enum type, but thought > why not go polymorphic with it. So I changed it and got the error I > originally inquired about. For variety, I'll go a slightly different direction. If you generalize count to use any predicate, instead of always

Re: [Haskell-cafe] Printing list of enum type

2009-04-14 Thread John Dorsey
Michael, > What do I need to add to this Color enum type to print a list of them? You can also easily print a list of /all/ of them. Regards, John scratch$ cat color.hs data Color     = Red     | Blue     | Green     | Yellow     | Orange     | Brown     | White     | Black deriving (Show,E

Re: [Haskell-cafe] Re: Configuring cabal dependencies at install-time

2009-04-07 Thread John Dorsey
Edward, Thanks for straightening me out; I see the problems better now. In particular I was missing: 1) Orphaned types (and related design issues) get in the way of splitting the package. 2) Viral dependencies work in two directions, since "upstream" packages must pick up your deps to

Re: [Haskell-cafe] Re: Configuring cabal dependencies at install-time

2009-04-07 Thread John Dorsey
John Lato wrote: > I think that the proper solution is to break up libraries into > separate packages as Jeff suggests (buster, buster-ui, etc.), but then > the total packages on hackage would explode. I don't feel great about I thought about this a while back and came to the conclusion that the

Re: [Haskell-cafe] high probability of installation problems and quality of the glorious implementation

2009-04-05 Thread John Dorsey
Quoth FFT: > My general null hypothesis is, as Alec Baldwin put it, that a loser is > a loser, or a buggy project is buggy. I can't see the world in such black and white terms. GHC has strengths and weaknesses, as do other projects. GHC is changing over time, as are other projects. Formally ver

Re: [Haskell-cafe] high probability of installation problems and quality of the glorious implementation

2009-04-05 Thread John Dorsey
FFT, > I'm still learning Haskell and also evaluating whether I want to use > the language in my work. I've been learning and using GHC in spare hours for several years. I've had challenges installing it on MacOSX-ppc, and on RHEL4; kind folks on irc and the mailing lists have always been very h

Re: [Haskell-cafe] Function to cast types

2009-03-22 Thread John Dorsey
Rafael Cunha de Almeida wrote: > This e-mail is offtopic, but I suppose being a little offtopic every now > and then isn't that bad, specially if the subject is interesting. So, > here I go. It's the cafe'. Very little is strictly off-topic here, and certainly not this. I'm happy to help anyone

Re: [Haskell-cafe] Function to cast types

2009-03-22 Thread John Dorsey
Anonymous One, > I'm new to haskell, I'm wondering how can you write a function that will do > the following: > fromIntToString :: Int -> String Is this a homework assignment, perchance? Please take a look at http://www.haskell.org/haskellwiki/Homework_help Everyone here is glad to help, but we'

Re: [Haskell-cafe] Re: [Haskell-beginners] folds -- help!

2009-03-14 Thread John Dorsey
Adrian, > That's why I said "for appropriate g and f". But I see that my > wording was misleading. Thanks for following up! I had thought you were arguing that foldl and foldr were easily and intuitively interchangeable; they're surely not so for beginners. Now I think you're arguing that giv

Re: [Haskell-cafe] Haskell users in the Houston area??

2009-02-18 Thread John Dorsey
Vasili, > Are there Haskell users in the Houston area? At least one, but I'm behind on my cafe' reading. Cheers, John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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

2008-12-24 Thread John Dorsey
Quoth Miguel Mitrofanov: > You have to be unnecessarily strict to read the whole word "Haskell" > and not just first one or two letters. Not true, if you're looking forward to what may follow "Haskell". Cheers, John ___ Haskell-Cafe mailing list Hask

Re: [Haskell-cafe] Crash!

2008-10-24 Thread John Dorsey
em that > there will never be a crash, though.. The robustness claim is > strong enough without embellishment. Pure, total Haskell programs may blow the stack. Just what is the concise, compelling, unembellished claim regarding Haskell&#

Re: [Haskell-cafe] Linking and unsafePerformIO

2008-10-14 Thread John Dorsey
Jules Bean wrote: > I'm saying that we can change programs, and that changes their > denotation, and that's fine, and anyone can do that. But the denotation > of a program is supposed to be something independent of a particular > compiler or OS or MAC address or RAM size or any of the millions

Re: [Haskell-cafe] [] vs [()]

2008-10-09 Thread John Dorsey
> dmehrtash: > >What is the difference between empty list [] and list with one unit > >element [()]? > > Prelude> length [] > 0 > Prelude> length [()] > 1 Also, they differ in type. [()] is a list of unit elements, and happens to contain exactly one of them. [] is a (pol

Re: [Haskell-cafe] Announcing OneTuple-0.1.0

2008-10-02 Thread John Dorsey
ypes, permitting the singleton. minh thu writes: > I thought to this idea in another way : parenthesis could be used for > s-expressions and [unicode 0x27e8 and 0x27e0] could be used for > regular grouping. This would allow to switch in the same code between > infix and s-expr (e.g. enabling SXM

[Haskell-cafe] Announcing OneTuple-0.1.0

2008-10-01 Thread John Dorsey
. Contributions are welcome. The project could use a tutorial, and a decent test suite. Strict singleton tuples are planned for the next version. Enjoy! Regards, John Dorsey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [haskell-cafe] Monad and kinds

2008-09-04 Thread John Dorsey
Tim, > > A year or two ago, ISTR that *most* of the newbie-generated traffic in > > the cafe was about atrocious performance of naive programs due to > > strict/lazy concerns. I think it was scaring people away. > > I think it's debatable what the various causality relationships might be here

Re: [haskell-cafe] Monad and kinds

2008-09-04 Thread John Dorsey
Tim Chevalier wrote: > I'm no master, but I've never encountered a situation where strictness > annotations would be useful as documentation, nor can I imagine one. > That's because optimization *is* the only reason why programmers > should care about strictness information. IMO, arguing that > pro

Re: [Haskell-cafe] unsafeInterleaveIO, lazyness and sharing

2008-08-26 Thread John Dorsey
t; executed at most once. Again, I suppose that this is the case while I cannot > find a guarantee for it. I'd be surprised if an implementation didn't have that behavior. I'd also be wary of anyone claiming to guarantee it, beyond compiler X version Y. John Dorsey ___

Re: [Haskell-cafe] Cabal + yi + alex problem.

2008-07-30 Thread John Dorsey
-installed it. How does cabal verify the prerequisite alex version? (Or does it?) I'm enjoying cabal since I've begun using it, but it's still somewhat opaque to me. Regards, John Dorsey ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Another optimization question

2008-05-17 Thread John Dorsey
Jeroen, > isPrime :: Int -> Bool > isPrime x = isPrime' x primes > where isPrime' x (p:ps) | x == p = True > | x > p = isPrime' x ps > | otherwise = False > > main = print $ length (filter (== True) (map isPrime [1..5000])) [...] > isPri

(forw) Re: [Haskell-cafe] deriving

2008-04-07 Thread John Dorsey
I meant to send this reply to the cafe. - Forwarded message - Date: Mon, 7 Apr 2008 15:05:00 -0400 To: PR Stanley <[EMAIL PROTECTED]> Subject: Re: [Haskell-cafe] deriving Paul, > No, sorry. I'm not sure how this differs from my definition. > Could you elaborate please? Gladly.

Re: [Haskell-cafe] deriving

2008-04-07 Thread John Dorsey
Paul, > Hi > data Bool = False | True > deriving (Eq, Or, Show, Read) > > Bool is an instance of Eq, Ord, Show and Read. It is derived form > these classes. No. "deriving ..." here does not mean that Bool is derived from those classes; it's not a statement about inheritance or anything simil

Re: [Haskell-cafe] Re: ANNOUNCE: GHC version 6.8.2

2007-12-23 Thread John Dorsey
Judah, Thanks for your reply, and your help. > > (Although it looks like the libraries/readline/configure script > > might recognize these, I can't get an option to pass through.) > > Actually, this is supposed to work. When running the top-level ghc > configure, you should be a

[Haskell-cafe] Re: ANNOUNCE: GHC version 6.8.2

2007-12-21 Thread John Dorsey
(Moving to the cafe) On a related topic, I've been trying to build 6.8.2 on Leopard lately. I've been running up against the infamous OS X readline issues. I know some builders here have hacked past it, but I'm looking for a good workaround... ideally one that works without changes outside the GH