Why Nostr? What is Njump?
2025-04-15 14:31:07

Tariq on Nostr: The #haskell mooc I'm doing is introducing IO but imho not very well. I'm confused by ...

The #haskell mooc I'm doing is introducing IO but imho not very well.

I'm confused by the following snippet:

-------

ghci> val1 <- putStrLn "hello"
hello

ghci> val1
()

ghci> val2 = putStrLn "bye"

ghci> val2
bye

-----

val2 is easy I think. val2 is putStrLn "bye" and when prompted to represent itself the output is "bye", I guess the IO is "executed".

but val1 I don't get.

what is <- and why does it produce and output on the repl? and what is () ?
Author Public Key
npub1xsrfffw8z907pyv0ulkfqwrcvkfw8qz0rg8y2l37p8gran76m34s2ctf6m