Re: [Haskell-cafe] Please review my Xapian foreign function interface

2011-02-21 Thread Edward Z. Yang
Excerpts from Oliver Charles's message of Mon Feb 21 08:53:48 -0500 2011: Yes, this is a concern to me as well. The only places I've used unsafePerformIO is with Query objects, which I am mostly treating as immutable data, and never exposing anyway to modify query objects. That is a good way

Re: [Haskell-cafe] Please review my Xapian foreign function interface

2011-02-20 Thread Edward Z. Yang
Thanks Oliver! I haven't had time to look at your bindings very closely, but I do have a few initial things to think about: * You're writing your imports by hand. Several other projects used to do this, and it's a pain in the neck when you have hundreds of functions that you

Re: [Haskell-cafe] Conditionals and case expressions in do blocks

2011-01-26 Thread Edward Z. Yang
Excerpts from Edward Amsden's message of Wed Jan 26 15:51:46 -0500 2011: do ... case ... of Foo x - do ... ... return foobar Bar x - do ... ... return foobar There's not enough context here to say what is appropriate.

Re: [Haskell-cafe] Are constructors strict?

2011-01-20 Thread Edward Z. Yang
Hello Daryoush, That is a good question, and depends on distinguishing between laziness and nondeterminism. Suppose I have a normal, lazily evaluated list: [1,2...] There are thunks used in this case, but the end result is fully deterministic: the next will always be 3, and then 4, and so

Re: [Haskell-cafe] Misleading MVar documentation

2011-01-13 Thread Edward Z. Yang
Ok, here is an updated doc patch. I've also added a substantial introduction section. diff -rN -u old-base/Control/Concurrent/MVar.hs new-base/Control/Concurrent/MVar.hs --- old-base/Control/Concurrent/MVar.hs 2011-01-13 16:26:59.0 + +++ new-base/Control/Concurrent/MVar.hs

Re: [Haskell-cafe] Misleading MVar documentation

2011-01-12 Thread Edward Z. Yang
These are interesting, opposed perspectives, and I suspect what would be good is to treat both situations. I think perhaps what would be good to put in the introduction is the conceptual model of MVars: that is, take and put are the fundamental operations, and everything else is composed of them.

Re: [Haskell-cafe] ghci seg faulting, have no idea why.

2011-01-12 Thread Edward Z. Yang
If you load ghci into gdb, and then run it until the segfault, do you get any interesting backtrace? Did you recently run software updates? What happens if you reinstall GHC? Have you rebooted recently? Cheers, Edward Excerpts from Michael Litchard's message of Wed Jan 12 21:07:30 -0500 2011:

Re: [Haskell-cafe] Set monad

2011-01-08 Thread Edward Z. Yang
Hello Peter, This is a classic problem with the normal monad type class. You can achieve this with restricted monads, but there is a bit of tomfoolery you have to do to get do-notation support for them. Here is some relevant reading: -

Re: [Haskell-cafe] Type System vs Test Driven Development

2011-01-05 Thread Edward Z. Yang
Haskell's type system makes large classes of traditional unit tests irrelevant. Here are some examples: - Tests that simply run code to make sure there are no syntax errors or typos, - Tests that exercise simple input validation that is handled by the type system, i.e.

Re: [Haskell-cafe] thread safety, IO arrays, and IO refs

2010-12-31 Thread Edward Z. Yang
If you need multithreaded mutable arrays, TArray may be a better choice, as the underlying stm implementation will manage locking for you. (The current implementation isn't terribly efficient, but when it gets better you'll get it for free too :-)

Re: [Haskell-cafe] Misleading MVar documentation

2010-12-25 Thread Edward Z. Yang
Wasn't that result John Launchbury's? I recalled hearing something similar as well. Cheers, Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Misleading MVar documentation

2010-12-25 Thread Edward Z. Yang
Excerpts from Mitar's message of Fri Dec 24 23:18:43 -0500 2010: I am not sure if this are really race conditions? The point is that readMVar, withMVar and others do not return until they can return the value back and after that the value is the same as it was at the beginning of the call. So

[Haskell-cafe] Misleading MVar documentation

2010-12-24 Thread Edward Z. Yang
Merry Christmas all! Is it just me, or does the Control.Concurrent.MVar documentation seem a bit misleading? In particular, we should explicitly note the race conditions for not just swapMVar but also readMVar, withMVar, modifyMVar_ and modifyMVar, and clarify that the safety guarantees of the

