| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Polytropos.Plugin.Source
Description
Source plugin for polytropos.
Desugars ergonomic syntax for row-polymorphic records, open variants,
and declaration forms into standard Polytropos runtime combinators
before renaming and typechecking:
- Record Construction:
REC { x = 1, y = True }(bare) andREC_F { x = Just 1 }(HKD) with field punning support. - Variant Injection:
VAR { Ok = 200 }orVARIANT { Err = "fail" }. - Record Updates:
REC_UPD r { x = 42 }intosetFieldchains. - Pattern Matching:
REC { x, y }into record view patterns, andVAR { Tag = pat }into variant projection view patterns. - Open Declarations:
data Person = Person { name :: String, age :: Int } deriving OpenRecordanddata Status = Active | Inactive String deriving OpenVariant.
Synopsis
- sourcePlugin :: [CommandLineOption] -> ParsedResult -> Hsc ParsedResult
Documentation
sourcePlugin :: [CommandLineOption] -> ParsedResult -> Hsc ParsedResult Source #
Top-level entry point for GHC's parsedResultAction.
Invoked immediately after GHC's parser completes on each source file.
See Note [Source Plugin Desugaring Architecture: Syntactic Sugar Before Typechecking] [ref:note-source-plugin-arch]