150 likes | 240 Views
Introducing HaskellLight. Rijk-Jan, Arjan, Daan, Martijn L. Goal. Teaching “Compiler framework”. Haskell. Demo. Language Haskell Error reporting No classes. Compiler Simplicity Error reporting eXtreme testing. Design. Highlights. Precise positions of errors Warnings
E N D
Introducing HaskellLight Rijk-Jan, Arjan, Daan, Martijn L.
Goal • Teaching • “Compiler framework” Haskell
Language Haskell Error reporting No classes Compiler Simplicity Error reporting eXtreme testing Design
Highlights • Precise positions of errors • Warnings • Hints (type errors, undefined var.) • Still fast, small and portable
Position f = 3 x = 3 f = 4 • Hugs: • ERROR Main.hs:1 - "f" multiply defined • Where is the other definition? • Helium: • (1, 1), (3, 1): duplicated function "f"
Warnings f id = id 3 id x = x • Which “id” was meant? • Hugs • Silent • Helium • (1, 3): variable "id" shadows the one at (3, 1)
Warnings • Unused parameters/functions... • No type definition • Unreachable code (in case)
Hints map f xs = case xs of []->[] y:ys->map ys • ERROR Main.hs:1 – Type error in function binding*** Term : map*** Type : c -> [a] -> [b]*** Does not match : [a] -> [b] • (4, 11): type error in rhs of case: map ystype: b -> cprevious rhs’s: [a]Probably too few arguments to 'map' in this right-hand side
Code speed GHC 5 x Helium 60 x Hugs
Implementation Lexer Lazy Virtual Machine (Daan Leijen) Parser ToCore Static Analysis Type Checker
Not yet modules where, lambda Float, tuples pattern-matching nested patterns comprehensions FFI (Java), GUI, IDE, interpreter “Never” classes Double, Integer records Future of Helium
Conclusion • Helium is Haskell-- with nice error messages • Helium will be “textbook Haskell” • Helium will hopefully some day be used in education