Neuron NG Log - Hacker Log

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Sridhar Ratnakumar

Kind of writing a new neuron on top of ema: https://github.com/srid/emabook

Currently using heist to provide HTML templates. It is a bit unusual templating language, but certain things are ONLY possible with heist (and not others like mustache). For example, implementing a sidebar tree - which requires recursion, and you can't do that in a template's language (afaiu).

WIP: Spiritual successor to neuron, based on Ema. Contribute to srid/emabook development by creating an account on GitHub.
Sridhar Ratnakumar

Just came across https://docusaurus.io/ which is pretty much in the same domain (except JavaScript nonsense). "Document Versioning" & "Content Search" are two features I should consider.

An optimized site generator in React. Docusaurus helps you to move fast and write content. Build documentation websites, blogs, marketing pages, and more.
Sridhar Ratnakumar

Specifically I don't think you can easily style the pandoc AST with a non-XML aware template language, cf. https://github.com/srid/emabook/pull/4/files#diff-5ac7732e49ce4a15810529dbd4a9bed5f9ed08aaadd282913a931d0c14958966R85-R103

Allow customizing HTML attributes (esp. class) of individual pandoc AST elements.
Sridhar Ratnakumar

Almost was going to start using RDMS (sqlite in-memory) but then I stumbled upon IxSet via https://stackoverflow.com/q/9234205/55246

I find it very common to want to model relational data in my functional programs. For example, when developing a web-site I may want to have the following data structure to store info about my user...
Sridhar Ratnakumar

Simplifies quite a bit.
image.png

https://github.com/srid/emabook/commit/e76de502caa42bcf63b44e261c827f9d260b236a

WIP: Spiritual successor to neuron, based on Ema. Contribute to srid/emabook development by creating an account on GitHub.
Sridhar Ratnakumar

The ixset package makes use of run-time type information to find a suitable index on a query, resulting in possible run-time errors when no suitable index exists. In ixset-typed, the types of all indices available or tracked in the type system. Thus, ixset-typed should be safer to use than ixset, but in turn requires more GHC extensions.

:thinking:

https://hackage.haskell.org/package/ixset-typed

Sridhar Ratnakumar

with IxSet, backlinks suppport was straightforward to add without having to build graphs first, https://github.com/srid/emabook/pull/5/files

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Sridhar Ratnakumar

i'm enjoying this IxSet thing. it is almost like a mini RDMS model in haskell

https://github.com/srid/emabook/pull/6/files

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Sridhar Ratnakumar

some damn cool data processing in neuron-ng ... requires merging aeson values, then I found this https://github.com/phadej/aeson-extra/issues/5

Take a look at the two functions I propose in this issue: haskell/aeson#245 Bos doesn't want them in aeson itself, and I completely understand his reasons, so I was thinking about making an aes...
Sridhar Ratnakumar

@TheMatten Is there a TailwindCSS version of the side-notes from https://edwardtufte.github.io/tufte-css/ (for use in Pandoc footnotes)?

TheMatten

Can't find any, though it seems to only have 2 CSS files that should be easy enough to modify

Sridhar Ratnakumar

https://ema.srid.ca/ is now running on Neuron NG (emanote). Milestone achieved. Onwards ...

Sridhar Ratnakumar

Open union seems suitable for representing polymorphic (and user extensible) route types, https://hackage.haskell.org/package/world-peace-1.0.2.0/docs/Data-WorldPeace-Union.html

type Static = Tagged "Static" FilePath

type EmaR as = OpenUnion (Static ': Route Html ': as)

type S = OpenUnion '[Static, Route Md, Route Yaml, Route HeistTmpl]

type R = OpenUnion '[Static, Route Html, Route RSS]

allRoutes :: () -> [R]
allRoutes () =
  [ openUnionLift (Tagged "static/favicon.png" :: Static),
    openUnionLift (indexRoute @Html)
  ]

gen :: () -> R -> LByteString
gen () r =
  fromMaybe undefined $
    fmap genHtml (openUnionMatch r)
      <|> fmap genRss (openUnionMatch r)
      <|> fmap copyStatic (openUnionMatch r)
  where
    genHtml :: Route Html -> LByteString
    genHtml = error "not implemented"
    genRss :: Route RSS -> LByteString
    genRss = error "not implemented"
    copyStatic :: Static -> LByteString
    copyStatic = error "not implemented"
Sridhar Ratnakumar

Switching over this log to Matrix. So long ...