21
Heat — An Interactive Development Environment for Learning & Teaching Haskell Olaf Chitil 11 th September 2008 Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11 th September 2008 1 / 17

Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Heat — An Interactive Development Environment forLearning & Teaching Haskell

Olaf Chitil

11th September 2008

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 1 / 17

Page 2: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

The Problem

two separate tools:editor + interpreter

edit→save→switch→load - cycle

tiresomeeasy to forgetsave or load

command-lineconsideredold-fashioned

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 2 / 17

Page 3: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Emacs and IDEs

Emacs, gvim etc. with Haskell mode

not fully integrated(evaluate wrt. old program)

too many confusing features

GUI not nice enough

Professional IDE: Eclipse, Visual Studio

too complex

Haskell modes not mature

hard to install

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 3 / 17

Page 4: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Requirements

1 integrates editor and interpreter console within a single user interface

2 provides a graphical user interface similar to professional IDEs

3 simple and fool-proof:only features that support students beginning to learn Haskell

4 reliable

5 runs on all major platforms used by our students and staff(Windows, OS X, Linux, Solaris)

6 easy to install

7 small source code and easy to maintain

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 4 / 17

Page 5: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Requirements

1 integrates editor and interpreter console within a single user interface

2 provides a graphical user interface similar to professional IDEs

3 simple and fool-proof:only features that support students beginning to learn Haskell

4 reliable

5 runs on all major platforms used by our students and staff(Windows, OS X, Linux, Solaris)

6 easy to install

7 small source code and easy to maintain

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 4 / 17

Page 6: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Requirements

1 integrates editor and interpreter console within a single user interface

2 provides a graphical user interface similar to professional IDEs

3 simple and fool-proof:only features that support students beginning to learn Haskell

4 reliable

5 runs on all major platforms used by our students and staff(Windows, OS X, Linux, Solaris)

6 easy to install

7 small source code and easy to maintain

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 4 / 17

Page 7: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Requirements

1 integrates editor and interpreter console within a single user interface

2 provides a graphical user interface similar to professional IDEs

3 simple and fool-proof:only features that support students beginning to learn Haskell

4 reliable

5 runs on all major platforms used by our students and staff(Windows, OS X, Linux, Solaris)

6 easy to install

7 small source code and easy to maintain

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 4 / 17

Page 8: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Requirements

1 integrates editor and interpreter console within a single user interface

2 provides a graphical user interface similar to professional IDEs

3 simple and fool-proof:only features that support students beginning to learn Haskell

4 reliable

5 runs on all major platforms used by our students and staff(Windows, OS X, Linux, Solaris)

6 easy to install

7 small source code and easy to maintain

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 4 / 17

Page 9: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Requirements

1 integrates editor and interpreter console within a single user interface

2 provides a graphical user interface similar to professional IDEs

3 simple and fool-proof:only features that support students beginning to learn Haskell

4 reliable

5 runs on all major platforms used by our students and staff(Windows, OS X, Linux, Solaris)

6 easy to install

7 small source code and easy to maintain

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 4 / 17

Page 10: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Requirements

1 integrates editor and interpreter console within a single user interface

2 provides a graphical user interface similar to professional IDEs

3 simple and fool-proof:only features that support students beginning to learn Haskell

4 reliable

5 runs on all major platforms used by our students and staff(Windows, OS X, Linux, Solaris)

6 easy to install

7 small source code and easy to maintain

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 4 / 17

Page 11: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

The Solution: Heat

Editor

for a single module

syntax-highlighting

matching brackets

Status: ? ×√

Interpreter console

highlight prompt &errors

error: source line &explanation

Overview

defined types,functions, . . .

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 5 / 17

Page 12: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Checking Properties

Design recipe(How To Design Programs)

1 purpose in comment

2 type declaration

3 example properties

4 actual definition

5 test

-- yield square of given numbersquare :: Float -> Floatsquare x = x * x

prop_square1 = square 2 == 4prop_square2 = square 0 == 0prop_square3 = square (-4) == 16

Only Boolean unit tests, general QuickCheck later.

Properties separate in overview pane and automatic testing.

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 7 / 17

Page 13: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Composing Pictures

Simon Thompson The Craft of Functional Programming

A small library for making picturescompositionally:

data Picture -- abstract

horse :: Picturerotate90, flipV, flipH, invertColour:: Picture -> Picture

above , sideBySide, superimpose:: Picture -> Picture -> Picture

.......##...

.....##..#..

...##.....#.

..#.......#.

..#...#...#.

..#...###.#.

.#....#..##.

..#...#.....

...#...#....

....#..#....

.....#.#....

......##....ASCII art does not impress students!

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 9 / 17

Page 14: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Graphics via PDF

generate a PDF file

automatically start PDFviewer

separate from Heat

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 10 / 17

Page 15: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Implementation

Written by final year project students.

15.000 lines of Java

jEdit syntax package

lexing for syntax-highlighting

Hugs as separate process

communication only via textual input/output streamno interrupt signal: restart Hugs process

new basic Haskell parser

Hugs’ :browse and :info only works for valid Haskell

graphics in PDF

incremental graphics model of PDF poor fit

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 11 / 17

Page 16: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Student Feedback

It’s a great idea and much easier than using Hugs itself. Howeverit was inconsistent on the Mac and a total disaster on Vistawhich with the number of both on campus (CS specifically) isnot very useful. Preferences saving between sessions didn’t workvery well and the pop-up help did it’s own thing.It has issueswith line breaks too.

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 12 / 17

Page 17: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Evaluation

Reliability (spurious bug) main issue

Syntax error in expression (unexpected ‘;’, possibly due tobad layout) is all that needs to be said.

Fool-proof?Enter full path of Hugs...

Expect standard GUI featuresshortcut keys, OS X shortcuts, automatic indentation, . . .

Missing or awkward features not a problemno interrupt; expression input box

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 13 / 17

Page 18: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Why Not Use the Glasgow Haskell Compiler?

GHC’s error messages more detailed but

many messages, no stop after firstmention language extensions: fst :: forall a b. (a,b) -> ause substantial indentationerror location confusing, if in input expression

GHC is harder to install

GHC does not have built-in observe (future debugging)

Still, Heat should support GHC in future.

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 14 / 17

Page 19: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Big Role Model: DrScheme

Unfortunately relies on close integration of IDE with compiler and runtimesystem.

Different language levels with different error messages highly desirable,especially language with limited classes and without partial application.

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 15 / 17

Page 20: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Future Extensions

Not many!

include library documentation

Haddock: extensible, standardhandwritten: Prelude for novices (several levels?)

spelling help

support full QuickCheck

debugging via observing functions

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 16 / 17

Page 21: Heat --- An Interactive Development Environment for ... · only features that support students beginning to learn Haskell 4 reliable 5 runs on all major platforms used by our students

Conclusions

small but effective wrapper IDE possible

reliability most important, not features

Availability

Heat 1.1http://www.cs.kent.ac.uk/teaching/resources/haskell/heat.html

Heat 3.0real soon ... watch Haskell mailing list

Olaf Chitil (University of Kent) Heat — An IDE for Learning Haskell 11th September 2008 17 / 17