[Haskell-cafe] local loops

2004-12-14 Thread Per Larsson
I often use local loops in monadic code, e.g. main = do ... let loop = do ... if cond then loop else return () loop It seems that I can encode this idiom slightly more concise with the 'fix' operator (from Control.Monad.Fix), i.e. main = do

Re: [Haskell-cafe] The difference between ($) and application

2004-12-14 Thread Andres Loeh
Date: Tue, 14 Dec 2004 10:24:15 -0500 From: Andrew Pimlott [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] The difference between ($) and application On Tue, Dec 14, 2004 at 11:23:24AM +0100, Henning Thielemann wrote: On Tue, 14 Dec 2004, Andrew Pimlott wrote: (Of course, it's still

Re: [Haskell-cafe] The difference between ($) and application

2004-12-14 Thread Marcin 'Qrczak' Kowalczyk
Andres Loeh [EMAIL PROTECTED] writes: The function ($) is the identity function, restricted to functions. Almost. With the standard definition of f $ x = f x it happens that ($) undefined `seq` () = () id undefined `seq` () = undefined -- __( Marcin Kowalczyk \__/

[Haskell-cafe] Named function fields vs. type classes

2004-12-14 Thread Derek Elkins
On the other hand, it's difficult or impossible to make a list of a bunch of different types of things that have nothing in common save being members of the class. I've recently been playing with making, for each class C, a interface datatype IC (appropriately universally and

Re: [Haskell-cafe] The difference between ($) and application

2004-12-14 Thread Ben Rudiak-Gould
Derek Elkins wrote: Andrew Pimlott wrote: I think this post should go under the heading ($) considered harmful. I've been bitten by this, and I never use ($) anymore in place of parentheses because it's too tempting to think of it as syntax. I find this position ridiculous. [...] If you ever make

Re: [Haskell-cafe] Sound library?

2004-12-14 Thread Jeremy Shaw
At Fri, 03 Dec 2004 10:40:45 -0800, Jeremy Shaw wrote: At Fri, 03 Dec 2004 10:56:24 -0500, Jason Bailey wrote: Would anyone know of packages out there for Haskell that support mp3's or ogg files? I have some haskell bindings to libmad somewhere ... I don't remember how complete

Re: [Haskell-cafe] The difference between ($) and application

2004-12-14 Thread Andrew Pimlott
On Tue, Dec 14, 2004 at 01:49:57PM -0500, Derek Elkins wrote: On Mon, Dec 13, 2004 at 07:49:00PM -0800, oleg at pobox.com wrote: The operator ($) is often considered an application operator of a lower precedence. Modulo precedence, there seem to be no difference between ($) and `the

Re: [Haskell-cafe] The difference between ($) and application

2004-12-14 Thread Tom Pledger
[EMAIL PROTECTED] wrote: [...] However, if we try t2' = W $ id we get an error: /tmp/t1.hs:13: Inferred type is less polymorphic than expected Quantified type variable `a' escapes Expected type: (a - a) - b Inferred type: (forall a1. a1 - a1) - W In the first argument

Re: [Haskell-cafe] special term describing f :: (Monad m) = (a - m b) ?

2004-12-14 Thread Ralf Hinze
I can understand how calling this kind of function effectual makes sense in the magic IO monad, or perhaps even in the ST and State monads, because the term seems to imply side-effects. However, it is a misnomer for eg, the Error, List and Cont monads. It depends a bit on how wide you

[Haskell-cafe] special term describing f :: (Monad m) = (a - m b)?

2004-12-14 Thread Derek Elkins
What is a function of the followning type called: f :: (Monad m) = (a - m b) Is there a special term describing such a function (a function into a monad)? For f in a = f is en example. Need it for an article/report. Regards/Henning Well, formally, it's called a Kleisli arrow

[Haskell-cafe] The difference between ($) and application

2004-12-14 Thread Derek Elkins
Derek Elkins wrote: Andrew Pimlott wrote: I think this post should go under the heading ($) considered harmful. I've been bitten by this, and I never use ($) anymore in place of parentheses because it's too tempting to think of it as syntax. I find this position ridiculous. [...]

Re: [Haskell-cafe] local loops

2004-12-14 Thread Jon Cast
Per Larsson [EMAIL PROTECTED] wrote: I often use local loops in monadic code, e.g. main = do ... let loop = do ... if cond then loop else return () loop It seems that I can encode this idiom slightly more concise with the 'fix'

Re: [Haskell-cafe] The difference between ($) and application

2004-12-14 Thread Jon Cast
Derek Elkins [EMAIL PROTECTED] wrote: Personally, I would mind ($) being magical. One of the nice things about Haskell is there is practically no magic. The last thing I want is Haskerl (http://www.dcs.gla.ac.uk/~partain/haskerl.html). runST simply had a rank-2 type that is not