Sign inSign up

julianbrendl/html-haskell

By julianbrendl

•Updated over 7 years ago

Image
0

100K+

julianbrendl/html-haskell repository overview

⁠html-haskell

A simple, light-weight server that transpiles Haskell code to HTML.

This project arose from the need to build React components using Haskell. Under the hood, html-haskell uses type-of-html⁠. Look at type-of-html to see what Haskell code you can write and how it is transformed to HTML.

⁠Example:

Haskell code:

render = div_ $ colorPp "red" (genString "Hello")

colorPp color content = p_A (A.style_ $ "color: " ++ color) content

genString :: String -> String
genString str = str ++ " " ++ str ++ "!"

Resulting HTML:

<div>
  <p style="color: red">Hello Hello!</p>
</div>

⁠API

⁠/transpile

Make a POST request to /transpile with the following payload as JSON:

{
  code: "code to transpile"
}

Important: The code has to be formatted as shown in the example above, providing the render function that returns a Haskell-HTML.

⁠/status

You can check the status of the service with a simple GET request to /status. If everything is okay, 200 should be returned.

⁠Docker

You can find this server as a docker image under julianbrendl/html-haskell⁠.

Tag summary

Content type

Image

Digest

Size

633.3 MB

Last updated

over 7 years ago

docker pull julianbrendl/html-haskell