Active Haskell

A whirlwind, github tour of 4 active Haskell projects.

There’s a lot happening in Haskell-land, and I thought I’d take stock of a few issues lists in github. Let’s jump in.

shellcheck

In other news, shellcheck has overtaken pandoc as the most starred Haskell github repository.

Looking through the readme, Haskell onboarding is first-class. Interesting that Cabal and stack are so highly aligned:

On systems with Cabal (installs to ~/.cabal/bin):

cabal update
cabal install ShellCheck
On systems with Stack (installs to ~/.local/bin):

stack update
stack install ShellCheck

The Windows install even includes the magical incantation chcp 65001, which I always have to recall on a fresh Windows install.

I had heard that rust was eating Haskell’s lunch (in systems programming at least), but we’re vibing on code analytics.

pandoc

The grand old dame of Haskell projects, pandoc, has closed a page of issues in the last 18 days - incredible active throughput. I use pandoc-types extensively, and the last rewrite was sublime - native Pandoc gives me a lot of freedom. I do have to lug around the full pandoc to get the markdown+lhs+github readers & writers, though, and the pandoc compile chokes my travis builds.

Tidal

Tidal is a massive success at at 1.2k stars, and always super active, with 11 issues needing help. Tidal is at the core of my local music scene; meetups are load atom, and start making coding up music, doing experiments.

A typical email I will get from my daughter is:

d1
  $ density 1
  $ s "sn*100" -- Mess with number of samples,, up to audio rate (starts at like 100)
  # lpf "[50, 100, 500, 1500, 10000]"
  # lpq "0.7" -- Filter resonance
  # pan (stitch "[t f]*5" (range 0 0.5 saw) (range 1 0.5 saw))
  # gain "0.8"

That’s it! The benefits of composition are there. You can see how tidal, the strings, are threaded through functional, transformation control.

Inside development, is a language semantically like haskell but processed by haskellish, with the intent to pick up from a web browser.

The data pipeline between haskell and the browser is almost always key-value pairs such as JSON, and is best thought of as a HashMap Text Text. This map is shared across the browser (or dom), together with a naming source. The flow from browser to individual elements of type a happens over a state computation HashMap Text Text -> (HashMap Text Text, a) allowing the mutation of the element to also change the map state. Browser elements may be composed on other browser elements, so the main loop fans across the elements being watched and reacts.

The flow from haskell to browser is a one way turnstile of new representations of the shared map of objects, translated to javascript and evaluated by the viewer.

From web-rep:

data RepF r a = Rep
  { rep :: r,
    make :: HashMap Text Text -> (HashMap Text Text, Either Text a)
  }
  deriving (Functor)

-- | the common usage, where the representation domain is Html
type Rep a = RepF (Html ()) a
-- |
-- Driven by the architecture of the DOM, web page components are compositional, and tree-like, where components are often composed of other components, and values are thus shared across components.
--
-- This is sometimes referred to as "observable sharing". See <http://hackage.haskell.org/package/data-reify data-reify> as another library that reifies this (pun intended), and provided the initial inspiration for this implementation.
--
-- unshare should only be run once, which is a terrible flaw that might be fixed by linear types.
newtype SharedRepF m r a = SharedRep
  { unshare :: StateT (Int, HashMap Text Text) m (RepF r a)
  }
  deriving (Functor)

-- | default representation type of 'Html' ()
type SharedRep m a = SharedRepF m (Html ()) a

This is similar to data-reify but without an IO wrapper, which isn’t necessary.

HLS

The haskell-language-server has the most focus in the community right now. New versions pop out of a multitude of GUIs and features look easy to add with the plug-in vibe.

By now, one would assume that hie (aside from .hie files which will be baked in to ghc forever) and ghcide are integrated. From what I see, interests bifurcate but it’s one solid project. There’s a lot of deconstruction work on the ghcide side, of tests rearranged and supported, that would clean things up nicely.

In contrast, the ghc issues board, looks like an emergency ward. Issue on issue demands such specialist knowledge - the adults are definitely in charge.

Now back to a Tidal ticket.