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:
data Message = ... --leaving this out because it's not important
data Plane = Plane {
id :: Int,
position :: (Int,Int,Int),
direction :: Int,
path :: [Int],
messagebuf :: Chan Message
}
main = do
c <- newChan :: Chan Message
p <- Plane 0 (0,0,0) 0 [] c
f p
f p = putStrLn $ (show Main.id p) ++ " - message received"
This causes an error "The function `show' is applied to two arguments".
If I put instead:
f p = putStrLn $ (show . Main.id p) ++ " - message received"
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"
This seems to be the same for many other situations where I try to use
function composition of some sort. It's just getting kind of annoying.
-Eitan
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe