Re: [Haskell-cafe] Re: A GHC error message puzzle

2010-08-13 Thread Wei Hu
On Fri, Aug 13, 2010 at 4:53 AM, Simon Marlow marlo...@gmail.com wrote: Ah yes, that works too.  But other similar versions don't, like this one: process :: String -  String process _ = let x = x in x Hence why I added the tail in my version. Without -O, this version doesn't work, but with

Re: [Haskell-cafe] Re: A GHC error message puzzle

2010-08-12 Thread Wei Hu
Anyone care to explain why? I also tested a slightly changed program pasted below, and am very confused. main = do -- This call doesn't terminate, why? print $ nonTermination a -- Comment the above line to test the rest of the code -- RTS detects the loop and bails out print $

Re: [Haskell-cafe] Re: A GHC error message puzzle

2010-08-12 Thread Wei Hu
Threaded or not doesn't seem to make a difference. I just noticed with optimization turned on, RTS does detect the loop. On Thu, Aug 12, 2010 at 4:28 PM, Jason Dagit da...@codersbase.com wrote: On Thu, Aug 12, 2010 at 1:25 PM, Wei Hu wei@gmail.com wrote: Anyone care to explain why? I

Re: [Haskell-cafe] Implementation of Functional Languages - a tutorial

2010-03-31 Thread Wei Hu
I was working through this book last year, and posted my work at https://patch-tag.com/r/wh5a/CoreCompiler/home. It was almost complete. On Wed, Mar 31, 2010 at 7:12 AM, C K Kashyap ckkash...@gmail.com wrote: Looks like some functions are left as an exercise... I'd appreciate it if someone

Re: [Haskell-cafe] Re: Long running Haskell program

2009-11-11 Thread Wei Hu
I used to be a victim of GFW, so I can feel your pain. You may try to subscribe to http://leimy9.blogspot.com/feeds/posts/default in your Google Reader. In case that fails too, I've pasted the blog post below, with no images: I've been using Haskell in a serious way for about 2 years. Been using

[Haskell-cafe] The (|) function in Control.Parallel.Strategies

2009-10-31 Thread Wei Hu
The documentation of (|) says that it evaluates the first argument before the second. The function is defined as (http://www.haskell.org/ghc/docs/6.10-latest/html/libraries/parallel/src/Control-Parallel-Strategies.html#%3E|): (|) :: Done - Done - Done {-# INLINE (|) #-} (|) = Prelude.seq I'm

Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-24 Thread Wei Hu
I recommend Learn you a Haskell for great good: http://learnyouahaskell.com/functors-applicative-functors-and-monoids#applicative-functors On Sun, Aug 23, 2009 at 12:25 PM, Diego Souzadso...@bitforest.org wrote: A quick search pointed me to this:

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

2009-06-25 Thread Wei Hu
Could you or anyone else briefly explain how mmtl solves the combinatorical explosion problem? Reading the source code is not very productive for newbies like me. Thanks! On Tue, Jun 23, 2009 at 5:34 AM, Luke Palmerlrpal...@gmail.com wrote: On Tue, Jun 23, 2009 at 2:20 AM, papa.e...@free.fr

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

2009-06-25 Thread Wei Hu
OK, I found two papers by the author, Mauro Jaskelioff, that seem relevant. One paper Modular Monad Transformers is all category theoretical. Maybe I should read the other one Monatron: An Extensible Monad Transformer Library. On Thu, Jun 25, 2009 at 12:17 PM, Wei Huwei@gmail.com wrote:

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

2009-06-25 Thread Wei Hu
On Thu, Jun 25, 2009 at 1:10 PM, David Menendezd...@zednenem.com wrote: On Thu, Jun 25, 2009 at 12:17 PM, Wei Huwei@gmail.com wrote: Could you or anyone else briefly explain how mmtl solves the combinatorical explosion problem? Reading the source code is not very productive for newbies

Re: [Haskell-cafe] can someone point me to more help about Database.HDBC.ODBC?

2009-05-30 Thread Wei Hu
Try http://sites.google.com/site/haskell/notes/connecting-to-mysql-with-haskell that I wrote up. An important thing that I don't think was documented anywhere is that the trailing ';' is required. On Fri, May 29, 2009 at 11:01 PM, Michael P Mossey m...@alumni.caltech.edu wrote: I'm trying to use

[Haskell-cafe] RE: [ANN] Safe Lazy IO in Haskell

2009-03-23 Thread Wei Hu
Nicolas Pouillard nicolas.pouillard at gmail.com writes: Hi folks, We have good news (nevertheless we hope) for all the lazy guys standing there. Since their birth, lazy IOs have been a great way to modularly leverage all the good things we have with *pure*, *lazy*, *Haskell* functions to

[Haskell-cafe] Re: Predicativity?

2008-09-17 Thread Wei Hu
Thomas Davie tom.davie at gmail.com writes: In your application (id id) you create two instances of id, each of which has type forall a. a - a, and each of which can be applied to a different type. In this case, the left one gets applied to the type (a - a) and the right one a, giving

[Haskell-cafe] Predicativity?

2008-09-16 Thread Wei Hu
Hello, I only have a vague understanding of predicativity/impredicativity, but cannot map this concept to practice. We know the type of id is forall a. a - a. I thought id could not be applied to itself under predicative polymorphism. But Haksell and OCaml both type check (id id) with no

[Haskell-cafe] A question about mfix

2008-07-29 Thread Wei Hu
What's wrong about giving mfix the following general definition? mfix :: (a - m a) - m a mfix f = (mfix f) = f I know it diverges if (=) is strict on the first argument. My question is, is this definition correct for all lazy monads? The documentation

[Haskell-cafe] Re: A question about mfix

2008-07-29 Thread Wei Hu
So that's also why the fix function from Data.Function is defined as fix f = let x = f x in x instead of fix f = f $ fix f right? But, I think my mfix definition and your mfixLazy definition are still semantically equivalent because they expand to the same thing. See the following