Copyright | (c) L. S. Leary 2025 |
---|---|
Safe Haskell | None |
Language | GHC2021 |
Data.Hetero.Role
Contents
Description
Singleton Role
s and corresponding constraints.
Synopsis
- data RoleKind
- data Role (r :: RoleKind) where
- Phantom :: Role 'Phantom
- Representational :: Role 'Representational
- Nominal :: Role 'Nominal
- class KnownRole (r :: RoleKind) where
- expositRole :: forall (r :: RoleKind) s. Role r -> (KnownRole r => s) -> s
- type IsPhantom (f :: k -> l) = forall (x :: k) (y :: k). Coercible (f x) (f y)
- type IsRepresentational (f :: k -> l) = (SubNominal f, SuperPhantom f)
- type IsNominal (f :: k -> l) = forall (x :: k) (y :: k). Coercible (f x) (f y) => x ~ y
- type SubNominal (f :: k -> l) = forall (x :: k) (y :: k). Coercible x y => Coercible (f x) (f y)
- type SuperPhantom (f :: k -> l) = forall (x :: k) (y :: k). Coercible (f x) (f y) => Coercible x y
Roles
The kind of roles.
Constructors
Phantom | |
Representational | |
Nominal |
Instances
data Role (r :: RoleKind) where Source #
Singleton roles.
Constructors
Phantom :: Role 'Phantom | |
Representational :: Role 'Representational | |
Nominal :: Role 'Nominal |
class KnownRole (r :: RoleKind) where Source #
Get the unique value corresponding to a RoleKind
.
expositRole :: forall (r :: RoleKind) s. Role r -> (KnownRole r => s) -> s Source #
Make a Role
known.
Constraints
type IsRepresentational (f :: k -> l) = (SubNominal f, SuperPhantom f) Source #
type SubNominal (f :: k -> l) = forall (x :: k) (y :: k). Coercible x y => Coercible (f x) (f y) Source #
type SuperPhantom (f :: k -> l) = forall (x :: k) (y :: k). Coercible (f x) (f y) => Coercible x y Source #