#haskell #type-families
type family F1 a where
F1 Int = Bool
So, when we declare
F1
, we create an infinite family of unique types containing
F1
applied to all types of kind
*
,
except for Int
, because
F1 Int
is identically
Bool
.
If you want to change selection, open document below and click on "Move attachment"
What are type families? | Types and Kindsly thing different about something like F1 Char from something like Maybe Char is that F1 Char cannot be used in a type pattern (that is, the left-hand side of a type family equation or data family instance). That’s the only difference. <span>So, when we declare F1 , we create an infinite family of unique types containing F1 applied to all types of kind * , except for Int , because F1 Int is identically Bool .
I find this treatment of non-covering closed type families rather bizarre. Compare against term-level behavior. When a term-level function is non-covering, passing an argument for which Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details