Introducing Haskell Light RijkJan Arjan Daan Martijn L

  • Slides: 15
Download presentation
Introducing Haskell. Light Rijk-Jan, Arjan, Daan, Martijn L.

Introducing Haskell. Light Rijk-Jan, Arjan, Daan, Martijn L.

Goal l Teaching l “Compiler framework”

Goal l Teaching l “Compiler framework”

Demo

Demo

Design Language Compiler Haskell l Error reporting l l – No classes Simplicity l

Design Language Compiler Haskell l Error reporting l l – No classes Simplicity l Error reporting l e. Xtreme testing

Highlights l Precise positions of errors l Warnings l Hints (type errors, undefined var.

Highlights l Precise positions of errors l Warnings l Hints (type errors, undefined var. ) l Still fast, small and portable

Position f = 3 x = 3 f = 4 l Hugs: – ERROR

Position f = 3 x = 3 f = 4 l Hugs: – ERROR Main. hs: 1 - "f" multiply defined l Where is the other definition? l Helium: – (1, 1), (3, 1): duplicated function "f"

Warnings l Which “id” was meant? f id = id 3 id x =

Warnings l Which “id” was meant? f id = id 3 id x = x l Hugs – Silent l Helium – (1, 3): variable "id" shadows the one at (3, 1)

Warnings l Unused l No parameters/functions. . . type definition l Unreachable code (in

Warnings l Unused l No parameters/functions. . . type definition l Unreachable code (in case)

Hints map f xs = case xs of []->[] y: ys->map ys ERROR Main.

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] l (4, 11): type error in rhs of case: map ys type: b -> c previous rhs’s: [a] Probably too few arguments to 'map' in this right-hand side l

Fast, small, portable Helium GHC Hugs Compiler speed + (800 l/s) (400/s) ++ (4500

Fast, small, portable Helium GHC Hugs Compiler speed + (800 l/s) (400/s) ++ (4500 l/s) Disk space + (1 M) - (130 M) + (1 M) Code speed + ++ - Code size + - N. A. Messages ++ + - Finished - + ++

Code speed time in sec Hugs Helium GHC –O Sieve 31 2. 4 0.

Code speed time in sec Hugs Helium GHC –O Sieve 31 2. 4 0. 8 0. 5 Build & consume 32 2. 7 0. 8 0. 6 Nfib 30 70 2. 4 2. 5 1. 4 GHC 5 x Helium 60 x Hugs

Implementation Lexer Lazy Virtual Machine (Daan Leijen) Parser To. Core Static Analysis Type Checker

Implementation Lexer Lazy Virtual Machine (Daan Leijen) Parser To. Core Static Analysis Type Checker

Future of Helium Not yet “Never” l modules l classes l where, lambda l

Future of Helium Not yet “Never” l modules l classes l where, lambda l Double, Integer l Float, tuples l records l pattern-matching l nested patterns l comprehensions l FFI (Java), GUI, IDE, interpreter

Conclusion l Helium is Haskell-- with nice error messages l Helium will be “textbook

Conclusion l Helium is Haskell-- with nice error messages l Helium will be “textbook Haskell” l Helium will hopefully some day be used in education