hyperbole: Interactive HTML apps using type-safe serverside Haskell

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Interactive HTML applications using type-safe serverside Haskell. Inspired by HTMX, Elm, and Phoenix LiveView


[Skip to Readme]

Properties

Versions 0.1.1, 0.1.2, 0.2.0, 0.3.5, 0.3.6, 0.3.6
Change log CHANGELOG.md
Dependencies base (>=4.16 && <5), bytestring (>=0.11 && <0.13), casing (>0.1 && <0.2), containers (>=0.6 && <1), cookie (>=0.4 && <0.5), effectful (>=2.3 && <3), file-embed (>=0.0.10 && <0.1), http-api-data (>=0.6 && <0.7), http-types (>=0.12 && <0.13), hyperbole, network (>=3.1 && <4), string-conversions (>=0.4 && <0.5), string-interpolate (>=0.3 && <0.4), text (>=1.2 && <3), wai (>=3.2 && <4), wai-middleware-static (>=0.9 && <=0.10), wai-websockets (>=3.0 && <4), warp (>=3.3 && <4), web-view (>=0.4 && <=0.5), websockets (>=0.12 && <0.14) [details]
License BSD-3-Clause
Author Sean Hess
Maintainer seanhess@gmail.com
Category Web, Network
Home page https://github.com/seanhess/hyperbole
Bug tracker https://github.com/seanhess/hyperbole/issues
Source repo head: git clone https://github.com/seanhess/hyperbole
Uploaded by seanhess at 2024-05-21T23:51:19Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hyperbole-0.3.6

[back to package description]

Hyperbole

Hackage

Create fully interactive HTML applications with type-safe serverside Haskell. Inspired by HTMX, Elm, and Phoenix LiveView

Learn more about Hyperbole on Hackage

{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}

import Web.Hyperbole

main = do
  run 3000 $ do
    liveApp (basicDocument "Example") (page mainPage)


mainPage = do
  handle message
  load $ do
    pure $ do
      el bold "My Page"
      hyper (Message 1) $ messageView "Hello"
      hyper (Message 2) $ messageView "World!"


data Message = Message Int
  deriving (Generic, Param)

data MessageAction = Louder Text
  deriving (Generic, Param)

instance HyperView Message where
  type Action Message = MessageAction


message :: Message -> MessageAction -> Eff es (View Message ())
message _ (Louder m) = do
  let new = m <> "!"
  pure $ messageView new


messageView m = do
  el_ $ text m
  button (Louder m) id "Louder"

Examples

The example directory contains an app with pages demonstrating various features

Run the examples in this repo using cabal. Then visit http://localhost:3000/ in your browser

cabal run

Learn More

View Documentation on Hackage

View on Github

In Production

National Solar Observatory