suavemente: An applicative functor that seamlessly talks to HTML inputs.

[ bsd3, library, web ] [ Propose Tags ]

Please see the README on GitHub at https://github.com/isovector/suavemente#readme


[Skip to Readme]

Modules

[Last Documentation]

  • Web
    • Web.Suavemente

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), blaze-markup, bytestring, diagrams-core, diagrams-lib, diagrams-svg, interpolatedstring-perl6, lens, mtl, servant, servant-blaze, servant-server, servant-websockets, stm, streaming, suavemente, svg-builder, transformers, warp, websockets [details]
License BSD-3-Clause
Copyright 2019 Sandy Maguire
Author Sandy Maguire
Maintainer sandy@sandymaguire.me
Category Web
Home page https://github.com/isovector/suavemente#readme
Bug tracker https://github.com/isovector/suavemente/issues
Source repo head: git clone https://github.com/isovector/suavemente
Uploaded by isovector at 2019-01-04T17:07:57Z
Distributions NixOS:0.2.0.0
Executables suavemente-exe
Downloads 1076 total (9 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2019-01-04 [all 3 reports]

Readme for suavemente-0.1.0.0

[back to package description]

suavemente

Build Status | Hackage

Dedication

Today's kitchen is all about a well-planned space that makes cooking a completely interactive experience among family and friends.

Candice Olson

Overview

Suavemente is an applicative functor capable of seamlessly talking to HTML elements. Running a suavemente program automatically spins up a webserver and hooks up its pages with websockets. The use case is to quickly deploy simple, interactive Haskell programs without needing to figure out how the fuck GHCJS works.

Example

{-# LANGUAGE ApplicativeDo #-}

module Main where

import Diagrams.Backend.SVG
import Diagrams.Prelude hiding (rad)
import Web.Suavemente


main :: IO ()
main = suavemente $ do
  rad <- slider "Radius" 1 10 5
  r   <- realSlider "Red" 0 1 0.05 1
  g   <- realSlider "Green" 0 1 0.05 1
  b   <- realSlider "Blue" 0 1 0.05 1
  x   <- slider "X" 0 20 10
  y   <- slider "Y" 0 20 10

  pure (
    circle rad
            # fc (sRGB r g b)
            # translate (r2 (x, y))
            # rectEnvelope (p2 (0, 0)) (r2 (20, 20))
    :: Diagram B)

To Do

The "protocol" is disgusting---it just tries to read the incoming websocket data. A better approach would be to hook it up via FromJSON, but it's nontrivial to get JSON out of a web form and I cbf.

Pull requests are welcome!