Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

State without width and height (or with width and height of type Size a)? #6

Open
liammcdermott opened this issue Apr 4, 2018 · 3 comments · May be fixed by #7
Open

State without width and height (or with width and height of type Size a)? #6

liammcdermott opened this issue Apr 4, 2018 · 3 comments · May be fixed by #7

Comments

@liammcdermott
Copy link

liammcdermott commented Apr 4, 2018

Thanks for the library, it's very helpful. My use case is that I have a leaflet map where the container element should have CSS width: 100%.

I notice the State type includes width and height fields; they're Int type and it's assumed they're pixel values. I would like to either avoid setting the width and height on the container element (and just use good old fashioned CSS), or use any Size a as the width/height, i.e. changing:

type State =
  { width ∷ Int
  , height ∷ Int
  , view ∷ LC.LatLng
  , zoom ∷ LC.Zoom
  , leaflet ∷ Maybe LC.Leaflet
  }

to

type State a =
  { width ∷ Size a
  , height ∷ Size a
  , view ∷ LC.LatLng
  , zoom ∷ LC.Zoom
  , leaflet ∷ Maybe LC.Leaflet
  }

(and then fixing the code using that type). The problem is this would (probably?) break any code using this library, so I'm wondering: would the contributors accept such a change, if not what change would be accepted to support my use case?

Thanks for your consideration.

@safareli
Copy link
Contributor

safareli commented Apr 4, 2018

You can also do Exists Size so that you don't need to add a to State

@cryogenian
Copy link
Member

cryogenian commented Apr 4, 2018

Also why should we stick with Sizes? I'd say having style :: CSS would be better, wouldn't it?
No problem with major version bump though

@liammcdermott
Copy link
Author

style :: CSS sounds like a good idea! I'll base my patch on that.

You can also do Exists Size so that you don't need to add a to State

Even if this isn't the approach we end up using, I have no idea how this would work in the type system, so I'll have to check it out. Thank you for the pointer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants