Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- class PSubtype a b => PTryFrom (a :: PType) (b :: PType)
- type family PTryFromExcess a b :: PType
- ptryFrom' :: forall s r. PTryFrom a b => Term s a -> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r) -> Term s r
- ptryFrom :: forall b a s r. PTryFrom a b => Term s a -> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r) -> Term s r
- data PSubtypeRelation
- type family PSubtype (a :: PType) (b :: PType) :: Constraint where ...
- type family PSubtype' (a :: PType) (b :: PType) :: PSubtypeRelation where ...
- pupcast :: forall a b s. PSubtype a b => Term s b -> Term s a
- pupcastF :: forall a b (p :: PType -> PType) s. (PSubtype a b, PCovariant p) => Proxy p -> Term s (p b) -> Term s (p a)
- pdowncastF :: forall a b (p :: PType -> PType) s. (PSubtype a b, PContravariant p) => Proxy p -> Term s (p a) -> Term s (p b)
Documentation
class PSubtype a b => PTryFrom (a :: PType) (b :: PType) Source #
PTryFrom a b
represents a subtyping relationship between a
and b
,
and a way to go from a
to b
.
Laws:
- (punsafeCoerce . fst) $ tcont (ptryFrom x) ≡ pure x
Instances
type family PTryFromExcess a b :: PType Source #
Instances
ptryFrom' :: forall s r. PTryFrom a b => Term s a -> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r) -> Term s r Source #
ptryFrom :: forall b a s r. PTryFrom a b => Term s a -> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r) -> Term s r Source #
type family PSubtype (a :: PType) (b :: PType) :: Constraint where ... Source #
PSubtype a b = (PSubtype' a b ~ 'PSubtypeRelation, PSubtypeHelper a b (PSubtype' a b)) |
type family PSubtype' (a :: PType) (b :: PType) :: PSubtypeRelation where ... Source #
PSubtype' a a = 'PSubtypeRelation | |
PSubtype' a b = Helper a b (PInner b) |
pupcastF :: forall a b (p :: PType -> PType) s. (PSubtype a b, PCovariant p) => Proxy p -> Term s (p b) -> Term s (p a) Source #
pdowncastF :: forall a b (p :: PType -> PType) s. (PSubtype a b, PContravariant p) => Proxy p -> Term s (p a) -> Term s (p b) Source #