mathiasbynens / small

Smallest possible syntactically valid files of different types
https://mathiasbynens.be/notes/minimal-html
1.93k stars 184 forks source link

Haskell examples #11

Closed andy-morris closed 12 years ago

andy-morris commented 12 years ago

Not sure whether these are supposed to exit with status 0 or if it doesn’t matter, so here’s one of each.


haskell_loop.hs is an infinite loop (well, in GHC, it throws a NonTermination exception instead).

haskell_term.hs is AFAICT the smallest program that terminates successfully; it even has output! (But only because print 0 is slightly shorter than return().)

Actually, the smallest syntactically valid file is empty. But in an actual program the Main module (which a file with no module header is) has to at least contain the main function. And similarly, main=0 would be shorter but main is expected to have the type IO ().

mathiasbynens commented 12 years ago

Awesome, thanks!