Skip to content
Implementation of the Elm Architecture in Purescript
PureScript JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
scripts
src
.eslintrc.json
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
PULL_REQUEST_TEMPLATE.md
README.md
README.md.template
bower.json
build-watch
db.json
oak-logo.svg
package.json
yarn.lock

README.md

Oak is an implementation of the Elm architecture in Purescript.

bower install purescript-oak

This library requires the virtual-dom module. You can get it by using npm to install virtual-dom.

npm install virtual-dom

Documentation is published on pursuit.

A breif example Oak app:

module Main (main) where

import Oak

import Prelude hiding (div)

type Model
  = {number :: Int}

data Msg
  = Inc
  | Dec

view :: Model -> Html Msg
view model = root [] do
  div [] do
    button [onClick Inc] do
      text "+"
    div [] do
      text model.number
    button [onClick Dec] do
      text "-"

next :: Msg -> Model -> (Msg -> Effect Unit) -> Effect Unit
next msg mod h = mempty

update :: Msg -> Model -> Model
update msg model = case msg of
  Inc -> model { number = model.number + 1 }
  Dec -> model { number = model.number - 1 }

init :: Model
init = { number: 0 }

app :: App Msg Model
app = createApp { init, view, update, next }

main :: Effect Unit
main = do
  rootNode <- runApp app Nothing
  container <- getElementById "app"
  appendChildNode container rootNode
You can’t perform that action at this time.