git @ Cat's Eye Technologies Burro / master src / HasteMain.hs
master

Tree @master (Download .tar.gz)

HasteMain.hs @masterraw · history · blame

-- Copyright (c) 2007-2023, Chris Pressey, Cat's Eye Technologies.
-- This file is distributed under a 2-clause BSD license, see LICENSES/ dir.
-- SPDX-License-Identifier: LicenseRef-BSD-2-Clause-X-Burro

module Main where

import Haste.DOM (withElems, getValue, setProp)
import Haste.Events (onEvent, MouseEvent(Click))

import Language.Burro.Definition (interpret)


main = withElems ["prog", "result", "run-button"] driver

driver [progElem, resultElem, runButtonElem] =
    onEvent runButtonElem Click $ \_ -> do
        Just prog <- getValue progElem
        setProp resultElem "textContent" $ show $ interpret prog