seanhess / hyperbole

Haskell interactive serverside web framework inspired by HTMX
Other
95 stars 6 forks source link

Better Handle/Load interface with tuples #41

Closed seanhess closed 3 weeks ago

seanhess commented 3 weeks ago

In #31 @benjaminweb correctly pointed out that the new type-safe handler API is annoying. We can't use the monadic interface any more, and the current main branch has an interface like:

page :: Hyperbole :> es => Page es '[Central, Presets, Handler3]
page = 
  handle central $ handle presets $ handle handler3 $ load $ do
    ...

With this PR, it changes to this:

page :: Hyperbole :> es => Page es (Central, Presets, Handler3)
page = 
  handle (central, presets, handler3) $ do
    ...

It doesn't require calling load, it's intuitive, and much more terse. I like it a lot.

Any feedback?