Re: Referential transparency in ATS

2019-08-18 Thread Artyom Shalkhakov
On Sunday, August 18, 2019 at 7:10:26 AM UTC+3, Brandon Barker wrote: > > Hi Artyom - would you mind sharing the repo URL, assuming it is open? > > Well, here it is: https://github.com/ashalkhakov/libatsc > On Thursday, August 8, 2019 at 2:49:43 AM UTC-4, Artyom Shalkhakov wrote: >> >> Hi

Re: Referential transparency in ATS

2019-08-17 Thread Brandon Barker
Hi Artyom - would you mind sharing the repo URL, assuming it is open? On Thursday, August 8, 2019 at 2:49:43 AM UTC-4, Artyom Shalkhakov wrote: > > Hi Brandon, Alexander, > > On Wednesday, August 7, 2019 at 5:31:04 AM UTC+3, Brandon Barker wrote: > >> I just want to say this is quite intriguing,

Re: Referential transparency in ATS

2019-08-08 Thread Artyom Shalkhakov
Hi Brandon, Alexander, On Wednesday, August 7, 2019 at 5:31:04 AM UTC+3, Brandon Barker wrote: > I just want to say this is quite intriguing, I think it would be very > appealing to have a standard library built on this idea (a modification of > Temptory?), perhaps with some more fleshed out

Re: Referential transparency in ATS

2019-08-06 Thread Brandon Barker
I just want to say this is quite intriguing, I think it would be very appealing to have a standard library built on this idea (a modification of Temptory?), perhaps with some more fleshed out examples of IO splits before really digging in. On Thu, Mar 21, 2019, 8:18 PM gmhwxi wrote: > > One

Re: Referential transparency in ATS

2019-08-06 Thread Dambaev Alexander
This looks interesting, will follow up if/when I will got something from it :) -- You received this message because you are subscribed to the Google Groups "ats-lang-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: Referential transparency in ATS

2019-08-06 Thread gmhwxi
The problem, as I understand it, is very common in practice. The solution you outlined in Haskell is what I call a "closed-world" solution. What do I mean by a "closed-world" solution? For instance, in LISP, there are a lot of functions that are like: creating a resource, using it and then

Re: Referential transparency in ATS

2019-08-06 Thread Dambaev Alexander
Thanks for directions to investigate! > -- You received this message because you are subscribed to the Google Groups "ats-lang-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscr...@googlegroups.com. To view this discussion

Re: Referential transparency in ATS

2019-08-06 Thread Hongwei Xi
Thanks! There are quite a few issues mentioned in your message. Let me address them separately. >>The point of `IO` data type in pure language is not about precision. It's purpose is to control where the source and distribution of side-effects in your program. In haskell, it is done in an

Re: Referential transparency in ATS

2019-08-05 Thread Dambaev Alexander
Thanks for response. понедельник, 5 августа 2019 г., 17:56:43 UTC пользователь gmhwxi написал: > > If I understand correctly, I think I have dealt with this issue before. > > When an iterator is taken out, you can stop the object from being used > until > the iterator is returned. For instance,

Re: Referential transparency in ATS

2019-08-05 Thread Hongwei Xi
If I understand correctly, I think I have dealt with this issue before. When an iterator is taken out, you can stop the object from being used until the iterator is returned. For instance, the 'minus' view in PATSHOME/prelude/SATS/extern.sats is precisely introduced for this purpose. To me, a

Re: Referential transparency in ATS

2019-08-05 Thread Dambaev Alexander
Hi all, I want to popup this topic again. And I will start with some context: recently, I had debugged pcmanfm file manager's segmentation faults, that happen during navigation through hidden folders. I found out, that the cause of this error is in per-directory settings of displaying hidden

Re: Referential transparency in ATS

2019-05-29 Thread Brandon Barker
Thanks, Dambaev, for the excellent explanation. On Sunday, May 5, 2019 at 1:48:48 PM UTC-4, Dambaev Alexander wrote: > > > >> Admittedly I don't really understand what RT is, but from what I >> understand, in Haskell the expression like [print "ha"] is basically a >> command to the top-level

Re: Referential transparency in ATS

2019-05-05 Thread Dambaev Alexander
> > So, being pure, Haskell pretends that "program is started with some > unknown RealWorld state of value0 and each IO action modifies this state > and thus, this value is unique for all expressions and thus. complier > should evaluate them all instead of caching result of the first

