# ATS resources

**URL:** <https://discourse.ats-lang.org/t/ats-resources/589>\
**Category:** Google Group\
**Created:** [January 12, 2014, 3:50am UTC](https://discourse.ats-lang.org/t/ats-resources/589 "2014-01-12T03:50:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![H\_Zhang](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@H\_Zhang](https://discourse.ats-lang.org/u/H_Zhang)\
**Post date:** [January 12, 2014, 3:50am UTC](https://discourse.ats-lang.org/t/ats-resources/589/1 "2014-01-12T03:50:34Z")

</div>

(This was first posted in another thread as a reply although I intended it  
to start a new thread.)

Hi,

I found Chris Double’s blogs very helpful with real world usage examples of  
ATS:  
[http://bluishcoder.co.nz/tags/ats/](http://bluishcoder.co.nz/tags/ats/)

I am very interested in ATS but I am trying to figure out how exactly it  
fits with my needs. I think some high level guidelines on how a project can  
be done in ATS will really help newcomers and may even benefit the  
developers as it may force you to think more about how ATS will be used in  
real projects.

For my own preference for explorative coding I like languages that are  
expressive and that have REPL support. I currently use Prolog. ATS has an  
ML-like part that is expressive but does not support REPL.

That leaves the potential usage model of coding in ATS for performance  
critical libraries. Again if possible I still would like to code in the  
more expressive ML style, but the library code needs to work with other  
high level languages that have their own garbage collectors. Does that mean  
that ML style is out of question if I want to write an FLI extension for,  
say, Prolog? If ML style is still possible how does one go about  
boxing/unboxing data structures from ATS ML style to the target language  
and interacting with host GC? Or is the realistic choice to code in C  
style? I would love to see some worked out examples on interfacing ATS (ML  
style – for C style presumable one can just follow the FLI of the targets)  
to Prolog or Scheme/Lisp, writing performance critical libraries in ATS and  
working with the FLIs of the target languages.

Sincerely,  
HaitaoOn Thursday, January 9, 2014 8:59:33 AM UTC-8, gmhwxi wrote:

> Right now, a serious problem with ATS is that there is very little  
> on-line source of information for people interested in learning it. So it  
> is  
> my hope that everyone learning ATS right now could also help his or her  
> fellow learners.
> 
> By the way, encoding proofs of theorems inside ATS is an excellent way to  
> gain understanding of the theorems. For instance, I had great difficulty  
> with  
> Yoneda Lemma in category theory. Once I was able to implement it in ATS  
> a couple days ago, I felt that I had gained solid understanding of it.  
> Actually,  
> I right now feel that Yoneda Lemma is so “trivial” 🙂

---

<div class="post-metadata">

**Author:** ![Brandon\_Barker](https://sea1.discourse-cdn.com/flex019/user_avatar/discourse.ats-lang.org/brandon_barker/32/61_2.png) [@Brandon\_Barker](https://discourse.ats-lang.org/u/Brandon_Barker)\
**Post date:** [January 12, 2014, 5:26am UTC](https://discourse.ats-lang.org/t/ats-resources/589/2 "2014-01-12T05:26:55Z")

</div>

I just want to summarize what I’ve picked up on the list related to this  
question. ATS is a complex language, and trying to use all the features on  
a first pass is extremely difficult, even for expert ATS users. Starting  
with an ML style is perhaps a good first option, but you may want to make  
it more procedural (C-style) to get performance, and bring in linear types,  
ATS/LF, and dependent types to guarantee your code is working correctly  
later on. Of course, procedural style and linear types may be integrated at  
the same stage I imagine.

I think Hongwei had a tutorial posted on a mailing list a few months ago  
where he went from ML style, to procedural, to procedural + linear along  
these lines. There is probably more than one that has at least two of these  
steps. This doesn’t touch on abstract types and templates which will also  
likely be important parts of projects; the former in particular seems to be  
important for program design.

As for a REPL interface, I’m also interested in having this, and would be  
happy to contribute what I can to making it happen. I’m wondering if using  
CINT as a backend would be viable, but I don’t have enough experience to  
know how the GC might work in this situation.

Brandon Barker  
brandon…@gmail.comOn Sat, Jan 11, 2014 at 10:50 PM, H Zhang [zht...@gmail.com](mailto:zht...@gmail.com) wrote:

> (This was first posted in another thread as a reply although I intended it  
> to start a new thread.)
> 
> Hi,
> 
> I found Chris Double’s blogs very helpful with real world usage examples  
> of ATS:  
> [Tags » ats](http://bluishcoder.co.nz/tags/ats/)
> 
> I am very interested in ATS but I am trying to figure out how exactly it  
> fits with my needs. I think some high level guidelines on how a project can  
> be done in ATS will really help newcomers and may even benefit the  
> developers as it may force you to think more about how ATS will be used in  
> real projects.
> 
> For my own preference for explorative coding I like languages that are  
> expressive and that have REPL support. I currently use Prolog. ATS has an  
> ML-like part that is expressive but does not support REPL.
> 
> That leaves the potential usage model of coding in ATS for performance  
> critical libraries. Again if possible I still would like to code in the  
> more expressive ML style, but the library code needs to work with other  
> high level languages that have their own garbage collectors. Does that mean  
> that ML style is out of question if I want to write an FLI extension for,  
> say, Prolog? If ML style is still possible how does one go about  
> boxing/unboxing data structures from ATS ML style to the target language  
> and interacting with host GC? Or is the realistic choice to code in C  
> style? I would love to see some worked out examples on interfacing ATS (ML  
> style – for C style presumable one can just follow the FLI of the targets)  
> to Prolog or Scheme/Lisp, writing performance critical libraries in ATS and  
> working with the FLIs of the target languages.
> 
> Sincerely,  
> Haitao
> 
> On Thursday, January 9, 2014 8:59:33 AM UTC-8, gmhwxi wrote:
> 
> > Right now, a serious problem with ATS is that there is very little  
> > on-line source of information for people interested in learning it. So it  
> > is  
> > my hope that everyone learning ATS right now could also help his or her  
> > fellow learners.
> > 
> > By the way, encoding proofs of theorems inside ATS is an excellent way to  
> > gain understanding of the theorems. For instance, I had great difficulty  
> > with  
> > Yoneda Lemma in category theory. Once I was able to implement it in ATS  
> > a couple days ago, I felt that I had gained solid understanding of it.  
> > Actually,  
> > I right now feel that Yoneda Lemma is so “trivial” 🙂
> 
> –  
> 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-user...@googlegroups.com](mailto:ats-lang-user...@googlegroups.com).  
> To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/ats-lang-users/c8d27f1b-874d-42ef-8fa7-172dcccc0e0b%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/c8d27f1b-874d-42ef-8fa7-172dcccc0e0b%40googlegroups.com)  
> .

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [January 12, 2014, 4:56pm UTC](https://discourse.ats-lang.org/t/ats-resources/589/3 "2014-01-12T16:56:19Z")

</div>

This all depends how Prolog creates/manipulates heap-allocated values.  
If a library for Prolog can be implemented in ATS in ML-style, then it  
should already be possible  
to do it in ML. So I have doubts about the viability of such an approach.

However, one possiblity is that you first implement in ML-style but use a  
separate heap to store  
ATS values; this will create memory-leaks; then you employ linear types to  
eliminate these leaks.

If you have a concrete case, I will be happy to take a look.On Saturday, January 11, 2014 10:50:34 PM UTC-5, H Zhang wrote:

> (This was first posted in another thread as a reply although I intended it  
> to start a new thread.)
> 
> Hi,
> 
> I found Chris Double’s blogs very helpful with real world usage examples  
> of ATS:  
> [Tags » ats](http://bluishcoder.co.nz/tags/ats/)
> 
> I am very interested in ATS but I am trying to figure out how exactly it  
> fits with my needs. I think some high level guidelines on how a project can  
> be done in ATS will really help newcomers and may even benefit the  
> developers as it may force you to think more about how ATS will be used in  
> real projects.
> 
> For my own preference for explorative coding I like languages that are  
> expressive and that have REPL support. I currently use Prolog. ATS has an  
> ML-like part that is expressive but does not support REPL.
> 
> That leaves the potential usage model of coding in ATS for performance  
> critical libraries. Again if possible I still would like to code in the  
> more expressive ML style, but the library code needs to work with other  
> high level languages that have their own garbage collectors. Does that mean  
> that ML style is out of question if I want to write an FLI extension for,  
> say, Prolog? If ML style is still possible how does one go about  
> boxing/unboxing data structures from ATS ML style to the target language  
> and interacting with host GC? Or is the realistic choice to code in C  
> style? I would love to see some worked out examples on interfacing ATS (ML  
> style – for C style presumable one can just follow the FLI of the targets)  
> to Prolog or Scheme/Lisp, writing performance critical libraries in ATS and  
> working with the FLIs of the target languages.
> 
> Sincerely,  
> Haitao
> 
> On Thursday, January 9, 2014 8:59:33 AM UTC-8, gmhwxi wrote:
> 
> > Right now, a serious problem with ATS is that there is very little  
> > on-line source of information for people interested in learning it. So it  
> > is  
> > my hope that everyone learning ATS right now could also help his or her  
> > fellow learners.
> > 
> > By the way, encoding proofs of theorems inside ATS is an excellent way to  
> > gain understanding of the theorems. For instance, I had great difficulty  
> > with  
> > Yoneda Lemma in category theory. Once I was able to implement it in ATS  
> > a couple days ago, I felt that I had gained solid understanding of it.  
> > Actually,  
> > I right now feel that Yoneda Lemma is so “trivial” 🙂

---

<div class="post-metadata">

**Author:** ![H\_Zhang](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@H\_Zhang](https://discourse.ats-lang.org/u/H_Zhang)\
**Post date:** [January 12, 2014, 4:48pm UTC](https://discourse.ats-lang.org/t/ats-resources/589/4 "2014-01-12T16:48:24Z")

</div>

Brandon,

Thanks for the comments. It would be nice if we can write ML style code  
that can be made binary compatible with foreign language data structures or  
have a nice way to model foreign language data structures even while using  
ML style. Also there is the question of working with the foreign language  
GC.

I started a separate thread on an REPL for ATS. From what I read about CINT  
I hear it is a rather hairy hack due to C semantics.

HaitaoOn Saturday, January 11, 2014 9:26:55 PM UTC-8, Brandon Barker wrote:

> I just want to summarize what I’ve picked up on the list related to this  
> question. ATS is a complex language, and trying to use all the features on  
> a first pass is extremely difficult, even for expert ATS users. Starting  
> with an ML style is perhaps a good first option, but you may want to make  
> it more procedural (C-style) to get performance, and bring in linear types,  
> ATS/LF, and dependent types to guarantee your code is working correctly  
> later on. Of course, procedural style and linear types may be integrated at  
> the same stage I imagine.
> 
> I think Hongwei had a tutorial posted on a mailing list a few months ago  
> where he went from ML style, to procedural, to procedural + linear along  
> these lines. There is probably more than one that has at least two of these  
> steps. This doesn’t touch on abstract types and templates which will also  
> likely be important parts of projects; the former in particular seems to be  
> important for program design.
> 
> As for a REPL interface, I’m also interested in having this, and would be  
> happy to contribute what I can to making it happen. I’m wondering if using  
> CINT as a backend would be viable, but I don’t have enough experience to  
> know how the GC might work in this situation.
> 
> Brandon Barker  
> [brand...@gmail.com](mailto:brand...@gmail.com) \<javascript:\>
> 
> On Sat, Jan 11, 2014 at 10:50 PM, H Zhang \<[zht...@gmail.com](mailto:zht...@gmail.com) \<javascript:\>\>wrote:
> 
> > (This was first posted in another thread as a reply although I intended  
> > it to start a new thread.)
> > 
> > Hi,
> > 
> > I found Chris Double’s blogs very helpful with real world usage examples  
> > of ATS:  
> > [Tags » ats](http://bluishcoder.co.nz/tags/ats/)
> > 
> > I am very interested in ATS but I am trying to figure out how exactly it  
> > fits with my needs. I think some high level guidelines on how a project can  
> > be done in ATS will really help newcomers and may even benefit the  
> > developers as it may force you to think more about how ATS will be used in  
> > real projects.
> > 
> > For my own preference for explorative coding I like languages that are  
> > expressive and that have REPL support. I currently use Prolog. ATS has an  
> > ML-like part that is expressive but does not support REPL.
> > 
> > That leaves the potential usage model of coding in ATS for performance  
> > critical libraries. Again if possible I still would like to code in the  
> > more expressive ML style, but the library code needs to work with other  
> > high level languages that have their own garbage collectors. Does that mean  
> > that ML style is out of question if I want to write an FLI extension for,  
> > say, Prolog? If ML style is still possible how does one go about  
> > boxing/unboxing data structures from ATS ML style to the target language  
> > and interacting with host GC? Or is the realistic choice to code in C  
> > style? I would love to see some worked out examples on interfacing ATS (ML  
> > style – for C style presumable one can just follow the FLI of the targets)  
> > to Prolog or Scheme/Lisp, writing performance critical libraries in ATS and  
> > working with the FLIs of the target languages.
> > 
> > Sincerely,  
> > Haitao
> > 
> > On Thursday, January 9, 2014 8:59:33 AM UTC-8, gmhwxi wrote:
> > 
> > > Right now, a serious problem with ATS is that there is very little  
> > > on-line source of information for people interested in learning it. So  
> > > it is  
> > > my hope that everyone learning ATS right now could also help his or her  
> > > fellow learners.
> > > 
> > > By the way, encoding proofs of theorems inside ATS is an excellent way to  
> > > gain understanding of the theorems. For instance, I had great difficulty  
> > > with  
> > > Yoneda Lemma in category theory. Once I was able to implement it in ATS  
> > > a couple days ago, I felt that I had gained solid understanding of it.  
> > > Actually,  
> > > I right now feel that Yoneda Lemma is so “trivial” 🙂
> > 
> > –  
> > 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...@googlegroups.com](mailto:ats-lang...@googlegroups.com) \<javascript:\>.  
> > To post to this group, send email to [ats-l...@googlegroups.com](mailto:ats-l...@googlegroups.com)\<javascript:\>  
> > .  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/ats-lang-users/c8d27f1b-874d-42ef-8fa7-172dcccc0e0b%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/c8d27f1b-874d-42ef-8fa7-172dcccc0e0b%40googlegroups.com)  
> > .
