Hi,
Something that's great about Servant is having a very descriptive type for the APi, like
`Get '[JSON] [Toy]`.
And also being able to return different types of responses using instances, like returning JSON or HTML as long as I've got ToJSON and ToMarkup instances of `Something`:
`Get '[JSON,HTML] [Toy]`
If i'm returning HTML, its for humans to look at, so I want to wrap my site in something nice with a layout, a header, a footer, etc. What's a nice way to do that with Servant?
I can think of a few approaches, and i'm curious if there's a community-preferred practice.
1. Just create new alternative enpoints like `Get '[HTML] Html`.
This would let me write a handler to produce any html i want, but now the api type doesn't say anything about what this enpoint is, anymore.
2. Write my ToMarkup intances of types to include all the site layout/wrapper content, like
```
toMarkup a = wrapInSiteBase $ div
show a
```
The problem I run into this way is if i've got multiple types. Type `Fruit` needs a page for each Fruit, so it needs an instance that wraps it in the site wrapper. But it also is part of the type `Basket [Fruit] [Vegetable]`, and `Basket` also needs a ToMarkup instance. It will be convenient in `Basket`'s `ToMarkup` instance to call `toMarkup fruit`. But now I've included the site wrapper multiple times.
I have only just started going down this road, and it seems like it'll work, but it'll be very rigid. There will only be one wrapper that I'll be able to apply, so it'll be useful for adding a site-wide theme/header/styles.
I hope this makes sense, and i'm happy to add more detail, if it'd be helpful.
Thanks!