Re: [Haskell-cafe] Re: New slogan for haskell.org

2007-11-28 Thread Juanma Barranquero
On Nov 28, 2007 6:16 PM, Laurent Deniau [EMAIL PROTECTED] wrote: I can't see how it could be one page of C unless the page is 10 lines long ;-) The following code is the direct translation of your Haskell code (except that it prints the result instead of building a list). a+, ld. #include

Re: [Haskell-cafe] PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Juanma Barranquero
On 9/27/07, ok [EMAIL PROTECTED] wrote: (What the heck _is_ Tangut, anyway?) http://en.wikipedia.org/wiki/Tangut_language Juanma ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Newbie qustion about monads

2003-10-04 Thread Juanma Barranquero
On Thu, 02 Oct 2003 14:57:22 +0200, Juanma Barranquero [EMAIL PROTECTED] wrote: data Accum s a = Ac [s] a instance Monad (Accum s) where return x = Ac [] x Ac s1 x = f = let Ac s2 y = f x in Ac (s1++s2) y output :: a - Accum a () output x = Ac [x] () After trying this one

Newbie qustion about monads

2003-10-02 Thread Juanma Barranquero
I have an extremely-newbie question about monads and how to interpret the monadic laws; I asked that same question yesterday on IRC and the answers were interesting but non-conclusive (to me anyway). I'm trying to learn monads by reading All About Monads, version 1.0.2. I though of defining a

Re: Newbie qustion about monads

2003-10-02 Thread Juanma Barranquero
On Thu, 02 Oct 2003 11:22:13 +0200 Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] wrote: As you discovered, there is no meaningful count of operations. If an operation doesn't do anything, do you count it? It's not about counting the operations (that's just an example), but accumulating any kind

Re: AW: Newbie qustion about monads

2003-10-02 Thread Juanma Barranquero
On Thu, 2 Oct 2003 13:16:13 +0200 [EMAIL PROTECTED] wrote: The Monad class is just called Monad because it is intended to cover a monad. But it doesn't ensure the laws. That is your sole responsibility. Yeah, I know. But it's difficult to ensure I'm satisfying the laws when I'm not entirely

Re: Newbie qustion about monads

2003-10-02 Thread Juanma Barranquero
On Thu, 2 Oct 2003 12:30:54 +0100 Alastair Reid [EMAIL PROTECTED] wrote: Observational equivalence. For monads like list and maybe, this boils down to the normal equality because the standard equality on these types is exactly observational equality. For monads like IO, you can't define

Re: Newbie qustion about monads

2003-10-02 Thread Juanma Barranquero
On Thu, 02 Oct 2003 14:27:29 +0200 Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] wrote: Accumulating state is fine. These definitions don't accumulate state: 'return' should yield a neutral state, and the above = ignores the state of the lhs. You're right. data Accum s a = Ac [s] a

Re: Newbie qustion about monads

2003-10-02 Thread Juanma Barranquero
On Thu, 2 Oct 2003 16:09:11 +0100, Alastair Reid [EMAIL PROTECTED] wrote: So you should not interpret the '==' in the monad law as requiring you to define an Eq instance. If you do define an Eq instance, it ought to be reflexive, symmetric and transitive (i.e., an equivalence) if you want

How to detect finite/infinite lists?

2003-09-18 Thread Juanma Barranquero
Extremely-newbie questions: Is there any way to know if a list is finite or infinite, other than doing: length l and waiting forever? :) I ask because I was learning Haskell by writing some pretty naive implementation of surreal numbers, where I used lists for left and right surreal sets,

Re: How to detect finite/infinite lists?

2003-09-18 Thread Juanma Barranquero
On Thu, 18 Sep 2003 15:53:12 -0400, Derek Elkins [EMAIL PROTECTED] wrote: In Haskell 98, no. With a slightly impure extension (observable sharing) sometimes but in general, no. Interesting. just use a data structure that says, an infinity of x. The simplest thing I would think of is to