HORIZON HASKELLDocslts/ghc-10.0.xc7d136e2026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · c7d136e · 2026-10-12

Modulefirst-class-families-0.8.2.0

Fcf.Utils

  • 13 types
  • 1 class
typetype (-->) = 'Match_
#
typetype Any = 'Any_
#
datadata Case (a :: [Match j k]) (b :: j) (c :: k)
#
Instances1Eval
  • type Eval (Case ms a) = Case_ ms aDefined in first-class-families-0.8.2.0 · Fcf.Utils
typetype Else = 'Else_
#
typetype Is = 'Is_
#
classclass IsBool (b :: Bool) where
#

Methods

Instances2IsBool
  • IsBool 'FalseDefined in first-class-families-0.8.2.0 · Fcf.Utils
  • IsBool 'TrueDefined in first-class-families-0.8.2.0 · Fcf.Utils
familytype family Stuck :: a
#
datadata TyEq (c :: a) (d :: b) (e :: Bool)
#
Instances1Eval
  • type Eval (TyEq a b) = TyEqImpl a bDefined in first-class-families-0.8.2.0 · Fcf.Utils
familytype family If (cond :: Bool) (tru :: k) (fls :: k) :: k where
#

Type-level If. If True a b ==> a; If False a b ==> b

Equations

familytype family TypeError (a :: ErrorMessage) :: b where
#

The type-level equivalent of error.

The polymorphic kind of this type allows it to be used in several settings. For instance, it can be used as a constraint, e.g. to provide a better error message for a non-existent instance,

-- in a context
instance TypeError (Text "Cannot Show functions." :$$:
                    Text "Perhaps there is a missing argument?")
      => Show (a -> b) where
    showsPrec = error "unreachable"

It can also be placed on the right-hand side of a type-level function to provide an error for an invalid case,

type family ByteSize x where
   ByteSize Word16   = 2
   ByteSize Word8    = 1
   ByteSize a        = TypeError (Text "The type " :<>: ShowType a :<>:
                                  Text " is not exportable.")