Re: [Haskell-cafe] Category Theory woes

2010-02-02 Thread Creighton Hogg
2010/2/2 Álvaro García Pérez agar...@babel.ls.fi.upm.es You may try Pierce's Basic Category Theory for Computer Scientists or Awodey's Category Theory, whose style is rather introductory. Both of them (I think) have a chapter about functors where they explain the Hom functor and related

Re: [Haskell-cafe] What *is* a DSL?

2009-10-07 Thread Creighton Hogg
2009/10/7 Robert Atkey bob.at...@ed.ac.uk: What is a DSL? How about this as a formal-ish definition, for at least a pretty big class of DSLs: A DSL is an algebraic theory in the sense of universal algebra. I.e. it is an API of a specific form, which consists of:  a) a collection of

Re: [Haskell-cafe] Monad transformer, liftIO

2009-04-03 Thread Creighton Hogg
On Fri, Apr 3, 2009 at 11:49 AM, Michael Roth mr...@nessie.de wrote: Hello list, maybe I'm just stupid, I'm trying to do something like this:        import Control.Monad        import Control.Monad.Trans        import Control.Monad.List        foobar = do                a - [1,2,3]    

Re: [Haskell-cafe] The votes are in!

2009-03-24 Thread Creighton Hogg
2009/3/24 John Van Enk vane...@gmail.com: Is this the part where all the pundits come out and talk about how Jeff isn't a citizen, eats babies, and wants to turn Haskell into an imperative language? Well given the fact that Haskell has been called the world's best imperative language, that we

Re: [Haskell-cafe] Request: warn about language extensions that are not used