Re: [Haskell-cafe] Misleading MVar documentation

2010-12-24 Thread Edward Z. Yang
Here is one suggested doc patch. Comments and revisions welcome: ezy...@javelin:~/Dev/ghc-clean/libraries/base/Control/Concurrent$ darcs whatsnew -u hunk ./Control/Concurrent/MVar.hs 59 {-| This is a combination of 'takeMVar' and 'putMVar'; ie. it takes the value - from the 'MVar', puts

Re: [Haskell-cafe] Making type-incompatible strategies interchangeable

2010-12-18 Thread Edward Z. Yang
Excerpts from Jacek Generowicz's message of Fri Dec 17 20:17:30 -0500 2010: Imagine an activity which may be performed either by a computer, or by a human (alternatively, either locally, or remotely across a network). From Haskell's type system's perspective, these two will look completely

Re: [Haskell-cafe] Infinite lists in real world programs

2010-12-15 Thread Edward Z. Yang
It sounds like a good fit for your problem as stated. One thing to note is that Haskell will give you great abstractions for very strong amounts of code, as long as what you want to do is a good fit for the abstraction. Haskell makes it quite hard to fit a square peg into a round hole, so if one

Re: [Haskell-cafe] Infinite lists in real world programs

2010-12-15 Thread Edward Z. Yang
Excerpts from Yves Parès's message of Wed Dec 15 13:28:11 -0500 2010: if one day you decide you need an agent that generates random numbers I could say that my agents now run in a certain monad, I just would have to transform my basic agents to : agent1 = liftM . fmap (*2) (or even agen1

Re: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-12-04 Thread Edward Z. Yang
Excerpts from Brandon S Allbery KF8NH's message of Sat Dec 04 13:42:48 -0500 2010: We went over this some time back; the GHC runtime is wrong here, it should only disable flags when running with geteuid() == 0. Also, the current mechanism for specifying runtime flags at compile time is

Re: [Haskell-cafe] Most images broken on haskellwiki pages

2010-12-03 Thread Edward Z. Yang
This was because, for some odd reason, the images were stored using absolute URLs and not real wikilinks. I've fixed most of them on that page. Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-11-25 Thread Edward Z. Yang
Hello John, Arguably the correct thing to do is to use GHC's hooks for programatically specifying runtime options; unfortunately, because this has to run /before/ any Haskell code starts, it's a bit unwieldly: essentially you'll need a C stub file that scribbles the correct options into char

Re: [Haskell-cafe] Wondering if this could be done.

2010-11-22 Thread Ling Yang
Haskell does not play as well with overloading as one would do it in C++; every name used must be fully qualified. Indeed, if we try something like Indeed, if we try something like data A = A Int deriving (Show, Eq) test = A 3 unA (A i) = i class Group a where (+) :: a - a - a instance Group

Re: [Haskell-cafe] category-extras clash with transformers

2010-11-20 Thread Edward Z. Yang
No, you're not totally screwed; you just need to bug xmonad-contrib and category-extras to fix their code. Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Making monadic code more concise

2010-11-17 Thread Ling Yang
Thank you for highlighting these problems; I should really test my own code more thoroughly. After reading these most recent examples, the translation to existing monads is definitely too neat, and a lot of semantics of the monad are 'defaulted' on. In particular for the probability monad examples

[Haskell-cafe] Re: Making monadic code more concise

2010-11-16 Thread Ling Yang
of autolifting. On Tue, Nov 16, 2010 at 2:49 AM, o...@okmij.org wrote: Ling Yang wrote I think a good question as a starting point is whether it's possible to do this 'monadic instance transformation' for any typeclass, and whether or not we were lucky to have been able to instance Num so easily

[Haskell-cafe] Making monadic code more concise

2010-11-15 Thread Ling Yang
and functions, rather than data and code. I would also appreciate any pointers to works in that area. Thanks for any leads, Lingfeng Yang lyang at cs dot stanford dot edu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo

Re: [Haskell-cafe] Making monadic code more concise

2010-11-15 Thread Ling Yang
for the mention of applicative functors; I should have included them in the original post. Lingfeng Yang lyang at cs dot stanford dot edu I should have included a mention of Applicative in my original post. Part of the reason Num was so easy is that all the functions produce values whose type

Re: [Haskell-cafe] Test command line programs

2010-10-26 Thread Edward Z. Yang
Hello Dupont, If your code follows good style and has kept as much code out of IO as possible, you should be able to easily unit test the pure portions of your code. Otherwise, classic integration tests, by setting up the network jigs yourself, is standard. Another little question: How can I

[Haskell-cafe] cross-platform compile

2010-10-26 Thread Hong Yang
Just curious if Haskell can or will generate cross-platform executable code, e.g., generate code for Linux from a Windows machine. Thanks, Hong ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: libefence useful for debugging ghc+ffi programs?

2010-10-20 Thread Edward Z. Yang
Excerpts from Johannes Waldmann's message of Wed Oct 20 05:13:36 -0400 2010: and indeed, gethostbyname is famous for being non re-entrant. If you have the time, this would be a great time to improve the multithreaded support of these libraries. In particular, glibc offers a re-entrant version

Re: [Haskell-cafe] Re: libefence useful for debugging ghc+ffi programs?

2010-10-20 Thread Edward Z. Yang
Hmm, in that case, one possibility is someone else did an FFI import of gethostbyname and isn't using the same lock. Can you check for that? Edward Excerpts from Johannes Waldmann's message of Wed Oct 20 16:17:06 -0400 2010: and indeed, gethostbyname is famous for being non re-entrant.

Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-17 Thread Edward Z. Yang
I'm a bit partial to Swift Mailer [1]. It's useful to support multiple transport backends, especially in situations where sendmail is not portable. Cheers, Edward [1] http://swiftmailer.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] allocation for pure FFI functions

2010-10-14 Thread Edward Z. Yang
Excerpts from Johannes Waldmann's message of Thu Oct 14 13:45:46 -0400 2010: Is there a solution? Workaround? Better approach? If it boils down to unsafePerformIO, then where do I put it, and what should I watch out for? unsafePerformIO is your ticket here. The key is to ensure all of the

Re: [Haskell-cafe] Re-order type

2010-10-09 Thread Edward Z. Yang
Excerpts from André Batista Martins's message of Sat Oct 09 17:45:05 -0400 2010: Hello, exists any algorithm to determine how terms can be changed to safisty the type of one function? Your terminology is a little off: in particular, your example doesn't include any terms (which are

Re: [Haskell-cafe] HTML library with DOM?

2010-10-07 Thread Edward Z. Yang
Excerpts from Gregory Collins's message of Wed Oct 06 19:44:44 -0400 2010: I've got the month of October off, and one of the things I've been planning on working on is a compliant HTML5 parser for Haskell -- something which is sorely needed! I will ping the list back if/when I get it finished.

Re: [Haskell-cafe] Non-strict evaluation and concurrency (STM) : conflict?

2010-09-28 Thread Edward Z. Yang
Excerpts from Romain Demeyer's message of Tue Sep 28 09:06:53 -0400 2010: That's what we want, but what is the explanation of this behavior? STM is designed to be optimistic, not blocking. So, does it means that the value is evaluated at commit-time? Do you know some problems that are related

Re: [Haskell-cafe] Stateful DSLs

2010-09-17 Thread Edward Z. Yang
Excerpts from Günther Schmidt's message of Fri Sep 17 13:27:45 -0400 2010: I'd want to create a EDSL where I want to be able to statically ensure that expressions can only be built according to a particular state. Like in a network application, SMTP client for example, where I can only

Re: [Haskell-cafe] Unified Haskell login

2010-09-17 Thread Edward Z. Yang
Excerpts from Neil Davies's message of Fri Sep 17 05:27:34 -0400 2010: Why not use kerberos? We find it works for us, integrates with web (natively or via WebAuth), remote command execution (remctl) and ssh - widely used, scales brilliantly. MIT uses Kerberos and it is quite nice to be

Re: [Haskell-cafe] Re: Cleaning up threads

2010-09-14 Thread Edward Z. Yang
Excerpts from Ertugrul Soeylemez's message of Mon Sep 13 03:03:11 -0400 2010: In general it's better to avoid using killThread. There are much cleaner ways to tell a thread to exit. This advice doesn't really apply to Haskell: in fact, the GHC developers have thought really carefully about

Re: [Haskell-cafe] Re: ghc HEAD

2010-09-07 Thread Edward Z. Yang
Excerpts from Johannes Waldmann's message of Tue Sep 07 10:38:47 -0400 2010: Yuras Shumovich shumovichy at gmail.com writes: http://hackage.haskell.org/trac/ghc/ticket/3910 So what is the magic link-time flag to en/disable the RTS options? As you mentioned earlier, -rtsopts. It seems it

Re: [Haskell-cafe] circular imports

2010-09-06 Thread Edward Z. Yang
Excerpts from Evan Laforge's message of Mon Sep 06 13:30:43 -0400 2010: I feel like the circular imports problem is worse in haskell than other languages. Maybe because there is a tendency to centralize all state, since you need to define it along with your state monad. But the state monad

Re: [Haskell-cafe] How to generate dependend values with QuickCheck

2010-08-25 Thread Edward Z. Yang
Excerpts from Jürgen Nicklisch-Franken's message of Wed Aug 25 23:32:51 -0400 2010: instance Arbitrary QCExample where arbitrary = let i1 = arbitrary i2 = fmap (* 2) i1 in liftM2 QCExample i1 i2 What's happening here is that you are evaluating the random

[Haskell-cafe] Failed inference: maybe bug?

2010-08-18 Thread Edward Z. Yang
On the prompting of napping, I humbly submit the following code to haskell-cafe: ezy...@javelin:~/Dev/haskell/generic-typeclass$ cat Bar.hs {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleContexts #-} data Foo b = Foo class

[Haskell-cafe] Specific to General to Specific

2010-08-18 Thread Edward Z. Yang
Imagine that I have the following type-class: class (Monad (m n)) = NetworkMonad m n data NT n a instance NetworkMonad NT n data NQ n a instance NetworkMonad NQ n monadicValue :: NetworkMonad m n = m n () It defines some family of phantom monads, in this case NT n and

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-14 Thread Edward Z. Yang
Excerpts from John Millikin's message of Sun Aug 15 01:32:51 -0400 2010: Also, despite the name, ByteString and Text are for separate purposes. ByteString is an efficient [Word8], Text is an efficient [Char] -- use ByteString for binary data, and Text for...text. Most mature languages have

Re: [Haskell-cafe] Re: String vs ByteString

2010-08-13 Thread Edward Z. Yang
Excerpts from Kevin Jardine's message of Fri Aug 13 16:37:14 -0400 2010: I find it disturbing that a modern programming language like Haskell still apparently forces you to choose between a representation for mostly ASCII text and Unicode. Surely efficient Unicode text should always be the

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-10 Thread Edward Z. Yang
Excerpts from Ertugrul Soeylemez's message of Tue Aug 10 02:31:14 -0400 2010: There is no evalCont, there is runCont: runCont :: (a - r) - Cont r a - r Note that Cont/ContT computations result in a value of type 'r': newtype Cont r a = Cont ((a - r) - r) Yes, but if you pass in 'id'

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-10 Thread Edward Z. Yang
Excerpts from Ertugrul Soeylemez's message of Tue Aug 10 03:40:02 -0400 2010: Then you can only run evalCont, if r = a, which makes that function quite pointless: evalCont :: Cont r r - r evalCont = runCont id Ah, yes, that was what I was imagining. I don't think the function is

Re: [Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread Edward Z. Yang
Excerpts from aditya siram's message of Mon Aug 09 15:05:14 -0400 2010: Until test is called in 'main' we don't know the order of monads. In fact even the base monad is not know. All we know is that it uses the State and Writer monad. In each call to 'test' in main we can determine the stacking

Re: [Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread Edward Z. Yang
Excerpts from Gábor Lehel's message of Mon Aug 09 15:39:49 -0400 2010: Actually, while I haven't even used monad transformers before (just read about them a lot), I was thinking that something like this might be the way to solve the lift . lift . lift . lift . foo problem on the one hand, and

Re: [Haskell-cafe] Can we come out of a monad?

2010-08-09 Thread Edward Z. Yang
Excerpts from Luke Palmer's message of Tue Aug 10 01:04:04 -0400 2010: Except, of course, you want the signature evalCont :: Cont r a - a Which is not possible. But I am not sure where all this discussion is coming from, Maybe and (r -) cannot be broken out of. Isn't that example

Re: [Haskell-cafe] Cabal LD errors

2010-08-01 Thread Edward Z. Yang
Excerpts from wren ng thornton's message of Sun Aug 01 21:06:07 -0400 2010: So I'm getting some weird linking errors from cabal-install when doing `cabal configure cabal build` Hello Wren, Could you run cabal with -v3 or so and attach the output somewhere? Cheers, Edward

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

2010-07-30 Thread Edward Z. Yang
Excerpts from michael rice's message of Fri Jul 30 14:41:44 -0400 2010: One description has the type and associated operations, the other only has the operations. Where can I find the type definition for List, and why isn't it in Data.List? Hello Michael, This is because the List datatype

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

2010-07-30 Thread Edward Z. Yang
Excerpts from Edward Z. Yang's message of Fri Jul 30 14:48:34 -0400 2010: Const x xs is x:xs (constructor) That should be a Cons, not Const. :o) Cheers, Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] using the orc library

2010-07-30 Thread Edward Z. Yang
Excerpts from Günther Schmidt's message of Fri Jul 30 16:16:38 -0400 2010: I'd like to download 1,000 web pages with up to 6 six concurrent downloads at a time. How can I express such a thread limit within the orc EDSL? One solution that comes to mind is place all 1000 web pages in an MVar

Re: [Haskell-cafe] Is 'flip' really necessary?

2010-07-26 Thread Edward Z. Yang
IMO, if you really want a wildcard, just write a lambda... \x - foo 1 x 3 Cheers, Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Is 'flip' really necessary?

2010-07-25 Thread Edward Z. Yang
Excerpts from aditya siram's message of Sun Jul 25 17:13:16 -0400 2010: Eta-reducing is nice, and sometimes it makes code more readable. But 'flip' is one of those functions that always seems to hinder rather than help readability, conversely factoring out flip always makes code easier to

Re: [Haskell-cafe] [C Binding] Turning the mutable to immutable?

2010-07-07 Thread Edward Z. Yang
To answer the question in your subject, “Very Carefully.” While I don’t know much about your particular problem domain (and it seems others have given useful advice), I can say some general things about making mutable things immutable. There is a very simple way to make something mutable

Re: [Haskell-cafe] whine and solution about programmers not respecting documentations

2010-06-29 Thread Edward Z. Yang
Excerpts from Albert Y.C.Lai's message of Mon Jun 28 15:44:34 -0400 2010: I propose that at each minor version of base, someone picks an implementation randomly. This has actually been done, in a legitimate language implementation. Check out:

Re: [Haskell-cafe] Re: How does one get off haskell?

2010-06-18 Thread Edward Z. Yang
Excerpts from braver's message of Fri Jun 18 12:55:24 -0400 2010: So when your problem is open-ended and the shape of data is in flux, a dynamic language is faster to prototype. I think I can second this comment. However, I would still prefer Haskel for a system intended for production; with

Re: [Haskell-cafe] Re: How does one get off haskell?

2010-06-18 Thread Edward Z. Yang
Excerpts from Bryan O'Sullivan's message of Fri Jun 18 13:16:58 -0400 2010: I'm inclined to disagree. It's precisely when the code is in a state of constant upheaval that I want the type system to be pointing out my dumb errors. In my experience, the type system has forced me to care about

Re: [Haskell-cafe] Re: How does one get off haskell?

2010-06-17 Thread Edward Z. Yang
Excerpts from Paul Lotti's message of Thu Jun 17 15:33:30 -0400 2010: Same feelings here. I work in a company that uses C++/Java and the best I could manage was to use Haskell for prototyping and then deliver in Java. This worked out twice so far. The downside is having to translate it

Re: [Haskell-cafe] How to browse code written by others

2010-06-14 Thread Edward Z. Yang
Excerpts from Luke Palmer's message of Mon Jun 14 19:35:16 -0400 2010: If you go this route, I will shamelessly promote hothasktags instead of ghci. It generates proper tags for qualified imports. Ooh, that's a good time. (Ditches hasktags for hothasktags).

Re: [Haskell-cafe] Terminology

2010-06-14 Thread Edward Z. Yang
Excerpts from Emmanuel Castro's message of Mon Jun 14 18:10:09 -0400 2010: I am looking for the name of the property linking two functions f and g when : [f(a),f(b),f(c)] = g([a,b,c]) Is there a standard name? In practice, g is an optimised version of f when working on large amount of

Re: [Haskell-cafe] ANN: Monad.Reader Issue 16

2010-05-12 Thread Edward Z. Yang
Excerpts from Brent Yorgey's message of Wed May 12 14:12:53 -0400 2010: I am very pleased to announce that Issue 16 of The Monad.Reader is now available [1]. Excellent news! Looking forward to reading. Cheers, Edward ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] haskell on suse?

2010-05-06 Thread Edward Z. Yang
Excerpts from gladstein's message of Thu May 06 14:33:38 -0400 2010: I've been spoiled by package managers that download and install everything for you, and I've forgotten how RPM works. In particular, I want to install Haskell on suse, and I read that RPMs are available from openSUSE. I

Re: [Haskell-cafe] Cabal dependency hell

2010-04-11 Thread Edward Z. Yang
Excerpts from Daniel Fischer's message of Sun Apr 11 16:20:30 -0400 2010: I think in the default cabal config, build-reporting would be turned off and you'd have to turn it on yourself. Turning it on by default wouldn't be sensible. I doubt you'd get very much runtime with that. I'd suggest

Re: [Haskell-cafe] Cabal dependency hell

2010-04-11 Thread Edward Z. Yang
Excerpts from Ivan Lazar Miljenovic's message of Sun Apr 11 17:37:15 -0400 2010: Edward Z. Yang ezy...@mit.edu writes: I doubt you'd get very much runtime with that. I'd suggest prompting the user to submit a failed build report if the build fails. Exactly like how Windows keeps prompting

Re: [Haskell-cafe] Can Haskell enforce the dimension?

2010-04-09 Thread Edward Z. Yang
Excerpts from Haihua's message of Fri Apr 09 12:28:23 -0400 2010: In C++, template can be used to enforce the dimension. For example, F=m*a is OK and F=m*t will issue a compile time error. Is there a way to do this in Haskell? http://hackage.haskell.org/package/dimensional Cheers, Edward

Re: [Haskell-cafe] Why does Haskell not infer most general type?

2010-04-06 Thread Edward Z. Yang
Excerpts from Brandon S. Allbery KF8NH's message of Tue Apr 06 16:46:28 -0400 2010: On Apr 6, 2010, at 15:56 , Job Vranish wrote: Is haskell supposed to always infer the most general type (barring extensions)? Look up the monomorphism restriction. Hey Brandon, I tested the code with

Re: [Haskell-cafe] Hackage accounts and real names

2010-04-05 Thread Edward Z. Yang
This is a pretty terrible reason, but I'm going to throw it out there: I like real names because they're much more aesthetically pleasing. In my younger days, I once decided, Hey, I should get a pseudonym and I picked something fairly ridiculous, just because everyone else was doing it. I would

Re: [Haskell-cafe] A function that makes list of Bool lists from list of Int lists

2010-04-03 Thread Edward Z. Yang
Excerpts from Maur Toter's message of Sat Apr 03 09:54:26 -0400 2010: I am new with Haskell so I think this will be a pretty dumb question. I would like to make a function that makes this: listbool :: [[Int]] - [[Bool]] in this way: listbool [[1,2],[3,4]] == [[True, True],[False, False]]

Re: [Haskell-cafe] A function that makes list of Bool lists from list of Int lists

2010-04-03 Thread Edward Z. Yang
Excerpts from Maur Toter's message of Sat Apr 03 10:29:34 -0400 2010: What does the ($) at zipWith? ($) is function application Prelude :t ($) ($) :: (a - b) - a - b Cheers, Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] benchmarking pure code

2010-03-31 Thread Edward Z. Yang
Excerpts from Paul Brauner's message of Wed Mar 31 03:17:02 -0400 2010: The part I want to benchmark is 2. In particular I would like that: a. \x.t is already evaluated when I run 2 (I don't want to measure the performances of the generator) b. the action of substituting u for x in t

Re: [Haskell-cafe] Optimizing hash array mapped tries

2010-03-01 Thread Edward Z. Yang
Excerpts from Don Stewart's message of Wed Feb 24 16:13:18 -0500 2010: Almost all the vector library generators fill a vector destructively, before doing an unsafeFreeze. Alright. Is there a standard idiom for filling vectors pointing to vectors destructively, and then unsafely freezing all of

Re[2]: [Haskell-cafe] Optimizing hash array mapped tries

2010-02-24 Thread Edward Z. Yang
Excerpts from Bulat Ziganshin's message of Wed Feb 24 14:48:53 -0500 2010: I'd be really curious about techniques that permit mutation during the construction of functional datastructures; this seems like a cool way to get fast performance w/o giving up any of the benefits of immutability.

Re: [Haskell-cafe] Optimizing hash array mapped tries

2010-02-24 Thread Edward Z. Yang
Excerpts from Don Stewart's message of Wed Feb 24 16:13:38 -0500 2010: These are exported from vector, though. Aha! I was looking in Data.Vector for them; they're actually in Data.Vector.Generic. Awesome. Cheers, Edward ___ Haskell-Cafe mailing list

[Haskell-cafe] Optimizing hash array mapped tries

2010-02-21 Thread Edward Z. Yang
Hello all, I spent this weekend attempting to impement Phil Bagwell's Hash Array Mapped Tries in Haskell. You can view the fruits of this work at this repository: http://github.com/ezyang/hamt Unfortunately, I'm getting pretty abysmal performance out of the implementation I wrote, so I'm

Re: [Haskell-cafe] automatically exclude unused modules at compile time

2010-02-09 Thread Hong Yang
I did not use -split-objs. This option did help after I tried it. Thanks. Hong On Mon, Feb 8, 2010 at 11:57 AM, Felipe Lessa felipe.le...@gmail.comwrote: On Mon, Feb 08, 2010 at 11:25:13AM -0600, Hong Yang wrote: Can we make GHC a little bit more intelligent to automatically exclude

[Haskell-cafe] automatically exclude unused modules at compile time

2010-02-08 Thread Hong Yang
When I turned on -Wall knob at compile time, I got a message: Warning: Module `System.Cmd' is imported, but nothing from it is used, except perhaps instances visible in `System.Cmd' To suppress this warning, use: import System.Cmd() Then I did four experiments as

Re: [Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread Edward Z. Yang
Excerpts from michael rice's message of Tue Jan 26 21:34:42 -0500 2010: fromMaybe d x = case x of {Nothing - d;Just v  - v} fromMaybe z = maybe z id They're equivalent. Here the definition of maybe: maybe :: b - (a - b) - Maybe a - b maybe n _ Nothing = n maybe _ f (Just x) = f x

Re: [Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread Edward Z. Yang
Excerpts from Daniel Peebles's message of Tue Jan 26 23:25:28 -0500 2010: There are actually only two (extensionally) possible total functions with that type, as far as I can see :) Is the other one... const? Cheers, Edward ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Use of the Try typeclass

2010-01-01 Thread Edward Z. Yang
I upgraded, but now both Control.Monad.Failure and Control.Monad.Error claim to be exporting Error. Is this correct, and if so, which one should I hide? Cheers, Edward ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Use of the Try typeclass

2010-01-01 Thread Edward Z. Yang
Excerpts from Edward Z. Yang's message of Fri Jan 01 13:27:49 -0500 2010: I upgraded, but now both Control.Monad.Failure and Control.Monad.Error claim to be exporting Error. Is this correct, and if so, which one should I hide? Sorry my bad; I should have been importing

[Haskell-cafe] Use of the Try typeclass

2009-12-30 Thread Edward Z. Yang
Hello all, I am currently playing with the new cadre of failure libraries, and I'm trying to figure out how to use the monadic version of Failure while also getting the Try typeclass, which appears to be the standardized mechanism for marshalling values from specific monads into the failure

Re: [Haskell-cafe] Use of the Try typeclass

2009-12-30 Thread Edward Z. Yang
Excerpts from Alexander Dunlap's message of Thu Dec 31 00:06:58 -0500 2009: Why are you importing both Control.Failure and Control.Monad.Failure when the latter just re-exports the former? Are you using the latest versions of the two packages? Try importing just Control.Monad.Failure.MTL; that

Re: [Haskell-cafe] Use of the Try typeclass

2009-12-30 Thread Edward Z. Yang
Excerpts from Michael Snoyman's message of Thu Dec 31 00:43:52 -0500 2009: What version of the packages are you using? Can you give the output of: ghc-pkg list|grep failure Sure thing: (control-monad-failure-0.4), (control-monad-failure-0.5.0), control-monad-failure-mtl-0.5.0,

[Haskell-cafe] Broken GHC doc links

2009-12-16 Thread Edward Z. Yang
Hello, I think the recent GHC 6.12 release broke all of the old links to Haddock documentation; as of writing Hoogle still points to the wrong Haddock docs and stuff like: http://www.haskell.org/ghc/staging/docs/latest/html/libraries/mtl/Control-Monad-Cont.html is now 404ing despite being the

Re: [Haskell-cafe] Token parsers in parsec consume trailing whitespace

2009-12-15 Thread Edward Z. Yang
Excerpts from Greg Fitzgerald's message of Mon Dec 14 18:44:37 -0500 2009: It's too bad that the 'nat' function in Token is not defined in Parsec's Char module, and because of that, you need to copy-paste that code or roll your own. Maybe I should write a patch for that. That's correct.

[Haskell-cafe] Token parsers in parsec consume trailing whitespace

2009-12-12 Thread Edward Z. Yang
I recently ran into a nasty little bug where token parsers in parsec consume trailing whitespace, which were consuming newlines and thus bamboozling a higher-level sepBy combinator. I replaced my instances of 'natural' with 'read $ many1 digit', but this gave rise to the following questions: 1.

Re: [Haskell-cafe] control-monad-failure and mtl

2009-11-30 Thread Edward Z. Yang
Excerpts from Jose Iborra's message of Sun Nov 29 10:41:50 -0500 2009: There is indeed an Monad instance for Either in mtl, declared in the module Control.Monad.Error. I can't explain why your compiler cannot find it. Can you paste a blurb of code somewhere? {-# LANGUAGE PackageImports,

[Haskell-cafe] control-monad-failure and mtl

2009-11-28 Thread Edward Z. Yang
Hello folks, I took advantage of Thanksgiving weekend to port my application to use Control.Monad.Failure, and learned (slightly painfully) that I still needed to pick some mechanism to instantiate my failure monads as. After the experience, I have three questions/comments: 1. Why isn't there an

Re: [Haskell-cafe] ghci + user prelude

2009-11-17 Thread Edward Z. Yang
Excerpts from Sean McLaughlin's message of Mon Nov 16 19:06:06 -0500 2009: Hi. I'm aware of this option, and use it frequently to override the default prelude, but it doesn't help this problem: I suppose this is the appropriate quote from the GHC manual: GHC normally imports Prelude.hi files

Re: [Haskell-cafe] ghci + user prelude

2009-11-16 Thread Edward Z. Yang
Excerpts from Sean McLaughlin's message of Mon Nov 16 15:27:55 -0500 2009: Is there a way around this? I often like to have a modified Prelude file in a subdirectory of my project, and this behavior keeps me from being able to start ghci there.

Re: [Haskell-cafe] ANNOUNCE: control-monad-failure and safe-failure

2009-11-16 Thread Edward Z. Yang
Excerpts from Michael Snoyman's message of Mon Nov 16 14:39:14 -0500 2009: control-monad-failure provides a basic notion of failure which does not commit to any concrete representation. It is just a version of the MonadError class without the annoying bits. Excellent! I've used MonadError in

Re: [Haskell-cafe] looking for a good algorithm

2009-11-13 Thread Hong Yang
Hi Casey, Thanks very much for your zeal. The table is a csv file. Actually the number of rows can be sixty thousand. Hong On Fri, Nov 13, 2009 at 5:08 PM, Casey Hawthorne cas...@istar.ca wrote: Sorry, I forgot to ask an important question. Is the table stored in a dense format as in

Re: [Haskell-cafe] looking for a good algorithm

2009-11-11 Thread Hong Yang
Thanks. I actually prototyped in Perl the SA method intuitively (though I do not know its name). But it is way slow. So I want to improve the speed by means of both algorithm and language. Hong On Wed, Nov 11, 2009 at 9:36 AM, Tillmann Vogt tillmann.v...@rwth-aachen.de wrote: Hong Yang

Re: [Haskell-cafe] Monadic correctness

2009-10-17 Thread Edward Z. Yang
Excerpts from Andrew Coppin's message of Sat Oct 17 15:21:28 -0400 2009: Suppose we have newtype Foo x instance Monad Foo runFoo :: Foo x - IO x What sort of things can I do to check that I actually implemented this correctly? I mean, ignoring what makes Foo special for a

Re: [Haskell-cafe] better way to do this?

2009-10-07 Thread Edward Z. Yang
Excerpts from Ketil Malde's message of Wed Oct 07 05:13:19 -0400 2009: One could argue that IO should be broken down into a set of sub-monads encapsulating various subsets of the functionality - file system, network access, randomness, and so on. This could extend the safe spot to cover much

[Haskell-cafe] error on --++ bla bla bla

2009-09-30 Thread Hong Yang
Hi, I got an error if one of lines reads --++ bla bla bla where I tried to comment, but -- ++ bla bla bla (notice the space after --) is OK. Do you think this revealed a tiny bug in the GHC compiler (I am using Windows Haskell Platform 2009.2.0.2)? Thanks, Hong

Re: [Haskell-cafe] error on --++ bla bla bla

2009-09-30 Thread Hong Yang
-- introduces a comment. In GHCI: Prelude let (--++) = (+) in 5 --++ 6 11 Hope this helps, Dan On Wed, Sep 30, 2009 at 7:52 PM, Hong Yang hyang...@gmail.com wrote: Hi, I got an error if one of lines reads --++ bla bla bla where I tried to comment, but -- ++ bla bla bla (notice the space

<    1   2   3   >