Re: error messages

2020-08-03 Thread Richard
Hi Timmy,

Here is a tool that displays the compiler error messages in a more consumable 
way: https://github.com/sparverius/ats-acc. 

Hope it helps!

- Richard

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/37ec2e94-2f68-48d9-8b59-d271c4dd5368o%40googlegroups.com.


Re: "error(parsing): the keyword [:] is needed" message despite code appearing to be fine

2020-03-21 Thread Richard

Looks like the issue is from a few lines before 171, unterminated string, here:

fn vec2_to_array {} ( v: vec2, out: ptr ) : void = "sta#%

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/c7d0cebd-757d-49e8-bf2e-b9f4f94a44f7%40googlegroups.com.


"error(parsing): the keyword [:] is needed" message despite code appearing to be fine

2020-03-21 Thread Richard
Hi,

Missing equals sign here?

fn vec2_smootherstep {} ( v1: vec2, v2: vec2, amount: vec2 ) : vec2 "sta#%"

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/456e9d75-1e14-4256-b22d-80dc4e95e670%40googlegroups.com.


Re: How can I best help

2020-02-28 Thread Richard
Hi froyo,

True, good documentation is very important!

Have you seen the documentation here?
http://www.ats-lang.org/Documents.html

For building ats from scratch, (i.e. bootstrapping ats2 from ats1) the 
documentation is indeed limited.

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/4c688af1-b742-4417-887f-85e5002bf215%40googlegroups.com.


ats3 extension - jsonize abstract syntax trees

2019-12-22 Thread Richard
Hello all,

Here is an ats3 compiler extension that I have been working on called 
"xjsonize", see https://github.com/sparverius/xjsonize

Brief overview, 

   - written in ats2 
   - similar to xinterp, links the ats3 compiler library (libxatsopt)
   - exports the AST at any level of compilation as json
   - provides a library libxjsonize 
  - link other extensions with -lxjsonize
  - for example, https://github.com/sparverius/xatscc,
 -  this example links both libxatsopt and libxjsonize to xinterp 
 for jsonizing the the tree of the interpreter
  
Later versions can suite specific needs however, for now the jsonized 
output is currently meant to be as verbose as possible with the exception 
of location information (coming soon!). Also, the labify branch 
 provides a flatter 
representation than the master branch. 


Some examples of the exported json can be found HERE 
.


Possible use cases:

   - Learn about each translation phase of the ats3 compiler
   - Export AST to write extensions in any programming language you wish. 
   (some examples soon!)
   - Something else you think ofentirely??
   
Personally, reading through the AST in json form has helped me tremendously 
with understanding the compilation phases of ats3. I hope you find it 
useful as well!


Cheers!

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/7f012a74-7e12-4532-a03b-f6000bb25b7a%40googlegroups.com.


Re: Are you interested in building tools for ATS3?

2019-12-21 Thread Richard
Here is an other extension example https://github.com/sparverius/xjsonize. 
(see the readme for building instructions)
Outputs the AST at each transition level in json. This can be helpful for 
writing other extensions or even just to learn ast.

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/a8c85846-0f9a-4433-aa85-f431aeb14bac%40googlegroups.com.


Re: Are you interested in building tools for ATS3?

2019-12-16 Thread Richard
By the way, xjsonize is nearly ready to be published! I will publish it 
following a similar format to xinterp later this evening :)

On Monday, December 16, 2019 at 11:05:41 PM UTC-5, gmhwxi wrote:
>
>
> The full name for ATS3 is ATS/Xanadu.
>
> From this point on, I would use the name 'Xanadu' for ATS3 as this should 
> make it easier
> for people to locate information on ATS/Xanadu.
>
> I have so far implemented ATS0 (ATS/Proto),  ATS1 (ATS/Geizella and 
> ATS/Anairiats),
> and ATS2 (ATS/Postiats). ATS/Proto and ATS/Geizella were done in OCaml and 
> the others
> in ATS1. I now see all of these implementations as parts of a lengthy 
> programming language
> experiment spanning a period of about 15 years.
>
> But ATS3 is designed and implemented very differently. First and foremost, 
> I hope that ATS3
> can become a programming language suitable for use in production. For that 
> to have a chance to
> ever happen, we need to build an ecosystem for ATS3. ATS3 is structured in 
> a way that can
> greatly facilitate collaboration of contributors.
>
> While it is still a bit too early for a release of ATS3, I feel that some 
> people may be interested in
> playing with the syntax of ATS3 and learning a few tricks about 
> programming language implementation.
> With that thought on my mind, I have just implemented a (naive) 
> interpreter for ATS3. Please find the code
> for this interpreter in the following repository:
>
> https://github.com/xanadu-lang/xinterp
>
> The basic idea is to structure xinterp as a project external to ATS/Xanadu.
>
> After git-cloing xinterp, please also git-clone the following repo inside 
> the xinterp repo:
>
> https://github.com/xanadu-lang/xanadu
>
> Please do not modify the code in the xanadu repo; the code in this repo is 
> copied from elsewhere.
> You may ask me to do the modification, though.
>
> By studying xinterp (and possibly raising questions here), you can 
> implement all kinds of tools
> for processing the syntax of ATS3: syntax-highlighting, pretty-printing, 
> error-messgage-reporting, etc.
>
> Have fun!
>
> --Hongwei
>
> --Hongwei
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/0e76353e-aeda-4bf3-a369-c79cfe45a4a0%40googlegroups.com.


Re: Are you interested in building tools for ATS3?

2019-12-16 Thread Richard
Now one can do,

git clone https://github.com/xanadu-lang/xinterp.git
cd xinterp
sh build.sh
./bin/xinterp -d TEST/kfact.dats