2009-03-11 Thread Creighton Hogg
2009/3/11 Peter Verswyvelen bugf...@gmail.com: When I put {-# OPTIONS_GHC -Wall -Werror #-} in my source file, I don't get compiler (GHC) warnings about redundant language extensions that I enabled. It would be nice if the compiler gave warnings about this, since after refactoring, some

[Haskell-cafe] ANN : happs-tutorial 0.8

2009-03-08 Thread Creighton Hogg
Hello, I'd like to announce the release of the happstack-0.2 compatible release of happs-tutorial on hackage and available for perusing on tutorial.happstack.com. A number of changes occurred in this release: * General cleanup of code for readability * Migration to the new

[Haskell-cafe] ANN : Crypto 4.2.0 Related News

2009-02-16 Thread Creighton Hogg
Hello Haskellers, I'm pleased to announce version 4.2.0 of Crypto has been uploaded to Hackage that I am taking over maintenance of the library from Dominic Steinitz. As of this release it should be cabal install'able on GHC 6.10.1. I'm also pleased to announce that the darcs repo will be

Re: [Haskell-cafe] ANN : Crypto 4.2.0 Related News

2009-02-16 Thread Creighton Hogg
On Mon, Feb 16, 2009 at 7:30 PM, Antoine Latter aslat...@gmail.com wrote: On Mon, Feb 16, 2009 at 12:48 PM, Creighton Hogg wch...@gmail.com wrote: Hello Haskellers, I'm pleased to announce version 4.2.0 of Crypto has been uploaded to Hackage that I am taking over maintenance of the library

[Haskell-cafe] ANN : happs-tutorial 0.7

2009-02-07 Thread Creighton Hogg
HAppS/Happstack more accessible. Please feel free to e-mail me with any comments, errata, or threats of bodily harm. Cheers, Creighton Hogg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Happstack 0.1 Released!

2009-02-05 Thread Creighton Hogg
On Thu, Feb 5, 2009 at 6:58 PM, Don Stewart d...@galois.com wrote: andrewcoppin: Jochem Berndsen wrote: The HAppS project has been abandoned, see http://groups.google.com/group/HAppS/msg/d128331e213c1031 . The Happstack project is intended to continue development. For more details, see

Re: [Haskell-cafe] Why binding to existing widget toolkits doesn't make any sense

2009-02-02 Thread Creighton Hogg
2009/1/29 Conal Elliott co...@conal.net: Hi Achim, I came to the same conclusion: I want to sweep aside these OO, imperative toolkits, and replace them with something genuinely functional, which for me means having a precise simple compositional (denotational) semantics. Something

Re: [Haskell-cafe] Why binding to existing widget toolkits doesn't make any sense

2009-02-02 Thread Creighton Hogg
On Mon, Feb 2, 2009 at 3:28 PM, Conal Elliott co...@conal.net wrote: On Mon, Feb 2, 2009 at 11:39 AM, Creighton Hogg wch...@gmail.com wrote: snip I think working on a purely functional widget toolkit would actually be a really cool project. Do you have any ideas, though, on what should

Re: [Haskell-cafe] Employment

2009-01-20 Thread Creighton Hogg
On Tue, Jan 20, 2009 at 1:50 PM, Paul Johnson p...@cogito.org.uk wrote: Tom Hawkins wrote: Such a database would help me counter by boss's argument that it's impossible to find and hire Haskell programmers. There was a thread last week where someone asked who would be interested in a

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

2009-01-15 Thread Creighton Hogg
On Thu, Jan 15, 2009 at 10:46 AM, Ross Mellgren rmm-hask...@z.odi.ac wrote: snip Usually when encountering something like Monoid (if I didn't already know it), I'd look it up in the library docs. The problem I've had with this tactic is twofold: First, the docs for the typeclass usually don't

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

2009-01-15 Thread Creighton Hogg
On Thu, Jan 15, 2009 at 10:18 PM, Jonathan Cast jonathancc...@fastmail.fm wrote: On Thu, 2009-01-15 at 17:06 -0500, Steve Schafer wrote: On Thu, 15 Jan 2009 13:21:57 -0800, you wrote: Where, in the history of western civilization, has there ever been an engineering discipline whose adherents

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-09 Thread Creighton Hogg
2009/1/9 John A. De Goes j...@n-brain.net: If you're looking for a project to take on, I would suggest starting with the following: A high-level, type-safe AMQP client written in 100% Haskell, which provides a clean way of handling hundreds of unique message types. Then it would be

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Creighton Hogg
On Thu, Jan 8, 2009 at 8:32 AM, John A. De Goes j...@n-brain.net wrote: Haskell's networking support is very rudimentary. Erlang's is quite sophisticated. For network intensive applications, especially those requiring messaging, fault-tolerance, distribution, and so forth, there's no doubt

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Creighton Hogg
On Thu, Jan 8, 2009 at 12:06 PM, Don Stewart d...@galois.com wrote: wchogg: On Thu, Jan 8, 2009 at 8:32 AM, John A. De Goes j...@n-brain.net wrote: Haskell's networking support is very rudimentary. Erlang's is quite sophisticated. For network intensive applications, especially those

Re: [Haskell-cafe] Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

2009-01-08 Thread Creighton Hogg
On Thu, Jan 8, 2009 at 2:02 PM, John A. De Goes j...@n-brain.net wrote: On Jan 8, 2009, at 12:56 PM, Tim Newsham wrote: You replied to someone discussing using Haskell at a CDN to implement things like web servers by saying that Haskell wasn't suitable for the task. That is incorrect. I

[Haskell-cafe] Reading group for Programming Collective Intelligence

2008-12-30 Thread Creighton Hogg
Hello Haskellers, For those of your who aren't nose-deep in Real World Haskell at the moment, I'd like to start a small group for the O'Reilly book Programming Collective Intelligence*. I think it might be very instructive to convert the examples exercises to Haskell. I think it would be good

[Haskell-cafe] Questions for Free!

2008-10-19 Thread Creighton Hogg
Hello Haskellers, So I have a bit of a follow up question after reading Theorems For Free! this weekend. There's a throw away comment near the beginning about how you can recast the results into category theoretic form, but using lax natural transformations. Now I'm assuming this means a natural

Re: [Haskell-cafe] FFI Newbie: c functions that want pointers to objects

2008-10-16 Thread Creighton Hogg
On Thu, Oct 16, 2008 at 7:28 AM, Mauricio [EMAIL PROTECTED] wrote: Hi, Some functions in C changes data using pointers, like this example: void change_int (int *n) { *n ++; } What is the proper way to handle that? I guess I should wrap it like this: foreign ccall change_int

Re: [Haskell-cafe] Where did House/hOp go?

2008-10-16 Thread Creighton Hogg
2008/10/16 Donnie Jones [EMAIL PROTECTED]: Hello Svein Ove Aas, On Thu, Oct 16, 2008 at 12:31 PM, Svein Ove Aas [EMAIL PROTECTED] wrote: I'd finally gotten to the point in learning haskell at which they might be interesting to look at, and then.. they were gone. Does anyone know what

Re: [Haskell-cafe] Re: Where did House/hOp go?

2008-10-16 Thread Creighton Hogg
On Thu, Oct 16, 2008 at 3:47 PM, Kenny Graunke [EMAIL PROTECTED] wrote: Hello! On Thu, Oct 16, 2008, Donnie Jones donnie at darthik.com wrote: [snip] The site is working for me even now. Unfortunately, the site hasn't really been updated much over the past couple of years and when I

[Haskell-cafe] Network trouble: what to do?

2008-10-15 Thread Creighton Hogg
So in my quest to create bindings to BlueZ in Haskell, I've hit a bit of a snag: sockets programming. In C, you can use the standard sockets library and just pass around addresses as arrays of 6 bytes instead of arrays of 4 bytes like you normally would. The problem I'm having is that in

Re: [Haskell-cafe] Network trouble: what to do?

2008-10-15 Thread Creighton Hogg
On Wed, Oct 15, 2008 at 12:26 PM, Bryan O'Sullivan [EMAIL PROTECTED] wrote: On Wed, Oct 15, 2008 at 6:54 AM, Creighton Hogg [EMAIL PROTECTED] wrote: Is there a way around this that I just haven't seen, or should I write a patch to Network to add an extra constructor to SockAddr and code

Re: [Haskell-cafe] ANNOUNCE: Salsa: A .NET Bridge for Haskell

2008-10-13 Thread Creighton Hogg
On Mon, Oct 13, 2008 at 1:35 PM, Albert Y. C. Lai [EMAIL PROTECTED] wrote: Alex Queiroz wrote: On Fri, Oct 10, 2008 at 5:48 PM, Andrew Coppin In what way? As far as I'm aware, .NET never really caught on and has long since become obsolete. In what alternate universe? Anthropic

[Haskell-cafe] A round of golf

2008-09-18 Thread Creighton Hogg
Hey Haskell, So for a fairly inane reason, I ended up taking a couple of minutes and writing a program that would spit out, to the console, the number of lines in a file. Off the top of my head, I came up with this which worked fine with files that had 100k lines: main = do path - liftM head $

Re: [Haskell-cafe] A round of golf

2008-09-18 Thread Creighton Hogg
On Thu, Sep 18, 2008 at 1:29 PM, Don Stewart [EMAIL PROTECTED] wrote: wchogg: Hey Haskell, So for a fairly inane reason, I ended up taking a couple of minutes and writing a program that would spit out, to the console, the number of lines in a file. Off the top of my head, I came up with this

Re: [Haskell-cafe] A round of golf

2008-09-18 Thread Creighton Hogg
On Thu, Sep 18, 2008 at 1:55 PM, Don Stewart [EMAIL PROTECTED] wrote: wchogg: On Thu, Sep 18, 2008 at 1:29 PM, Don Stewart [EMAIL PROTECTED] wrote: snip This makes me cry. import System.Environment import qualified Data.ByteString.Lazy.Char8 as B main = do [f] -

Re: [Haskell-cafe] A round of golf

2008-09-18 Thread Creighton Hogg
On Thu, Sep 18, 2008 at 1:55 PM, Don Stewart [EMAIL PROTECTED] wrote: wchogg: On Thu, Sep 18, 2008 at 1:29 PM, Don Stewart [EMAIL PROTECTED] wrote: wchogg: Hey Haskell, So for a fairly inane reason, I ended up taking a couple of minutes and writing a program that would spit out, to the

Re: [Haskell-cafe] one-way monads

2008-05-21 Thread Creighton Hogg
On Wed, May 21, 2008 at 6:37 PM, Neil Mitchell [EMAIL PROTECTED] wrote: Hi Real Haskell Programmers Only Use Top Level IO! (But then again, real programmers wouldn't use Haskell: http://www.pbm.com/~lindahl/real.programmers.htmlhttp://www.pbm.com/%7Elindahl/real.programmers.html )

Re: [Haskell-cafe] Re: Couple of formal questions

2008-05-11 Thread Creighton Hogg
/rosetta.pdf Creighton Hogg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Couple of formal questions

2008-04-29 Thread Creighton Hogg
could I find a proof that the initial algebras final coalgebras of CPO coincide? I saw this referenced in the Bananas.. paper as a fact, but am not sure where this comes from. Thanks, Creighton Hogg ___ Haskell-Cafe mailing list Haskell-Cafe

[Haskell-cafe] Problems with Bananas

2008-04-19 Thread Creighton Hogg
point of some functor F, not the functor itself. I'm sure I'm just being dumb, but this is really bugging me. Thanks, Creighton Hogg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Pierce on type theory and category theory

2007-09-25 Thread Creighton Hogg
On 9/25/07, Philippa Cowderoy [EMAIL PROTECTED] wrote: On Tue, 25 Sep 2007, Seth Gordon wrote: Are Benjamin C. Pierce's _Types and Programming Languages_ and/or _Basic Category Theory for Computer Scientists_ suitable for self-study? Basic Category Theory depends on your mindset

[Haskell-cafe] [Math] Category theory research programs?

2007-07-13 Thread Creighton Hogg
Hi Haskell, Sorry to contribute to the noise but given that we've been talking about categories lately, I was wondering if anyone had any opinions on good universities for studying category theory. I'm trying to figure out where to apply for my phd. I want to either be at a place with a strong

Re: [Haskell-cafe] Clearly, Haskell is ill-founded

2007-07-10 Thread Creighton Hogg
On 7/9/07, Dan Piponi [EMAIL PROTECTED] wrote: On 7/8/07, Thomas Conway [EMAIL PROTECTED] wrote: The basic claim appears to be that discrete mathematics is a bad foundation for computer science. I suspect the subscribers to this list would beg to disagree. Wearing my tin foil hat for the

Re: [Haskell-cafe] Clearly, Haskell is ill-founded

2007-07-10 Thread Creighton Hogg
On 7/9/07, Conor McBride [EMAIL PROTECTED] wrote: Hi all On 9 Jul 2007, at 06:42, Thomas Conway wrote: I don't know if you saw the following linked off /. http://www.itwire.com.au/content/view/13339/53/ [..] The basic claim appears to be that discrete mathematics is a bad foundation

Re: [Haskell-cafe] Re: In-place modification

2007-07-10 Thread Creighton Hogg
On 7/10/07, Aaron Denney [EMAIL PROTECTED] wrote: On 2007-07-10, Sebastian Sylvan [EMAIL PROTECTED] wrote: On 10/07/07, Andrew Coppin [EMAIL PROTECTED] wrote: Sebastian Sylvan wrote: That might eliminate the concurrency imperative (for a while!), but it doesn't adress the productivity

Re: [Haskell-cafe] Very freaky

2007-07-10 Thread Creighton Hogg
On 7/10/07, Jim Burton [EMAIL PROTECTED] wrote: Andrew Coppin wrote: On the one hand, it feels exciting to be around a programming language where there are deep theoretical discoveries and new design territories to be explored. (Compared to Haskell, the whole C / C++ / Java / JavaScript

Re: [Haskell-cafe] Collections

2007-06-19 Thread Creighton Hogg
A lot of people have had comments on this thread, but I have a off-hand question: what data types are required by the 98 standard? I figured it was just lists tuples because they have syntactic support, but is that true? Thanks, Creighton ___

Re: [Haskell-cafe] yi or not to yi was: IDE?

2007-06-18 Thread Creighton Hogg
On 6/18/07, Andrew Coppin [EMAIL PROTECTED] wrote: Pasqualino 'Titto' Assini wrote: I think that we should not underestimate the transforming power of dogged determination. Think of Linux: only a terminal idiot could have conceived the plan of writing from scratch a clone of a 20 years old

Re: [Haskell-cafe] IDE?

2007-06-18 Thread Creighton Hogg
On 6/18/07, Andrew Coppin [EMAIL PROTECTED] wrote: Mark T.B. Carroll wrote: Are KWrite and Kate something to do with KDE or something? One of the first things I do with a new Linux install is to dump all the KDE and Gnome stuff on the basis that it's an enormous amount of bloatware for

Re: [Haskell-cafe] yi or not to yi was: IDE?

2007-06-18 Thread Creighton Hogg
On 6/18/07, Andrew Coppin [EMAIL PROTECTED] wrote: Creighton Hogg wrote: On 6/18/07, *Andrew Coppin* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: That reminds me... Somebody should write an *OS* in Haskell! :-D Well, there hasn't been a lot of work done on the subject but you

[Haskell-cafe] OS design FP aesthetics

2007-06-18 Thread Creighton Hogg
On 6/18/07, Andrew Coppin [EMAIL PROTECTED] wrote: Creighton Hogg wrote: Well, since we're on the subject and it's only the Cafe list, what is it that you find messy about Linux that you would want to be solved by some hypothetical Haskell OS? This is drifting off-topic again, but here goes

Re: [Haskell-cafe] OS design FP aesthetics

2007-06-18 Thread Creighton Hogg
On 6/18/07, Creighton Hogg [EMAIL PROTECTED] wrote: On 6/18/07, Andrew Coppin [EMAIL PROTECTED] wrote: Creighton Hogg wrote: There are lots of things to like about Linux. It doesn't cost money. It's fast. It's reliable. It's flexible. It's secure. Okay, I'm not sure

Re: [Haskell-cafe] OS design FP aesthetics

2007-06-18 Thread Creighton Hogg
On 6/18/07, Thomas Conway [EMAIL PROTECTED] wrote: On 6/19/07, Creighton Hogg [EMAIL PROTECTED] wrote: Okay, I remember seeing an example of this before , but I'm not sure if I see what language based security Haskell's type system could provide in protecting address spaces from each other

Re: [Haskell-cafe] Just for a laugh...

2007-05-31 Thread Creighton Hogg
On 5/31/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On May 31, 2007, at 15:47 , Andrew Coppin wrote: If you're bored... can you come up with a solution to this? http://warp.povusers.org/ProgrammingChallenge.html Is it me, or does this look like a job for Data.Binary? It's not

Re: [Haskell-cafe] Memoization

2007-05-30 Thread Creighton Hogg
On 5/26/07, Mark Engelberg [EMAIL PROTECTED] wrote: I'd like to write a memoization utility. Ideally, it would look something like this: memoize :: (a-b) - (a-b) memoize f gives you back a function that maintains a cache of previously computed values, so that subsequent calls with the same

Re: [Haskell-cafe] Language extensions [was: Memoization]

2007-05-30 Thread Creighton Hogg
On 5/29/07, Andrew Coppin [EMAIL PROTECTED] wrote: Claus Reinke wrote: phantom types: the types of ghost values (in other words, we are only interested in the type, not in any value of that type). Mmm... Still not seeing a great amount of use for this one. Okay,

Re: [Haskell-cafe] Memoization

2007-05-30 Thread Creighton Hogg
On 5/30/07, Isaac Dupree [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Creighton Hogg wrote: Now maybe I'm being dense here, but would you really *want* a way in Haskell to do something like memo :: (a-b) - a-b since it changes the semantics of the function

Re: [Haskell-cafe] OpenGL

2007-05-30 Thread Creighton Hogg
On 5/30/07, Jon Harrop [EMAIL PROTECTED] wrote: I've found HOpenGL and the Debian package libghc6-opengl-dev. The former seems to be very out of date (last release 2003) but I can't find any demos for the latter. Where should I go to get started with OpenGL and Haskell? For at least GHC

Re: [Haskell-cafe] New book: Real-World Haskell!

2007-05-23 Thread Creighton Hogg
On 5/23/07, Tom Harper [EMAIL PROTECTED] wrote: I really hope they choose the flying squirrel. They should just use that picture of Philip Wadler as Lambda-Man. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] instance monad problem

2007-05-14 Thread Creighton Hogg
Hi On 5/14/07, Veer Singh [EMAIL PROTECTED] wrote: Hello, I am trying to learn haskell , but i am struggling with types , its been around 7 days , it will be very kind if some explain it why this error , i think this is the only stumbling block . I am looking for the comparison on why similar

Re: [Haskell-cafe] Monad pronounced like gonad?

2007-05-10 Thread Creighton Hogg
On 5/10/07, Dan Weston [EMAIL PROTECTED] wrote: I've been pronouncing monad like gonad (moh-nad), but it occurs to me that it might be pronounced like monoid (mah-nad). Is there an official way to pronouce this word - maybe with a Scottish accent? :) I've always said mah-nad, mah-noyd, and

Re: [Haskell-cafe] Topoi, the categorical Analysis of Logic

2007-05-06 Thread Creighton Hogg
Hi, I've been reading it off and on for a couple of months. I definitely wouldn't say it'll make you a better programmer, but it's a pretty nice, gentle, introduction to some basic category theory and some uses of topoi. Read it if you're interested in all that, not if you're just focused on

Re: [Haskell-cafe] Monad/Functor Book

2007-03-27 Thread Creighton Hogg
On 3/27/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Given the amount of material posted at haskell.org and elsewhere explaining IO, monads and functors, has anyone considered publishing a comprehensive book explaining those subjects? (I am trying to read all the material online, but books

Re: [Haskell-cafe] Monad/Functor Book

2007-03-27 Thread Creighton Hogg
On 3/27/07, Dan Piponi [EMAIL PROTECTED] wrote: On 3/27/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Given the amount of material posted at haskell.org and elsewhere explaining IO, monads and functors, has anyone considered publishing a comprehensive book explaining those subjects? (I am

Re: [Haskell-cafe] Re: [Haskell] Call-by-name: moved to haskell-cafe

2007-03-20 Thread Creighton Hogg
On 3/20/07, Dan Weston [EMAIL PROTECTED] wrote: Dan Weston wrote: Douglas Philips wrote: On 2007 Mar 20, at 3:30 PM, Dan Weston indited: I looked up John Backus on wikipedia and followed a link to ALGOL: http://en.wikipedia.org/wiki/ALGOL_60 where the following undesirable property of

Re: [Haskell-cafe] Strange memory consumption problems in something that should be tail-recursive

2007-02-13 Thread Creighton Hogg
On 2/13/07, Duncan Coutts [EMAIL PROTECTED] wrote: On Tue, 2007-02-13 at 15:27 -0500, Jefferson Heard wrote: Hi, I am running the following code against a 210 MB file in an attempt to determine whether I should use alex or whether, since my needs are very performance oriented, I should write

Re: [Haskell-cafe] Strange memory consumption problems in something that should be tail-recursive

2007-02-13 Thread Creighton Hogg
On 2/13/07, Bernie Pope [EMAIL PROTECTED] wrote: Creighton Hogg wrote: This may be silly of me, but I feel like this is an important point: so you're saying that tail recursion, without strictness, doesn't run in constant space? It is an important point, and a classic space bug (see foldl

Re: [Haskell-cafe] pythags

2007-02-12 Thread Creighton Hogg
On 2/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, the Advanced Monads page in the Haskell Wikibook (http://en.wikibooks.org/wiki/Haskell/Advanced_monads) contains the following example of a List Monad pythags = do x - [1..] y - [x..] z - [y..] guard

Re: [Haskell-cafe] Re: Optimization fun

2007-02-11 Thread Creighton Hogg
On 2/10/07, Matthew Brecknell [EMAIL PROTECTED] wrote: Rafael Almeida said: I've always found the following definition of the sieve of eratosthenes the clearest definition one could write: sieve [] = [] sieve (x:xs) = x : sieve [y | y - xs, y `mod` x /= 0] It doesn't perform better than

[Haskell-cafe] Optimization fun

2007-02-10 Thread Creighton Hogg
to learn a bit more about how to optimize Haskell code. Cheers, Creighton Hogg -- Naive way to calculate prime numbers, testing each new n to see if it has prime factors less than sqrt(n). import Data.List primes = 2:(foldr (\x y - if isPrime x then x:y else y) [] [3..]) where isPrime x = foldl' (\z

Re: [Haskell-cafe] Optimization fun

2007-02-10 Thread Creighton Hogg
there. I should have proofread. Also, your code is not idiomatic Haskell. Here's a different version: primes :: [Int] primes = 2:filter isPrime [3,5..] where isPrime x = all (\ y - x `mod` y /= 0) $ takeWhile (\ p - p*p = x) primes On Feb 10, 2007, at 21:02 , Creighton Hogg wrote

Re: [Haskell-cafe] Optimization fun

2007-02-10 Thread Creighton Hogg
On 2/10/07, Creighton Hogg [EMAIL PROTECTED] wrote: On 2/10/07, Lennart Augustsson [EMAIL PROTECTED] wrote: There are many things that makes your code slow. * The default for Haskell is to compute with Integer, not Int. So that makes from Integral and floor very slow. * foldl' is a bad

Re: [Haskell-cafe] Optimization fun

2007-02-10 Thread Creighton Hogg
On 2/10/07, Peter Berry [EMAIL PROTECTED] wrote: Gah! Gmail has really broken defaults for posting to lists. On 10/02/07, Creighton Hogg [EMAIL PROTECTED] wrote: Hello Haskell-ers, So a friend and I were thinking about making code faster in Haskell, and I was wondering if there was a way

Re: [Haskell-cafe] Re: Optimization fun

2007-02-10 Thread Creighton Hogg
On 2/10/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Creighton Hogg wrote: Hello Haskell-ers, So a friend and I were thinking about making code faster in Haskell, and I was wondering if there was a way to improve the following method of generating the list of all prime numbers. It takes

[Haskell-cafe] Picking out elements of a heterogenous list

2006-12-05 Thread Creighton Hogg
Hi Haskell-ers, So I think I understand the idea of creating a heterogenous list using typeclasses and existentials, but I don't see how to filter the list to retrieve elements of the list that are of only one type. More concretely, taking the example

[Haskell-cafe] More threading confusion

2006-08-17 Thread Creighton Hogg
Good afternoon Haskellers,So I'm trying to understand how STM works, and wrote a quick 'eating philosophers' example to see if I understood how it's supposed to work.The problem is that while it executes, it doesn't appear to *do* anything. Did I completely write things wrongheadedly or am I being

[Haskell-cafe] Questions on threads and IO

2006-08-16 Thread Creighton Hogg
Hello Haskell'rs, I've been playing with threads and I tried to do a toy example (that used java) from a class. When run, the program should print a prompt and accept commands just like a linux shell. It doesn't have to do anything fancy, just spawn new threads that make system calls when

[Haskell-cafe] Re: [Haskell] Haskell.org and Google Summer of Code 2006

2006-04-22 Thread Creighton Hogg
in the language without sacrificing too much performance and having a hundred times the flexibility and *maintainability*. Creighton Hogg On 4/22/06, Paolo Martini [EMAIL PROTECTED] wrote: Hello everybody, nice to meet you all. Last year I did work on an Haskell project during the first year of the Google

[Haskell-cafe] Re: Fundeps: I feel dumb

2006-04-13 Thread Creighton Hogg
On 13 Apr 2006 03:27:03 -, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Creighton Hogg wrote: No instance for (MatrixProduct a (Vec b) c) arising from use of `*' at interactive:1:3-5 Probable fix: add an instance declaration for (MatrixProduct a (Vec b) c

[Haskell-cafe] Fundeps: I feel dumb

2006-04-12 Thread Creighton Hogg
Hi, So I'm trying the fun-deps example from http://www.haskell.org/hawiki/FunDeps and seeing if I can use it, but I can't really get things to work the way I want. The code follows below, and the error I get if I try to multiply 10 * (vector 10 [0..9]) is No instance for (MatrixProduct a (Vec

[Haskell-cafe] Matching constructors

2006-02-10 Thread Creighton Hogg
Hi, If I have something like data Patootie = Pa Int | Tootie Int and I want to pull out the indices of all elements of a list that have type constructor Tootie, how would I do that? I thought I might be able to use findIndices, but I don't know how to express the predicate.

[Haskell-cafe] Encapsulation in Haskell

2005-12-22 Thread Creighton Hogg
Hi guys, So one of the big things in object oriented programming is encapsulation, and I'm wondering how to do it properly in Haskell. How do you define new data types but minimize the dependence of external packages on the exact nature of the data definition?

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Creighton Hogg
On Wed, 21 Dec 2005, Robin Green wrote: Henning Thielemann wrote: Starting with IO in Haskell is like starting LaTeX with rotating text and making it colorful. Not at all! Indeed IO _is_ complicated regardless of whether it is modelled by Monads in Haskell or differently in other

Re: [Haskell-cafe] Functions with side-effects?

2005-12-21 Thread Creighton Hogg
On Wed, 21 Dec 2005, Daniel Carrera wrote: Hi all, I'm a Haskell newbie and I don't really understand how Haskell deals with functions that really must have side-effects. Like a rand() function or getLine(). I know this has something to do with monads, but I don't really understand

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Creighton Hogg
On Wed, 21 Dec 2005, Henning Thielemann wrote: On Wed, 21 Dec 2005, Creighton Hogg wrote: I agree with this wholeheartedly. When I first started playing with Haskell, some of the tutorials made it look like it was very difficult to do anything practical with it because doing real

Re: [Haskell-cafe] Functions with side-effects?

2005-12-21 Thread Creighton Hogg
On Wed, 21 Dec 2005, Daniel Carrera wrote: Thanks for all the help. I think things are much clearer now. And this bit: main = do putStrLn Hello, what is your name? name - getLine putStrLn (Hello, ++ name ++ !) Looks quite straight forward. I just wrote my very

Re: [Haskell-cafe] Functions with side-effects?

2005-12-21 Thread Creighton Hogg
On Wed, 21 Dec 2005, Daniel Carrera wrote: Creighton Hogg wrote: x is a String, getLine has type IO String. That's what I was getting at in one of my last e-mails. Hmm... let's see if I understand: * getLine() has type IO String. * The - will convert an IO String to a plain String

Re: [Haskell-cafe] Re: problems with square roots...

2005-12-21 Thread Creighton Hogg
On Wed, 21 Dec 2005, Scherrer, Chad wrote: From: Daniel Carrera [EMAIL PROTECTED] Hey, The sqrt function is not doing what I want. This is what I want: round sqrt(2) --- Daniel, A lot of Haskell folks like to avoid

[Haskell-cafe] Learning about haskell compilers

2005-12-20 Thread Creighton Hogg
Hi guys, I was wondering where I should get started in learing about how to implement a haskell compiler? Are there papers, wiki entries, or other things people think would be helpful or should I just start looking at the source of one of the compilers?

Re: [Haskell-cafe] Learning about haskell compilers

2005-12-20 Thread Creighton Hogg
On Tue, 20 Dec 2005, John Meacham wrote: On Tue, Dec 20, 2005 at 10:36:36AM -0600, Creighton Hogg wrote: I was wondering where I should get started in learing about how to implement a haskell compiler? Snip Absolute Awesomeness Wow! That was a great response, with more references than

[Haskell-cafe] Haskell School of Expression?

2005-12-15 Thread Creighton Hogg
Hi, Has anyone recently tried to install the graphics libraries included on http://haskell.org/soe/software.htm ? I've tried to make the libraries, but I get these errors. make: Entering directory `/home/wchogg/coding/haskell/GraphicsLib/lib/x11' ffihugs +G +LX_stub_ffi.c X.hs Warning:

[Haskell-cafe] Monads as control structures?

2005-10-27 Thread Creighton Hogg
Hi, so I'm a newbie getting used to Haskell. I'm writing some simple things like genetic algorithms in it for practice, and I keep coming across something that really bugs me: are there any standard libraries that allow you to do imperative style for or while loops using monads to keep

Re: [Haskell-cafe] Monads as control structures?

2005-10-27 Thread Creighton Hogg
On Thu, 27 Oct 2005, Creighton Hogg wrote: On Thu, 27 Oct 2005, Robert Dockins wrote: On Oct 27, 2005, at 11:54 AM, Creighton Hogg wrote: Hi, so I'm a newbie getting used to Haskell. I'm writing some simple things like genetic algorithms in it for practice, and I keep

RE: [Haskell-cafe] Nice way to calculate character frequency in astring

2005-10-25 Thread Creighton Hogg
On Tue, 25 Oct 2005, Simon Peyton-Jones wrote: | Ugh! These are all horrid. If something on the lines of | | calc = accumArray (+) 0 (minBound, maxBound) . (map (\x-(x,1))) | | isn't fast enough, complain to the implementors! What's the | point of functional programming if one has to

Re: [Haskell-cafe] Haskell versus Lisp

2005-09-16 Thread Creighton Hogg
On Fri, 16 Sep 2005, Mark Carter wrote: This is not a troll, honest, so please bear with me ... I'm a C/C++/VBA programmer (although the former 2 are several years old for me), with a sprinkling of Python. Needless to say, I was looking to see if there were any better ways of doing