Data.Constraint.Char

constraints-0.14.2: Constraint manipulation

Safe Haskell | None
Language | Haskell2010

Data.Constraint.Char

Description

Utilities for working with `KnownChar` constraints.

This module is only available on GHC 9.2 or later.

Synopsis

- type family CharToNat (a :: Char) :: Natural where ...
- type family NatToChar (a :: Natural) :: Char where ...
- charToNat :: forall (c :: Char). KnownChar c :- KnownNat (CharToNat c)
- natToChar :: forall (n :: Natural). (n <= 1114111, KnownNat n) :- KnownChar (NatToChar n)

# Documentation

type family CharToNat (a :: Char) :: Natural where ... #

Convert a character to its Unicode code point (cf. `ord`)

@since base-4.16.0.0

type family NatToChar (a :: Natural) :: Char where ... #

Convert a Unicode code point to a character (cf. `chr`)

@since base-4.16.0.0

charToNat :: forall (c :: Char). KnownChar c :- KnownNat (CharToNat c) #

natToChar :: forall (n :: Natural). (n <= 1114111, KnownNat n) :- KnownChar (NatToChar n) #