Skip to content

Latest commit

 

History

History
106 lines (69 loc) · 2.85 KB

TUTORIAL_INSTALL.md

File metadata and controls

106 lines (69 loc) · 2.85 KB

Tutorial: Installing Typedefs

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 serialisers and deserialisers 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 tools.

0. Install Idris

Since Typedefs is written using Idris we are going to install the Idris compiler. You can find instruction on how to install Idris for your platform here: https://www.idris-lang.org/download/.

Shortcut: Mac OS

If you're using Mac OS, you can use brew to install Idris by typing this on your terminal

brew install idris

Check it's working

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>

Use :q to quit.

1. Get the source

In order to compile Typedefs you will need to download its 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

2. Get elba

For this tutorial we are going to build the project using the elba package manager. The README contains the instructions to install elba on your system.

The easiest way to install is to use the pre-built binary and add it to your path.

The prebuilt binary can be found on the release page

3. Compile and install

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

elba install

This will download all the dependencies and compile the project. The last line printed should be something like

done! 1 binaries installed into ~/.elba/bin [54.81s]

4. Try it out

You can try Typedefs by running it with a very simple command:

~/.elba/bin/typedefs -i "(name bool (+ 1 1))"

This assumes that elba installed the binary in ~/.elba/bin. If you have ~/.elba/bin in your path you can simply call

typedefs -i "(name bool (+ 1 1))"

You can now move on to our next tutorial Using typedefs