Re: Referential transparency in ATS

2019-05-05 Thread Dambaev Alexander
> > Admittedly I don't really understand what RT is, but from what I > understand, in Haskell the expression like [print "ha"] is basically a > command to the top-level interpreter (which is the language runtime) to > perform an effect on the console (moreover, it will be evaluated on >

Re: Referential transparency in ATS

2019-03-26 Thread Artyom Shalkhakov
On Tuesday, March 26, 2019 at 5:14:34 PM UTC+2, gmhwxi wrote: > > Boxing is removed: > > https://pastebin.com/JacNgK2t > > Some hacks are used to make it work... > > This is awesome. Now we don't need to allocate every time we call a 'read' function. :) Thanks! I've updated my gist with this and

Re: Referential transparency in ATS

2019-03-26 Thread Hongwei Xi
Boxing is removed: https://pastebin.com/JacNgK2t Some hacks are used to make it work... On Tue, Mar 26, 2019 at 10:14 AM Hongwei Xi wrote: > >>Did you mean to use vtype in {a,b:vtype} here? Or not? > > Typo: vtype should be vt@ype. > > On Tue, Mar 26, 2019 at 10:12 AM Artyom Shalkhakov < >

Re: Referential transparency in ATS

2019-03-26 Thread Hongwei Xi
>>Did you mean to use vtype in {a,b:vtype} here? Or not? Typo: vtype should be vt@ype. On Tue, Mar 26, 2019 at 10:12 AM Artyom Shalkhakov < artyom.shalkha...@gmail.com> wrote: > On Tuesday, March 26, 2019 at 4:07:38 PM UTC+2, gmhwxi wrote: >> >> A "standard" solution is to use

Re: Referential transparency in ATS

2019-03-26 Thread Artyom Shalkhakov
On Tuesday, March 26, 2019 at 4:07:38 PM UTC+2, gmhwxi wrote: > > A "standard" solution is to use call-by-reference: > > extern > fun > runCommand > {a:vt@ype} > (c:Command(a:vt@ype), ? >> a): void > > I think we covered this a few months back when Chris asked about it. This finally reminded me

Re: Referential transparency in ATS

2019-03-26 Thread Artyom Shalkhakov
On Tuesday, March 26, 2019 at 3:55:47 PM UTC+2, gmhwxi wrote: > > >> Now, what about boxing, can we do something with boxing? > > Do you mean that you want to have 'a:t@ype' instead of 'a:type'? > > Yes. I think any use of 'bind' is highly discouraged if we have 'a:type' restriction (e.g. want to

Re: Referential transparency in ATS

2019-03-26 Thread Hongwei Xi
>> Now, what about boxing, can we do something with boxing? Do you mean that you want to have 'a:t@ype' instead of 'a:type'? On Tue, Mar 26, 2019 at 9:36 AM Artyom Shalkhakov < artyom.shalkha...@gmail.com> wrote: > Hi Hongwei, > > On Tuesday, March 26, 2019 at 3:22:41 PM UTC+2, gmhwxi wrote: >>

Re: Referential transparency in ATS

2019-03-26 Thread Artyom Shalkhakov
On Tuesday, March 26, 2019 at 3:02:42 PM UTC+2, gmhwxi wrote: > > Nice! > > But I am very surprised that this code actually works. > My understanding is that It works because of a bug in patsopt :) > > May I suggest this bug to be classified as a feature. :) Basically, runCommand should be

Re: Referential transparency in ATS

2019-03-26 Thread Artyom Shalkhakov
Hi Hongwei, On Tuesday, March 26, 2019 at 3:22:41 PM UTC+2, gmhwxi wrote: > > Here is a linear version: > > https://pastebin.com/sqXcRhnf > > Also, Command is a linear datatype (i.e., dataviewtype). > > Great! Now, what about boxing, can we do something with boxing? I expect such code, if it's

Re: Referential transparency in ATS

2019-03-26 Thread Hongwei Xi
Here is a linear version: https://pastebin.com/sqXcRhnf Also, Command is a linear datatype (i.e., dataviewtype). On Tue, Mar 26, 2019 at 9:02 AM Hongwei Xi wrote: > Nice! > > But I am very surprised that this code actually works. > My understanding is that It works because of a bug in

Re: Referential transparency in ATS

