7Safe %&:OQRTTAsserts that a value has a particular type, and raises an exception if it does not.assertHasT @Bool TrueReflassertHasT @Bool "hello"Z*** Exception: expected value of type Bool , but got "hello" , which is of type [Char] Like 4, but instead of returning a witness upon success, r returns its second argument. The second argument can be an expression that typechecks under the assumption that a ~ b. Vfoo :: (Show a, Typeable a) => a -> a foo x = withAssertHasT @String x $ map toUpper x foo "hello""HELLO"foo TrueW*** Exception: expected value of type [Char] , but got True , which is of type Bool CallStack (from HasCallStack):D withAssertHasT, called at <interactive>:17:13 in interactive:Ghci1Like k, but asserts that two types are the same instead of asserting that a value has a type. Generally, prefer B when possible, since it will produce better error messages, but d can be necessary when the type does not have a runtime representation (such as if it is phantom).assertEqT @Bool @BoolReflassertEqT @Bool @Int7*** Exception: expected type Int , but got type Bool Like , but with the type propogation behavior of . Generally, prefer B when possible, since it will produce better error messages, but c can be necessary when the type does not have a runtime representation (such as if it is phantom). _foo :: forall a proxy. (Show a, Typeable a) => proxy a -> a foo _ = withAssertEqT @Bool @a Truefoo (Proxy @Bool)Truefoo (Proxy @Int)7*** Exception: expected type Int , but got type Bool  .type-assertions-0.1.0.0-5it0HlbfLIZKETw7dMwXfbTest.TypeAssertionsbaseData.Type.EqualityRefl:~: assertHasTwithAssertHasT assertEqT withAssertEqT