smirk-polysemy: Polysemy interface for the Smirk PCRE engine

[ apache, effects, library, regex, text ] [ Propose Tags ] [ Report a vulnerability ]

Exposes Smirk's pure, step-bounded PCRE engine as a polysemy effect (Smirk.Effect.Polysemy), with pure and fuel-bounded interpreters. This package depends on the plain smirk package for the core engine, so consumers who only need polysemy (not effectful) do not drag in effectful.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.16 && <5), polysemy (>=1.9 && <2), smirk (>=0.1 && <0.2), text (>=2.0 && <3) [details]
License Apache-2.0
Author Nadia Yvette Chambers
Maintainer Nadia Chambers <nadia.yvette.chambers@ik.me>
Uploaded by nyc at 2026-11-03T19:27:52Z
Category Text, Regex, Effects
Home page https://github.com/NadiaYvette/smirk
Bug tracker https://github.com/NadiaYvette/smirk/issues
Source repo head: git clone https://github.com/NadiaYvette/smirk.git(packages/smirk-polysemy)
Distributions
Downloads 3 total (3 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 smirk-polysemy-0.1.0.0

[back to package description]

smirk-polysemy

Polysemy interface for the Smirk PCRE engine.

smirk-polysemy provides first-class polysemy bindings for Smirk's pure, step-bounded PCRE regular expression engine.


Features

  • Polysemy Effect (SmirkRegex): Idiomatic effect definition integrating seamlessly into Sem r effect rows.
  • Dual Interpreters:
    • runSmirkPure: Unbounded pure in-memory execution.
    • runSmirkFuel: Fuel-bounded execution guaranteeing ReDoS immunity by returning Left OutOfFuel if a step budget is exceeded.
  • Lightweight Dependency: Only depends on smirk and polysemy, without dragging in effectful.

Quick Example

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TypeApplications #-}

import Polysemy
import Smirk (re)
import Smirk.Effect.Polysemy

prog :: (Member SmirkRegex r) => Sem r (Maybe (Match Text))
prog = match [re|hello (\w+)|] "hello world"

main :: IO ()
main = do
  let result = run (runSmirkPure prog)
  print result

License

Licensed under the Apache License 2.0 (LICENSE).