Permalink
Browse files

Rebrand higher-rank + constructors as the basis for the new Hackett impl

  • Loading branch information...
lexi-lambda committed May 9, 2017
1 parent b1fb4a1 commit 1fd7fc905b93f68e39b9d01fedc4fb52aa44c4c4
View
@@ -5,6 +5,7 @@ env:
- RACKET_DIR: '~/racket'
matrix:
- RACKET_VERSION: 6.8
- RACKET_VERSION: 6.9
- RACKET_VERSION: HEAD
before_install:
@@ -13,7 +14,7 @@ before_install:
- export PATH="${RACKET_DIR}/bin:${PATH}"
install:
- raco pkg install --installation --auto --name higher-rank --link $TRAVIS_BUILD_DIR
- raco pkg install --installation --auto --link $TRAVIS_BUILD_DIR/hackett-lib
script:
- raco test -ep higher-rank
- raco test -ep hackett-lib
View
@@ -1,28 +1,69 @@
# higher-rank
# Hackett [![Build Status](https://travis-ci.org/lexi-lambda/hackett.svg?branch=master)](https://travis-ci.org/lexi-lambda/hackett)
A Racket implementation of [Complete and Easy Bidirectional Typechecking
for Higher-Rank Polymorphism][complete-and-easy] using the techniques outlined in [Type Systems as Macros][types-as-macros]. This is a sister project to [the simpler Haskell implementation][haskell-higher-rank] from which it is adapted.
Hackett is an attempt to implement a Haskell-like language with support for Racket’s macro system, built using the techniques described in the paper [*Type Systems as Macros*][types-as-macros]. It is currently *extremely* work-in-progress.
This project should be installed as a Racket package, and it defines `#lang higher-rank`. You can run a REPL from within DrRacket, or you can use the command line:
Here are some of the features that Hackett supports **right now**:
- Bidirectional type inference
- Higher-rank polymorphism
- Type-aware/type-directed macros
Here are some of the features that still need to be implemented for a minimal release:
- Algebraic datatypes (ADTs)
- Higher-kinded types
- Typeclasses
- Kindchecking
- Exhaustiveness checking
- Type inference for recursive definitions
- Type expanders (of which type aliases are a subset)
And finally, here is a (non-exhaustive) collection of features I would like to eventually support:
- Multi-parameter typeclasses
- Functional dependencies
- Syntax for infix operators
- GADTs
- Row types
- Type families
Due to the way Hackett is implemented, many things that are language features in Haskell can be derived concepts in Hackett. In fact, Hackett’s ADTs are not primitives, they are actually implemented as a library via the `data` and `case` macros in `hackett/private/adt`. Other things, like newtype deriving and generics, should be possible to implement as derived concepts as well.
Here’s what some Hackett code *might* eventually look like:
```
$ cd racket-higher-rank
$ raco pkg install
$ racket -iI higher-rank
Welcome to Racket v6.8.0.3.
> unit
: Unit
#<unit>
> (lambda x x)
: (-> g1^ g1^)
#<procedure:...er-rank/main.rkt:70:18>
> ((: (lambda id ((id (lambda x x)) (id unit)))
(-> (forall a (-> a a)) Unit))
(lambda x x))
: Unit
#<unit>
#lang hackett
(data (Maybe a)
nothing
(just a))
(def x : Int
(let ([y 3]
[z 7])
{y + z}))
(class (Show a)
[show : {Int -> a -> String}])
(instance (forall [a] (Show a) => (Show (Maybe a)))
(def+ show
[nothing -> "nothing"]
[(just x) -> {"just " <> (show x)}]))
```
[complete-and-easy]: http://www.cs.cmu.edu/~joshuad/papers/bidir/
[types-as-macros]: http://www.ccs.neu.edu/home/stchang/popl2017/
[haskell-higher-rank]: https://github.com/lexi-lambda/higher-rank
Some of the above syntax is already implemented, but most things are not.
## Trying Hackett
To reiterate: **Hackett is extremely experimental right now.** Things are not guaranteed to work correctly (or work at all), and things are likely to change dramatically. If you really want to install Hackett to play around with it, though, you can.
You will need to have Racket installed to use Hackett. Using `raco`, you can install Hackett as a package:
```
$ raco pkg install hackett
```
Now you can use Hackett by writing `#lang hackett` at the top of a file.
[types-as-macros]: http://www.ccs.neu.edu/home/stchang/pubs/ckg-popl2017.pdf
@@ -10,9 +10,9 @@
racket/match
syntax/parse/define
(for-syntax higher-rank/private/typecheck
higher-rank/private/util/list
higher-rank/private/util/stx))
(for-syntax hackett/private/typecheck
hackett/private/util/list
hackett/private/util/stx))
(provide #%module-begin #%top
(rename-out [datum #%datum]
@@ -13,8 +13,8 @@
syntax/parse
threading
higher-rank/private/util/list
higher-rank/private/util/stx)
hackett/private/util/list
hackett/private/util/stx)
(provide (contract-out [struct τ:var ([x identifier?])]
[struct τ:var^ ([x^ identifier?])]
File renamed without changes.
View
@@ -0,0 +1,10 @@
#lang info
(define collection 'multi)
(define deps
'("hackett-lib"))
(define build-deps
'())
(define implies deps)

0 comments on commit 1fd7fc9

Please sign in to comment.