logic_programmer
logic_programmer

Reputation: 11

Haskell & The Implementation of Functional Languages book

I'm having trouble executing the chapters of the book Implementing Functional Languages: a tutorial by Simon L Peyton Jones and David R Lester.

I'm using ghc on OSX and I'm using make to generate the input, e.g. "make language.lhs" and "make utils.lhs".

peano:pj-lester-book bwat$ make utils.lhs
cat utils.src | ./make-version 1 G >utils.lhs
peano:pj-lester-book bwat$ make language.lhs
make: *** No rule to make target `language-tutor.src', needed by `language.lhs'.    Stop.
peano:pj-lester-book bwat$ touch language-tutor.src
peano:pj-lester-book bwat$ make language.lhs
cat language.src language-tutor.src | ./make-version 3 G > language.lhs
peano:pj-lester-book bwat$ ghci
GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :load language
[1 of 1] Compiling Main             ( language.lhs, interpreted )

language.lhs:708:23:
    Not in scope: ‘foldll’
    Perhaps you meant one of these:
      ‘foldl1’ (imported from Prelude), ‘foldl’ (imported from Prelude),
      ‘foldr’ (imported from Prelude)

[Other similar errors deleted to save space]

Has anybody gone through this book with ghc?

Upvotes: 0

Views: 213

Answers (1)

Karl Bielefeldt
Karl Bielefeldt

Reputation: 48998

Look at Appendix A.5, which defines a number of functions to avoid compatibility problems with changing versions. From that appendix:

screenshot from appendix

Also, that book was written with examples in Miranda, not Haskell. You might find several cases with small incompatibilities where you need a deeper understanding than just copying and pasting.

Upvotes: 4

Related Questions