2.3. Version 9.4.1

2.3.1. base library

  • GHC.Exts.magicDict has been renamed to withDict and given a more specific type:

    withDict :: forall {rr :: RuntimeRep} st dt (r :: TYPE rr). st -> (dt => r) -> r

    Unlike magicDict, withDict can be used without defining an intermediate data type. For example, the withTypeable function from the Data.Typeable module can now be defined as:

    withTypeable :: forall k (a :: k) rep (r :: TYPE rep). ()
                 => TypeRep a -> (Typeable a => r) -> r
    withTypeable rep k = withDict @(TypeRep a) @(Typeable a) rep k

    Note that the explicit type applications are required, as the call to withDict would be ambiguous otherwise.