On Tuesday, December 17, 2019 at 1:45:26 AM UTC-5, Richard wrote:
>
> Opened a pr to add a simple (but convenient) build script 
> https://github.com/xanadu-lang/xinterp/pull/2/files
>
> On Tuesday, December 17, 2019 at 1:25:41 AM UTC-5, gmhwxi wrote:
>>
>> You were too fast :)
>>
>> Now it is ready. Please find a session attached to this message.
>> Basically, I did:
>>
>> cd /tmp
>> git clone https://github.com/xanadu-lang/xinterp.git
>> cd xinterp
>> git clone https://github.com/xanadu-lang/xanadu.git
>> make libxatsopt
>> make xinterp
>> ./bin/xinterp -d TEST/kfact.dats
>> ./bin/xinterp -d TEST/cbref.dats
>>
>> By the way, there is a lot of debugging info printed out when
>> you try xinterp. But I hope that interested parties can start to
>> contribute now...
>>
>>
>>
>> On Tuesday, December 17, 2019 at 12:19:44 AM UTC-5, Kiwamu Okabe wrote:
>>>
>>> Hi, 
>>>
>>> On Tue, Dec 17, 2019 at 1:05 PM gmhwxi <...> wrote: 
>>> > With that thought on my mind, I have just implemented a (naive) 
>>> interpreter for ATS3. Please find the code 
>>> > for this interpreter in the following repository: 
>>> > 
>>> > https://github.com/xanadu-lang/xinterp 
>>> > 
>>> > The basic idea is to structure xinterp as a project external to 
>>> ATS/Xanadu. 
>>> > 
>>> > After git-cloing xinterp, please also git-clone the following repo 
>>> inside the xinterp repo: 
>>> > 
>>> > https://github.com/xanadu-lang/xanadu 
>>>
>>> Umm... 
>>>
>>> ``` 
>>> $ pwd 
>>> /home/kiwamu/src/xinterp 
>>> $ ls ../xanadu/srcgen/xats/SATS 
>>> basics.sats   effect.sats   label0.sats   parsing.sats  statyp2.sats 
>>> t1xread.sats  trans23.sats 
>>> dynexp0.sats  filpath.sats  lexbuf.sats   staexp0.sats  symbol.sats 
>>> t2xread.sats  trans33.sats 
>>> dynexp1.sats  filsrch.sats  lexing.sats   staexp1.sats  symenv.sats 
>>> t3xread.sats  trans3t.sats 
>>> dynexp2.sats  fixity.sats   locinfo.sats  staexp2.sats  symmap.sats 
>>> trans01.sats  xerrory.sats 
>>> dynexp3.sats  global.sats   nmspace.sats  stamp0.sats   synread.sats 
>>> trans12.sats 
>>> $ make 
>>> /home/kiwamu/src/ATS-Postiats/bin/patsopt -o BUILD/intrep0_sats.c 
>>> --static SATS/intrep0.sats 
>>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1547(line=47, offs=1) -- 
>>> 1584(line=48, offs=29): error(1): the file 
>>> [./../xanadu/srcgen/xats/SATS/basics.sats] is not available for 
>>> staloading. 
>>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1588(line=50, offs=1) -- 
>>> 1625(line=51, offs=29): error(1): the file 
>>> [./../xanadu/srcgen/xats/SATS/label0.sats] is not available for 
>>> staloading. 
>>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1626(line=52, offs=1) -- 
>>> 1664(line=53, offs=30): error(1): the file 
>>> [./../xanadu/srcgen/xats/SATS/filpath.sats] is not available for 
>>> staloading. 
>>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1665(line=54, offs=1) -- 
>>> 1703(line=55, offs=30): error(1): the file 
>>> [./../xanadu/srcgen/xats/SATS/locinfo.sats] is not available for 
>>> staloading. 
>>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1730(line=59, offs=1) -- 
>>> 1773(line=60, offs=35): error(1): the file 
>>> [./../xanadu/srcgen/xats/SATS/lexing.sats] is not available for 
>>> staloading. 
>>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1800(line=64, offs=1) -- 
>>> 1844(line=65, offs=36): error(1): the file 
>>> [./../xanadu/srcgen/xats/SATS/dynexp1.sats] is not available for 
>>> staloading. 
>>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1848(line=67, offs=1) -- 
>>> 1892(line=68, offs=36): error(1): the file 
>>> [./../xanadu/srcgen/xats/SATS/staexp2.sats] is not available for 
>>> staloading. 
>>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1893(line=69, offs=1) -- 
>>> 1937(line=70, offs=36): error(1): the file 
>>> [./../xanadu/srcgen/xats/SATS/statyp2.sats] is not available for 
>>> staloading. 
>>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1938(line=71, offs=1) -- 
>>> 1982(line=72, offs=36): error(1): the file 
>>> [./../xanadu/srcgen/xats/SATS/dynexp2.sats] is not available for 
>>> staloading. 

Re: Are you interested in building tools for ATS3?

2019-12-16 Thread Richard
Opened a pr to add a simple (but convenient) build script 
https://github.com/xanadu-lang/xinterp/pull/2/files

On Tuesday, December 17, 2019 at 1:25:41 AM UTC-5, gmhwxi wrote:
>
> You were too fast :)
>
> Now it is ready. Please find a session attached to this message.
> Basically, I did:
>
> cd /tmp
> git clone https://github.com/xanadu-lang/xinterp.git
> cd xinterp
> git clone https://github.com/xanadu-lang/xanadu.git
> make libxatsopt
> make xinterp
> ./bin/xinterp -d TEST/kfact.dats
> ./bin/xinterp -d TEST/cbref.dats
>
> By the way, there is a lot of debugging info printed out when
> you try xinterp. But I hope that interested parties can start to
> contribute now...
>
>
>
> On Tuesday, December 17, 2019 at 12:19:44 AM UTC-5, Kiwamu Okabe wrote:
>>
>> Hi, 
>>
>> On Tue, Dec 17, 2019 at 1:05 PM gmhwxi <...> wrote: 
>> > With that thought on my mind, I have just implemented a (naive) 
>> interpreter for ATS3. Please find the code 
>> > for this interpreter in the following repository: 
>> > 
>> > https://github.com/xanadu-lang/xinterp 
>> > 
>> > The basic idea is to structure xinterp as a project external to 
>> ATS/Xanadu. 
>> > 
>> > After git-cloing xinterp, please also git-clone the following repo 
>> inside the xinterp repo: 
>> > 
>> > https://github.com/xanadu-lang/xanadu 
>>
>> Umm... 
>>
>> ``` 
>> $ pwd 
>> /home/kiwamu/src/xinterp 
>> $ ls ../xanadu/srcgen/xats/SATS 
>> basics.sats   effect.sats   label0.sats   parsing.sats  statyp2.sats 
>> t1xread.sats  trans23.sats 
>> dynexp0.sats  filpath.sats  lexbuf.sats   staexp0.sats  symbol.sats 
>> t2xread.sats  trans33.sats 
>> dynexp1.sats  filsrch.sats  lexing.sats   staexp1.sats  symenv.sats 
>> t3xread.sats  trans3t.sats 
>> dynexp2.sats  fixity.sats   locinfo.sats  staexp2.sats  symmap.sats 
>> trans01.sats  xerrory.sats 
>> dynexp3.sats  global.sats   nmspace.sats  stamp0.sats   synread.sats 
>> trans12.sats 
>> $ make 
>> /home/kiwamu/src/ATS-Postiats/bin/patsopt -o BUILD/intrep0_sats.c 
>> --static SATS/intrep0.sats 
>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1547(line=47, offs=1) -- 
>> 1584(line=48, offs=29): error(1): the file 
>> [./../xanadu/srcgen/xats/SATS/basics.sats] is not available for 
>> staloading. 
>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1588(line=50, offs=1) -- 
>> 1625(line=51, offs=29): error(1): the file 
>> [./../xanadu/srcgen/xats/SATS/label0.sats] is not available for 
>> staloading. 
>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1626(line=52, offs=1) -- 
>> 1664(line=53, offs=30): error(1): the file 
>> [./../xanadu/srcgen/xats/SATS/filpath.sats] is not available for 
>> staloading. 
>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1665(line=54, offs=1) -- 
>> 1703(line=55, offs=30): error(1): the file 
>> [./../xanadu/srcgen/xats/SATS/locinfo.sats] is not available for 
>> staloading. 
>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1730(line=59, offs=1) -- 
>> 1773(line=60, offs=35): error(1): the file 
>> [./../xanadu/srcgen/xats/SATS/lexing.sats] is not available for 
>> staloading. 
>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1800(line=64, offs=1) -- 
>> 1844(line=65, offs=36): error(1): the file 
>> [./../xanadu/srcgen/xats/SATS/dynexp1.sats] is not available for 
>> staloading. 
>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1848(line=67, offs=1) -- 
>> 1892(line=68, offs=36): error(1): the file 
>> [./../xanadu/srcgen/xats/SATS/staexp2.sats] is not available for 
>> staloading. 
>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1893(line=69, offs=1) -- 
>> 1937(line=70, offs=36): error(1): the file 
>> [./../xanadu/srcgen/xats/SATS/statyp2.sats] is not available for 
>> staloading. 
>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1938(line=71, offs=1) -- 
>> 1982(line=72, offs=36): error(1): the file 
>> [./../xanadu/srcgen/xats/SATS/dynexp2.sats] is not available for 
>> staloading. 
>> /home/kiwamu/src/xinterp/SATS/intrep0.sats: 1986(line=74, offs=1) -- 
>> 2030(line=75, offs=36): error(1): the file 
>> [./../xanadu/srcgen/xats/SATS/dynexp3.sats] is not available for 
>> staloading. 
>> patsopt(TRANS1): there are [10] errors in total. 
>> exit(ATS): uncaught exception: 
>> _2home_2kiwamu_2src_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
>>  
>>
>> make: *** [Makefile:72: BUILD/intrep0_sats.c] Error 1 
>> rm BUILD/intrep0_sats.c 
>> ``` 
>>
>> Best regards, 
>> -- 
>> Kiwamu Okabe at METASEPI DESIGN 
>>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/64bfbf1e-0ad6-4424-9d93-6837bd4724df%40googlegroups.com.


Re: A brief update on ATS3 implementation

2019-12-15 Thread Richard
Well done! Looking forward to the future progress.

On Sunday, December 15, 2019 at 9:08:21 PM UTC-5, gmhwxi wrote:
>
>  Hi, there,
>
> I would like to make a brief announcement, telling those in this group
> about some recent progress made in the implementation of ATS3. The
> project itself is publicly accessible at the following site:
>
> https://github.com/githwxi/ATS-Xanadu
>
> Note that you need to have ATS2 installed in order to compile ATS3.
>
> So far I have essentially finished the following parts, though changes and 
> fixes
> are definitely needed for a long time to come:
>
> Part 1: Concrete syntax design + Parsing
> Part 2: Binding resolution based on static scoping
> Part 3: Type-inference + supporting for symbol overloading
> Part 4: Type-based template code selection
>
> I have also implemented a basic interpreter for testing.
>
> Compiling ATS3 to C is scheduled in the next phase. After that. advanced 
> type-checking
> (for dependent types and linear types) needs to be supported.
>
> Before starting the next phase, I plan to write some documentation and 
> hope to get more
> people on board. More on that later.
>
> Cheers!
>
> --Hongwei
>
>
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/3d9d8819-bb08-4c42-bf8a-9ed85fa73c04%40googlegroups.com.


Re: Unit and Void types in ATS3

2019-12-11 Thread Richard
Though, this should compile correctly,

val unit = unit()
val tuple = (1, unit)
implement main0() = ()



On Wednesday, December 11, 2019 at 5:16:43 AM UTC-5, rodol wrote:
>
> So I was reading category theory, and it talked about initial object and 
> the terminal object. In haskell, () is the unit, so it was the first thing 
> I tried in ATS Postiats.
>
> val unit = ()
> implement main0 () = ()
>
> Awesome, that compiles. So I tried putting the unit in a tuple, just for 
> testing:
>
> val unit = ()
> val tuple = (1, unit)
> implement main0 () = ()
>
> It doesn't compile, saying
>
> error: field has incomplete type 'atsvoid_t0ype' (aka 'void')
>
> I searched a bit here, and found this had been talked about 
> .
>
> So the question is, since this is a limitation coming from C, will this be 
> able to change in ATS3 since it will use LLVM?
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/64ec1e39-90e0-4193-9574-253b02e61302%40googlegroups.com.


Read IO and Write IO

2019-08-08 Thread Richard
Wow. So simple yet powerfully insightful.

-- 
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 on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/a8fdbb40-e474-4f8b-9e04-f99af28e49c2%40googlegroups.com.


Re: Issue with call-by-reference and template dispatch

2019-06-26 Thread Richard
On Tuesday, June 25, 2019 at 9:47:50 AM UTC-4, M88 wrote:
> I noticed this a while ago in ATS2 (just verified in Temptory).
> 
> 
> 
> It seems that call-by-reference functions in record definitions cause issues 
> with template dispatch.
> 

>From what I can tell after some testing, a type defined as a function with 
>call-by-reference seems to cause the same issue (even outside records). 

> 
> The following will fail to compile ( no match for `do_something` ) -- 
> changing  the signature of `foo.f` to `(int) -> void` will compile 
> successfully.
> 
> 
> 
> 
> 
> 
> #include "share/HATS/temptory_staload_bucs320.hats"
> 
> typedef foo = @{
>   f = () -> void
> }
> 
> extern
> fun {a:vtflt} do_something( a ) : void
> 
> impltmp
> do_something( x ) =
>   let
>      var z : int = 0
>    in x.f(z)
>    end
> 
> implfun main0() 
>    = println!("Hello [test0]") 
>    where {
>      var ff : foo = (@{
>           f = lam(x) => println!(x)
>         }): foo
> 
>      val () = do_something(ff)
>    }
> 
> 
> 
> 
> I've been using abstract types / casting as a work-around.

Could you share how you use abstract type / casting in this example to get it 
to work?

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/207d0d55-77dd-4e98-a583-34fff33ab8f7%40googlegroups.com.


Re: Issue with call-by-reference and template dispatch

2019-06-25 Thread Richard
Though I see what you might be getting at. There is a difference between 
implementing a template 'forall' vs for a particular type 
On Tuesday, June 25, 2019 at 6:27:40 PM UTC-4, Richard wrote:
>
>
>
> On Tuesday, June 25, 2019 at 9:47:50 AM UTC-4, M88 wrote:
>>
>> I noticed this a while ago in ATS2 (just verified in Temptory).
>>
>
> Just out of curiosity, did you build Temptory from the releases or from 
> scratch?
>  
>
>>
>> It seems that call-by-reference functions in record definitions cause 
>> issues with template dispatch.
>>
>> The following will fail to compile ( no match for `do_something` ) -- 
>> changing  the signature of `foo.f` to `(int) -> void` will compile 
>> successfully.
>>
>>
> Edited below:
> The main difference is annotating the argument 'a' and removing the 
> template  and replacing with impltmp{a} instead.
>  
>
>>
>> #include "share/HATS/temptory_staload_bucs320.hats"
>>
>> typedef foo = @{
>>   f = () -> void
>> }
>>
>> extern
>> fun {a:vtflt} do_something( a:foo ) : void
>>
>> impltmp{a}
>> do_something( x ) =
>>   let
>>  var z : int = 0
>>in x.f(z)
>>end
>>
>> implfun main0() 
>>= println!("Hello [test0]") 
>>where {
>>  var ff : foo = (@{
>>   f = lam(x) => println!(x)
>> }): foo
>>
>>  val () = do_something(ff)
>>}
>>
>>
>>
>>
>> I've been using abstract types / casting as a work-around. 
>>
>

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/1fd59896-794d-4756-8faf-2ee28121a39f%40googlegroups.com.


Re: Issue with call-by-reference and template dispatch

2019-06-25 Thread Richard


On Tuesday, June 25, 2019 at 9:47:50 AM UTC-4, M88 wrote:
>
> I noticed this a while ago in ATS2 (just verified in Temptory).
>

Just out of curiosity, did you build Temptory from the releases or from 
scratch?
 

>
> It seems that call-by-reference functions in record definitions cause 
> issues with template dispatch.
>
> The following will fail to compile ( no match for `do_something` ) -- 
> changing  the signature of `foo.f` to `(int) -> void` will compile 
> successfully.
>
>
Edited below:
The main difference is annotating the argument 'a' and removing the 
template  and replacing with impltmp{a} instead.
 

>
> #include "share/HATS/temptory_staload_bucs320.hats"
>
> typedef foo = @{
>   f = () -> void
> }
>
> extern
> fun {a:vtflt} do_something( a:foo ) : void
>
> impltmp{a}
> do_something( x ) =
>   let
>  var z : int = 0
>in x.f(z)
>end
>
> implfun main0() 
>= println!("Hello [test0]") 
>where {
>  var ff : foo = (@{
>   f = lam(x) => println!(x)
> }): foo
>
>  val () = do_something(ff)
>}
>
>
>
>
> I've been using abstract types / casting as a work-around. 
>

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/99c99079-bd7a-4f86-86af-8e03c90a54fb%40googlegroups.com.


Re: Linear types + Exceptions

2019-06-20 Thread Richard
On Thursday, June 20, 2019 at 7:38:57 PM UTC-4, Raoul Duke wrote:
> Worthy of being a faq type entry? High level question would be, under 
> what-all conditions do we hit such potential leaks?

When the linear resource is not freed before calling 'exit', unhandled 
exceptions, and unsafe casts.

>From what I understand exit is akin to a backdoor. It inherits the return 
>value of an expression. In other words, exit can be any type. I assume that 
>unhandled exceptions are treated similarly. 

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/a1bf2975-a0d6-40dc-8436-354d921fed72%40googlegroups.com.


Re: Linear types + Exceptions

2019-06-20 Thread Richard
Did you use the flag, -D_GNU_SOURCE ?

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/c9e1ad94-7a43-4401-ba94-37ab1ddf71f7%40googlegroups.com.


Linear types + Exceptions

2019-06-20 Thread Richard
Hello Aditya,

I know this is not identical but checkout this example,
https://github.com/githwxi/atslangweb/blob/master/ats2-lang/doc/EXAMPLE/INTRO/sieve_llazy.dats#L53

The tilde tells the compiler to free the empty stream in this example.

Is this similar to what you have in mind?

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/44bc2f75-f5b4-4610-98f1-55f3e5da4a6d%40googlegroups.com.


Re: refinement subset?

2019-06-20 Thread Richard
Hey Raoul,

Do you have a particular example in mind?

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/af66f071-f948-445e-a2a2-c7327105f577%40googlegroups.com.


Re: Published Article on ATS

2019-06-18 Thread Richard
Nice! I particularly appreciate the points about Improving Correctness!!

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/c6015e3a-abed-4bc4-8897-48e70db25c15%40googlegroups.com.


Re: Published Article on ATS

2019-06-17 Thread Richard
Nice work! This inspired me to write a post about the need for programming 
languages like Temptory. It is not very comprehensive. Just a short rant... 

https://medium.com/@qpotizo/temptory-9b613a5cf152

On Monday, June 17, 2019 at 8:10:39 PM UTC-4, gmhwxi wrote:
>
>
> Great! Forwarding it to the ats-lang-users group.
>
> -- Forwarded message -
> From: Ruiz Gutierrez, Nataniel <...>
> Date: Mon, Jun 17, 2019 at 4:56 PM
> Subject: Published Article on ATS
>
> Hi Hongwei,
>
> I thought you would be interested in this recent development. My article 
> on K-Medoids using ATS has been published on Towards Data Science. They had 
> asked me if they could publish it and I agreed. This will attract many 
> views to the article.
>
> You can find it here: 
> https://towardsdatascience.com/k-medoids-clustering-using-ats-unleashing-the-power-of-templates-56cd7ab944bf
>
> Cheers!
>
> Nataniel 
>

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/0dbbf462-b376-4967-a26f-2a50e641da2c%40googlegroups.com.


Re: Temptory Docs Website

2019-06-03 Thread Richard
On Monday, June 3, 2019 at 1:20:09 PM UTC-4, gmhwxi wrote:
> Thanks for the effort!
> 
> 
> I just created 'mytempacc', which is a wrap around 'tempacc'.
> It infers some flags based on the command-line. For instance,
> 
> 
> mytempacc foo.dats // generate a.out
> mytempacc -o foo foo.dats // generate foo
> mytempacc foo1.dats foo2.dats -lgc // generate a.out with gc
> mytempacc -dry ... // just generate the

Perfect. Working on adding this now

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/8d721d52-e57d-415c-bb7c-dbfc32bbbe1e%40googlegroups.com.


Re: Temptory Docs Website

2019-06-03 Thread Richard
Of course!

Currently, I am working on a way for others to contribute content. In the 
meantime, anyone is welcome to suggest edits or ideas!

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/82b55254-9b1d-4418-9edb-9db2a01a2195%40googlegroups.com.


Temptory Docs Website

2019-06-02 Thread Richard
Hello all,

Just a sneak peak of something I have been working on for documenting 
ATS-Temptory.

https://sparverius.github.io/tmplats-doc/

- Richard

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/6a68507a-bb2e-4e80-a560-089c3d6bf81e%40googlegroups.com.


Re: Consume all linear props of a given form in the environment?

2019-06-01 Thread Richard

On Saturday, June 1, 2019 at 2:26:33 AM UTC-4, Shimin Guo wrote:
>
> Thanks for your reply and kind words. I think I got it.
>
> Basically to prove the existence of dir1/dir2 we must first prove the 
> existence of dir1, and `rm -r dir1` will destroy that proof.
>
> I've long been thinking about how to improve something like ansible, and 
> recently had this idea, and thought it might actually work. I have no clue 
> how to actually implement it though. I hope someone much smarter than I can 
> make it happen :)
>

Sure you could do it, you already have a perspective of what you would like 
to improve. By that, you have already accomplished half the battle! 

For such an idea, linear viewtypes in ATS are a great start on your 
journey. I would encourage you to learn more about them. Here is a good 
place to start 
http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/HTMLTOC/p3319.html. 
Programming with linear viewtypes is definitely one of (if not the most) 
advanced features in ATS however, once you get some understanding you will 
find that programming with viewtypes is quite intuitive. 

Best, 
Richard

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/2cc575cc-4257-4db6-ae81-c49e4de403b0%40googlegroups.com.


Re: Unexpected/confusing behavior

2019-06-01 Thread Richard
Hello Srdjan,

On Saturday, June 1, 2019 at 1:12:35 AM UTC-4, Srdjan Mitrovic wrote:
>
> Hi! First time using both google groups and ATS, so forgive me if this is 
> a really dumb question or the wrong spot but this seems like the best place 
> to get in contact with other ATS people :p
>


Glad you found the right place and all questions are always welcome!

 

> I'm working through the intro to programming in ATS book, and in this 
> section 
>  it 
> says that you should denote functions which use a value not at the top 
> level nor in the function arguments with .
>


Perhaps things have changed a bit since the time the book was written or 
the example given is potentially misleading. 
I tested the code and looked over the C output and although the function 
(without closure annotation) still requires enivromental variables from the 
outside (i.e. n), a closure is not created.
 

In the next section on higher order functions, there's a function which is 
> supposed to find the first natural number root of a given polynomial. The 
> example given looks like this:
>
> fun rtfind
>   (f: int -> int): int = let
>   fun loop (
> f: int -> int, n: int
>   ) : int =
> if f(n) = 0 then n else loop (f, n+1)
>   // end of [loop]
> in
>   loop (f, 0)
> end // end of [rtfind]
>
> I was a little curious, so I removed `f` from the inner `loop` function 
> and re-compiled, curious to see if I would get an error for having not 
> included 
>
>
> fun rtfind
>   (f: int -> int): int = let
>   fun loop (
> n: int
>   ) :(*  *) int =
> if f(n) = 0 then n else loop (n+1)
> in
>   loop (0)
> end
>
> As it is, this works fine, but what I found more surprising was that 
> uncommenting  results in this:
>
> [image: cloref1.png]
>
>
>
>
>
> am I missing something here? I have atspre_staload.hats included in my 
> file fwiw
>

When annotating the function with : means that the function is a 
closure and so the compiler needs to allocate memory for creating this 
environment. 
This is why the error (which in this case is a warning from the 
linker/loader) states that there is an undefined reference to 
'atsruntime_malloc_undef'. 
Basically you just need to add a compiler flag (-DATS_MEMALLOC_LIBC)

the full command would be,
patscc -DATS_MEMALLOC_LIBC -o hofs hofs.dats

Hope that helps!

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/0776c0a4-2dc9-441f-ab93-dd6a2e7cc2ab%40googlegroups.com.


Re: Consume all linear props of a given form in the environment?

2019-05-31 Thread Richard
Apologies, forgot to say hello,

Hi Shimin, this is a great question. I like your thinking!

On Friday, May 31, 2019 at 7:33:37 PM UTC-4, Shimin Guo wrote:
>
> I'm thinking of using linear types for system administration. 
> Specifically, I want to add type annotations to commands like mkdir, rm, 
> etc., so I can reason about the state of the system after they are executed.
>
> For example, mkdir will have the type
>
> p: path -> isdir(p)
>
> where isdir(x) is a linear prop. rmdir will consume that prop.
>
> What I'm currently stuck on is the following scenario:
>
> touch a/b/c
> rm -r a
>
> After the touch, there should be a linear prop exists(a/b/c), and after 
> the rm, the linear prop needs to be consumed. My question is, what should 
> the type signature for "rm -r " be? It seems it needs to consume all 
> the linear props in the "environment" in the form of exists(p) where p is 
> under . Is there a way to represent such a signature in a language 
> like ATS?
>

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/2157ce50-566b-4a17-8b4c-873a43ec1d2d%40googlegroups.com.


Re: Consume all linear props of a given form in the environment?

2019-05-31 Thread Richard


On Friday, May 31, 2019 at 7:33:37 PM UTC-4, Shimin Guo wrote:
>
> I'm thinking of using linear types for system administration. 
> Specifically, I want to add type annotations to commands like mkdir, rm, 
> etc., so I can reason about the state of the system after they are executed.
>
> For example, mkdir will have the type
>
> p: path -> isdir(p)
>
> where isdir(x) is a linear prop. rmdir will consume that prop.
>
> What I'm currently stuck on is the following scenario:
>
> touch a/b/c
>

Here you mean "mkdir -p a/b/c" correct? 
 

> rm -r a
>
> After the touch, there should be a linear prop exists(a/b/c), and after 
> the rm, the linear prop needs to be consumed. My question is, what should 
> the type signature for "rm -r " be? It seems it needs to consume all 
> the linear props in the "environment" in the form of exists(p) where p is 
> under . Is there a way to represent such a signature in a language 
> like ATS?
>

One way could be to model directory operations within ats... 
Just a quick (naive) idea...

#include "share/HATS/temptory_staload_bucs320.hats"

// Here 'Dir' is a (linear) datatype or 
// data-view-type as they call it in ats
// it is defined using mutual recursion to allow
// rmdir to work properly (as in only work for empty dirs)
// rmdir_dir should probably be named rm_r

datavtype Dir =
  | empty of Empty
  | dir of (string, subdirs)

  and Empty = empty_dir of (string)
where subdirs = list_vt(Dir)


extern fun mkdir_empty : string -> Empty
extern fun mkdir_dir : (string, subdirs) -> Dir

extern fun rmdir_empty : Empty -> void
extern fun rmdir_dir : Dir -> void

implfun mkdir_empty(path) = empty_dir(path)

implfun rmdir_empty(dir) =
  case+ dir of
| ~empty_dir(_) => ()

implfun mkdir_dir(path, opt_dirs) = dir(path, opt_dirs)

implfun rmdir_dir(dirp) =
  case+ dirp of
| ~empty(x) => (rmdir_empty(x))
| ~dir(_, subdirs) => (list0_vt_foreach0(subdirs)) where
{
  impltmp
  list0_vt_foreach0$work(x) = rmdir_dir(x)
}

#symload mkdir with mkdir_empty
#symload mkdir with mkdir_dir
#symload rmdir with rmdir_empty
#symload rmdir with rmdir_dir



#define :: list0_vt_cons
#define nil list0_vt_nil

implfun main0() =
{
  val xs = mkdir("hey")
  val () = rmdir(xs)

  val xs = mkdir("empty0")
  val ys = mkdir("empty1")

  val zs = mkdir("full0", empty(xs)::empty(ys)::nil())
  // if we do not free our linear datatype 'Dir' as
  // seen below, the typechecker will warn us that 
  // zs needs to be consumed.
  // val () = rmdir(zs)
}

 

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/73a0eddd-afe7-413b-9c6d-699d5a6c4087%40googlegroups.com.


Re: Idea for new logo

2019-05-30 Thread Richard
On Thursday, May 30, 2019 at 2:23:37 PM UTC-4, gmhwxi wrote:
> A bit of explanation on the design?

It is based off the original logo with added expression of motion. This one 
also attempts to use white space to illuminate the letters a t s of the blue 
shape in the original logo. 

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/d31ced68-625d-489d-8e71-7ac37692de31%40googlegroups.com.


Idea for new logo

2019-05-30 Thread Richard
https://raw.githubusercontent.com/sparverius/ats-logo/master/ats.png

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/a27e44d7-be10-4134-9e68-f4605106c2b9%40googlegroups.com.


Re: Effectless ffi

2019-05-29 Thread Richard


On Wednesday, May 29, 2019 at 9:54:57 PM UTC-4, Brandon Barker wrote:
>
> Hi Richard - thanks for the instructive examples; I clarified a related 
> point on the wiki. 
>
>
> On Wednesday, May 29, 2019 at 9:12:07 PM UTC-4, Richard wrote:
>>
>>
>> #include "share/atspre_staload.hats"
>>
>> implement main0() = ()
>>
>> // If I am not mistaken, all functions in ats have all effects (i.e. 
>> :<1>) by default.
>> // note, :<0> is equivalent to :<>
>>
>> // Just some thoughts
>>
>> fun terminating .<>. (n: int):<> int = n * n
>>
>> //
>> // Here we require to provide proof that the function terminates
>> // so, we just insist that it does (.<>.)
>> //
>> // Well it does not seem to be a very effectful function so sure
>> // though, what is the significance of purity in this case?
>> //
>> // Effects tracking in ats is not exactly a contract
>> // For example,
>>
>> val terminate = terminating(0xb505)
>>
>> //
>> // This typechecks fine however, do you notice something strange about 
>> the resulting value?
>> // Passing a value larger than the square root of INTMAX causes 
>> arithmetic overflow...
>> //
>> // In this case, what good is a function annotated as pure if it can 
>> produce arithmetic overflow?
>> //
>> // Let us look at a different example, lets use dependent types to flush 
>> out this potential bug...
>> //
>>
>> stadef IMAX = 2147483647
>>
>> fun dependent {n:int | n*n <= IMAX} (n: int(n)): int(n*n) = n*n
>>
>> // 'depend' below fails typechecking,
>> // unsolved constraint:
>> // (46341 * 46341) <= IMAX
>> val depend = dependent(0xb505)
>>
>>
>> // however this typechecks,
>> val depend = dependent(0xb504)
>>
>>
>>
>>
>> On Wednesday, May 29, 2019 at 1:14:19 PM UTC-4, Brandon Barker wrote:
>>>
>>> Hi Guys,  Thanks for the discussion.
>>>
>>> As usual I don't fully understand or recall some of the relevant issues.
>>>
>>> In the online editor I quickly tried out this:
>>>
>>> fun double (n: int) :<1> int = n + n
>>>
>>> val () = println! ("double(5) = ", double(5))
>>>
>>>
>>> Which works. But changing :<1> to :<0> fails to compile; i also tried a 
>>> non-polymorphic identity function for ints and had the same result. So what 
>>> does :<0> really mean?
>>>
>>> I think if we had (1), a way to keep track of purity, i.e., any 
>>> expressions returning unit must be equivalent to the expression () 
>>> (hopefully this isn't hard to check..), and (2), a way to tell the compiler 
>>> to assume that ":" assumes :<0> by default, then we might just get purity 
>>> checking done for free.
>>>
>>
>> I think that requiring all functions to be pure in the current 
>> implementation of ats2 would produce an environment that would greatly 
>> decrease programming productivity :)
>>  
>>
>
> I agree, that in its current definition, "pure" is actually stronger than 
> what I had in mind. I think letting the programmer choose the default 
> effect type of functions could be useful when executing a build (though it 
> would also have to take this into account, ideally, when linking with other 
> ATS libraries).  
>
> I was going to see if I could get what I wanted, starting by doing this, 
> and playing around with eliminating effects that don't jive with my notion 
> of "sort of pure" ;-):
>
> implement
> main0 () = {
>  val () = println! ("double(5) = ", double(5))
> }
>
> fun double .<>. (n: int) :<0> int = (
>   // print 'h';
>   n + n
> )
>
>
>
>  Unfortunately, this resulted in an error that I don't have time to dive 
> into tonight (was using version 0.3.11 out of convenience). Online, it 
> works (see attached image). However, if I uncomment the print 'h' line, it 
> fails, but i can't see the error online.
>

When un-commenting 
// print 'h';  
the typechecker issues a warning stating that 
some disallowed effects may be incurred: 1
This is expected behavior as the function signature states that it is pure 
(:<0>)

To further illustrate the difficulty in relying on effects, one can just as 
easily silence the compiler with one of the "ats-swiss-army-knives",
fun double .<>. (n: int):<> int =
(
  $effmask{1}(print 'h');
  n + n
)

Here, we just tell the compiler "look, just ignore this one" :)

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/94f30ac7-5f51-44f2-a490-1b4e93093fc9%40googlegroups.com.


Re: Effectless ffi

2019-05-29 Thread Richard

#include "share/atspre_staload.hats"

implement main0() = ()

// If I am not mistaken, all functions in ats have all effects (i.e. :<1>) 
by default.
// note, :<0> is equivalent to :<>

// Just some thoughts

fun terminating .<>. (n: int):<> int = n * n

//
// Here we require to provide proof that the function terminates
// so, we just insist that it does (.<>.)
//
// Well it does not seem to be a very effectful function so sure
// though, what is the significance of purity in this case?
//
// Effects tracking in ats is not exactly a contract
// For example,

val terminate = terminating(0xb505)

//
// This typechecks fine however, do you notice something strange about the 
resulting value?
// Passing a value larger than the square root of INTMAX causes arithmetic 
overflow...
//
// In this case, what good is a function annotated as pure if it can 
produce arithmetic overflow?
//
// Let us look at a different example, lets use dependent types to flush 
out this potential bug...
//

stadef IMAX = 2147483647

fun dependent {n:int | n*n <= IMAX} (n: int(n)): int(n*n) = n*n

// 'depend' below fails typechecking,
// unsolved constraint:
// (46341 * 46341) <= IMAX
val depend = dependent(0xb505)


// however this typechecks,
val depend = dependent(0xb504)




On Wednesday, May 29, 2019 at 1:14:19 PM UTC-4, Brandon Barker wrote:
>
> Hi Guys,  Thanks for the discussion.
>
> As usual I don't fully understand or recall some of the relevant issues.
>
> In the online editor I quickly tried out this:
>
> fun double (n: int) :<1> int = n + n
>
> val () = println! ("double(5) = ", double(5))
>
>
> Which works. But changing :<1> to :<0> fails to compile; i also tried a 
> non-polymorphic identity function for ints and had the same result. So what 
> does :<0> really mean?
>
> I think if we had (1), a way to keep track of purity, i.e., any 
> expressions returning unit must be equivalent to the expression () 
> (hopefully this isn't hard to check..), and (2), a way to tell the compiler 
> to assume that ":" assumes :<0> by default, then we might just get purity 
> checking done for free.
>

I think that requiring all functions to be pure in the current 
implementation of ats2 would produce an environment that would greatly 
decrease programming productivity :)
 

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/dff8a79d-1a11-471b-9ae8-10d3b54fc20f%40googlegroups.com.


Re: ATS-Temptory

2019-05-29 Thread Richard
On Wednesday, May 29, 2019 at 2:14:57 AM UTC-4, Kiwamu Okabe wrote:
> What's `val-tt`?
> -- 
> Kiwamu Okabe

Assert that the value is true. 

For the definition of tt, see 
https://github.com/githwxi/ATS-Temptory/blob/master/libats/basics_pre.sats#L66

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/c9a1f8b3-2bae-45f9-98ba-cb6326895fd1%40googlegroups.com.


Re: libatscc: packaging

2019-05-06 Thread Richard
Sounds like a good idea to me!

On Monday, April 1, 2019 at 6:46:44 AM UTC-4, Artyom Shalkhakov wrote:
>
> Hi all,
>
> I've started work on improving atscc2js yesterday and found that we have 
> three similar projects:
>
>1. https://github.com/steinwaywhw/ATS-Python3
>2. https://github.com/bakpakin/ats-lua
>3. https://github.com/sazl/ats-go
>4. and the in-progress atscc2js
>
> Every target programming language comes with its own "prelude" (e.g. 
> libatscc2js for JS), but such preludes essentially implement the interfaces 
> defined in libatscc.
>
> Now I'm thinking that we need to package up the interface and keep it as 
> uniform as possible across the different targets, so that programmers may 
> hopefully share more code between platforms with little issues (or no issue 
> at all).
>
> With the above in mind, I propose to:
>
>1. package up libatscc somehow, e.g. put it on NPM (I'm working on 
>this, it will require only minimal changes to the existing code)
>2. come up with some process to maintain this 'specification' (maybe 
>create a github organization and put this library into a repository; let 
>people use issues and PRs to propose changes)
>
> Is anybody interested? If not I'll just go with the first point, and the 
> specification will live on in the ATS-Postiats repository (for now).
>

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/7e30cb96-4956-4ca7-af48-f0ad49726b3c%40googlegroups.com.


Re: Effectless ffi

2019-05-06 Thread Richard
Oops, did not see you responded Artyom!

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/10e6f90a-fb2f-42e7-81d1-6032a798f107%40googlegroups.com.


Re: Effectless ffi

2019-05-06 Thread Richard

>
>
> I do understand, that this is due to goal to make transition from C to ATS 
> to be less painful, but maybe, there should be some flag (like -XSafe for 
> ghc, or maybe -Wall -Werror), which will treat effectless ffi calls to be 
> compile time errors?
>

Annotating a function definition with effects can be seen as a 
programmer-centric way to provide the typechecker with extra information 
about a functions apparent purity, most often seen in combination with 
proof functions. Also, effects-tracking is most useful when the 
characteristic behavior of a function is known to the programmer.

And one more generic question: I haven't got if user can introduce new 
> custom effects or are they just a predefined set of effects? Are there any 
> docs about such topics in ATS?
>

Only builtin effects are currently supported. Here is some information on 
the builtin effects, https://github.com/githwxi/ATS-Postiats/wiki/effects
 

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/6644ffad-e2dd-4915-abc6-7491d40ccb45%40googlegroups.com.


Re: Writing a lock-free, threadsafe stack (or queue)

2019-03-01 Thread Richard
At first glance, making the functions polymorphic (as opposed to templates) 
could be a potential reason for segmentation faults (see 
https://github.com/githwxi/ATS-Postiats/issues/216). Though mixing dependent 
types and templates together has also been known to cause issues (see 
https://groups.google.com/d/msgid/ats-lang-users/c7885759-c97b-482e-a9a8-313152cc1e6b%40googlegroups.com?utm_medium=email_source=footer)

On Thursday, February 28, 2019 at 12:10:50 PM UTC-5, Vanessa McHale wrote:
> Hi all,
> 
> I've been trying to implement a lock-free stack here:
>   https://github.com/vmchale/stack. Unfortunately, this is not
>   something I'm particularly familiar with, and it segfaults around
>   70% of the time I try to actually do anything with it.
> 
>   
> 
>   Here is the static bit:
> 
>   
> 
>   %{#
> 
>   #include 
> 
>   %}
> 
>   
> 
>   typedef aptr(l: addr) = $extype "_Atomic void**"
> 
>   
> 
>   datavtype pointer_t(a: vt@ype) =
> 
>     | pointer_t of node_t(a)
> 
>     | none_t
> 
>   and node_t(a: vt@ype) =
> 
>     | node_t of @{ value = [ l : addr | l > null ] (a @
> l | aptr(l))
> 
>      , next = pointer_t(a)
> 
>      }
> 
>   
> 
>   vtypedef stack_t(a: vt@ype) = @{ stack_head =
> pointer_t(a) }
> 
>   
> 
>   castfn release_stack {a:vt@ype} (stack_t(a)) : void
> 
>   
> 
>   fun new {a:vt@ype} (_t(a)? >> stack_t(a))
> : void
> 
>   
> 
>   fun {a:vt@ype} push (_t(a) >> stack_t(a),
> a) : void
> 
>   
> 
>   fun {a:vt@ype} pop (_t(a) >> _) :
> Option_vt(a)
> 
>   
> 
>   fun newm {a:vt@ype} () : stack_t(a)
> 
>   
> 
>   fn atomic_store {a:vt@ype}{ l : addr | l > null }(a? @
> l | aptr(l), a) : (a @ l | void) =
> 
>     "mac#"
> 
>   
> 
>   fn atomic_load {a:vt@ype}{ l : addr | l > null }(a @ l
> | aptr(l)) : a =
> 
>     "mac#"
> 
>   
> 
>   fn leaky_malloc {a:vt@ype}{ sz : int | sz == sizeof(a)
> }(sz : size_t(sz)) :
> 
>     [ l : addr | l > null ] (a? @ l | aptr(l)) =
> 
>     "mac#malloc"
> 
>   
> 
>   And here is the implementation:
> 
>   
> 
>   staload "SATS/stack.sats"
> 
>   
> 
>   implement new (st) =
> 
>     st.stack_head := none_t
> 
>   
> 
>   implement {a} push (st, x) =
> 
>     let
> 
>       val (pf_pre | ptr) = leaky_malloc(sizeof)
> 
>       val (pf | ()) = atomic_store(pf_pre | ptr, x)
> 
>       val next_node = node_t(@{ value = (pf | ptr), next =
> st.stack_head })
> 
>       val () = st.stack_head := pointer_t(next_node)
> 
>     in end
> 
>   
> 
>   implement {a} pop (st) =
> 
>     case+ st.stack_head of
> 
>       | ~pointer_t (~node_t (nd)) => 
> 
>     begin
> 
>       let
> 
>     val (pf | aptr) = nd.value
> 
>     val x = atomic_load(pf | aptr)
> 
>     val () = st.stack_head := nd.next
> 
>       in
> 
>     Some_vt(x)
> 
>       end
> 
>     end
> 
>       | none_t() => None_vt()
> 
>   
> 
> 
> 
> It's based on the Michael-Scott paper
>   http://www.cs.rochester.edu/~scott/papers/1996_PODC_queues.pdf,
>   but I worry about the frees in the pattern match (of ~node_t
>   and ~pointer_t), and in fact this does segfault when I
>   try to use it for parallel directory traversal.
> 
>   
> 
>   Cheers,
> 
>   Vanessa McHale

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/159f0461-8890-4dfe-9490-c31bb322d859%40googlegroups.com.


Re: Need help understanding free@

2019-02-10 Thread Richard
In the provided example, why is it that we can replace zero with any 
natural number?

...
free@{a}{123456(*insert random nat here*)}(xs);...
...

(typechecks and compiles with no issues...)


On Sunday, February 10, 2019 at 8:43:22 PM UTC-5, gmhwxi wrote:
>
>
> A list node contains two cells: one holding the content and the other 
> holding
> the pointer to the next node (or null).
>
> When xs matches the pattern @list_vt_cons(x, xs1), xs refers to a list 
> node;
> x refers to the content cell and xs1 refers to the pointer cell. In this 
> case, the
> content is non-linear (a:t@ype) and thus does not need to be moved out. But
> the pointer needs to be moved out before xs can be freed:
>
> val xs1_ = xs
>
> The above code was written long time ago. It could be prettified a bit as 
> follows:
>
> fun
> {a:t@ype}
> list_vt_free
>   {n:nat} ..
>   (xs: list_vt(a, n)): void =
> (
>   case+ xs of
>   | ~list_vt_nil() => ()
>   | @list_vt_cons(_, xs1) =>
> let
>   val xs1 = xs1
> in
>   free@{a}{0}(xs); list_vt_free(xs1)
> end
> )
>
> People are often puzzled by a beautiful line like 'val xs1 = xs1' :)
>
> On Sunday, February 10, 2019 at 6:17:03 PM UTC-5, rnagasam wrote:
>>
>> Hi all,
>>
>> I'm facing some difficulty understanding how `free@' is used. I'm going 
>> through the *Introduction to Programming in ATS* book, and the example 
>> I'm facing trouble with is this,
>>
>> fun{
>> a:t@ype
>> } list_vt_free
>>   {n:nat}.. (xs: list_vt (a, n)): void =
>>   case+ xs of
>>   | @list_vt_cons(x, xs1) => let
>>   val xs1_ = xs1
>>   val () = free@{a}{0}(xs) in list_vt_free (xs1_)
>>   end
>>   | @list_vt_nil () => free@{a} (xs)
>>
>> Why is it `free@{a}{0} (xs)' and not `free@{a}{0} (x)'? It seems that 
>> `free@' requires an unfolded constructor (here, it is operating on 
>> `list_vt_cons_unfold'). However, that begs the question -- how does `free@' 
>> know to free only the first node of the list and not the rest of the list? 
>> Any help understanding this will be much appreciated!
>>
>> Thanks,
>> Ramana
>>
>

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/6495082c-d729-4027-8189-592346f21f4f%40googlegroups.com.


