Yhc/Tutorial

From HaskellWiki
< Yhc
Revision as of 13:19, 18 June 2007 by NeilMitchell (talk | contribs) (→‎Setting the Package Path)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Part of Yhc

(Download)

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.

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.

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!

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.

yhi

The yhi command runs a haskell byte code file.

yhe

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