# Purview - A new framework for building websites

**URL:** <https://discourse.haskell.org/t/purview-a-new-framework-for-building-websites/7664>\
**Category:** Announcements\
**Created:** [September 23, 2023, 11:10pm UTC](https://discourse.haskell.org/t/purview-a-new-framework-for-building-websites/7664 "2023-09-23T23:10:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bontaq](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/bontaq/32/2589_2.png) [@bontaq](https://discourse.haskell.org/u/bontaq)\
**Post date:** [September 23, 2023, 11:10pm UTC](https://discourse.haskell.org/t/purview-a-new-framework-for-building-websites/7664/1 "2023-09-23T23:10:43Z")

</div>

Hello hello,

I’m happy to announce the first good release of [Purview](https://hackage.haskell.org/package/purview-0.2.0.0/docs/Purview.html). By good I mean I found myself having a good bit of fun writing a website with it.

The features, which are an assortment of things I’ve found nice across the ecosystem:

- Side-by-side styling for HTML
- State can be broken apart into smaller units, although you can still Elm it up and have one large event handler at the top
- Server side rendered
- Easy access to IO in handlers, with changes always run in green threads to avoid blocking
- Type safe events
- Reasonably simple interop with Javascript
- Basic hot reloading via ghcid

My focus has mostly been on the ergonomics of use, so it’s still missing plenty and performance has not been considered at all. One aim was to be able to call an existing library of code easily and get a website going quick!

To accompany this very alpha framework, there’s a very alpha [website](https://purview-hs.org). And, of course, the [github](https://github.com/purview-framework/purview).

I’d love to hear your thoughts and feel free to message me 🙂

---

<div class="post-metadata">

**Author:** ![srid](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/srid/32/5514_2.png) [@srid](https://discourse.haskell.org/u/srid)\
**Post date:** [September 24, 2023, 12:55am UTC](https://discourse.haskell.org/t/purview-a-new-framework-for-building-websites/7664/2 "2023-09-24T00:55:34Z")

</div>

> [@bontaq](#):
>
> Basic hot reloading via ghcid

That’s neat. ghcid is a great tool, I’ve also incorporated it in my static site generator ([Ema](https://ema.srid.ca/)) to provide hot reload: [Hot Reload – Ema](https://ema.srid.ca/topics/hot-reload#haskell-reload)

---

<div class="post-metadata">

**Author:** ![haroldcarr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/haroldcarr/32/4173_2.png) [@haroldcarr](https://discourse.haskell.org/u/haroldcarr)\
**Post date:** [September 24, 2023, 5:12am UTC](https://discourse.haskell.org/t/purview-a-new-framework-for-building-websites/7664/3 "2023-09-24T05:12:44Z")

</div>

Are there any tutorials or simple examples of using ghcid for hot reloading?

---

<div class="post-metadata">

**Author:** ![haroldcarr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/haroldcarr/32/4173_2.png) [@haroldcarr](https://discourse.haskell.org/u/haroldcarr)\
**Post date:** [September 24, 2023, 5:13am UTC](https://discourse.haskell.org/t/purview-a-new-framework-for-building-websites/7664/4 "2023-09-24T05:13:54Z")

</div>

I just skimmed the docs. Looks interesting and fun. Question: If one want to use a different HTML library (e.g., blaze-html), would that be possible?

---

<div class="post-metadata">

**Author:** ![haroldcarr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/haroldcarr/32/4173_2.png) [@haroldcarr](https://discourse.haskell.org/u/haroldcarr)\
**Post date:** [September 24, 2023, 5:18am UTC](https://discourse.haskell.org/t/purview-a-new-framework-for-building-websites/7664/5 "2023-09-24T05:18:36Z")

</div>

Looking at the Purview haddock, I see this

```haskell
ghcid --command 'stack ghci yourProject/Main.hs' --test :main

```

so maybe that’s the answer to my question.

And continuing looking, I see [https://github.com/srid/ema/blob/master/bin/run](https://github.com/srid/ema/blob/master/bin/run)

It works - thanks!

---

<div class="post-metadata">

**Author:** ![srid](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/srid/32/5514_2.png) [@srid](https://discourse.haskell.org/u/srid)\
**Post date:** [September 24, 2023, 1:48pm UTC](https://discourse.haskell.org/t/purview-a-new-framework-for-building-websites/7664/6 "2023-09-24T13:48:21Z")

</div>

You can also store the arguments in a `.ghcid` file ([example](https://github.com/srid/ema-template/blob/master/.ghcid)) … then, simply running `ghcid` (without arguments) will work.

---

<div class="post-metadata">

**Author:** ![bontaq](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/bontaq/32/2589_2.png) [@bontaq](https://discourse.haskell.org/u/bontaq)\
**Post date:** [September 24, 2023, 2:10pm UTC](https://discourse.haskell.org/t/purview-a-new-framework-for-building-websites/7664/7 "2023-09-24T14:10:13Z")

</div>

> [@haroldcarr](#):
>
> I just skimmed the docs. Looks interesting and fun. Question: If one want to use a different HTML library (e.g., blaze-html), would that be possible?

Right now I don’t think it’s possible to use another HTML library but it’d be interesting to see what it’d take to allow that. Blaze-html is something I’m looking at moving all the behind the scenes HTML construction in Purview to for speeed.

And to answer your question about the hot reloading, yep it’s just using ghcid to restart the process on changes. Purview will then re-request the page on reconnection when you have `devMode` set to `True` ala

```haskell
main = serve defaultConfiguration { devMode=True } yourComponent

```

which it does by default.

---

<div class="post-metadata">

**Author:** ![haroldcarr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/haroldcarr/32/4173_2.png) [@haroldcarr](https://discourse.haskell.org/u/haroldcarr)\
**Post date:** [September 24, 2023, 2:23pm UTC](https://discourse.haskell.org/t/purview-a-new-framework-for-building-websites/7664/8 "2023-09-24T14:23:02Z")

</div>

I’ve got a bunch of blaze code that I would not want to redo.

Thanks for pointing out that code for “re-request”.
