Re: [Haskell-cafe] Re: A few ideas about FRP and arbitrary access in time

2010-03-09 Thread Gregory Crosswhite
On Mar 9, 2010, at 9:34 AM, John Meacham wrote: Hmm.. I thought something interesting happened on the scale of the plank time, 10^-44 seconds or so. Or is that only relevant to our ability to _measure_ things at that scale and not the continuity of time itself as far as QM is concerned?

[Haskell-cafe] Happy Easter / ZJD!

2010-04-04 Thread Gregory Crosswhite
Happy Easter to those of you who are Christian, and Happy Zombie Jesus Day to those of you who aren't! - Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] How do I use ByteString?

2010-04-05 Thread Gregory Crosswhite
Look in Data.ByteString.Char8 Cheers, Greg On Apr 5, 2010, at 6:27 PM, Günther Schmidt wrote: Hi all, I've never found an easy way to deal with ByteStrings. I'm using the RSA library and it en- and decodes Data.ByteString.Lazy.ByteString. I initially start with Strings, ie. [Char],

Re: [Haskell-cafe] Simple binary-protocol through network test

2010-04-06 Thread Gregory Crosswhite
Yay, I'm glad to see someone else using my package. :-) Hmm, your program seems to work for me. I compiled and ran the Server (with ghc --make), then compiled and ran the Client, and then typed Operation 1.0 Mult 2.0 into the Client process, and the result it got was 2.0

Re: [Haskell-cafe] Simple binary-protocol through network test

2010-04-06 Thread Gregory Crosswhite
, Yves Parès wrote: Weird... I use GHC 6.12.1, and I run Ubuntu 9.10 (32bits version). Would have I miss something? Like a flush or a close? Logically, I don't see where I would... Gregory Crosswhite-2 wrote: Yay, I'm glad to see someone else using my package. :-) Hmm, your program

Re: [Haskell-cafe] Re: GSoC: Improving Cabal's Test Support

2010-04-06 Thread Gregory Crosswhite
Rather that starting from scratch, you should strongly consider adapting something like test-framework to this task, as it already has done the heavy work of creating a way to combine tests from different frameworks into a single suite and includes such features as displaying a progress bar

Re: [Haskell-cafe] Re: GSoC: Improving Cabal's Test Support

2010-04-06 Thread Gregory Crosswhite
On Apr 6, 2010, at 4:40 PM, Thomas Tuegel wrote: Now, if you're telling me I'm going off in the wrong direction by proposing to integrate a test framework into Cabal itself, that's another story. Should I pare down my proposal to only include support for a proper 'Test' stanza in the

Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-06 Thread Gregory Crosswhite
I concur that the latest version with the softer colors looks a lot nicer, and I approve of the overall design. I think that you should go back to using a change in the foreground color rather than the background color for the links in the main description, since at the moment it looks ugly.

Re: [Haskell-cafe] Re: GSoC: Improving Cabal's Test Support

2010-04-06 Thread Gregory Crosswhite
On Apr 6, 2010, at 5:28 PM, Thomas Tuegel wrote: On Tue, Apr 6, 2010 at 7:43 PM, Rogan Creswick cresw...@gmail.com wrote: test-framework and test-runner both address the second problem, and those solutions can be kept separate, at least for now. Figuring out the best way to specify test

Re: [Haskell-cafe] what are the safety conditions for unsafeIOToST

2010-04-06 Thread Gregory Crosswhite
I would venture that the condition under which unsafeIOtoST would be safe is if all of the computations you are performing in the IO monad are only changing state that is local to the computation within the ST monad in which you are running. (For example, if there were no STRef type then you

Re: [Haskell-cafe] Re: GSoC: Improving Cabal's Test Support

2010-04-06 Thread Gregory Crosswhite
On Apr 6, 2010, at 5:35 PM, Ivan Miljenovic wrote: On 7 April 2010 10:28, Thomas Tuegel ttue...@gmail.com wrote: Ok, this is the bottom-line that I didn't understand after our first exchange, but I think now I do: I should entirely scrap the second aspect of my proposal and focus exclusively

Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-06 Thread Gregory Crosswhite
they could be). Without any styling the blurb would look too boring, so I'm using the same blue that the title bar uses. On 7 April 2010 01:25, Gregory Crosswhite gcr...@phys.washington.edu wrote: I concur that the latest version with the softer colors looks a lot nicer, and I approve

Re: [Haskell-cafe] Re: GSoC: Improving Cabal's Test Support

