Nice writeup. Thank you for sharing.

One question you might or might not have asked yourself is whether the 
encapsulation is worth it. Why should the `Period` state be hidden with an 
opaque type? If you're writing a library, then, yes, it makes total sense 
so that you can avoid having to make major version bumps as the library 
evolves. But if this is an application-specific component which will only 
ever be used *within* this project, then you might not need the 
encapsulation.

Encapsulation is useful as a technique for managing software complexity. 
But a purely functional program without shared references to mutable state, 
does not have as much intrinsic complexity as a standard OOP program. So 
encapsulation is not *necessarily* something that you need to reach for *as 
frequently*.

As a total aside: if you haven't already seen it, you might want to look at 
Evan's README for elm-sortable-table 
<https://github.com/evancz/elm-sortable-table>, which has some notes on API 
design of component-like libraries.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to