Modulecardano-base-0.1.6.0
Cardano.Base.Proxy
- 2 types
- 2 values
- Packagecardano-base-0.1.6.0
- Exports4
- LicenceApache-2.0
- SourceProxy.hs
asProxyTypeOf is a type-restricted version of const. It is usually used as an infix operator, and its typing forces its first argument (which is usually overloaded) to have the same type as the tag of the second.
import GHC.Internal.Word:type asProxyTypeOf 123 (Proxy :: Proxy Word8)asProxyTypeOf 123 (Proxy :: Proxy Word8) :: Word8
Note the lower-case proxy in the definition. This allows any type
constructor with just one argument to be passed to the function, for example
we could also write
import GHC.Internal.Word:type asProxyTypeOf 123 (Just (undefined :: Word8))asProxyTypeOf 123 (Just (undefined :: Word8)) :: Word8
A concrete, promotable proxy type, for use at the kind level. There are no instances for this because it is intended at the kind level only
Proxy is a type that holds no data, but has a phantom parameter of arbitrary type (or even kind). Its use is to provide type information, even though there is no value available of that type (or it may be too costly to create one).
Historically, Proxy :: Proxy a is a safer alternative to the
undefined :: a idiom.
Proxy :: Proxy (Void, Int -> Int)Proxy
Proxy can even hold types of higher kinds,
Proxy :: Proxy EitherProxy
Proxy :: Proxy FunctorProxy
Proxy :: Proxy complicatedStructureProxy
Instances62Generic1, FoldableWithIndex, FunctorWithIndex, TraversableWithIndex, RepeatWithIndex, SemialignWithIndex, …
Generic1 ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsFoldableWithIndex Void ProxyDefined in indexed-traversable-0.1.5 · WithIndexFunctorWithIndex Void ProxyDefined in indexed-traversable-0.1.5 · WithIndexTraversableWithIndex Void ProxyDefined in indexed-traversable-0.1.5 · WithIndexRepeatWithIndex Void ProxyDefined in semialign-1.4 · Data.Semialign.InternalSemialignWithIndex Void ProxyDefined in semialign-1.4 · Data.Semialign.InternalZipWithIndex Void ProxyDefined in semialign-1.4 · Data.Semialign.InternalFilterableWithIndex Void ProxyDefined in witherable-0.5 · WitherableWitherableWithIndex Void ProxyDefined in witherable-0.5 · WitherableMonad ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyFunctor ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyApplicative ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyFoldable ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.FoldableTraversable ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.TraversableAlternative ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyMonadPlus ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyMonadZip ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Control.Monad.ZipEq1 ProxyDefined in base-4.22.0.0 · Data.Functor.ClassesOrd1 ProxyDefined in base-4.22.0.0 · Data.Functor.ClassesRead1 ProxyDefined in base-4.22.0.0 · Data.Functor.ClassesShow1 ProxyDefined in base-4.22.0.0 · Data.Functor.ClassesContravariant ProxyDefined in base-4.22.0.0 · Data.Functor.ContravariantNFData1 ProxyDefined in deepseq-1.5.1.0 · Control.DeepSeqHashable1 ProxyDefined in hashable-1.5.1.0 · Data.Hashable.ClassDistributive ProxyDefined in distributive-0.6.3 · Data.DistributiveDecidable ProxyDefined in contravariant-1.5.6 · Data.Functor.Contravariant.DivisibleDivisible ProxyDefined in contravariant-1.5.6 · Data.Functor.Contravariant.DivisibleAlt ProxyDefined in semigroupoids-6.0.2 · Data.Functor.AltApply ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Bind.ClassBind ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Bind.ClassExtend ProxyDefined in semigroupoids-6.0.2 · Data.Functor.ExtendConclude ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Contravariant.ConcludeDecide ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Contravariant.DecideDivise ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Contravariant.DivisePlus ProxyDefined in semigroupoids-6.0.2 · Data.Functor.PlusAlign ProxyDefined in semialign-1.4 · Data.Semialign.InternalSemialign ProxyDefined in semialign-1.4 · Data.Semialign.InternalUnalign ProxyDefined in semialign-1.4 · Data.Semialign.InternalRepeat ProxyDefined in semialign-1.4 · Data.Semialign.InternalUnzip ProxyDefined in semialign-1.4 · Data.Semialign.InternalZip ProxyDefined in semialign-1.4 · Data.Semialign.InternalFilterable ProxyDefined in witherable-0.5 · WitherableWitherable ProxyDefined in witherable-0.5 · WitherableFromJSON1 ProxyDefined in aeson-2.2.5.1 · Data.Aeson.Types.FromJSONToJSON1 ProxyDefined in aeson-2.2.5.1 · Data.Aeson.Types.ToJSONBounded (Proxy t)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyEnum (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyEq (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyData t => Data (Proxy t)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.DataOrd (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyRead (Proxy t)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyShow (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyIx (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyGeneric (Proxy t)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSemigroup (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyMonoid (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.ProxyNFData (Proxy a)Defined in deepseq-1.5.1.0 · Control.DeepSeqHashable (Proxy a)Defined in hashable-1.5.1.0 · Data.Hashable.ClassFromJSON (Proxy a)Defined in aeson-2.2.5.1 · Data.Aeson.Types.FromJSONToJSON (Proxy a)Defined in aeson-2.2.5.1 · Data.Aeson.Types.ToJSONtype Rep (Proxy t) = D1 ('MetaDataDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics"Proxy"
"GHC.Internal.Data.Proxy"
"ghc-internal"
'False) (C1 ('MetaCons"Proxy"
'PrefixI 'False) U1)type Rep1 Proxy = D1 ('MetaDataDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics"Proxy"
"GHC.Internal.Data.Proxy"
"ghc-internal"
'False) (C1 ('MetaCons"Proxy"
'PrefixI 'False) U1)