Personal tools

Yhc/Tutorial

From HaskellWiki

< Yhc(Difference between revisions)
Jump to: navigation, search
(Setting the Package Path)
Line 7: Line 7:
 
== Setting the Package Path ==
 
== Setting the Package Path ==
   
The easiest way to use Yhc is to first set the YHC_PACKAGE_PATH environment variable to the root of the packages. <say how to do this, give an example>
+
You can either set <tt>YHC_BASE_PATH</tt> to something so that <tt>"%YHC_BASE_PATH%/bin/yhc"</tt> will run Yhc, typically the location of the <tt>inst</tt> folder if you are running from the source tree.
  +
  +
Alternatively, you can add your yhc executable to the Path, and Yhc will find the other bits automatically.
   
 
== Compiling Hello World ==
 
== Compiling Hello World ==

Revision as of 13:19, 18 June 2007

Part of Yhc

(Download)

Contents

1 Obtaining Yhc

Either download a binary distribution, or compile it from source (see Yhc/Building). A binary distribution is probably easier, but there aren't any yet until the first release.

2 Setting the Package Path

You can either set YHC_BASE_PATH to something so that "%YHC_BASE_PATH%/bin/yhc" will run Yhc, typically the location of the inst folder if you are running from the source tree.

Alternatively, you can add your yhc executable to the Path, and Yhc will find the other bits automatically.

3 Compiling Hello World

Take a sample file, HelloWorld.hs

=========== File HelloWorld.hs ===============
module Main where
main = putStrLn "Hello, World!\n"
==============================================
$ yhc HelloWorld
$ yhi HelloWorld
Hello, World!

3.1 yhc

The yhc command takes a haskell source file, and generate a haskell bytecode file (extension, .hbc). The program always runs in make mode - so it will compile all requirements automatically.

3.2 yhi

The yhi command runs a haskell byte code file.

3.3 yhe

Yhe provides a Haskell 'command line' powered by Yhc. A gtk GUI also exists.