Skip to content
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

move the Id type alias to the Id object #186

Merged
merged 6 commits into from
Feb 13, 2015
Merged

Conversation

stew
Copy link
Contributor

@stew stew commented Feb 12, 2015

this fixes #185
also adds docs to the website for Id, so if you merge, please consider running ghpagesPushSite.

this fixes typelevel#185
also adds docs to the website for Id, so if you merge, please consider running ghpagesPushSite.
def coflatMap[A, B](a: Id[A])(f: Id[A] => B): Id[B]
```

But then realize that in the flatMap signature, since `Id[B]` is the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks a bit weird to start this sentence with "But then" but it is probably because I am not a native speaker.

I might have said something like: "when you compare ... you realize that if you replace Id[X] by X, they all have the same signature which is simply function application"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julien-truffaut added a new commit with a correction, tell me if this reads better for you.

@julien-truffaut
Copy link
Contributor

it looks great!

@julien-truffaut
Copy link
Contributor

👍

@milessabin
Copy link
Member

Should Id be covariant? I ask mainly because you say,

We can freely treat values of type A as values of type Id[A], and vice-versa.

which is only strictly true if it is.

@ceedubs
Copy link
Contributor

ceedubs commented Feb 12, 2015

@milessabin that's a good question.

I've never found myself wanting Id to be covariant. Does anyone have examples of when it would have been useful?

@milessabin in the (current) case of Id invariance, is there an alternate wording you would propose?

@ceedubs
Copy link
Contributor

ceedubs commented Feb 12, 2015

Also I'm okay with merging this now and addressing the covariant question separately.

@mpilquist
Copy link
Member

Alternatively, could we move the Id instance to the package object and rename it to val Id: ...? I always disliked explaining to folks why there was an Id.Id.

@milessabin
Copy link
Member

Id in shapeless (and I think in Scalaz?) is covariant. I just tried making it invariant and nothing broke.

On reflection I think your wording is fine. Substitution is fine for values, just not for types. This is odd, to put it mildly, but I think that's @odersky's problem, not ours ;-)

@milessabin
Copy link
Member

👍

@julien-truffaut
Copy link
Contributor

@mpilquist I like Id to be it is own file when you're browsing github. At the same time, since there is good documentation on the website, there is less interest to look at the file structure.

@mpilquist
Copy link
Member

@julien-truffaut That's definitely understandable. At the same time, many users will never look at the source -- or at least will never want to look at the source. I guess the question is whether avoiding the strangeness of import Id.Id outweighs the benefit of having Id defined in its own source file.

@julien-truffaut
Copy link
Contributor

@mpilquist completely agree

@aryairani
Copy link
Contributor

I've always found import scalaz.Id.Id to be annoying, although I never took the time to understand the reason for it.

@non
Copy link
Contributor

non commented Feb 12, 2015

I like @mpilquist's suggestion here. Let's try it?

(I would be open to @stew doing it here or someone else opening a competing PR.)

@mpilquist
Copy link
Member

Oh, one improvement -- we could actually just define it as a companion directly in the package object.

package object cats {

  type Id[A] = A
  object Id extends Bimonad[Id] ...
}

@aryairani
Copy link
Contributor

implicit object Id extends ... ?

@aryairani
Copy link
Contributor

... or does that cause ambiguity?

@mpilquist
Copy link
Member

Right, yes, sorry

On Feb 12, 2015, at 11:20 AM, Arya Irani notifications@github.com wrote:

... or does that cause ambiguity?


Reply to this email directly or view it on GitHub.

@stew
Copy link
Contributor Author

stew commented Feb 13, 2015

yeah, that works for me, added a commit which moves the implicit into the package object.

@aryairani
Copy link
Contributor

@stew ruh roh, build failed :-/

@non
Copy link
Contributor

non commented Feb 13, 2015

👍

non added a commit that referenced this pull request Feb 13, 2015
move the Id type alias to the Id object
@non non merged commit d4c0e3a into typelevel:master Feb 13, 2015
@non non removed the in progress label Feb 13, 2015
@stew stew deleted the issue/185 branch March 7, 2015 07:12
@travisbrown travisbrown mentioned this pull request Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

its hard to use Id
7 participants