I am trying to represent a fragment of a number hierarchy using the Haskell concepts of value, type, and type class. I would like the Haskell code to reflect the mathematical semantics $\vdash ((x \in \mathbb{N}) \land (\mathbb{N} \subset \mathbb{Z}\subset \mathbb{Q}) \Rightarrow (x \in \mathbb{Q}))$. In words, given that the set $\mathbb{N}$ of natural numbers is a subset of the the set $\mathbb{Z}$ of integers and integers are a subset of rationals $\mathbb{Q}$, we can deduce that every natural number is an rational number. I omit the constraint that natural numbers are actually a proper subset of integers.
Below is my attempt at relating the math and Haskell semantics. I am unsure whether a class is a set of types as stated by GAST (Section 3.5) and hence a type can be considered as an element of a class $(T \in TC)$.
Note it is possible that $V_1=V_2$ (e.g. 1:Nat=1:Int)
Below is my flawed attempt to capture the mathematical meaning using Haskell. I am aware that implementing rationals would lead to a situation where rationals were represented by both a type and a type class (not good!). Please note for research purposes I am restricted to only using values, types,and type class. I am not intentionally seeking to impose Object Oriented class semantic on Haskell.
data Natural = One | Suc Natural deriving Show
data Integers = Zero | Succ Integers deriving Show
class RationallNumbers x where
plus::x -> x -> x
instance RationallNumbers Integers where
plus x Zero = x
plus x (Succ y) = Succ (plus x y)
instance RationallNumbers Natural where
plus x One = Suc x
plus x (Suc y) = Suc (plus x y)
twoPlusTwoNat = plus (Suc One) (Suc One)
twoPlusTwoInt = plus (Succ (Succ Zero)) (Succ (Succ Zero))
To sum up my question is:
Can the numeric hierarchy described be represented in Haskell using the semantic concepts of values, types, and classes?
Related questions: A mathematical (categorical) description of type classes, Is there a model theory for Haskell type classes?