-4

I want to create a program for the Linux OS in Haskell with multiple .hs files. I don't need help with the code or compiling it, what I don't know how to do is create an application that can be called from the terminal (like how python or ghci is). So:

  • Where should the files go?
  • What do I need to do to allow it to be called from the command line?

I'll appreciate any help/tutorials on this.

Edit: I need to turn my program into whatever it is that you install on your computer. Like Python! How does Python pull this off?

3

1 Answer 1

3

Invoking command anywhere from the terminal means that the command is available in the PATH.

PATH is an environment variable containing an order list of directories. Whenever a command is called the list is parsed to see if an executable file of the same name is available. If it is, it is executed. If nothing was found you get "command not found error"

Depending on your goal there are multiple way to attain the same results.

If you just want you program to be called anywhere, you can update the PATH variable in you .bashrc file (or equivalent) to add the directory where your executable file is.

If you want to create a distributable package to share with people you can either compress a folder (tar) with your executable and leave the PATH configuration to the user or create a proper installable package.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.