Yhc/Erlang/Proof of concept

From HaskellWiki
< Yhc
Revision as of 03:03, 15 May 2008 by DimitryGolubovsky (talk | contribs) (intro-2)

Jump to: navigation, search

Introduction

This Wiki page describes an experiment targeting execution of Haskell programs on top of the Erlang Virtual Machine (BEAM). Haskell source code is compiled to Yhc Core with York Haskell Compiler (Yhc), then the program further discussed converts Yhc Core to Core Erlang; finally Erlang Compiler (erlc) compiles Core Erlang to the BEAM file format which can be loaded and executed by the Erlang VM.

There have been numerous discussions about Haskell (mainly GHC) runtime lacking some properties that are available in Erlang environment, as well as about possible improvements in Erlang language syntax and type system to bring some elements available in Haskell.

This experiment is an attempt to satisfy the criticists from both sides. Once it becomes possible to execute Haskell programs in Erlang environment, Haskell users get access to the robust concurrency-oriented runtime, still being able to use Haskell native syntax. Erlang users get possibility to develop some algorithms with regard to the Haskell strong type system, while still being able to code directly in Erlang, where it seems more appropriate implementation-wise.

Implementation details

Erlang core overview

Haskell on BEAMs ;)

Lazy computations

Haskell objects

Thunks

Data constructors

Special cases

Haskell calling Erlang

General calling convention

Primitive calls

Hardcoded BIFs

Erlang calling Haskell

Typed processes

Spawning processes

Receiving messages

Sending messages

Examples

Factorial

Merging lists

Ping-pong