[Haskell-cafe] Uses of `fix' combinator

2009-02-19 Thread Khudyakov Alexey
Hello, While browsing documentation I've found following function -- | @'fix' f@ is the least fixed point of the function @f@, -- i.e. the least defined @x@ such that @f x = x...@. fix :: (a - a) - a fix f = let x = f x in x I have two questions. How could this function be used? I'm unable

Re: [Haskell-cafe] Uses of `fix' combinator

2009-02-19 Thread Derek Elkins
On Thu, 2009-02-19 at 17:00 +0300, Khudyakov Alexey wrote: Hello, While browsing documentation I've found following function -- | @'fix' f@ is the least fixed point of the function @f@, -- i.e. the least defined @x@ such that @f x = x...@. fix :: (a - a) - a fix f = let x = f x in x

Re: [Haskell-cafe] Uses of `fix' combinator

2009-02-19 Thread Bulat Ziganshin
Hello Khudyakov, Thursday, February 19, 2009, 5:00:03 PM, you wrote: I have two questions. How could this function be used? I'm unable to imagine any. Naive approach lead to nothing (no surprise): fix (1:) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re: [Haskell-cafe] Uses of `fix' combinator

2009-02-19 Thread Eugene Kirpichov
By the way, the fact that least is in the sense of least defined explains why fix (2^) gives an undefined: The least defined fixpoint of any strict function (f : f _|_ = _|_) is, by definition, undefined. And (2^) is strict. 2009/2/19 Derek Elkins derek.a.elk...@gmail.com: On Thu, 2009-02-19 at

Re: [Haskell-cafe] Uses of `fix' combinator

2009-02-19 Thread Miguel Mitrofanov
Each data type in Haskell contains one element, which is usually invisible. It's called bottom and denoted by (_|_). Naturally (_|_) of type Int and (_|_) of type Char are different; however, they are denoted as if they are the same, 'cause there isn't much difference between them. Anyway,

Re: [Haskell-cafe] Uses of `fix' combinator

2009-02-19 Thread Khudyakov Alexey
Thankyou everyone. This was most helpful. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe