Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- class PSubtype a b => PTryFrom (a :: PType) (b :: PType) where
- type PTryFromExcess a b :: PType
- ptryFrom' :: forall s r. 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) where 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
Nothing
type PTryFromExcess a b :: PType Source #
type PTryFromExcess a b = PTryFromExcess a (PInner b)
ptryFrom' :: forall s r. Term s a -> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r) -> Term s r Source #
default ptryFrom' :: forall s r. (PTryFrom a (PInner b), PTryFromExcess a b ~ PTryFromExcess a (PInner b)) => Term s a -> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r) -> Term s r Source #
Instances
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 #