For example, if I have these weird types:
{-# LANGUAGE TypeFamilies #-}
type family WeirdFamily a
type instance WeirdFamily () = Int
type instance WeirdFamily (a, b) = (a, WeirdFamily b)
Can I display (e.g. in GHCi) the result of WeirdFamily (Bool, (Char, ()))
by typing something like:
:t WeirdFamily (Bool, (Char, ()))
into GHCi?
Use kind!
.
:kind! WeirdFamily (Bool, (Char, ()))
WeirdFamily (Bool, (Char, ())) :: *
= (Bool, (Char, Int))
So I have figured out an answer. Type this into GHCi:
f :: WeirdFamily (Bool, (Char, ())); f = undefined
:t f
gives f :: (Bool, (Char, Int))
But it feels like there should be a "cleaner" way. Is there?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With