PureScript numeric hierarchy overview
      
        
        
          
            
            
              - definition
- set with commutative addition monoid and multiplication monoid
              (not necessarily commutative), with distributivity of
              multiplication over addition
- provides
- zero, one, add (+), mul (*)
- examples
- Natural numbers, \(\mathbb{N}\)
- Boolean semiring \((1 + 1 = 1)\)
 
         
        
        
        
          
            
            
              - definition
- semiring where addition forms a group, not just a monoid
- provides
- sub (-)
- examples
- Square matrices, e.g. \(\mathrm{Mat}(2,\mathbb{R})\)
- Linear mappings \(V \to V\) for some vector space \(V\)
 
         
        
        
        
          
            
            
              - definition
- ring where multiplication is commutative
- provides
- (no extra methods)
- examples
- Integers modulo \(m\), where \(m \in \mathbb{N}\)
 
          
            
            
              - definition
- ring where every non-zero element has a multiplicative inverse
- provides
- recip
- examples
- Quaternions, \(\mathbb{H}\)
 
         
        
        
        
          
            
            
              - definition
- non-zero commutative ring with no zero-divisors, equipped
              with a euclidean function
- provides
- div (/), mod, degree
- examples
- Integers, \(\mathbb{Z}\)
- Polynomials, \(\mathbb{R}[x]\)
 
          
            
            
              - definition
- commutative ring in which every non-zero element has a
              multiplicative inverse
- provides
- (no extra methods)
- examples
- Reals, \(\mathbb{R}\)
- Rationals, \(\mathbb{Q}\)
- Complex numbers, \(\mathbb{C}\)
- Integers modulo \(p\), where \(p\) is prime
 
         
       
      
        By Harry Garrood