-
Notifications
You must be signed in to change notification settings - Fork 39
Conversation
................ | ||
```Haskell | ||
class (Functor f, Representable u) => | ||
Adjunction f u | f -> u, u -> f where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omitted functional dependencies in scala version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor stuff
return :: d -> m d | ||
``` | ||
```scala | ||
def `return`[D]: D => M[D] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an M[_]
type parameter is missing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, m is the (endo-) functor corresponding to R∘L, and w is the (endo-) functor corresponding to L∘R. As we’ll see later, they are part of the definition of a monad and a comonad, respectively.
It seemed to me like kind of a concrete example, however simplified:
trait Extract[M[_]] { // ingnore
def return[D](d: D): M[D]
} //ignore
extract :: w c -> c | ||
``` | ||
```scala | ||
def extract[C]: W[C] => C |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a W[_]
type parameter is missing here
src/main/tut/3.2-adjunctions.md
Outdated
implicit val F: Functor[F], | ||
val U: Representable[U] | ||
){ | ||
def unit[A](a: => A): U[F[A]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you decide to make a
byname here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember why I've added it, and don't see a reason to keep it.
src/main/tut/3.2-adjunctions.md
Outdated
/* changed the order of parameters | ||
to help scala compiler infer types */ | ||
def leftAdjunct[A, B] | ||
(a: => A)(f: F[A] => B): U[B] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question wrt byname
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing parameter order makes sense from a scala perspective, but it might make seeing the relationship harder if one doesn't also read the haskell code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why I've added a comment.
The reasons to change the order in scala version:
- We are still going to do it in scala for sometime
- This example:
rightAdjunct(a)(identity)
src/main/tut/3.2-adjunctions.md
Outdated
rightAdjunct f = counit . fmap f | ||
``` | ||
```scala | ||
def unit[A](a: => A): U[F[A]] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
byname
src/main/tut/3.2-adjunctions.md
Outdated
rightAdjunct(a)(identity) | ||
|
||
def leftAdjunct[A, B] | ||
(a: => A)(f: F[A] => B): U[B] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
ebf0ff5
to
7efb738
Compare
merged since I think all feedback addressed. |
Fixes #26