Skip to content

Commit

Permalink
more readme cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
non committed Mar 9, 2014
1 parent 7457a64 commit 045a739
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
19 changes: 19 additions & 0 deletions COPYING
@@ -0,0 +1,19 @@
Copyright (c) 2011-2014 Erik Osheim.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 19 additions & 17 deletions README.md
Expand Up @@ -98,9 +98,9 @@ easier to type or say, and the latter is less verbose.
Here are some examples:

```scala
Lambda[A => (A, A)] // equivalent to: type R[A] = (A, A)
Lambda[(A, B) => Either[B, A]] // equivalent to: type R[A, B] = Either[B, A]
Lambda[A => Either[A, List[A]] // equivalent to: type R[A] = Either[A, List[A]]
Lambda[A => (A, A)] // equivalent to: type R[A] = (A, A)
Lambda[(A, B) => Either[B, A]] // equivalent to: type R[A, B] = Either[B, A]
Lambda[A => Either[A, List[A]]] // equivalent to: type R[A] = Either[A, List[A]]
```

Since types like `(+A, +B) => Either[A, B]` are not syntactically
Expand All @@ -118,9 +118,9 @@ other usage.)
Here are some examples with variance:

```scala
λ[`-A` => Function1[A, Double]] // equivalent to: type R[-A] = Function1[A, Double]
λ[(-[A], +[B]) => Function2[A, Int, B]] // equivalent to: type R[-A, +B] = Function2[A, Int, B]
λ[`+A` => Either[List[A], List[A]] // equivalent to: type R[+A] = Either[List[A], List[A]]
λ[`-A` => Function1[A, Double]] // equivalent to: type R[-A] = Function1[A, Double]
λ[(-[A], +[B]) => Function2[A, Int, B]] // equivalent to: type R[-A, +B] = Function2[A, Int, B]
λ[`+A` => Either[List[A], List[A]]] // equivalent to: type R[+A] = Either[List[A], List[A]]
```

The function syntax also supports higher-kinded types as type
Expand All @@ -144,7 +144,7 @@ expressions.
Either[Int, ?]
({type L_kp[X_kp1] = (Int, X_kp1)})#L_kp

Function2[-?, String, +?]
type Function2[-?, String, +?]
({type L_kp[-X_kp0, +X_kp2] = Function2[X_kp0, String, X_kp2)})#L_kp

Lambda[A => (A, A)]
Expand All @@ -157,20 +157,19 @@ Lambda[(A, B[_]) => B[A]]
({type L_kp[A, B[_]] = B[A]})#L_kp
```

As you can see, the reason that names like `L_kp` and `X_kp0` are
forbidden is that they would potentially conflict with the names of
types generated by the plugin.
As you can see, names like `L_kp` and `X_kp0` are forbidden because
they might conflict with names the plugin generates.

### Building the plugin

You can build kind-projector using SBT 0.13.0 or newer.

Here are some useful targets:

* compile: compile the code
* package: build the plugin jar
* test: compile the test files (no tests run; compilation is the test)
* console: launch a REPL with the plugin loaded so you can play around
* `compile`: compile the code
* `package`: build the plugin jar
* `test`: compile the test files (no tests run; compilation is the test)
* `console`: launch a REPL with the plugin loaded so you can play around

You can use the plugin with `scalac` by specifying it on the
command-line. For instance:
Expand All @@ -192,7 +191,7 @@ Others have noted that it would be nicer to be able to use `_` for
types the way we do for values, so that we could use `Either[Int, _]`
to define a type lambda the way we use `3 + _` to define a
function. Unfortunately, it's probably too late to modify the meaning
of _, which is why we chose to use `?` instead.
of `_`, which is why we chose to use `?` instead.

### Future Work

Expand All @@ -204,15 +203,18 @@ for which kind-projector lacks a syntax, please report it.

Kind projector is an unusual compiler plugin in that it runs *before*
the `typer` phase. This means that the rewrites and renaming we are
doing is relatively fragile, and the author disclaims all warranty or
doing are relatively fragile, and the author disclaims all warranty or
liability of any kind.

(That said, there are currently no known bugs.)

If you are using kind-projector in one of your projects, please feel
free to get in touch to report problems (or a lack of problems)!

### Copyright and License

All code is available to you under the MIT license, available at
http://opensource.org/licenses/mit-license.php.
http://opensource.org/licenses/mit-license.php and also in the COPYING
file.

Copyright Erik Osheim, 2011-2014.

0 comments on commit 045a739

Please sign in to comment.