I know this sound very simple, but I failed to combine two strings into a new one.
The IO String "a" from a gtk entry is fetched by
a <- (entryGetText text_field)
The goal is to combine it like:
newstring = "Text: "+a
Any ideas to accomplish that? Thanks!
string s = String. Concat(a,b); C#
The concatenation of all the elements of a container of lists.
IO is the way how Haskell differentiates between code that is referentially transparent and code that is not. IO a is the type of an IO action that returns an a . You can think of an IO action as a piece of code with some effect on the real world that waits to get executed.
Using string concatenation:
do a <- entryGetText text_field let b = "Text:" ++ a return b
More simply:
do a <- entryGetText text_field return $ "Text:" ++ a
You can play games too:
("Text:" ++) <$> (entryGetText text_field)
I believe that in Haskell, the string concatenation operator is ++
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With