HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulecardano-base-0.1.6.0

Cardano.Base.Proxy

  • 2 types
  • 2 values
valueasProxyTypeOf :: a -> proxy a -> a
#

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.

Example2 expressions
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

Example2 expressions
import GHC.Internal.Word:type asProxyTypeOf 123 (Just (undefined :: Word8))asProxyTypeOf 123 (Just (undefined :: Word8)) :: Word8
datadata KProxy t
#

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

datadata Proxy (t :: k)
#

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.

Example1 expression
Proxy :: Proxy (Void, Int -> Int)Proxy

Proxy can even hold types of higher kinds,

Example1 expression
Proxy :: Proxy EitherProxy
Example1 expression
Proxy :: Proxy FunctorProxy
Example1 expression
Proxy :: Proxy complicatedStructureProxy
Instances62Generic1, FoldableWithIndex, FunctorWithIndex, TraversableWithIndex, RepeatWithIndex, SemialignWithIndex, …
  • Generic1 ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • FoldableWithIndex Void ProxyDefined in indexed-traversable-0.1.5 · WithIndex
  • FunctorWithIndex Void ProxyDefined in indexed-traversable-0.1.5 · WithIndex
  • TraversableWithIndex Void ProxyDefined in indexed-traversable-0.1.5 · WithIndex
  • RepeatWithIndex Void ProxyDefined in semialign-1.4 · Data.Semialign.Internal
  • SemialignWithIndex Void ProxyDefined in semialign-1.4 · Data.Semialign.Internal
  • ZipWithIndex Void ProxyDefined in semialign-1.4 · Data.Semialign.Internal
  • FilterableWithIndex Void ProxyDefined in witherable-0.5 · Witherable
  • WitherableWithIndex Void ProxyDefined in witherable-0.5 · Witherable
  • Monad ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Functor ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Applicative ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Foldable ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Foldable
  • Traversable ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Traversable
  • Alternative ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • MonadPlus ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • MonadZip ProxyDefined in ghc-internal-9.1401.0 · GHC.Internal.Control.Monad.Zip
  • Eq1 ProxyDefined in base-4.22.0.0 · Data.Functor.Classes
  • Ord1 ProxyDefined in base-4.22.0.0 · Data.Functor.Classes
  • Read1 ProxyDefined in base-4.22.0.0 · Data.Functor.Classes
  • Show1 ProxyDefined in base-4.22.0.0 · Data.Functor.Classes
  • Contravariant ProxyDefined in base-4.22.0.0 · Data.Functor.Contravariant
  • NFData1 ProxyDefined in deepseq-1.5.1.0 · Control.DeepSeq
  • Hashable1 ProxyDefined in hashable-1.5.1.0 · Data.Hashable.Class
  • Distributive ProxyDefined in distributive-0.6.3 · Data.Distributive
  • Decidable ProxyDefined in contravariant-1.5.6 · Data.Functor.Contravariant.Divisible
  • Divisible ProxyDefined in contravariant-1.5.6 · Data.Functor.Contravariant.Divisible
  • Alt ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Alt
  • Apply ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Bind.Class
  • Bind ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Bind.Class
  • Extend ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Extend
  • Conclude ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Contravariant.Conclude
  • Decide ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Contravariant.Decide
  • Divise ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Contravariant.Divise
  • Plus ProxyDefined in semigroupoids-6.0.2 · Data.Functor.Plus
  • Align ProxyDefined in semialign-1.4 · Data.Semialign.Internal
  • Semialign ProxyDefined in semialign-1.4 · Data.Semialign.Internal
  • Unalign ProxyDefined in semialign-1.4 · Data.Semialign.Internal
  • Repeat ProxyDefined in semialign-1.4 · Data.Semialign.Internal
  • Unzip ProxyDefined in semialign-1.4 · Data.Semialign.Internal
  • Zip ProxyDefined in semialign-1.4 · Data.Semialign.Internal
  • Filterable ProxyDefined in witherable-0.5 · Witherable
  • Witherable ProxyDefined in witherable-0.5 · Witherable
  • FromJSON1 ProxyDefined in aeson-2.2.5.1 · Data.Aeson.Types.FromJSON
  • ToJSON1 ProxyDefined in aeson-2.2.5.1 · Data.Aeson.Types.ToJSON
  • Bounded (Proxy t)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Enum (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Eq (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Data t => Data (Proxy t)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Data
  • Ord (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Read (Proxy t)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Show (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Ix (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Generic (Proxy t)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Semigroup (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • Monoid (Proxy s)Defined in ghc-internal-9.1401.0 · GHC.Internal.Data.Proxy
  • NFData (Proxy a)Defined in deepseq-1.5.1.0 · Control.DeepSeq
  • Hashable (Proxy a)Defined in hashable-1.5.1.0 · Data.Hashable.Class
  • FromJSON (Proxy a)Defined in aeson-2.2.5.1 · Data.Aeson.Types.FromJSON
  • ToJSON (Proxy a)Defined in aeson-2.2.5.1 · Data.Aeson.Types.ToJSON
  • type Rep (Proxy t) = D1 ('MetaData "Proxy" "GHC.Internal.Data.Proxy" "ghc-internal" 'False) (C1 ('MetaCons "Proxy" 'PrefixI 'False) U1)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • type Rep1 Proxy = D1 ('MetaData "Proxy" "GHC.Internal.Data.Proxy" "ghc-internal" 'False) (C1 ('MetaCons "Proxy" 'PrefixI 'False) U1)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics