large binaries

Abraham Egnor aegnor@antioch-college.edu
Thu, 18 Jul 2002 14:40:39 -0400 (EDT)


This is something I just noticed...

hello.hs:
module Main(main) where

main = putStr "Hello world!\n"

hello.c:
#include <stdio.h>

int main(void)
{
  printf("Hello world!\n");
  return 0;
}

[abe@shiva:~/src/test] $ ghc hello.hs -o hello_hs
[abe@shiva:~/src/test] $ gcc hello.c -o hello_c
[abe@shiva:~/src/test] $ ls -l hello_*
-rwxr-xr-x    1 abe      engy        13712 Jul 18 11:34 hello_c
-rwxr-xr-x    1 abe      engy       299900 Jul 18 11:33 hello_hs

Why is the binary made by ghc 20 times bigger than the one made by gcc?

Abe