module MapRingExamples where import MapRing --Examples: Lists and Integers instance (Eq a) => Semigroup [a] where semigroupOperation = (++) semigroupIdentity = [] instance Semigroup Integer where semigroupOperation = (+) semigroupIdentity = 0 --Z^2 lattice, for a two variable poly ring. newtype Z2 = Z2 (Integer,Integer) deriving (Eq,Show,Ord) instance Semigroup Z2 where semigroupOperation (Z2 (x,y)) (Z2 (z,w)) = Z2 (x+z,y+w) semigroupIdentity = Z2 (0,0) --noncommutative ring of lists of Integers w = singleMapRing 2 [1,2] --x and y in poly ring x = singleMapRing 1 (Z2 (1,0)) y = singleMapRing 1 (Z2 (0,1))