# Scaling Views with Master View Types

**URL:** <https://discourse.elm-lang.org/t/scaling-views-with-master-view-types/4014>\
**Category:** Show and Tell\
**Created:** [July 18, 2019, 7:40am UTC](https://discourse.elm-lang.org/t/scaling-views-with-master-view-types/4014 "2019-07-18T07:40:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [July 18, 2019, 10:10am UTC](https://discourse.elm-lang.org/t/scaling-views-with-master-view-types/4014/2 "2019-07-18T10:10:07Z")

</div>

Hi,

You talk about the idea of ‘Reusable Views’ which is something that chimes with me. I also like the idea of using types to guide the implementation of a program at a larger scale. We use types all the time for small stuff, like making sure we put the right kind of thing into a list, but it can be very powerful to use types in a more zoomed out fashion to give shape to a whole application.

The principal way in which functional programming allows for code re-use is through higher-order functions. In your article you have explored a different approach, which is to use a custom type to describe a set of permitted options (TextBanner, ViewerBanner, ArticleBanner, …) and to restrict construction of the view using that type so that the various pieces of the view can only be plugged together in the right way.

I have previously explored the other option, which is to make use of higher-order functions; to allow customizable behaviour to be plugged into some defined piece of view logic in order to make it work in different settings. This is a more open-ended way of re-using code.

> [@Looking into Guide Types](https://discourse.elm-lang.org/t/looking-into-guide-types/2507):
>
> I don’t know if this concept has another name, because it is something that I thought of myself, and I call it ‘guide types’. But I am sure I am not the first to think of it, so do let me know if you have another name for it. A ‘guide type’ is a type, usually higher order, that aims to structure a whole program or at least a larger piece of a program, not just an individual function or data model or module. They are very often higher order, because they describe a way in which two pieces of sof…

Perhaps you will find this interesting, when considering the use of ‘large types’ in overall program structure.

---

_[View the full topic](https://discourse.elm-lang.org/t/scaling-views-with-master-view-types/4014)._
