Use Javascript Libraries
Afp
Task description
Recently a Javascript backend was added to Utrecht Haskell Compiler (UHC). This allows the use of existing Javascript libraries from within Haskell. As there are various of such libraries around, as well as various ways of modeling these in Haskell, this project actually consists of multiple projects. Approaches to modeling can be inspired by existing libraries such as wxHaskell or paradigms such as FRP (Functional Reactive Programming). The most prominent issue to be dealt with is how to use types in Haskell to wrap around almost untyped OO functionality. The choice of a specific Javascript library is free, apart from the preference for widely used 'standard' libraries.
Slides
Link
Source
Source code can be found on github:
https://github.com/serras/reactive-js
Soon to be also avaliable in the UHC examples repository.
Interesting links
Comparison between UI libraries in Haskell
The different frameworks for UI differ in:
- How they get extensible sets of properties
- How events and dataflow are handled
- How they get layout done
- For records, has a [[http://www.informatik.tu-cottbus.de/~jeltsch/research/ifl-2009-slides.pdf][special syntax]:
- In general, elements are defined using an arrow where input records are fed and output records are recorded:
X :& Push := ok <- button -< X :& Caption := pure "Ok"
- Then a complete UI is a circuit, where inputs and outputs are linked by the arrows:
mainCircuit = proc () -> do
rec let title = pure "simple"
text = SSignal.scan "*" (const . ('*':)) push
X :& Closure := closure `With` X :& Push := push
<- window `with` just pushButton
-< X :& Title := title `With` X :& Text := text
returnA <- closure
-
`With` and `with` are used to do layout
--
AlejandroSerrano - 30 Nov 2010