Skip to content

Commit

Permalink
Rename Compose to Nested, add tests, change tut
Browse files Browse the repository at this point in the history
  • Loading branch information
adelbertc committed May 16, 2016
1 parent a6c5d5c commit 3c90ab3
Show file tree
Hide file tree
Showing 18 changed files with 391 additions and 407 deletions.
201 changes: 0 additions & 201 deletions core/src/main/scala/cats/data/Compose.scala

This file was deleted.

10 changes: 5 additions & 5 deletions core/src/main/scala/cats/data/Func.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ sealed abstract class AppFunc[F[_], A, B] extends Func[F, A, B] { self =>
}
}

def compose[G[_], C](g: AppFunc[G, C, A]): AppFunc[Compose[G, F, ?], C, B] = {
implicit val gfApplicative: Applicative[Compose[G, F, ?]] = Compose.composeApplicative[G, F](g.F, F)
Func.appFunc[Compose[G, F, ?], C, B]({
c: C => Compose(g.F.map(g.run(c))(self.run))
def compose[G[_], C](g: AppFunc[G, C, A]): AppFunc[Nested[G, F, ?], C, B] = {
implicit val gfApplicative: Applicative[Nested[G, F, ?]] = Nested.nestedApplicative[G, F](g.F, F)
Func.appFunc[Nested[G, F, ?], C, B]({
c: C => Nested(g.F.map(g.run(c))(self.run))
})
}

def andThen[G[_], C](g: AppFunc[G, B, C]): AppFunc[Compose[F, G, ?], A, C] =
def andThen[G[_], C](g: AppFunc[G, B, C]): AppFunc[Nested[F, G, ?], A, C] =
g.compose(self)

def map[C](f: B => C): AppFunc[F, A, C] =
Expand Down
Loading

0 comments on commit 3c90ab3

Please sign in to comment.