HListPP: A preprocessor for HList labelable labels

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

A preprocessor that replaces `longDescriptiveName with

hLens' (Label :: Label "longDescriptiveName")

Use with ghc flags -F -pgmF HListPP. A file using HListPP could start with something like

❴-# OPTIONS_GHC -F -pgmF HListPP #-❵ -- change braces to ascii (haddock doesn't allow literal comments in files)
❴-# LANGUAGE DataKinds #-❵
import Data.HList.CommonMain
import Control.Lens

Then the labels can then be used in expressions with types like:

`x :: Lens (Record S) (Record T) a b
`x :: Prism (Variant S) (Variant T) a b
`a .==. "x" .*.
   `b .==. "y" .*. emptyRecord :: Record [ Tagged "a" String, Tagged "b" String ]

where S is a type-level list containing a Tagged "x" a and T is a type-level list containing a Tagged "x" b.

Note that `labels is expanded to something that takes up about 26 more columns. To avoid issues with layout, put a newline after keywords that introduce layout, at least if there are `labels in the same row. In other words:

`character.`position.`x %= \ x -> let
     msg = "a really long message about x>0"
     pos = x - 5
   in if pos < 0
         then error msg
         else pos

Instead of

`character.`position.`x %= \ x -> let msg = "a really long message about x>0"
                                      pos = x - 5
                           in if pos < 0
                               then error msg
                               else pos

Properties

Versions0.1, 0.2, 0.2.1, 0.2.2, 0.2.2
Change logChangeLog
Dependenciesbase (>=4.9 && <5), regex-applicative (==0.3.*) [details]
LicenseBSD-3-Clause
AuthorAdam Vogt <vogt.adam@gmail.com>
MaintainerAdam Vogt <vogt.adam@gmail.com>
CategoryDevelopment
Home pagehttp://github.com/aavogt/HListPP
Source repositoryhead: git clone http://github.com/aavogt/HListPP
ExecutablesHListPP
Uploaded2020-04-17T17:40:10Z by AdamVogt

Downloads

Maintainers' corner

For package maintainers and hackage trustees