2010-04-06 Thread Gregory Crosswhite
Sounds like a good plan to me! You still need some way to separate out the test dependencies from the main build dependencies, though. Perhaps as a separate line in the main Cabal header section? Also, per my earlier comment, it would be good if there were also an Automatic option in each

Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-06 Thread Gregory Crosswhite
any styling the blurb would look too boring, so I'm using the same blue that the title bar uses. On 7 April 2010 01:25, Gregory Crosswhite gcr...@phys.washington.edu wrote: I concur that the latest version with the softer colors looks a lot nicer, and I approve of the overall design. I

Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-06 Thread Gregory Crosswhite
While I think that (d) is a valid concern, it is also important not to let the perfect be the enemy of the good. If we agree that the proposed web site layout is sufficiently better than the current one and is good enough aesthetically, then I think we should go ahead and switch to the new

Re: [Haskell-cafe] Re: GSoC: Improving Cabal's Test Support

2010-04-06 Thread Gregory Crosswhite
, at 6:37 PM, Thomas Tuegel wrote: On Tue, Apr 6, 2010 at 9:00 PM, Gregory Crosswhite gcr...@phys.washington.edu wrote: Sounds like a good plan to me! You still need some way to separate out the test dependencies from the main build dependencies, though. Perhaps as a separate line in the main

Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Gregory Crosswhite
to remove it, but that just doesn't look good anymore. On 7 April 2010 14:19, Daniel Fischer daniel.is.fisc...@web.de wrote: Am Mittwoch 07 April 2010 04:09:17 schrieb Gregory Crosswhite: While I think that (d) is a valid concern, it is also important not to let the perfect be the enemy of the good

Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Gregory Crosswhite
Nicely done! On Apr 7, 2010, at 11:35 AM, Thomas Schilling wrote: http://i.imgur.com/kFqP3.png Didn't know about CSS's rgba to describe transparency. Very useful. On 7 April 2010 18:19, Gregory Crosswhite gcr...@phys.washington.edu wrote: Ooo, I really like this revision; it is a major

Re: [Haskell-cafe] Simple binary-protocol through network test

2010-04-08 Thread Gregory Crosswhite
That sounds like a reasonable modification; if you want, free to fork it at http://github.com/gcross/binary-protocol and push me your proposed changes. Cheers, Greg On Apr 8, 2010, at 9:12 AM, Yves Parès wrote: By the way, Gregory, concerning the package binary-protocol, I was wondering

Re: [Haskell-cafe] haskell gsoc proposal for richer numerical type classes and supporting algorithms

2010-04-08 Thread Gregory Crosswhite
On Apr 8, 2010, at 12:25 PM, Casey McCann wrote: Seriously, floating point so-called numbers don't even have reflexive equality! They don't? I am pretty sure that a floating point number is always equal to itself, with possibly a strange corner case for things like +/- 0 and NaN. Cheers,

Re: [Haskell-cafe] haskell gsoc proposal for richer numerical type classes and supporting algorithms

2010-04-08 Thread Gregory Crosswhite
On Apr 8, 2010, at 5:30 PM, Casey McCann wrote: On Thu, Apr 8, 2010 at 7:58 PM, wren ng thornton w...@freegeek.org wrote: Exactly. NaN /= NaN [...] Indeed. NaN means that equality is not reflexive for floats in general, only a subset of them. First of all, it isn't clear to me that NaN /=

Re: [Haskell-cafe] haskell gsoc proposal for richer numerical type classes and supporting algorithms

2010-04-08 Thread Gregory Crosswhite
On Apr 8, 2010, at 6:53 PM, Daniel Fischer wrote: Am Freitag 09 April 2010 02:51:23 schrieb Gregory Crosswhite: Yes, but 1/0 isn't a NaN: Prelude isNaN (1.0/0.0) False Prelude isNaN (0.0/0.0) True Prelude 1.0/0.0 Infinity Prelude 0.0/0.0 NaN Prelude (0.0/0.0) == (0.0/0.0) False

[Haskell-cafe] Bulk Synchronous Parallel

2010-04-19 Thread Gregory Crosswhite
Hey everyone, Has anyone done any work with bulk synchronous parallel computing in Haskell? The idea behind the model is that you divide your computation into a series of computation and communication phases, and it has recently occurred to me that this might be an ideal setup for

Re: [Haskell-cafe] Bulk Synchronous Parallel

2010-04-19 Thread Gregory Crosswhite
? Cheers, Greg On Apr 19, 2010, at 3:33 PM, Sebastian Sylvan wrote: On Mon, Apr 19, 2010 at 11:03 PM, Gregory Crosswhite gcr...@phys.washington.edu wrote: Hey everyone, Has anyone done any work with bulk synchronous parallel computing in Haskell? The idea behind the model is that you

Re: [Haskell-cafe] Bulk Synchronous Parallel

