Skip to content

line cap and dimensions bindings #1

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

Merged
merged 2 commits into from
Aug 18, 2014
Merged

Conversation

Fresheyeball
Copy link
Contributor

No description provided.

data LineCap = Round | Square | Butt

instance showLineCap :: Show LineCap where
show Round = "round"
Copy link
Contributor

Choose a reason for hiding this comment

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

This instance doesn't follow the "implicit contract" of Show that show x should evaluate to x in the REPL. Can we split this into a Show instance and another function to render a LineCap for use in setLineCap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im sorry, but i do not understand this comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

So, if you show something, you should be able to take the string and paste it into the REPL, and it should work, but round, for example does not evaluate to Round. This should be

show Round = "Round"

etc. with another function used to turn LineCaps into Strings for passing to the setLineCapImpl function.

Either that or make LineCap into a newtype around String.

@paf31
Copy link
Contributor

paf31 commented Aug 17, 2014

Looks good, I just put a few comments in the code.

@garyb
Copy link
Member

garyb commented Aug 18, 2014

Do the various get functions need the effect, aside from getContext2D they're pure aren't they?

@Fresheyeball
Copy link
Contributor Author

The dimensions of the canvas are mutable. So if readSTRef needs an effect, then I feel this does too.

paf31 added a commit that referenced this pull request Aug 18, 2014
line cap and dimensions bindings
@paf31 paf31 merged commit b9a2129 into purescript-web:master Aug 18, 2014
@paf31
Copy link
Contributor

paf31 commented Aug 18, 2014

👍 Thanks!

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.

3 participants