Skip to content
/ hakan Public

A functional programming language with algebraic datatypes and typeclasses

License

Notifications You must be signed in to change notification settings

bagnalla/hakan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hakan

A statically typed functional programming language with parametric polymorphism and type inference.

See monad.hk for an example program that uses typeclasses, and base.hk and prelude.hk for more example code. The other .hk files are probably out of date.

Instructions

To build hakan and run the interpreter on a test program:

stack build && stack exec hakan-exe hk/monad.hk

Compilation to JavaScript

src/JS.hs implements straightforward compilation to JavaScript. Try it out with:

./compileJS.sh hk/monad.hk

Compilation to C

src/C.hs implements compilation to C. It is less straightforward than the JS backend because of C's lack of innate support for higher-order functions / closures, and lack of garbage collection. Compilation proceeds by lambda-lifting all functions to top-level "supercombinators" which are then compiled to individual C functions. Currently doesn't support the use of typeclasses. The resulting executable is hooked up to Boehm GC.

./compileC.sh hk/ctest9.hk

About

A functional programming language with algebraic datatypes and typeclasses

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published