
Hi, Going through the '<-' description in 'learnouahaskell' it says - *" If we have a Maybe String and we bind it with <- to a variable, that variable will be a String"* so if you write do str <- Just "3" str should be of type 'String'. My question is how do I return "34" by concatenating it to "4" because the following line of code fails - --- do str <- Just "3" return str++"4"::Maybe String --- or for that matter how can I return/print just the value of str from this do block ? Thanks, Shishir

return (str++"4") should work
On 22 April 2015 at 20:54, Shishir Srivastava
Hi,
Going through the '<-' description in 'learnouahaskell' it says -
*" If we have a Maybe String and we bind it with <- to a variable, that variable will be a String"*
so if you write
do str <- Just "3"
str should be of type 'String'. My question is how do I return "34" by concatenating it to "4" because the following line of code fails -
--- do str <- Just "3" return str++"4"::Maybe String ---
or for that matter how can I return/print just the value of str from this do block ?
Thanks, Shishir
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Regards Sumit Sahrawat

On Wed, Apr 22, 2015 at 11:24 AM, Shishir Srivastava < shishir.srivastava@gmail.com> wrote:
return str++"4"::Maybe String
This is parsed as "(return str) ++ "4". Function application is always higher precedence than operators. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (3)
-
Brandon Allbery
-
Shishir Srivastava
-
Sumit Sahrawat, Maths & Computing, IIT (BHU)