Re: Need help understanding free@

2019-02-10 Thread Richard
If I remember correctly the node that is freed is based on the second static 
argument provided ( in this case,  the 0 in ‘free@{a}{0}(xs)’ )

On Sunday, February 10, 2019 at 6:17:03 PM UTC-5, rnag...@stevens.edu wrote:
> Hi all,
> 
> 
> I'm facing some difficulty understanding how `free@' is used. I'm going 
> through the Introduction to Programming in ATS book, and the example I'm 
> facing trouble with is this,
> 
> 
> 
> 
> fun{
> a:t@ype
> } list_vt_free
>   {n:nat}.. (xs: list_vt (a, n)): void =
>   case+ xs of
>   | @list_vt_cons(x, xs1) => let
>       val xs1_ = xs1
>       val () = free@{a}{0}(xs) in list_vt_free (xs1_)
>       end
>   | @list_vt_nil () => free@{a} (xs)
> Why is it `free@{a}{0} (xs)' and not `free@{a}{0} (x)'? It seems that `free@' 
> requires an unfolded constructor (here, it is operating on 
> `list_vt_cons_unfold'). However, that begs the question -- how does `free@' 
> know to free only the first node of the list and not the rest of the list? 
> Any help understanding this will be much appreciated!
> 
> 
> Thanks,
> Ramana

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/7ad6f308-def1-48e1-87aa-22c352f932d6%40googlegroups.com.


Re: Merging stream_vt

2019-01-02 Thread Richard
Yes, this compiles and runs as expected. Although, I am not sure that I 
have ever used 'stream_vt_con_free'. A slightly different way to do the 
same without using stream_vt_con_free,



#include "share/atspre_staload.hats"

extern fun {a:t@ype}{b:t@ype} 
  merge : (stream_vt a, stream_vt b) -> stream_vt(@(a,b))

implement{a}{b} merge (xs, ys) = let
fun
auxmain (xs: stream_vt a, ys: stream_vt b) : stream_vt(@(a,b)) = $ldelay
(
(
  case+ !xs of 
  | ~stream_vt_nil() => (~ys; stream_vt_nil())
  | ~stream_vt_cons(x, xs) => 
case+ !ys of 
| ~stream_vt_nil() => (~xs; stream_vt_nil())
| ~stream_vt_cons(y, ys) => 
  stream_vt_cons(@(x, y), auxmain(xs, ys))
) ,
(
  ~xs; ~ys
)
)
in
  auxmain(xs, ys)
end




To test,

implement main0() = 
{
  val xs = streamize_list_vt_elt($list_vt{int}(1, 2))
  val ys = streamize_list_vt_elt($list_vt{string}("x", "y"))

  val zs = merge (xs, ys)
 
  val l = stream2list_vt (zs)
  val () = println!(l) // should print something like: 1,x; 2,y

  val () = list_vt_free(l)
}




On Wednesday, January 2, 2019 at 3:00:17 AM UTC-5, Artyom Shalkhakov wrote:
>
> ср, 2 янв. 2019 г. в 09:41, aditya siram  >:
>
>> Awesome. That does typecheck but when I try to build it with:
>>
>> "$PATSHOME/bin/patscc" -O3 -flto -s -D_GNU_SOURCE -DATS_MEMALLOC_LIBC -I$
>> {PATSHOME}/contrib -O3 -o triples triples.dats -latslib
>>
>>
>>
> I don't have a compiler with me here but it seems like the function should 
> be made into a template (i.e. the type parameters should be put prior to 
> the function's name in the declaration).
>
> This typechecks and the online compiler will accept it:
>
> fun test (): void = {
>   val xs = stream_vt_make_cons ((g0ofg1)1, stream_vt_make_cons ((g0ofg1)2, 
> stream_vt_make_nil{int} ()))
>   
>   val ys = stream_vt_make_cons ((g0ofg1)"x", stream_vt_make_cons 
> ((g0ofg1)"y", stream_vt_make_nil{string} ()))
>
>   val zs = merge (xs, ys)
>   
>   val l = stream2list_vt (zs)
>   val () = println!(l) // should print something like: 1,x; 2,y
>
>   val () = list_vt_free(l)
> }
>
> Unfortunately I can't run it (the glot.io-provided compiler doesn't 
> support stream_vt_make_* functions).
>
>
>> I get:
>>
>> /home/deech/ATS/test/ATS/ATS2/ccomp/runtime/pats_ccomp_instrset.h:276:35: 
>> error: assignment to expression with array type
>>  #define ATSINSmove(tmp, val) (tmp = val)
>>^
>> triples_dats.c:1062:1: note: in expansion of macro ‘ATSINSmove’
>>  ATSINSmove(tmp19, ATSSELcon(env0, postiats_tysum_3, atslab__0)) ;
>>  ^~
>> /home/deech/ATS/test/ATS/ATS2/ccomp/runtime/pats_ccomp_instrset.h:276:35: 
>> error: assignment to expression with array type
>>  #define ATSINSmove(tmp, val) (tmp = val)
>>^
>> triples_dats.c:1070:1: note: in expansion of macro ‘ATSINSmove’
>>  ATSINSmove(tmp21, ATSSELcon(env1, postiats_tysum_4, atslab__0)) ;
>>  ^~
>> /home/deech/ATS/test/ATS/ATS2/ccomp/runtime/pats_ccomp_instrset.h:327:65: 
>> error: assignment to expression with array type
>>  #define ATSINSstore_fltrec_ofs(tmp, tyrec, lab, val) ((tmp).lab = val)
>>  ^
>> triples_dats.c:1093:1: note: in expansion of macro ‘
>> ATSINSstore_fltrec_ofs’
>>  ATSINSstore_fltrec_ofs(tmp23, postiats_tyrec_2, atslab__0, tmp19) ;
>>  ^~
>> /home/deech/ATS/test/ATS/ATS2/ccomp/runtime/pats_ccomp_instrset.h:327:65: 
>> error: assignment to expression with array type
>>  #define ATSINSstore_fltrec_ofs(tmp, tyrec, lab, val) ((tmp).lab = val)
>>  ^
>> triples_dats.c:1094:1: note: in expansion of macro ‘
>> ATSINSstore_fltrec_ofs’
>>  ATSINSstore_fltrec_ofs(tmp23, postiats_tyrec_2, atslab__1, tmp21) ;
>>  ^~
>>
>>
>>
>>
>> On Wednesday, January 2, 2019 at 1:21:24 AM UTC-6, Artyom Shalkhakov 
>> wrote:
>>>
>>> Hello Aditya!
>>>
>>> I've modified this a bit by inserting freeing:
>>>
>>> fun merge
>>>   {a: t@ype}
>>>   {b: t@ype}
>>>   (
>>> s1: stream_vt a,
>>> s2: stream_vt b
>>>   ) : stream_vt(@(a,b)) =
>>>   let
>>> val _s1 = !s1
>>> val _s2 = !s2
>>>   in
>>> $ldelay
>>>  (
>>>   (
>>>   case+ (_s1,_s2) of
>>>   | (~stream_vt_cons(_s1e, _s1s),
>>>  ~stream_vt_cons(_s2e, _s2s)) =>
>>>  stream_vt_cons(@(_s1e,_s2e), merge(_s1s,_s2s))
>>>   | (~stream_vt_nil (), _) => (stream_vt_con_free(_s2); 
>>> stream_vt_nil())
>>>   | (_, ~stream_vt_nil ()) => (stream_vt_con_free(_s1); 
>>> stream_vt_nil())
>>>   )
>>>  , (stream_vt_con_free(_s1); stream_vt_con_free(_s2))
>>>  )
>>>   end
>>>
>>> This type-checks (but I have not run it).
>>>
>>> $ldelay requires us to supply as its second argument an expression that 
>>> will free up all resources that are used in its first argument.
>>>
>>> ср, 2 янв. 2019 г. в 08:10, aditya siram :
>>>
 I trying to understand the stream_vt datatype by 

Re: is ptr_get0 from introduction implementable.

2018-12-11 Thread Richard
Not sure if this is completely correct however, it typechecks

extern fun {a:t@ype} 
ptr_get0 {l:addr} (pf: a @ l | p: ptr l): (a @ l | a)

implement {a} ptr_get0 {l} (pf | p) = (pf | A) where { val A = !p }

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/1fc1a3df-b70b-4106-be32-f6d51c5a5fc3%40googlegroups.com.


where do I get atscc2js from?

2018-11-08 Thread Richard
Here is a script to install ats2 (with atscc2js) on macOS.

https://pastebin.com/raw/HEr5fJuK

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/d3baf2a6-9a8f-45f2-8b69-38d31c3e49e2%40googlegroups.com.


Re: The myatscc utility

2018-05-19 Thread richard


> (*
> ##myatsccdef=\
> curl --data-urlencode mycode@$1 \
>
> http://bucs320-tutoriats.rhcloud.com/\
> SERVICE/assets/patsopt_ccats_eval_code_0_.php | \
> php -R 'if (\$argn != \"\") 
> echo(json_decode(urldecode(\$argn))[1].\"\\n\");' | \
> tcc -run -std=c99 -D_XOPEN_SOURCE -I\${PATSHOME} 
> -I\${PATSHOME}/ccomp/runtime -L\${PATSHOME}/ccomp/atslib/lib -o $fname($1) 
> -x c -
> *)
>

Hacking at its finest!

Here is a slightly different example,

//usr/bin/env myatscc "$0" && $(echo "$0" | sed 's/\.dats/_dats/g') ; exit

extern 
fun system:(string) -> int = "mac#system"

implement
main0() = () where
{
  val _ = system("patsopt")
}

(* end of [hello.dats] *)
 
Run via,
$ sh hello.dats
  Hello from ATS2(ATS/Postiats)!

-- 
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 post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/c49e914d-d92e-4a07-80e4-31113d39eed5%40googlegroups.com.