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

Moduleservant-0.20.2Haskell2010

Servant.API.UVerb.Union

Type-level code for implementing and using UVerb. Heavily inspired by world-peace.

  • 2 types
  • 2 values
  • Packageservant-0.20.2
  • Exports7
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceUnion.hs
typetype IsMember (a :: u) (as :: [u]) = (Unique as, CheckElemIsMember a as, UElem a as)
#
familytype family Unique (xs :: [k]) :: Constraint where
#

Check whether all values in a type-level list are distinct. This will throw a nice error if there are any duplicate elements in the list.

Equations

valuefoldMapUnion
  1. :: All c as
  2. => Proxy c
  3. -> forall x. c x => x -> a
  4. -> Union as
  5. -> a
#

Convenience function to apply a function to an unknown union element using a type class. All elements of the union must have instances in the type class, and the function is applied unconditionally.

See also: matchUnion.

valuematchUnion :: IsMember a as => Union as -> Maybe a
#

Convenience function to extract a union element using cast, ie. return the value if the selected type happens to be the actual type of the union in this value, or Nothing otherwise.

See also: foldMapUnion.