This tutorial aims to explain how to install and use Typedefs. Typedefs is a language to define types and generate type definitions as well as serializers and deserializers for a target language. We are going to see later how to achieve that, right now we are going to focus on how to install the tool.
For this tutorial we are going to build and install typedefs manually using its source code ans the idris compiler.
In order to compile idris code you will need the Idris compiler. You can find instruction on how to install idris for your platform here: https://www.idris-lang.org/download/.
If you're using Mac OS, you can use brew
to install Idris by typing this on your terminal
brew install idris
Once Idris is installed you can check it works by typing
idris
And you should get
____ __ _
/ _/___/ /____(_)____
/ // __ / ___/ / ___/ Version 1.3.2-git:ed4d4cf30
_/ // /_/ / / / (__ ) http://www.idris-lang.org/
/___/\__,_/_/ /_/____/ Type :? for help
Idris is free software with ABSOLUTELY NO WARRANTY.
For details type :warranty.
Idris>
In order to compile typedefs you will need to download it's source, you can find it on its public repo here: http://github.com/typedefs/typedefs
One very easy way to get the code is to clone the project with the following command
git clone [email protected]:typedefs/typedefs.git
For this tutorial we are going to build the project using the nix package manager. The main page (https://nixos.org/nix/) contains the instruction to install nix on your system.
Once your copy of the repo is downloaded go into its directory (using cd typedefs
for example) and you can now compile the project using
nix-build -A typedefs-parser
This will download all the dependencies and compile the typedefs-parser
project.