Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Conversation

@Risto-Stevcev
Copy link
Contributor

No description provided.

@garyb
Copy link
Member

garyb commented Oct 20, 2016

Thanks for working on these. I'll come back to this later once Aff has been updated (for the tests).

@garyb
Copy link
Member

garyb commented Oct 22, 2016

Aff can be bumped to 2.0.0 now, which hopefully will get things passing again.

@Risto-Stevcev
Copy link
Contributor Author

@garyb Got the checks to pass

Copy link
Member

@garyb garyb left a comment

Choose a reason for hiding this comment

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

Thanks for working on these! There's a few things I'd like removed or updated before merging though.


foreign import close :: forall eff. Window -> Eff (window :: WINDOW | eff) Unit

foreign import closed :: forall eff. Window -> Eff (window :: WINDOW | eff) Boolean
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this, it's a nonstandard property - this library is intentionally only implementing standards, even when things are commonly available.


foreign import length :: forall eff. Window -> Eff (window :: WINDOW | eff) Int

foreign import minimize :: forall eff. Window -> Eff (window :: WINDOW | eff) Unit
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this one too.

-> String
-> String
-> String
-> Eff (window :: WINDOW | eff) (Maybe Window)
Copy link
Member

Choose a reason for hiding this comment

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

You could implement this with Nullable instead and then use toMaybe. Something like this:

https://github.com/purescript-contrib/purescript-dom/blob/f7b786d9f005df0a41b1da63d3525b8d8ae55457/src/DOM/HTML/Event/DragEvent/DataTransfer.purs#L20-L23

The FFI code can just be currying then, with no need to handle the Nothing / Just arguments.

-> (forall a. Maybe a)
-> Window
-> String
-> Eff (prompt :: PROMPT | eff) (Maybe String)
Copy link
Member

Choose a reason for hiding this comment

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

Another case where Nullable can be used.

@Risto-Stevcev
Copy link
Contributor Author

@garyb Updated it

How do you feel about extending purescript-nullable to have Undefinable and NullOrUndefinable? Nullable is a lot easier to use than Data.Foreign.Null, but it doesn't have the equivalent Data.Foreign.Undefined and Data.Foreign.NullOrUndefined

@garyb
Copy link
Member

garyb commented Oct 23, 2016

Nullable is already NullOrUndefined, as it's not intended for precise data format matching like Foreign is - it's just a helper for when you have functions that might not return a value. Is the distinction necessary here? I wouldn't have though so.

Copy link
Member

@garyb garyb left a comment

Choose a reason for hiding this comment

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

Sorry, just noticed another thing - the argument orders are all "javascripty" rather than "purescripty" - window should be the last argument in each case, as then you can do things like:

alert "hi" =<< window

@Risto-Stevcev
Copy link
Contributor Author

Rearranged it

@garyb
Copy link
Member

garyb commented Oct 23, 2016

Thanks!

@garyb garyb merged commit 60bd12c into purescript-deprecated:master Oct 23, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants