fused-effects-th: Template Haskell helpers for fused-effects.

[ bsd3, control, library ] [ Propose Tags ]

This package provides Template Haskell splices that wrap the smart constructors needed for declaring new effects when using the fused-effects effect system.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3
Change log CHANGELOG.md
Dependencies base (>=4.12 && <4.17), fused-effects (>=1.1 && <1.3), template-haskell (>=2.12 && <2.19) [details]
License BSD-3-Clause
Copyright 2020 Patrick Thomson
Author Patrick Thomson
Maintainer Patrick Thomson <patrickt@github.com>
Revised Revision 2 made by patrick_thomson at 2022-07-13T14:23:36Z
Category Control
Home page https://github.com/fused-effects/fused-effects-th
Bug tracker https://github.com/fused-effects/fused-effects-th/issues
Source repo head: git clone https://github.com/fused-effects/fused-effects-th.git
Uploaded by patrick_thomson at 2021-04-07T22:11:00Z
Distributions NixOS:0.1.0.3
Downloads 518 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for fused-effects-th-0.1.0.3

[back to package description]

fused-effects-th

GitHub CI Hackage BSD-3-Clause license

This package provides Template Haskell helpers for fused-effects. The makeSmartConstructors splice, given the name of a GADT defining an effect, iterates through the possible constructors and generates functions that construct effects using send. That is to say, given the standard State type:

data State s m k where
  Get :: State s m s
  Put :: s -> State s m ()

calling makeSmartConstructors ''State generates the following code (cleaned up a little from the native Template Haskell output):

get ::
  forall s sig m
  Has (State s) sig m =>
  m s
get = send Get
{-# INLINEABLE get #-}
 put ::
  forall s sig m.
  Has (State s) sig m =>
  s ->
  m ()
put a = send (Put a)
{-# INLINEABLE put #-}

Bug reports are welcome on the issue tracker.