The front-end is written in PureScript; I renamed source files from *.purs to *.hs to get online syntax highlighting.
PureScript is very similar to Haskell, but differs in several aspects. It is strict, and uses a somewhat different typeclass hierarchy and naming. Notably
Effectis equivalent to Haskell
IO. For example,
String -> Effect Unit(docs)
Affis an asynchronous effect monad. For example, an AJAX request would return
Aff (Either Error ResponseType)(docs).
PureScript also heavily encourages writing total functions. For example, an array indexing function returns
Maybe a. For partial indexing, one must use
unsafeIndex together with
unsafePartial - quite a bunch of loops to jump through. This repo doesn't use any partial functions.
The application serves for data visualization purposes. Data is served by a Rust back-end from a database; the front-end uses several simple GET endpoints to get the data. The website is made using the Halogen library; it is single-page, and includes proper routing. I made a screenshot for illustration.
Since this is a simple application, I didn't bother with any sort of effect management; everything effectful is in the
Aff monad. If the application were to grow more, I would probably go for the "three-layered cake" architecture with a
ReaderT Env Effect at the bottom.
Also, error handling is crude. For example, most remotely-fetched state is inside
Maybe, but this doesn't represent errors in any way. They are simply written out to console instead. I just couldn't be bothered to do it properly :)
Here are some interesting files: