You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
piq9117 b71a19752f added Makefile 7 months ago
.circleci Update circleci caching 1 year ago
.github Create FUNDING.yml 10 months ago
assets Upgrate from Halogen 4 to Halogen 5 (#26) 1 year ago
src Initialize tag input from existing data in editor form (#56) 8 months ago
test Add explanatory comments throughout the application 1 year ago
.editorconfig Trim trailing whitespace and add .editorconfig 8 months ago
.gitignore Upgrate from Halogen 4 to Halogen 5 (#26) 1 year ago
LICENSE Initial commit 2 years ago
Makefile added Makefile 7 months ago
README.md Update README.md installation and build instructions (#39) 1 year ago
package-lock.json added Makefile 7 months ago
package.json added Makefile 7 months ago
packages.dhall Update to latest package set (#51) 9 months ago
spago.dhall Tweak JSON decoding (to reduce its footprint and make more compositional) (#33) 1 year ago

README.md

Real World Halogen

RealWorld Frontend CircleCI Maintainer: thomashoneyman

PureScript is a delightful purely-functional language that offers powerful, pragmatic tools to manage complexity and help you design, build, and refactor reliable apps of any size. This repository demonstrates the principles I apply at work every day in more than 2,000 lines of thoroughly commented code and has an accompanying long-form guide to building real-world Halogen applications.

Using Halogen 4? Browse the repository at the tag for Halogen 4. Upgrading from Halogen 4 to Halogen 5? See the PR which migrated this repository to Halogen 5.

I’m a senior software engineer at Awake Security (and previously at CitizenNet). Both companies have large production PureScript applications that have remained reliable, understandable, and maintainable as they scale. I’m convinced PureScript is the best language available today for most single-page applications.

This repository follows the RealWorld spec to implement a Medium clone called Conduit using Halogen. It’s large enough to demonstrate real world examples (CRUD, state management, scalable architecture, type classes, components, etc.) but not so large as to be overwhelming.

Installation

First, clone the repository:

git clone https://github.com/thomashoneyman/purescript-halogen-realworld
cd purescript-halogen-realworld

Install the JavaScript and PureScript dependencies:

yarn install

Next, build the project (this command will run spago build; see the package.json file to see all helper scripts for the project):

yarn build

Finally, bundle the JS and run a local server (defaults to port 8080, but if this port is already in use it will increment to 8081, etc.):

yarn serve

You can also run yarn bundle to create a distribution-ready bundle of JavaScript without starting a server.

Learning PureScript

This project is intended to give non-PureScript developers a taste of what a small application in the language looks like, and to give advanced beginners in PureScript a resource to feel comfortable building reliable applications of their own.

PureScript is a delightful language that becomes only more interesting and rewarding the more you use it and the larger your application becomes; if you haven’t yet tried it out, I encourage you to do so. Not convinced? Kris Jenkins has a lovely talk about PureScript which might change your mind.

Resources

The PureScript community is overwhelmingly warm and helpful. If you would like some help getting started, please consider joining the official Discourse and functional programming Slack (invite link). You may also want to check out:

  1. PureScript by Example, which will teach you PureScript from scratch and was written by the language’s creator, Phil Freeman. While the official book has not been updated for the latest version of the compiler, this link is to an up-to-date fork of the book.
  2. Jordan Martinez’s PureScript reference, which has a broad overview of dozens of topics in PureScript and functional programming.
  3. The (warning: currently in rough draft form) handbook which explains the theory & principles at work in this application in-depth, which will be useful to help take you from advanced beginner to advanced intermediate in the language.
  4. The official Halogen guide, which will teach you how to use the Halogen framework to write components.

Contributing

PRs are welcome! Any functional changes will need to remain compliant with the RealWorld spec, and I may re-word documentation changes to fit with the voice used throughout the repository.