Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Options and OptionsMonad #427

Merged
merged 2 commits into from
Dec 27, 2019
Merged

Introduce Options and OptionsMonad #427

merged 2 commits into from
Dec 27, 2019

Conversation

RyanGlScott
Copy link
Collaborator

This patch introduces an Options data type and an mtl-like OptionsMonad class for monads that carry Options. At present, the only things one can do with Options are:

The vast majority of this patch simply adds plumbing by using OptionsMonad in places that need it. See the D.S.TH.Options module for where most of the new code is housed, as well as the T150 and T204 test cases for examples of how to use it.

Copy link
Owner

@goldfirere goldfirere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there's a small opportunity for simplification/added clarity. Generally good. Thanks!

src/Data/Singletons/TH/Options.hs Outdated Show resolved Hide resolved
src/Data/Singletons/TH/Options.hs Show resolved Hide resolved
src/Data/Singletons/TH/Options.hs Outdated Show resolved Hide resolved
@RyanGlScott RyanGlScott force-pushed the wip/T204 branch 2 times, most recently from 486fec7 to fdf87a5 Compare December 24, 2019 23:05
src/Data/Singletons/TH/Options.hs Outdated Show resolved Hide resolved
src/Data/Singletons/TH/Options.hs Show resolved Hide resolved
This patch introduces an `Options` data type and an `mtl`-like
`OptionsMonad` class for monads that carry `Options`. At present,
the only things one can do with `Options` are:

* Toggle the generation of `SingKind` instances. Suppressing
  `SingKind` instances provides an effective workaround for #150.
* Hook into the TH machinery's naming conventions for promoted and
  singled names. This fixes #204.

The vast majority of this patch simply adds plumbing by using
`OptionsMonad` in places that need it. See the `D.S.TH.Options`
module for where most of the new code is housed, as well as the
`T150` and `T204` test cases for examples of how to use it.
Copy link
Owner

@goldfirere goldfirere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow custom naming hooks for autogenerated code
2 participants