HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Moduleeffectful-core-2.7.1.2GHC2021

Effectful.Internal.Utils

  • 1 type
  • 8 values

Utils for ThreadId

1 declaration

Utils for Any

3 declarations
familytype family Any :: k where
#

The type constructor Any :: forall k. k allows creating an arbitrary type of the given kind.

It can be used to create a placeholder type when you only have a kind in hand.

You can use unsafeCoerce# to unsafely coerce a value from ty :: k to Any @k and back. As per the documentation of unsafeCoerce#, this is only sound if both sides have the exact sameruntime representation. Some examples:

   unsafeCoerce# True :: (Any :: Type)                -- OK
   unsafeCoerce# (1# :: Int#) :: (Any :: TYPE IntRep) -- OK
   unsafeCoerce# True :: (Any :: Type IntRep)         -- INVALID
   unsafeCoerce  True :: (Any :: UnliftedType)        -- INVALID
   unsafeCoerce  (ba :: ByteArray#) :: (Any :: Type)  -- INVALID

To avoid accidentally unsafe-coercing between different representations, it is recommended to: - use explicit type annotations or type applications at every use-site of unsafeCoerce# - use representation-monomorphic variants such as unsafeCoerce or unsafeCoerceUnlifted.

In particular, this also implies it is safe to round-trip unsafe-coercion via Any, as long as the kinds line up e.g. unsafeCoerce (unsafeCoerce (val :: a) :: Any) :: a is safe in that way.

Unique

2 declarations
newtypenewtype Unique
#

A unique with no possibility for CAS contention.

Credits for this go to Edward Kmett.

Instances1Eq
  • Eq UniqueDefined in effectful-core-2.7.1.2 · Effectful.Internal.Utils

CallStack

1 declaration

Remove exactly one layer of freezing, i.e. the one added by send and friends via withFrozenCallStack. Freezes applied by client code need to stay intact, so this must not recurse.

Array capacity

1 declaration

Utils for MutablePrimArray

1 declaration