Some ATS2 library updates...

Skip to first unread message

May 30, 2021, 1:20:28 PM5/30/21
to ats-lang-users

Hey all,

I just wanted to let everyone know that I updated a bunch of the libraries that I created last year (ats-http, ats-epoll, ats-result, and a bunch of others). I was sort of frustrated with the overall build experience when working with ATS libraries. I wanted a similar experience to Rust's cargo tool. I found conan ( and it works really well, so I reworked all my libraries to use it to manage library dependencies. Using conan, you can specify libraries that an app/library depends on and their specific versions. You can specify build dependencies (like ats-unit-testing) and pre-built binaries are used, if available, otherwise the dependencies are built from source and cached locally. I created a simple python class to be used in a conan recipe to set the correct ATS include paths for all the dependencies ( All of my ATS libraries on my github account have been converted to use conan. I'm also hosting these packages in my self-hosted conan package repo ( in case anyone decides to try this out. You can either depend on any of these packages and just include the binaries, or you can build everything from source. Anyway, I think it's pretty neat that I can fetch all the dependencies, (optionally) build all the deps from source, and build my package all in a few simple commands. Finally, I updated my docker image to include conan (, the docker image is on dockerhub at xrandeex/ats2:0.4.2. I removed nodejs and npm from the docker image only because it made the image size huge. I'm pretty sure no one is using it anyways (lol). I can add it back, if anyone is actually using it. Also, I updated the ATS2 version to the latest (0.4.2).

Has anyone ever used conan? I'd love to hear about your experience with it. Anyway, hopefully this makes it easier to create and share ATS2 libraries with other developers.


Elijah Stone

May 30, 2021, 5:16:49 PM5/30/21
to ats-lang-users
Have you seen atspkg (

Haven't used it myself, but it seems to be what you're looking for.
I think Vanessa reads this list so she can probably say more.
> --
> 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
> To view this discussion on the web visit

Randy Valis

May 30, 2021, 5:59:47 PM5/30/21
Yes, I tried atspkg. At the time I tried it, it didn't quite work, though I can't quite remember what didn't work. I like building for x86 and ARM. There is no binary for ARM, and since it's written in Haskell, building for ARM from Haskell source is a pain. Conan makes this super simple. Also, once binaries are uploaded for a particular CPU architecture, those packages can be consumed without needing to compile again. atspkg doesn't include a package repository. Including plain C dependencies is super simple in Conan, too. No need to rely on your system version of a particular dependency. Take my ATS wrapper around sqlite, for example. It depends on the sqlite library and will either fetch the binary or else build sqlite from source when building the wrapper. 

Dambaev Alexander

May 30, 2021, 9:42:43 PM5/30/21
I can confirm, that having ghc (1 GB+) just to build ats package is overkill.
I am not speaking of cross compiling ghc to another architecture/libc is pain as well, as it requires big amounts of RAM and 2+ hours of building for stage1/stage2 compilers.... Then, you need to build cabal and only then you will be able to build atspkg...

Having to have/build python is not a pleasure as well, but at least, it is not required to bootstrap itself :)

Ideally, ATS package manager should be written in ATS :D (as in the worst case, it will require just a C compiler to be built)

For now I am using git with libraries being a git modules in $REPO/libs directory, like this:
and staloading appropriate modules like this:
#define LIBS_targetloc "../libs" (* search path for external libs *)
#include "./../HATS/text.hats"
#include "{$LIBS}/ats-bytestring/HATS/bytestring.hats"
staload "{$LIBS}/result/src/SATS/result.sats"
staload "{$LIBS}/foldable/src/SATS/foldable.sats"

it can be not ideal for the case when "library A depends on C 1.0 and on B 1.0 and at the same time B depends on C 1.1", as $REPO/libs will contain 1 version. At the same time, for handling such case you need to at least properly handle symbol prefixes with  ATS_PACKAGE and ATS_EXTERN_PREFIX, so I am not thinking about such case yet....

Ah yes, I am using NixOS and nix package manager to handle C/C++ libraries dependencies, so what I usually need to build a project:
$ nix-shell shell.nix
nix-shell $ make

I should try to use Conan, though, to check how it handles the dependencies and such...


May 31, 2021, 2:42:53 AM5/31/21
to ats-lang-users

Thanks for sending this report.

I ran into Conan not too long ago but have not got time trying it yet.
So it is really great to learn your very positive experience with Conan.



May 31, 2021, 3:32:38 AM5/31/21
to ats-lang-users
>>Ideally, ATS package manager should be written in ATS :D (as in the worst case, it will require just a C compiler to be built)

For ATS3, the design I have is to support some form of internet-based code search.
This would make package management in ATS3 quite different. We could use tools
like npm and Connan after template resolution is completed. However, we do need a
"native" package management system for handling template resolution.

Speaking of template resolution, I'd like to mention a surprise I got not too long ago.

I wrote some ATS3 code and compiled it to JS and tested it successfully. Later l noticed that
I had not implemented the string comparison used in the ATS3 code. Why did my code work?
I realized that the compiler actually generated a function in JS for comparing strings by treating
a string as a sequence of characters and using the generic comparison function for sequences
to compare strings. In short, the sheer complexity of template resolution in ATS3 would  make
it very difficult for you to know what kind of code is generated by the compiler even if you yourself
wrote the source code.
Reply all
Reply to author
0 new messages