2010-04-21 Thread Gregory Crosswhite
You know, I looked into Erlang, and while it looks intriguing it isn't great for my purposes because I want to be able to call Fortran routines to do the heavy number-crunching, and Erlang doesn't have a good standard FFI like Haskell. Also, I really don't want to use a dynamically typed

Re: [Haskell-cafe] Re: GSoC: Improving Cabal's Test Support

2010-04-28 Thread Gregory Crosswhite
If the goal is continuous integration, perhaps it would be sufficient to require cabal test to return an error code of 0 if all tests succeed, and something else if any of them fail; it can additionally print whatever output it wants in either case. The continuous integration system would

Re: [Haskell-cafe] Re: FRP for game programming / artifical life simulation

2010-04-28 Thread Gregory Crosswhite
On Apr 28, 2010, at 3:41 PM, Limestraël wrote: I think the problem with function serialization is that unlike languages which run over a virtual machine, bytecode generated by GHC is platform-specific (just as compilated C or C++) and therefore can run directly on top of the system, which

[Haskell-cafe] 64-bit code on OSX?

2010-04-30 Thread Gregory Crosswhite
Hey everyone, Just out of curiosity, does anyone know the story on what is holding up the ability of GHC to generate 64-bit code on OSX? Cheers, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Haskell and the Software design process

2010-05-04 Thread Gregory Crosswhite
to find all the edge cases of your code. -R. Kyle Murphy -- Curiosity was framed, Ignorance killed the cat. On Tue, May 4, 2010 at 12:56, John Lato jwl...@gmail.com wrote: On Tue, May 4, 2010 at 5:31 PM, Gregory Crosswhite gcr...@phys.washington.edu wrote: Yes, but I think

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-05 Thread Gregory Crosswhite
On May 5, 2010, at 3:09 PM, Daniel Fischer wrote: Learning Lisp dialects is much harder (to a large part because of the parentheses, which makes them near impossible to parse). On the contrary, the whole point of parentheses is that it makes Lisp *easier* to parse... for computers. :-)

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Gregory Crosswhite
On May 7, 2010, at 4:54 PM, Limestraël wrote: Personally I think fail is a terrible wart, and should be shunned. So do I. I can't understand its purpose since monads which can fail can be implemented through MonadPlus. As far as I can tell, its purpose is to essentially allow you to

Re: [Haskell-cafe] Haskell and the Software design process

2010-05-09 Thread Gregory Crosswhite
On May 9, 2010, at 1:04 AM, wren ng thornton wrote: If you're structuring your code with that invariant, then why aren't you using the correct type? I do try to use the type system as much as possible to enforce constraints. However. it is not always so simple as making sure that a list

Re: [Haskell-cafe] Numerical Analysis

2010-05-16 Thread Gregory Crosswhite
On May 16, 2010, at 4:51 AM, Roman Leshchinskiy wrote: You are quite right that vector only supports nested arrays but not multidimensional ones. This is by design, however - the library's only goal is to provide efficient one-dimensional, Int-indexed arrays. I'm thinking about how to

Re: [Haskell-cafe] Numerical Analysis

2010-05-17 Thread Gregory Crosswhite
of implementing an SVD algorithm might be useful for giving guidance on the kind of high-level operations that are needed in the library. Cheers, Greg On May 17, 2010, at 8:01 PM, Roman Leshchinskiy wrote: On 17/05/2010, at 05:17, Gregory Crosswhite wrote: As an aside, while

[Haskell-cafe] Multidimensional generalization of the vector package

2010-05-27 Thread Gregory Crosswhite
Hey everyone, I have been thinking about how to generalize the vector package to multiple dimensions, and I'd like to share my ideas with you all in the hope of having people smarter than me share their thoughts on how it could be improved --- *especially* regarding how to make it efficient!

Re: [Haskell-cafe] Rewriting a famous library and using the same name: pros and cons

2010-06-08 Thread Gregory Crosswhite
Or you just put an upper bound on the versions of the fgl library that your program will build against, as you should be doing anyway, and then nothing breaks. Cheers, Greg On Jun 8, 2010, at 11:08 AM, Gene A wrote: On Tue, Jun 8, 2010 at 8:08 AM, Don Stewart d...@galois.com wrote:

Re: [Haskell-cafe] Similarities between web programming and functional programming

2010-06-12 Thread Gregory Crosswhite
Unless you are using a framework like Twisted, where all potentially blocking operations are handled by passing in a function to be called when the operation is complete, so that the stack trace is non-existent. This way you get both the joy of working with a language where simple mistakes

Re: [Haskell-cafe] Rewriting a famous library and using the same name: pros and cons

2010-06-22 Thread Gregory Crosswhite
they want to use a library that used fc-labels internally with another library that used mtl internally. It fragments the library base that you are able to use. Version caps are not the answer. -Edward Kmett On Tue, Jun 8, 2010 at 2:21 PM, Gregory Crosswhite gcr...@phys.washington.edu mailto:gcr

