WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

ingun37/cmark-lens

Repository files navigation

CMark Lens

Unofficial collection of Lens for cmark.

This package is written in the style of writing lenses without lens making it a lightweight dependency.

Example

import CMark
import CMark.Lens
import Control.Lens

foo :: CMark.Node -> ()
foo node =
  let posInfo = node ^. _posInfo       -- Lens' PosInfo
      nodeType = node ^. _nodeType     -- Lens' NodeType
      text = nodeType ^. _TEXT         -- Prism' NodeType Text
      childNodes' = node ^.. _nodes    -- Traversal' Node [Node]
      childNodes  = node ^. _nodesLens -- Lens' Node [Node]
      -- Remove all the TEXTs at depth 2
      node'' = set (_nodes . _nodes . _nodeType . _TEXT) empty node
   in ()

For more extensive examples, go to /test/Main.hs.

Manual Deployment

CI/CD is work in progress so currently the deployment is done manually

Requirements

I use these versions because they seem to be the latest versions that works with Hackage/Haddock CI

  • Cabal 3.8
  • GHC 9.8
  • GHC2021

Changing the toolchain versions affects

Steps

Update the version in cmark-lens.cabal.

Commit.

Update the tag of source-repository this in cmark-lens.cabal.

source-repository this
    type:     git
    location: https://github.com/ingun37/cmark-lens.git
    tag:      f33793a7e46ac299796d82a16ccfafb9c18ab1c8

Commit again.

Run

cabal check # Just in case
cabal build # Just in case
cabal sdist

Upload the produced tarball to Hackage.

CMark-GFM Lens

For the lenses for cmark-gfm-lens go https://github.com/ingun37/cmark-gfm-lens

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published