Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Yitzchak Gale
Eitan Goldshtrom wrote: f p = putStrLn $ (show (Main.id p)) ++ - message received Brandon S Allbery KF8NH wrote: f p = putStrLn $ (show $ Main.id p) ++ = message received wren ng thornton w...@freegeek.org wrote:    f p = putStrLn $ show (Main.id p) ++ - message received    f p = putStrLn

Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Andrew Butterfield
On 10 May 2011, at 08:30, Yitzchak Gale wrote: If I were to describe to someone in words what this function does, I would say something like: Apply Main.id, turn it into a string, tack a message onto the end, and print it. So why not write it that way in Haskell? Why not indeed ? (--) =

Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Roel van Dijk
On 10 May 2011 09:47, Andrew Butterfield andrew.butterfi...@cs.tcd.ie wrote: Why not indeed ? (--) = flip (.) f = Main.id -- show -- (++ = message received) -- putStrLn -- () :: Category cat = cat a b - cat b c - cat a c import Control.Category ( () ) f = Main.id show (++ - message

Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Yitzchak Gale
Andrew Butterfield wrote: Why not indeed ? Roel van Dijk wrote: import Control.Category ( () ) f = Main.id show (++ - message received) putStrLn Indeed, I agree. I sometimes do that, too, when I want to emphasize the idea of applying tools one after the other. But most often I just use

Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Yitzchak Gale
Andrew Butterfield wrote: Why not indeed ? Roel van Dijk wrote: import Control.Category ( () ) f = Main.id show (++ - message received) putStrLn Indeed, I agree. I sometimes do that, too, when I want to emphasize the idea of applying tools one after the other. But most often I just use

Re: [Haskell-cafe] Those damned parentheses

2011-05-10 Thread Andrew Coppin
On 10/05/2011 08:30 AM, Yitzchak Gale wrote: I think the clearest way to write it is: f = putStrLn . (++ - message received) . show . Main.id You're serious?? If I were to describe to someone in words what this function does, I would say something like: Apply Main.id, turn it into a

Re: [Haskell-cafe] Those damned parentheses

2011-05-07 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 5/7/11 15:10 , Eitan Goldshtrom wrote: I get the error Couldn't match expected type `[Char]' with actual type `a0 - c0'. The only way it seems to work is f p = putStrLn $ (show (Main.id p)) ++ - message received Interestingly enough, you have

Re: [Haskell-cafe] Those damned parentheses

2011-05-07 Thread Antoine Latter
On Sat, May 7, 2011 at 2:10 PM, Eitan Goldshtrom thesource...@gmail.com wrote: Hi. I am kind of tired of all of the parentheses I have to put in places and I'm trying to figure out what is the correct way to write code such that I can leave out parentheses. For example, I have the following:

Re: [Haskell-cafe] Those damned parentheses

2011-05-07 Thread Eitan Goldshtrom
I know about the $ symbol, that's why it's in there in the respective places. I see that I can use it to fix my problem, but I was trying to figure out function composition really. I guess that's just not the place for it. I'll check out Control.Applicative. Also thanks for the clarification

Re: [Haskell-cafe] Those damned parentheses

2011-05-07 Thread Felipe Almeida Lessa
As another suggestion, you may try HLint [1]. It usually tells you if you put unnecessary parenthesis. Among other nice suggestions. [1] http://community.haskell.org/~ndm/hlint/ (or cabal-install hlint) Cheers, =) -- Felipe. ___ Haskell-Cafe

Re: [Haskell-cafe] Those damned parentheses

2011-05-07 Thread wren ng thornton
On 5/7/11 4:29 PM, Eitan Goldshtrom wrote: I know about the $ symbol, that's why it's in there in the respective places. I see that I can use it to fix my problem, but I was trying to figure out function composition really. I guess that's just not the place for it. I'll check out