[Haskell-cafe] Control.Alternative --- some and many?

2010-06-22 Thread Gregory Crosswhite
Hey everyone, Could someone explain to me (or point me to a reference explaining) the purpose of the some and many methods of the Alternative class? Also, there is a link posted in the documentation for Control.Applicative to a paper which describes the motivation behind the Applicative

Re: [Haskell-cafe] Rewriting a famous library and using the same name: pros and cons

2010-06-23 Thread Gregory Crosswhite
On 6/23/10 2:13 PM, Edward Kmett wrote: On Tue, Jun 22, 2010 at 4:54 PM, Gregory Crosswhite gcr...@phys.washington.edu mailto:gcr...@phys.washington.edu wrote: There is no reason that your program couldn't link to multiple versions of the same package so that each library can access

Re: [Haskell-cafe] Rewriting a famous library and using the same name: pros and cons

2010-06-23 Thread Gregory Crosswhite
On 6/23/10 3:29 PM, Edward Kmett wrote: Yes, and that problem still isn't resolved in another since, since they share the same module names, but as of yet, still provide an incompatible API. I can't (yet) provide 'RightSemiNearRing' instances that work with both the monad transformers from

Re: [Haskell-cafe] Rewriting a famous library and using the same name: pros and cons

2010-06-23 Thread Gregory Crosswhite
On 6/23/10 8:06 PM, Duncan Coutts wrote: Consider an example where we want to avoid using two versions of a dependency: The htar program depends on the tar and zlib packages. The tar and zlib packages depend on bytestring. Both tar and zlib export functions that use the type ByteString. The

Re: [Haskell-cafe] Rewriting a famous library and using the same name: pros and cons

2010-06-24 Thread Gregory Crosswhite
On 6/23/10 10:06 PM, Duncan Coutts wrote: Suppose both the zlib and tar packages specify build-depends: bytestring-0.9.*. It's entirely possible for me to install zlib, then upgrade to a new bugfix release of bytestring, install tar (using the new bytestring) and then build htar depending on

Re: [Haskell-cafe] Type-Level Programming

2010-06-25 Thread Gregory Crosswhite
Are any of those compatible with Haskell, so that we could mix code in that language with Haskell code? Cheers, Greg On 6/25/10 9:49 PM, wren ng thornton wrote: Jason Dagit wrote: On Fri, Jun 25, 2010 at 2:26 PM, Walt Rorie-Baety black.m...@gmail.comwrote: I've noticed over the - okay,

Re: [Haskell-cafe] ANNOUNCE: hs-cryptohash 0.4

2010-07-02 Thread Gregory Crosswhite
On 7/2/10 11:01 AM, Brandon S Allbery KF8NH wrote: Although now that I think about it, if we're just appending to the state, this should possibly be a Writer instead of a State; the interface is simpler. The problem with this approach is that the hash context isn't a monoid; you can

Re: [Haskell-cafe] ANNOUNCE: hs-cryptohash 0.4

2010-07-02 Thread Gregory Crosswhite
On 7/2/10 5:16 AM, Vincent Hanquez wrote: It's necessary in my case since i receive chunks of data to be hashed from the network, and I don't want to carry a buffer of data (with potential security issues), until i can hash everything. As an aside, this kind of pattern where you are

Re: [Haskell-cafe] ANNOUNCE: hs-cryptohash 0.4

2010-07-02 Thread Gregory Crosswhite
On 7/2/10 9:13 PM, Brandon S Allbery KF8NH wrote: If you read the example code I posted, the point was how to turn the current monolithic hash function into a cumulative one by using Writer. As such, there's no opaque hash state inside the Writer. (see `hash . runWriter'). You can do

[Haskell-cafe] Transformers versus monadLib versus...

2010-07-05 Thread Gregory Crosswhite
Hey everyone, What is the current state regarding transformers versus monadLib versus mmtl versus ... etc.? Transformers seems to be the blessed replacement for mtl, so when is it worthwhile to use the other libraries instead? It hadn't even occurred to me to look closely at packages other than

[Haskell-cafe] Transformers versus monadLib versus...

