Hi,
I want to write the code that will output :
length [1,2,3] => 3
In Ruby, I could do it like :
puts "length [1,2,3] => #{[1,2,3].length}"
Following try is Haskell failed...
Prelude Data.List> print "length [1,2,3]"
"length [1,2,3]"
Prelude Data.List> print (length [1,2,3])
3
Prelude Data.List> print "length [1,2,3]" (length [1,2,3])
<interactive>:1:0:
Couldn't match expected type `Int -> t'
against inferred type `IO ()'
In the expression: print "length [1,2,3]" (length [1, 2, 3])
In the definition of `it':
it = print "length [1,2,3]" (length [1, 2, 3])
Prelude Data.List>