Ask HN: Is there any “Make you a Haskell” tutorial?
Hi all,
I would like to write a programming language with semantics compatible with Haskell alike languages like F# or OCaml. I would make the prototype in python for all its bindings as I hope I can be more productive even if it has not support for pattern matching and ADTs.
The only known guide I know about hundreds of "Make you a Lisp" tutorials and about a "Make you a Haskell" one which is not complete[0] and does not go much in detail on some aspects.
The only part that scares me a bit is the type system for what I would be afraid to have to recreate a Prolog or something similar (my first thought was to delegate this job to a separate engine during the first proofs of concept but I to report errors properly and advance I will end up having to implement my own, much more complex, system). Also in order to implement proper Effect Systems or Lazy Execution/evaluation elegantly.
If that doesn't exist I also would love some pointers in any other programming language, such as Python, Clojure or OCaml.
[0] https://smunix.github.io/dev.stephendiehl.com/fun/index.html
>The only part that scares me a bit is the type system for what I would be afraid to have to recreate a Prolog or something similar
Creating the core of a Prolog interpreter isn't much work. It is like a 30 line program in Haskell. See chapter 4 of "The Art of Prolog":
https://mitpress.mit.edu/books/art-prolog-second-edition
...there is a PDF available under the "Open Access" tab.
To be quite honest: I don't think there is anything along those lines. But if want to tackle it I recommend looking for PDF copy of Types and Programming Languages by Benjamin C. Pierce. It contains all necessary typing rules — barred the whole inference magic — be it System F, ADTs or Records.
EDIT: Oh and also contains the reduction rules ofcourse! Though the book assumes you now how to read inference rules. ;)
EDIT: I just found an official PDF source: http://basics.sjtu.edu.cn/~xiaojuan/tapl2016/files/Types+and...