-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for the Invariant
typeclass
#710
Conversation
Current coverage is
|
Thanks! Looks good at a first glance. I'll take a more detailed look. |
--- | ||
# Invariant | ||
|
||
The `Invariant` typeclass is for `Functor`s that define an `imap` |
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.
We should probably be careful with wording here. In Cats, Functor
means covariant functor. To me, this sentence makes it sound like Invariant
is a subtype of Functor
, while it's actually the other way around. This may be solved by just changing Functor
to a generic "functor". That could potentially also be confusing to people who think that Functor
and "functor" would be synonymous. It may be fine though.
620b971
to
d3bf613
Compare
Added a full example at the end ;) |
Semigroup[Long].imap(longToDate)(dateToLong) | ||
|
||
val today: Date = longToDate(1449088684104l) | ||
val timeLeft: Date = longToDate(1900918893l) |
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.
In the spirit of the work that has just been done for #709, maybe we should put all but the last line of this into a tut:silent
shed, and just use tut
(with output) for the today |+| timeLeft
. The output for imports, etc is pretty noisy.
f53d72f
to
4425621
Compare
4425621
to
66297a1
Compare
I added two versions of the import, the version that imports all the stuff and a commented out version that is more explicit. @mikejcurry good catch for the typo :) |
I ran |
👍 |
Documentation for the `Invariant` typeclass
Adds a
tut
section aboutInvariant
as discussed in #164. I oriented the explanation according to @ceedubs example, I hope this is okay.I wasn't able to test the
jekyll serve
because it fails on my pc due to a missing ruby dependency, so I am not sure if adding the file is enough to make it show up on the typeclasses site? If someone could check that that'd be great :).If merged this fixes #164.
-- 24pullrequests