I have the following code:
{-# LANGUAGE TypeFamilies #-}
type family Times (a :: Nat) (b :: Nat) :: Nat where
Times Z n = Z
Times (S m) n = Plus n (Times m n)
I know that type families allow you to write functions on the type level. However, for the code above, I know that (a :: Nat) (b :: Nat)
are the types of the two parameters that are passed to the function Times
.
However I don't understand what the final :: Nat
after (a :: Nat) (b :: Nat)
means. Any insights are appreciated.
Type families are ranges of typeface designs. Each family is a variation of a basic style of alphabet. There are hundreds or maybe even thousands of typeface families.
In CSS (and in typography in general) there are five basic types, or families, of fonts: serif, sans serif, cursive, fantasy, and monospace.
The final :: Nat
indicates that the type-level function returns a Nat
.
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