2019-03-26 Thread Artyom Shalkhakov
I've made a gist: https://gist.github.com/ashalkhakov/c3577e97b20020fde31f84447fd1e056 It actually works. It illustrates the basics (sequencing, bind, input and output). Nice. It doesn't have Haskell's "return" though, but that is pretty simple to add (it's something that "creates" IO where

Re: Referential transparency in ATS

2019-03-26 Thread Artyom Shalkhakov
Hi Brandon, On Friday, March 22, 2019 at 8:49:29 PM UTC+2, Brandon Barker wrote: > > Hey Artyom, > > Thanks for the very interesting analysis and response. > > Glad you found it useful! On Fri, Mar 22, 2019 at 4:06 AM Artyom Shalkhakov > wrote: > >> Hi Brandon, >> >> This is a very lively

Re: Referential transparency in ATS

2019-03-23 Thread Vanessa McHale
Sounds like I have to fix atspkg :p If you want to use the monads package with npm + Makefiles, I suppose I could upload to npm (it might even be a good idea given the permanence of packages there). As an aside: I suspect that what makes IO so nice in the context of Haskell is that you get the

Re: Referential transparency in ATS

2019-03-23 Thread Brandon Barker
On Friday, March 22, 2019 at 2:49:29 PM UTC-4, Brandon Barker wrote: > > Hey Artyom, > > Thanks for the very interesting analysis and response. > > On Fri, Mar 22, 2019 at 4:06 AM Artyom Shalkhakov < > artyom.shalkha...@gmail.com> wrote: > >> Hi Brandon, >> >> This is a very lively discussion,

Re: Referential transparency in ATS

2019-03-21 Thread Brandon Barker
On Thu, Mar 21, 2019 at 8:18 PM gmhwxi wrote: > > One can definitely build a monad-based library to support IO: > > absvtype IO(a:vt@ype) = ptr > If really using monads, would it also be reasonable to do (or ideally start at Functor and then build up to Monad): absvtype Monad(a:vt@ype) = ptr

Re: Referential transparency in ATS

2019-03-21 Thread Hongwei Xi
Monads can be used to track effects in call-by-value languages as well. I was once told that SPJ wanted to implement a call-by-value Haskell if he could have started again :) In Ur/Web, Adam Chlipala's functional call-by-value language for web-programming, monads are used extensively for signals,

Re: Referential transparency in ATS

2019-03-21 Thread gmhwxi
One can definitely build a monad-based library to support IO: absvtype IO(a:vt@ype) = ptr The problem with IO monad is that it is so broad. With linear types, a programmer can specify a lot more precisely. >>is that ATS doesn't (by default?) model an IO effect. No, it doesn't if you use the

Re: Referential transparency in ATS

2019-03-21 Thread gmhwxi
I see. Then you have to blame C :) My observation is that engineers have a tendency to not treat things uniformly. For instance, in C, you cannot declare a variable (or a field in a struct) to be of the type 'void'. In other words, 'void' is treated specially as a type. This special treatment of

Re: Referential transparency in ATS

2019-03-21 Thread Brandon Barker
Hi Artyom, I'm also grappling with the issue of RT in this case as I'd so far only thought about it in terms of function calls, but what you and Vanessa say helped me to understand the issue. Though I haven't managed to get ATS to have the same behavior as OCaml in the "let expression" above,

Re: Referential transparency in ATS

2019-03-20 Thread Brandon Barker
On Wednesday, March 20, 2019 at 10:40:34 PM UTC-4, Vanessa McHale wrote: > > I think that might have do with laziness? If you have a side-effecting > expression and you try to pretend it's call-by-need, then bad things happen > (beta reduction is no longer valid!) > > Yes, that seems to be the

Re: Referential transparency in ATS

2019-03-20 Thread Vanessa McHale
I think that might have do with laziness? If you have a side-effecting expression and you try to pretend it's call-by-need, then bad things happen (beta reduction is no longer valid!) Do you have an example in OCaml? I admit I am curious as to why their compiler would do such a thing. On 3/20/19

Referential transparency in ATS

2019-03-20 Thread Brandon Barker
I'm a little rusty, so can't come up with many good examples. Apparently it is possible to do something like this in OCaml: implement main0 () = { val () = let val ha = print("ha") in (ha; ha) // How to get two ha's here? end } After running the program, you would only see one