-
Notifications
You must be signed in to change notification settings - Fork 19
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
ADD: Eq, Ord, and Show instances for JSDate #17
ADD: Eq, Ord, and Show instances for JSDate #17
Conversation
Resolves #14 |
@@ -263,3 +272,6 @@ toTimeString dt = runFn2 dateMethod "toTimeString" dt | |||
-- | Returns the date as a string using the UTC timezone. | |||
toUTCString :: JSDate -> String | |||
toUTCString dt = runFn2 dateMethod "toUTCString" dt | |||
|
|||
-- | Returns the date at a number of milliseconds since 1970-01-01 00:00:00 UTC. | |||
foreign import fromTime :: Number -> JSDate |
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.
fromTime
isn't exported or used?
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.
It already exists as fromInstant
too, I'd prefer we use that instead.
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.
fromTime
copes with NaN
and out of bound Number
s in the native way, which is not something that makes much sense with Instant
.
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.
Can you add the fromTime
export? Then I'll finally get this merged in and released.
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 guess it disappeared again in the convoluted reversion process 😉
@LiamGoodacre I have not the slightest idea of what you are talking about. |
|
I agree that this is not an obvious use of Generic but I do not know what the problem is. My understanding of Generic is that it supports encoding and decoding from types constructed from select constructors such as The ADT JSDate is analogous to is:
Hence my choice for the Generic representation. |
Well, as an example, |
I am not invested in the intentions of Generic. I am just looking at what Generic actually is. There is no reason to expect
I will submit that revision. |
genericShow produces valid PureScript code.
To be completely upfront (and well, a more than a little stubborn) I'm probably not going to merge this as long as there's a Can I ask why the instance is even useful for this type, since you've implemented the other instances that are usually generic derived anyway? |
No I am glad you are making the discussion straight-forward! Okay, I have reverted the addition of Generics. |
No description provided.