Hylograph.Unified.Display
- Package
- purescript-hylograph-selection
- Repository
- afcondon/purescript-hylograph-selection
Hylograph.Unified.Display - Profunctor-based Display Transformations
Non-destructive display formatting as composable typed pipelines.
Core Insight
Display transformations are typed morphisms that compose:
f :: a -> b
g :: b -> c
f >>> g :: a -> c
The key property is non-destructiveness: the underlying value is preserved; only the presentation changes.
Profunctor Structure
Display a b is a profunctor:
- Contravariant in
a(input type) - Covariant in
b(output type)
This enables:
lmapD f: Change input type (e.g., extract field from record)rmapD g: Change output type (e.g., further transform result)- Composition via
>>>
Usage
-- Define reusable displays
percentageD :: Display Number String
percentageD = scaleD 100.0 >>> roundD 1 >>> showNumD >>> suffixD "%"
-- Adapt to different sources
rateDisplay :: Display { rate :: Number } String
rateDisplay = lmapD _.rate percentageD
-- Use in spreadsheet
cellValue = format percentageD computedValue
-- Use in visualization label
labelText = runDisplay percentageD dataPoint.value
#Display Source
newtype Display a bDisplay transformation from type a to type b
This is essentially a newtype around a -> b, but with a semantic
meaning: it's a non-destructive presentation transformation.
The profunctor structure (contravariant in a, covariant in b) enables flexible composition and adaptation.
Constructors
Display (a -> b)
#runDisplay Source
runDisplay :: forall a b. Display a b -> a -> bRun a display transformation
#(>>>) Source
Operator alias for Hylograph.Unified.Display.composeD (left-associative / precedence 9)
#currencyWithSymbol Source
currencyWithSymbol :: String -> Display Number StringCurrency with custom symbol
#thousandsD Source
thousandsD :: Display String StringAdd thousands separators: 1234567 -> "1,234,567"
- Modules
- Data.
DependencyGraph - Hylograph.
AST - Hylograph.
Axis. Axis - Hylograph.
Brush - Hylograph.
Brush. FFI - Hylograph.
Brush. Types - Hylograph.
Classify - Hylograph.
Data. Graph - Hylograph.
Data. Graph. Algorithms - Hylograph.
Data. Node - Hylograph.
Data. Tree - Hylograph.
Expr. Animation - Hylograph.
Expr. Attr - Hylograph.
Expr. Datum - Hylograph.
Expr. Expr - Hylograph.
Expr. Friendly - Hylograph.
Expr. Integration - Hylograph.
Expr. Interpreter. CodeGen - Hylograph.
Expr. Interpreter. Eval - Hylograph.
Expr. Interpreter. Meta - Hylograph.
Expr. Interpreter. PureSVG - Hylograph.
Expr. Interpreter. SVG - Hylograph.
Expr. Path - Hylograph.
Expr. Path. Generators - Hylograph.
Expr. Sugar - Hylograph.
Expr. Units - Hylograph.
HATS - Hylograph.
HATS. Friendly - Hylograph.
HATS. InterpreterTick - Hylograph.
HATS. Transitions - Hylograph.
Interaction. Brush - Hylograph.
Interaction. Coordinated - Hylograph.
Interaction. Pointer - Hylograph.
Interaction. Zoom - Hylograph.
Internal. Attribute - Hylograph.
Internal. Behavior. FFI - Hylograph.
Internal. Behavior. Types - Hylograph.
Internal. Capabilities. Selection - Hylograph.
Internal. Capabilities. Transition - Hylograph.
Internal. FFI - Hylograph.
Internal. Selection. Join - Hylograph.
Internal. Selection. Operations - Hylograph.
Internal. Selection. Operations. Conversions - Hylograph.
Internal. Selection. Operations. Helpers - Hylograph.
Internal. Selection. Operations. Selection - Hylograph.
Internal. Selection. Query - Hylograph.
Internal. Selection. Types - Hylograph.
Internal. Transition. FFI - Hylograph.
Internal. Transition. Manager - Hylograph.
Internal. Transition. Scene - Hylograph.
Internal. Transition. Types - Hylograph.
Internal. Types - Hylograph.
Interpreter. D3 - Hylograph.
Interpreter. English - Hylograph.
Interpreter. Mermaid - Hylograph.
Interpreter. MetaAST - Hylograph.
Interpreter. SemiQuine - Hylograph.
Interpreter. SemiQuine. TreeToCode - Hylograph.
Interpreter. SemiQuine. Types - Hylograph.
Render - Hylograph.
Scale - Hylograph.
Scale. FP - Hylograph.
Shape. Arc - Hylograph.
Shape. Pie - Hylograph.
Shape. Polygon - Hylograph.
Tooltip - Hylograph.
Transform - Hylograph.
TreeDSL - Hylograph.
TreeDSL. ShapeTree - Hylograph.
Unified - Hylograph.
Unified. Attribute - Hylograph.
Unified. DataDSL - Hylograph.
Unified. Display - Hylograph.
Unified. Examples - Hylograph.
Unified. Join - Hylograph.
Unified. Sugar