HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulerow-types-1.0.1.2Haskell2010

Data.Row.Switch

This module provides the ability to discharge a polymorphic variant using a record that has matching fields.

  • 1 class
  • 2 values
classclass AppliesTo r f x | r x -> f, f r -> x where
#

A simple class that we use to provide a constraint for function application.

Methods

Instances1AppliesTo
  • AppliesTo r (x -> r) xDefined in row-types-1.0.1.2 · Data.Row.Switch
valueswitch :: BiForall r v (AppliesTo x) => Var v -> Rec r -> x
#

A Var and a Rec can combine if their rows line up properly. Given a Variant along with a Record of functions from each possible value of the variant to a single output type, apply the correct function to the value in the variant.