Haskell

From OSDev Wiki
Jump to navigation Jump to search

Haskell is a functional programming language that can be used for operating system development.

This page won't describe the pros and cons or the features of using Haskell for kernel development. You can find out more about Haskell on Wikipedia. Just like with most other languages, you still require some assembly to jump into your Haskell code.

Getting started

The most popular method though has been to use a small C or assembly microkernel, and use Haskell to implement the servers.

Being a functional programming language, it may be hard to adapt a lot of example code written in imperative languages, therefore a heavy theoretical understanding of operating systems and the concepts involved is required. That being said, you're not completely alone; try Googling for "Haskell on Bare Bones", and more general terms such as "Functional Languages in Operating Systems".

Compilers

The Glasgow Haskell Compiler is the recommended compiler for Haskell. GHC can output executables (though perhaps not in all of the Executable Formats required), assembly, byte code, Core, object files, LLVM (and possibly Clang depending, on the host OS) executables, C--, and finally ANSI C code (which you can send through your favorite C compiler, such as GCC). Caveat emptor: the C output from GHC is highly obfuscated, as it hard-codes stack and heap management, and essentially consists of many small, inter-connected procedures (spaghetti code).

Operating Systems in Haskell

See Also