Haskell: Instance definitions for type families
问题 Lets say we have the following code: class C t where g :: t instance C Int where g = 42 Simple. We can also define functions on Int, like so: f1 :: Int -> Int f1 x = x * x I've been working with type families, in particular because Data.Has uses them, and I want to insert them into an IxSet. But here I'm going to present a simplified example. Lets say we want to define a new type X , that is similar to an Int. We could do this: type family X type instance X = Int We can then define functions