The Unicode war is over: Fourmolu `main` can now convert between Unicode and ASCII syntax!

(Merged yesterday in this pull request.)

Many people were against Unicode syntax because the symbols it requires are not found on a typical keyboard, so they are hard to write. This is not needed anymore. Write ASCII and let Fourmolu convert it to Unicode!

(In the event that your font or terminal is strictly 8 bit, worry not: Fourmolu can convert back to ASCII as well!)

Get Fourmolu.

  1. Clone https://github.com/fourmolu/fourmolu/.
  2. Run cabal install there.
  3. Hopefully it will work!

Go!

  1. (Commit your stuff.)
  2. Put UnicodeSyntax somewhere Fourmolu can see, say in the default-extensions of your Cabal manifest.
  3. Run fourmolu --mode inplace --unicode detect [your Haskell files].
  4. Enjoy!

Not to your liking? Convert back:

  1. (Commit your stuff.)
  2. Run fourmolu --mode inplace --unicode never [your Haskell files].
  3. Remove UnicodeSyntax from wherever you put it before.
  4. Enjoy!

aside

Alternatively, you can put those symbols onto your keyboard in a matter of minutes. Check out for example this fantastic project.

What a time to be alive!

Like, share, and have a good day!

10 Likes

Great! And if it’d be my my choice, UnicodeSyntax would be on by default this century, in which case you could have skipped step 2!

3 Likes