I'm not quite sure what that means. IO as it is in Haskell, and as we implemented in Scala, maintains referential transparency of expressions.
-
-
Yeah and you can apply equational reasoning as others data types like list but coincidentally (and arbitrarily) ghc and other compiles use it as the main point entry to do ffi, right? Other compilers could use other data types (like Eff in purescript)
1 reply 0 retweets 0 likes -
Yes they do, since the denotational semantics of IO is "whatever." This is a valid criticism of IO. But IO is as referential transparent as [], Maybe, ((->) t), etc.. If the focus were shifted to the correct properties of IO, we could all work toward something better imo.
0 replies 1 retweet 3 likes -
This Tweet is unavailable.
-
This Tweet is unavailable.
-
Can you elaborate? When I i.e. readFile in haskell, it is IO right? How is that referential transparent? I cannot replace the call with its value the next time, since the file might not exist
1 reply 0 retweets 0 likes -
This Tweet is unavailable.
-
I do not know the *> operator?! I presume, that in the second example, readFile is only executed once, whereas in the first example, it is executed twice. The file could change in between no?
1 reply 0 retweets 0 likes -
This Tweet is unavailable.
-
Hehe I would love to attend, once I find the possibility. I would like to understand this... is it because it is not executed until you use whatever is inside the IO context?
2 replies 0 retweets 0 likes
Check out these two programs for an example of referential transparency, which includes writing to the file as well. The Python example violates referential transparency. The Haskell program (using IO) does not. https://github.com/data61/fp-course/blob/master/README.markdown#demonstrate-io-maintains-referential-transparency …
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.