Metasepi team meeting #6: "Snatch-driven development"Presentation Transcript
Metasepi team meeting #6:
Who am I?
☆ Twitter: @master_q
☆ Organizer of Metasepi project
☆ A developer of Ajhc Haskell compiler
☆ A Debian Maintainer
☆ 10 years' experience in developing
OS using NetBSD.
☆  Demo
☆  What is Ajhc?
☆  What is Metasepi?
☆  What is compiler to build OS
☆  How to use Ajhc
☆  Case study: Snatch Android
☆  Detail of Snatch process
☆ RSS reader running on mbed (ARM).
☆ Show reddit articles on LCD display.
☆ You can watch the movie following.
Architecture: ARM Cortex-M3
RAM size: 64kB
IO: Ethernet, LED, LCD, SD Card, USB
 What is Ajhc?
☆ Ajhc := A fork of jhc
☆ jhc := John's Haskell Compiler
☆ Jhc outputs binary that has lowmemory-footprint and runs fast.
☆ Good for embedded software.
Why need Ajhc?
☆ GHC is de facto standard on Haskell.
☆ GHC := Glasgow Haskell Compiler
☆ Why need another Haskell compiler?
☆ To develop kernel named "Metasepi".
 What is Metasepi?
☆ Unix-like OS designed by strong type.
☆ Using ML or more strong type lang.
. . . and suchlike.
Why need Metasepi?
☆ We have already Linux or Windows.
☆ But the developers are suffering.
☆ If use the kernel changed by you,
☆ you will get many runtime error.
☆ Difficult even to reproduce it.
Doesn't OSS have good quality?
☆ "The Cathedral and the Bazaar"
☆ "Given enough eyeballs, all bugs are
☆ But if you develop your own product
Low quality out of OSS umbrella
☆ Less runtime errors.
Kernel desperately wants type
☆ Kernels are developed with C lang.
☆ Error on user space => SEGV
☆ Error on kernel space => halt!
☆ Should design kernel with the
☆ C language is safe?
 What is compiler to build OS
☆ Need strong type.
☆ Need flexibility such as C language.
☆ Create it if there are not!
☆ From scratch? No thank you...
☆ Look for our compiler base.
Want POSIX free compiler
Programs to print "hoge" on terminal.
Measurement value is smaller,
dependence on POSIX is small.
Jhc output has only 20 undef
$ nm hs.out | grep
Jhc is translator to C language
Easy to cross build
Survive burning out
Let's develop in dogfooding style. (The
method is called "Snatch".)
 How to use Ajhc
Case of Ubuntu 12.04 amd64.
$ sudo apt-get install haskell-platform libncurses5-dev gcc m4
$ cabal update
$ export PATH=$HOME/.cabal/bin/:$PATH
$ cabal install ajhc
$ which ajhc
$ echo 'main = print "hoge"' > Hoge.hs
$ ajhc Hoge.hs
You can use on Windows or Mac OS X.
Detail of usage
Please read "Ajhc User's Manual".
Also you can read in Japanese.
 Detail of Snatch method
Let's watch Snatch animation on
Android NDK Apps. Have popcorn?
If you want to know more detail, try the
git clone https://github.com/ajhc/demo-android-ndk.git
git log -p
Step7: Get clear => GOAL
We are in the strong typed world.
Haskell's turn, now!
PR: Call For Articles
☆ Fanzine of functional programming.
☆ About Haskell or OCaml or . . .
☆ Article about Ajhc in C84 book.
☆ Call me if you read it!