| License | BSD-style (see the LICENSE file in the distribution) |
|---|---|
| Maintainer | libraries@haskell.org |
| Stability | experimental |
| Portability | not portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Type.Coercion
Description
Definition of representational equality (Coercion).
Since: 4.7.0.0
Representational equality. IfCoercion a b is inhabited by some terminating value, then the typea has the same underlying representation as the typeb.
To use this equality in practice, pattern-match on theCoercion a b to get out theCoercible a b instance, and then usecoerce to apply it.
Since: 4.7.0.0
| Category (Coercion :: k -> k ->Type)Source# | Since: 4.7.0.0 |
| TestCoercion (Coercion a :: k ->Type)Source# | Since: 4.7.0.0 |
Instance detailsDefined inData.Type.Coercion | |
| Coercible a b =>Bounded (Coercion a b)Source# | Since: 4.7.0.0 |
| Coercible a b =>Enum (Coercion a b)Source# | Since: 4.7.0.0 |
Instance detailsDefined inData.Type.Coercion Methods succ ::Coercion a b ->Coercion a bSource# pred ::Coercion a b ->Coercion a bSource# toEnum ::Int ->Coercion a bSource# fromEnum ::Coercion a b ->IntSource# enumFrom ::Coercion a b -> [Coercion a b]Source# enumFromThen ::Coercion a b ->Coercion a b -> [Coercion a b]Source# enumFromTo ::Coercion a b ->Coercion a b -> [Coercion a b]Source# enumFromThenTo ::Coercion a b ->Coercion a b ->Coercion a b -> [Coercion a b]Source# | |
| Eq (Coercion a b)Source# | Since: 4.7.0.0 |
| (Coercible a b,Data a,Data b) =>Data (Coercion a b)Source# | Since: 4.7.0.0 |
Instance detailsDefined inData.Data Methods gfoldl :: (forall d b0.Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) ->Coercion a b -> c (Coercion a b)Source# gunfold :: (forall b0 r.Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) ->Constr -> c (Coercion a b)Source# toConstr ::Coercion a b ->ConstrSource# dataTypeOf ::Coercion a b ->DataTypeSource# dataCast1 ::Typeable t => (forall d.Data d => c (t d)) ->Maybe (c (Coercion a b))Source# dataCast2 ::Typeable t => (forall d e. (Data d,Data e) => c (t d e)) ->Maybe (c (Coercion a b))Source# gmapT :: (forall b0.Data b0 => b0 -> b0) ->Coercion a b ->Coercion a bSource# gmapQl :: (r -> r' -> r) -> r -> (forall d.Data d => d -> r') ->Coercion a b -> rSource# gmapQr :: (r' -> r -> r) -> r -> (forall d.Data d => d -> r') ->Coercion a b -> rSource# gmapQ :: (forall d.Data d => d -> u) ->Coercion a b -> [u]Source# gmapQi ::Int -> (forall d.Data d => d -> u) ->Coercion a b -> uSource# gmapM ::Monad m => (forall d.Data d => d -> m d) ->Coercion a b -> m (Coercion a b)Source# gmapMp ::MonadPlus m => (forall d.Data d => d -> m d) ->Coercion a b -> m (Coercion a b)Source# gmapMo ::MonadPlus m => (forall d.Data d => d -> m d) ->Coercion a b -> m (Coercion a b)Source# | |
| Ord (Coercion a b)Source# | Since: 4.7.0.0 |
Instance detailsDefined inData.Type.Coercion | |
| Coercible a b =>Read (Coercion a b)Source# | Since: 4.7.0.0 |
| Show (Coercion a b)Source# | Since: 4.7.0.0 |
coerceWith ::Coercion a b -> a -> bSource#
Type-safe cast, using representational equality
gcoerceWith ::Coercion a b -> (Coercible a b => r) -> rSource#
Generalized form of type-safe cast using representational equality
Since: 4.10.0.0
repr :: (a:~: b) ->Coercion a bSource#
Convert propositional (nominal) equality to representational equality
classTestCoercion fwhereSource#
This class contains types where you can learn the equality of two types from information contained interms. Typically, only singleton types should inhabit this class.
Methods
testCoercion :: f a -> f b ->Maybe (Coercion a b)Source#
Conditionally prove the representational equality ofa andb.
| TestCoercion (Coercion a :: k ->Type)Source# | Since: 4.7.0.0 |
Instance detailsDefined inData.Type.Coercion | |
| TestCoercion ((:~:) a :: k ->Type)Source# | Since: 4.7.0.0 |
Instance detailsDefined inData.Type.Coercion | |
| TestCoercion ((:~~:) a :: k ->Type)Source# | Since: 4.10.0.0 |
Instance detailsDefined inData.Type.Coercion | |
Produced byHaddock version 2.20.0