2010-07-05 Thread Gregory Crosswhite
Hey everyone, What is the current state of opinion regarding transformers versus monadLib versus mmtl versus ... etc.? Transformers seems to be the blessed replacement for mtl, so when is it worthwhile to use the other libraries instead? (It hadn't even occurred to me to look closely at

Re: [Haskell-cafe] Merge hsql and HDBC -- there can only be one!

2010-07-07 Thread Gregory Crosswhite
I've been using Takusen for all of my database needs, which most of the time means interfacing to a PostgreSQL database, and it has worked out pretty well in practice. In fact, I experimented with hsql and HDBC a while back and for some reason I can't remember they turned out to be less

Re: [Haskell-cafe] Memoization in Haskell?

2010-07-08 Thread Gregory Crosswhite
On 7/8/10 9:17 PM, Michael Mossey wrote: Daniel Fischer wrote: If f has the appropriate type and the base case is f 0 = 0, module Memo where import Data.Array f :: (Integral a, Ord a, Ix a) = a - a f n = memo ! n where memo = array (0,n) $ (0,0) :[(i, max i (memo!(i

Re: [Haskell-cafe] Memoization in Haskell?

2010-07-08 Thread Gregory Crosswhite
) is encountered several times in the recursive branching, it would be computed several times. Am I wrong? Thanks, Mike Gregory Crosswhite wrote: On 7/8/10 9:17 PM, Michael Mossey wrote: Daniel Fischer wrote: If f has the appropriate type and the base case is f 0 = 0, module Memo where import

Re: [Haskell-cafe] Re: Memoization in Haskell?

2010-07-09 Thread Gregory Crosswhite
space and time efficient option is to use a trie like in MemoTrie. Cheers, Greg On 7/9/10 12:50 AM, Heinrich Apfelmus wrote: Gregory Crosswhite wrote: You're correct in pointing out that f uses memoization inside of itself to cache the intermediate values that it commutes, but those values don't

Re: [Haskell-cafe] Comments on Haskell 2010 Report

2010-07-09 Thread Gregory Crosswhite
I don't know what the rule is, but I personally just replace i.e. with that is and e.g. with for example in my head, and then apply whatever punctuation makes sense with those substitutions. Cheers, Greg On 7/9/10 12:17 PM, Sean Leather wrote: On Fri, Jul 9, 2010 at 18:35, Steve Schafer

[Haskell-cafe] DpH/repa cache locality

2010-07-12 Thread Gregory Crosswhite
Hey everyone, Just out of curiosity, what work is being done in the data parallel haskell / repa projects regarding cache locality? The reason I am asking is because, as I understand it, the biggest bottleneck on today's processors are cache misses, and the reason why optimized platform-specific

Re: [Haskell-cafe] Collecting MonadError errors generically

2010-07-13 Thread Gregory Crosswhite
Leon, In order to avoid the short-circuiting behaviour, it might help you to work in terms of Applicatives instead of Monads. For example, in my error-message package I have the following instance: instance (Monoid e) = Applicative (Either e) where pure = Right (*) (Left error2) (Left

Re: [Haskell-cafe] trees and pointers

2010-07-14 Thread Gregory Crosswhite
Or you can get the best of all worlds by combining all three! data User = User {userNext :: IORef (MVar (TVar User))) ,userPrev :: IORef (MVar (TVar User))) } On 07/14/10 14:39, Andrew Coppin wrote: Serguey Zefirov wrote: Use IORef. ;) PS MVar is better,

Re: [Haskell-cafe] RE: Design for 2010.2.x series Haskell Platform site (Don Stewart)

2010-07-17 Thread Gregory Crosswhite
Yes, but our freshly compiled binaries have far more nutrients then your factory produced ones! Besides, the world would be a far better place if everyone compiled local rather than having binaries shipped to them from half-way across the globe... On 7/17/10 4:08 PM, Miguel Mitrofanov

[Haskell-cafe] datatype contexts

2010-07-26 Thread Gregory Crosswhite
I agree with prior discussion on this list that adding contexts to datatype declarations seems to be more trouble than its worth, since these contexts just have to be added again to every function using the datatype. However, I have often wondered: why do function *have* to have these

Re: [Haskell-cafe] datatype contexts

2010-07-26 Thread Gregory Crosswhite
of the datatype has having another field which is proof that a is a member of C: {-# LANGUAGE ExistentialQuantification #-} data T2 a = C a = D2 a -- D2 :: C a = a - T2 a -- same as D1 bar :: T2 a - Int bar (D2 a) = runC a -- works -- ryan On Mon, Jul 26, 2010 at 7:48 AM, Gregory

[Haskell-cafe] Instances for Set of Functor, Traversable?

2010-07-26 Thread Gregory Crosswhite
Is there a specific reason why Set doesn't have instances for Functor and Traversable? Or have they just not been written yet? :-) Cheers, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Error Monad and strings

2010-07-27 Thread Gregory Crosswhite
It is for the very annoying reason that in order for Error to be a monad it has to implement the fail method, which means it has to know how to turn an arbitrary string into a value of your error type. Cheers, Greg On 07/27/10 15:32, Gerald Gutierrez wrote: Reading the Control.Monad.Error

Re: [Haskell-cafe] Definition of List type?

2010-07-30 Thread Gregory Crosswhite
List are actually built in to the language, but they are roughly equivalent to the following definition: data List a = [] | a:List a The reason why this definition never actually appears is because it defines the constructors using operators rather than names, which is not allowed in

[Haskell-cafe] Announce type-level-natural-number-1.0: Simple, Haskell 2010-compatible type level natural numbers

2010-07-30 Thread Gregory Crosswhite
feedback that the community has to offer. Cheers, Gregory Crosswhite ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ANNOUNCE: Takusen 0.8.6

2010-08-01 Thread Gregory Crosswhite
On 8/1/10 12:12 PM, austin seipp wrote: Hi Jason, I've had my eye on the 'Takusen' approach for a while. In particular I think it's a wonderful idea to use the left-fold based interface. Takusen is also well supported and pretty stable, having been around for a while. I agree; in fact, I

Re: [Haskell-cafe] ANNOUNCE: approximate-equality 1.0 -- Newtype wrappers for approximate equality

2010-08-03 Thread Gregory Crosswhite
On 8/3/10 3:27 AM, Neil Brown wrote: So you can get the same function without needing to add a type-class. Or is it that you envisage other tolerance specifications besides Digit? If so, I wonder if this flexibility complicates your API unnecessarily. If you removed those type-classes and

[Haskell-cafe] Why do unsafe foreign calls block other threads?

2010-08-03 Thread Gregory Crosswhite
Hey everyone, Could someone explain to me the logic behind having unsafe calls block other threads from executing? It seems to me that if anything it would make more sense for safe calls to block other threads since the call can call back into the Haskell runtime, as opposed to unsafe calls

Re: [Haskell-cafe] Why do unsafe foreign calls block other threads?

2010-08-03 Thread Gregory Crosswhite
that the function you're calling is unsafe (i.e., can call back into Haskell) then it blocks the world. But I do think it's unintuitive and a less ambiguous naming scheme would be nicer. Dan On Tue, Aug 3, 2010 at 11:54 PM, Gregory Crosswhite gcr...@phys.washington.edu mailto:gcr

Re: [Haskell-cafe] Why do unsafe foreign calls block other threads?

2010-08-03 Thread Gregory Crosswhite
On 08/03/10 15:22, Evan Laforge wrote: On Tue, Aug 3, 2010 at 3:06 PM, Gregory Crosswhite gcr...@phys.washington.edu wrote: But you've got it backwards: if the function I am calling can call back into Haskell (i.e., is marked as safe), then GHC *doesn't* block the world, but if the function

Re: [Haskell-cafe] Why do unsafe foreign calls block other threads?

2010-08-03 Thread Gregory Crosswhite
On 08/03/10 15:23, John Meacham wrote: It is more an accident of ghc's design than anything, the same mechanism that allowed threads to call back into the runtime also allowed them to be non blocking so the previously used 'safe' and 'unsafe' terms got re-used. personally, I really don't like

Re: [Haskell-cafe] Why do unsafe foreign calls block other threads?

2010-08-03 Thread Gregory Crosswhite
On 08/03/10 15:33, Evan Laforge wrote: Just think of unsafe in relation to unsafeIndex or something. It's faster, but you have to be sure the index is in bounds. Yes, but the whole reason to use unsafe is to get higher performance at the cost of safety. If the result of calling an unsafe

Re: [Haskell-cafe] Why do unsafe foreign calls block other threads?

2010-08-03 Thread Gregory Crosswhite
threads and the haskell threads mapped to them are not blocked, afaik. safe calls spawn a new OS thread (maybe reuse an existing one if available?), move the haskell threads over, (do various other housekeeping?), and then make the call. On Wed, Aug 4, 2010 at 12:41 AM, Gregory Crosswhite

[Haskell-cafe] Mutable data within a (non-IO) monad

2009-10-02 Thread Gregory Crosswhite
Hey everyone, I am thinking about creating a particular data structure with an immutable and mutable version. The key of my problem is that I would like the user to be able to work with a mutable version of the data within a non-IO monad and then get an immutable value at the end,

Re: [Haskell-cafe] Mutable data within a (non-IO) monad

2009-10-02 Thread Gregory Crosswhite
to correctly order the calculations. Very cool. :-) Cheers, Greg On Oct 2, 2009, at 4:08 PM, Gregory Crosswhite wrote: Hey everyone, I am thinking about creating a particular data structure with an immutable and mutable version. The key of my problem is that I would like the user to be able

Re: [Haskell-cafe] Generalizing IO

2009-10-05 Thread Gregory Crosswhite
My thought is that you could simply drop the IO from your type definition, type PDState = StateT PD You will need to change all of your type signature from PDState type to PDState m type to make them all polymorphic over the choice of monad. Then all you should need to do is to

Re: [Haskell-cafe] Generalizing IO

2009-10-06 Thread Gregory Crosswhite
It isn't clear what it is that you are trying to generalize the code to do. If you are trying to generalize it to work with an arbitrary input/output stream of lines, then unless you are doing arbitrary I/O it seems to me that all of these instance declarations are overkill. All that you

Re: [Haskell-cafe] Generalizing IO

2009-10-06 Thread Gregory Crosswhite
could use type-classes instead of passing around a datatype to specify how to send/fetch lines. On Oct 6, 2009, at 12:36 AM, Gregory Crosswhite wrote: It isn't clear what it is that you are trying to generalize the code to do. If you are trying to generalize it to work with an arbitrary

Re: [Haskell-cafe] Generalizing IO

2009-10-06 Thread Gregory Crosswhite
Putting a constraint on the MonadIO class actually makes your code less general rather than more since it prevents your code from ever being used in a purely functional setting. If you leave out this constraint, you can actually turn your code into a pure function by doing things like

Re: [Haskell-cafe] Creating an alias for a function

2009-10-06 Thread Gregory Crosswhite
Michael, You can define a function without listing some or all of its arguments by specifying it in terms of another function. So all you really need to write is, e.g., car = head cdr = tail cadr = car . cdr caddr = car . cadr cadar = car . cdr . car etc... On Oct 6, 2009, at 7:01 PM,

Re: [Haskell-cafe] New to Haskell - List Comprehension Question

2009-10-07 Thread Gregory Crosswhite
Hint: Move the boundary case outside the comprehension, and then use the comprehension to handle the normal case. Also, FYI, a comprehension feeds each value of the list xs into x, and then evaluates the expression to the left of the pipe with that single value of x. Cheers, Greg On

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

2009-10-08 Thread Gregory Crosswhite
Out of curiosity, why do you think that porting Haskell to the JVM would make such a large difference? Haskell can already interface with C libraries; are there really so many commercially vital libraries that are JVM-only? Cheers, Greg On Oct 8, 2009, at 11:08 AM, John A. De Goes

Re: [Haskell-cafe] MTL vs Transformers?

2009-10-12 Thread Gregory Crosswhite
ghc-pkg hide transformers On Oct 12, 2009, at 5:46 PM, Erik de Castro Lopo wrote: Hi all, I've just received the following error message: headers.hs:6:7: Could not find module `Control.Monad.Identity': it was found in multiple packages: transformers-0.1.4.0 mtl-1.1.0.2 I'm

Re: [Haskell-cafe] MTL vs Transformers?

2009-10-12 Thread Gregory Crosswhite
that link to it.) Cheers, Greg On Oct 12, 2009, at 6:08 PM, Erik de Castro Lopo wrote: Gregory Crosswhite wrote: ghc-pkg hide transformers Here's an example. CGI uses MTL, Iteratee uses Transformers. So, how do you use CGI and Iteratee in the same program? Erik

[Haskell-cafe] Why MTL and Transformers?

2009-10-12 Thread Gregory Crosswhite
Something that I have been wondering for a while is: why are there *still* two monad transformer libraries with seemingly identical functionality, especially given that they have conflicting namespaces? It creates stupid problems like the one that Erik encountered and had to work around.

Re: [Haskell-cafe] Re: Best Editor In Windows

2009-10-15 Thread Gregory Crosswhite
In my humble opinion, one of the best editors for development of all time is Leo: http://webpages.charter.net/edreamleo/front.html Leo takes the idea of code folding and gives you complete control over it. That is, unlike other editors which only let you fold the code inside

Re: [Haskell-cafe] Re: Best Editor In Windows

2009-10-16 Thread Gregory Crosswhite
AM, Deniz Dogan wrote: 2009/10/16 Gregory Crosswhite gcr...@phys.washington.edu: In my humble opinion, one of the best editors for development of all time is Leo: http://webpages.charter.net/edreamleo/front.html Leo takes the idea of code folding and gives you complete control over

Re: [Haskell-cafe] Simple but interesting (for me) problem

2009-10-21 Thread Gregory Crosswhite
And just because this has not been explicitly stated: it's not just for aesthetic reasons that you couldn't do this with a pure function, but because it violates the semantics and gets you the wrong result. So for example, if you modified Tim's code to be import Data.IORef import

Re: [Haskell-cafe] why cannot i get the value of a IORef variable ?

2009-10-22 Thread Gregory Crosswhite
For clarity, one trick that uses unsafePerformIO which you may have seen posted on this list earlier today is the following way of creating a globally visible IORef: import Data.IORef import System.IO.Unsafe *** counter = unsafePerformIO $ newIORef 0 *** next = do modifyIORef counter

Re: [Haskell-cafe] Simple but interesting (for me) problem

2009-10-22 Thread Gregory Crosswhite
. (Your nitpick that next would have been a better name than foo is well taken, though.) Cheers, Greg On Oct 22, 2009, at 12:48 AM, minh thu wrote: 2009/10/21 Gregory Crosswhite gcr...@phys.washington.edu: And just because this has not been explicitly stated: it's not just for aesthetic

Re: [Haskell-cafe] why cannot i get the value of a IORef variable ?

2009-10-22 Thread Gregory Crosswhite
, Gregory Crosswhite gcr...@phys.washington.edu wrote: For clarity, one trick that uses unsafePerformIO which you may have seen posted on this list earlier today is the following way of creating a globally visible IORef: import Data.IORef import System.IO.Unsafe *** counter = unsafePerformIO

Re: Re[2]: [Haskell-cafe] Lazy problem ?

2009-10-23 Thread Gregory Crosswhite
Or good_ssq_red = readFile ssqHitNum.txt = return . statis . str2Ints I personally prefer this because I like how the = illustrates that the result is being fed into return . statis . str2Ints, but it is a matter of style. :-) Cheers, Greg On Oct 23, 2009, at 1:09 AM, Bulat Ziganshin

