I write the original blog because I found it funny that languages like XQuery and XSLT, which I feel so 'functional', is not actually referentially transparent. Yet monadic I/O as implemented in Haskell, which I feel so 'procedural' is referentially transparent. So my intension in the blog was to come up with something that can better depict the computation model of XQuery and XSLT. My approach was to keep the concept of RT, but stretch the concept of functional programming. From the feedback, I can see that people think that's not acceptable.
I admit that it might not be a good idea to stretch some existing well established term. That's fine. I can go plan B.
A new term can be coined instead. For the time being, I call it 'pure computation'. Here's the definition - a function may be described as pure computation if both these statements about the function hold:
- The function always evaluates to the same result value given the same argument value(s) and the same set of context value(s). The function result value cannot depend on other hidden information.
- Evaluation of the result does not cause any semantically observable side effect or output through the direct interface of the hosting world.
By this definition, I want to make sure 'pure computation' cannot carried out side effects through some back door. If I'm the gatekeeper of the real hosting world, I can sleep soundly at night when I grant someone the right to run pure computational program in the hosting world.
Below are two diagrams comparing the two ways of viewing the programming world:
Which one better represents you perception of the programming world, I left it to you to decide.
It seems you've stated the fact that a pure function can contain local mutation. Or is there something different going on?
ReplyDeleteThere are no "RT functions with monadic I/O" in Haskell (barring the use of unsafePerformIO, which can be used to thwart this, but then you can no longer claim that your code is pure if you do). There are "RT functions on monadic I/O", which have no side effects. IO is a more akin to a datatype that can be acted on by functions, like an integer or string. One value of IO is bound to main and that piece of IO is what is actually run. This is magical, "main" is a special name and "main = ..." is an entry point. All other IO does nothing, it has to somehow be bound to main. Usually this is done by composing a bunch of IO into a single program and then binding the result to main. The composition functions themselves (>>= and return) have no side effects.
ReplyDeleteThat said, Haskell does support referentially transparent procedural programming with local mutable variables, but via a different mechanism from IO.
louis vuitton outlet
ReplyDeletecoach outlet online store
north face outlet 70% off
fitflop sale
abercrombie kids
fendi
jordan 6
fitflops
north face outlet store
michael kors outlet
gucci outlet online
new balance
coach purses
hermes bag
hermes bags
louis vuitton belt
cheap jordan shoes
hermes outlet
toms shoes
converse shoes sale
ferragamo shoes outlet
louboutin shoes
coach outlet store
polo factory outlet
north face clearance
coach factory outlet
michael kors factory outlet online
jordan shoes
christian louboutin outlet
celine bag
michael kors sale
reebok shoes outlet
abercrombie promo code
converse shoes
ralph lauren extra 25% off
toms outlet
nike high heels online
lebron 12 shoes
abercrombie and fitch
jordan retro 11 legend blue
marc jacobs outlet
kobes shoes
coach bag
kids north face jackets
1015wjl
1nike sale
ReplyDeletemichael kors outlet handbags
canada goose clearance
dior outlet online
ghd flat iron
cheap coach handbags
pink jordans
juicy couture
wholesale jordan shoes
michael kors handbags sale
salvatore ferragamo outlet
ray ban sunglasses
abercrombie
michael kors handbags clearance
ghd hair straighteners
north face jackets clearance
hermes outlet online
canada goose jackets
www.coachoutlet.com
ray ban sunglasses
nike free
mont blanc
mbt shoes for women
kate spade outlet
celine bags
nike free run
oakley sunglasses outlet
salvatore ferragamo belt
cheap jordans
coach outlet
nike shoes
michael kors outlet online
prada outlet
nike nfl jresey
air jordan retro 6
oakley sunglasses outlet
new balance sale
air max
hermes belt
joe's new balance
abercrombie outlet online
coach outlet online store
girls north face jackets
ugg boots clearance
1015wjl
Really your work is very nice and i like this article.Thanks for share. Our Wax Melts provide a long lasting and strong scent capable of filling your home with a lovely fragrance.
ReplyDeleteYou can find some Yankee Candle Company Massachusetts candles that include pre-made soap bases that come in soaps that have several different colors and scents. Check here to know more about buy yankee candle.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteIt is best to purchase your wicks from a reliable supplier to ensure quality. As a buyer, it is also important to note that the longer and thicker your wick is, the better it will burn. If you are curious to know more about woodwick, read me.
ReplyDelete