Skip to content

Commit 1323d2e

Browse files
committed
0.2.2 release
1 parent 3f7a9d4 commit 1323d2e

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

README.md

+18-13
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
Boilerplate free Tagless Final DSL macro annotation, written in [scala.meta](http://scalameta.org/) for future compatibility and other nice things (e.g. free IDE support, like in IntelliJ).
44

5+
This library provides 2 macros:
6+
7+
1. [`@diesel`](#diesel) to make it easier to compose algebras together
8+
2. [`@ktrans`](#ktrans) to make it easier to perform Kind transforms on interpreters.
9+
510
## `@diesel`
611

712
The `@diesel` annotation that cuts out the boilerplate associated with writing composable Tagless Final DSLs.
813

9-
The Dsl can be accessed directly from the companion object if you import a converter located in `ops`
14+
The Dsl can be accessed directly from the companion object if you import a converter located in `ops`
1015
(customisable by passing a name to the annotation as an argument). This are useful when you need to compose multiple DSLs in the context of `F[_]`, but do not want to name all the interpreter parameters.
1116

1217
### Example:
@@ -54,17 +59,17 @@ object DieselDemo {
5459

5560
}
5661
/*
57-
[info] Running DieselDemo
62+
[info] Running DieselDemo
5863
result 3
5964
*/
6065
```
6166

6267
For more in-depth examples, check out:
6368

64-
1. [examples/KVSApp](https://github.com/lloydmeta/diesel/blob/master/examples/src/main/scala/KVSApp.scala): a simple single-DSL program
69+
1. [examples/KVSApp](https://github.com/lloydmeta/diesel/blob/master/examples/src/main/scala/KVSApp.scala): a simple single-DSL program
6570
2. [examples/KVSLoggingApp](https://github.com/lloydmeta/diesel/blob/master/examples/src/main/scala/KVSLoggingApp.scala): composing 2 DSLs in a program
6671
3. [examples/FibApp](https://github.com/lloydmeta/diesel/blob/master/examples/src/main/scala/FibApp.scala): composing 3 DSLs in a program that calculates fibonacci numbers and caches them.
67-
72+
6873
All of the above examples use a pure KVS interpreter :)
6974

7075
### How it works
@@ -90,10 +95,10 @@ trait Maths[F[_]] {
9095
object Maths {
9196

9297
def apply[F[_]](implicit m: Maths[F]): Maths[F] = m
93-
94-
// In charge of aliasing your singleton Maths object to an in-scope Maths[F] :)
95-
object op {
96-
implicit def toDsl[F[_]](o: Maths.type)(implicit m: Maths[F]): Maths[F] = m
98+
99+
// In charge of aliasing your singleton Maths object to an in-scope Maths[F] :)
100+
object op {
101+
implicit def toDsl[F[_]](o: Maths.type)(implicit m: Maths[F]): Maths[F] = m
97102
}
98103
}
99104

@@ -105,7 +110,7 @@ object Maths {
105110
There is also a handy `@ktrans` annotation that adds a `transformK` method to a trait that is parameterised by a Kind that
106111
takes 1 type parameter. It's useful when you want to transform any given implementation of that trait for `F[_]` into one
107112
that implements it on `G[_]`
108-
113+
109114
### Example
110115

111116
```scala
@@ -129,14 +134,14 @@ val MathsIdInterp = new Maths[Id] {
129134
// Id to Option
130135
val idToOpt = λ[FunK[Id, Option]](Some(_))
131136

132-
// use the auto-generated transformK method to create a Maths[Option] from Maths[Id]
137+
// use the auto-generated transformK method to create a Maths[Option] from Maths[Id]
133138
// via idToOpt
134139
val MathsOptInterp = MathsIdInterp.transformK(idToOpt)
135140

136141
assert(MathsOptInterp.add(3, 10) == Some(13))
137142
```
138143

139-
There are conversions from Cat's natural transformation (`FunctionK`) or Scalaz's `NaturalTransformation` in the
144+
There are conversions from Cat's natural transformation (`FunctionK`) or Scalaz's `NaturalTransformation` in the
140145
`diesel-cats` and `diesel-scalaz` companion projects.
141146

142147
### Limitations
@@ -145,7 +150,7 @@ There are conversions from Cat's natural transformation (`FunctionK`) or Scalaz'
145150
- No unimplemented methods that return types not contained by the type parameter of the algebra
146151
- No unimplemented type members
147152
- No vals that are not assignments
148-
153+
149154
### How it works
150155

151156
```scala
@@ -164,7 +169,7 @@ trait Maths[G[_]] {
164169
def add(l: Int, r: Int): G[Int]
165170
def subtract(l: Int, r: Int): G[Int]
166171
def times(l: Int, r: Int): G[Int]
167-
172+
168173
// Note that FunK is a really simple NaturalTransform / FunctionK
169174
final def transformK[H[_]](natTrans: FunK[G, H]): Maths[H] = {
170175
val curr = this

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
lazy val theVersion = "0.2.2-SNAPSHOT"
1+
lazy val theVersion = "0.2.2"
22

33
lazy val theScalaVersion = "2.11.11"
44
lazy val scalaVersions = Seq("2.11.11", "2.12.2")

0 commit comments

Comments
 (0)