Re: [Haskell-cafe] wxMac/wxHaskell focus problem, a quick solution

2009-10-29 Thread Gregory Crosswhite
You don't have to turn a program into an application in order to make the GUI work, you just have to make some calls to enable GUI events to be delivered to your program (or something like that, at least). I've attached a script that I got from somewhere on the internet (can't remember

Re: [Haskell-cafe] wxMac/wxHaskell focus problem, a quick solution

2009-10-29 Thread Gregory Crosswhite
On Oct 29, 2009, at 1:00 PM, Iain Barnett wrote: On 29 Oct 2009, at 15:41, Gregory Crosswhite wrote: You don't have to turn a program into an application in order to make the GUI work This is true, but I don't think it's better to import extra code where simple packaging (folders

Re: [Haskell-cafe] Hackage still down?

2009-11-02 Thread Gregory Crosswhite
Of *course* your hard drives are getting damaged --- everyone knows that Raid only works on *real* bugs, not software bugs! Spraying it on your hard drives to improve the quality of the libraries on Hackage is just silly! - Greg On Nov 2, 2009, at 10:45 AM, Don Stewart wrote: magnus:

Re: [Haskell-cafe] Re: Best Editor In Windows

2009-11-03 Thread Gregory Crosswhite
Gour, Yes, I use Leo for Haskell development. You will need to use the development trunk, though, since it contains a necessary patch I submitted to make Leo work correctly with Haskell sources. You can download this from Launchpad: https://launchpad.net/leo-editor It is

Re: [Haskell-cafe] What's the deal with Clean?

2009-11-03 Thread Gregory Crosswhite
Actually, it's not a typo. If you look at the source, what you'll see is indexU arr n = indexS (streamU arr) n and then tracking down indexS, you'll see indexS (Stream next s0 _) n0 | n0 0= error Data.Array.Vector.Stream.indexS: negative index | otherwise = loop_index n0 s0

Re: [Haskell-cafe] Re: Best Editor In Windows

2009-11-03 Thread Gregory Crosswhite
The problem with Leo is that although there are rarely performance problems when navigating and editing the outline, the text pane can be very slow at times when using the Tk-based GUI --- even on modern hardware --- because the syntax highlighter is written in Python. (Incidentally, as

Re: [Haskell-cafe] What's the deal with Clean?

2009-11-03 Thread Gregory Crosswhite
So I take it you are saying that it really *cleans* Haskell's clock when it comes to speed? ;-) - Greg On Nov 3, 2009, at 9:04 PM, Richard O'Keefe wrote: On Nov 4, 2009, at 9:30 AM, Deniz Dogan wrote: So what's the deal with Clean? Why is it preferable to Haskell? Why is it not? (1)

Re: [Haskell-cafe] What's the deal with Clean?

2009-11-03 Thread Gregory Crosswhite
Oh, that's strange... the type class UA is defined twice, once in Data.Array.Vector and once in Data.Array.Vector.UArr; in the first module indexU is a separate function with the sources I exhibited, in the second module it is a method of the UA type-class which seems to have O(1) access

Re: [Haskell-cafe] representing Haskell objects in a uniform way

2009-11-04 Thread Gregory Crosswhite
The problem lies in the definition of your class: class AFun f where afun :: Data a = f - ([Dynamic] - a) You are saying that afun can return any type a that the user wants as long as it is an instance of Data, whereas here instance Data v = AFun v where afun f [] = f afun _ _ = error

  1   2   3   >