diff --git a/Algebra.hs b/Algebra.hs
new file mode 100644
--- /dev/null
+++ b/Algebra.hs
@@ -0,0 +1,64 @@
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE TypeFamilies #-}
+
+module Algebra where
+
+import Control.Category
+import Data.Functor
+import Data.Functor.Const
+import Data.Functor.Identity
+import Data.Monoid hiding ((<>))
+import Data.Proxy
+import Data.Semigroup
+import Prelude (Integer)
+import qualified Prelude as Base
+
+class Semigroup a => Abelian a
+
+class Semigroup a => Idempotent a
+
+class Monoid a => Group a where
+    invert :: a -> a
+
+instance Group () where
+    invert () = ()
+
+instance (Group a, Group b) => Group (a, b) where
+    invert (a, b) = (invert a, invert b)
+
+instance (Group a, Group b, Group c) => Group (a, b, c) where
+    invert (a, b, c) = (invert a, invert b, invert c)
+
+instance (Group a, Group b, Group c, Group d) => Group (a, b, c, d) where
+    invert (a, b, c, d) = (invert a, invert b, invert c, invert d)
+
+instance (Group a, Group b, Group c, Group d, Group e) => Group (a, b, c, d, e) where
+    invert (a, b, c, d, e) = (invert a, invert b, invert c, invert d, invert e)
+
+instance Group a => Group (Identity a) where invert = fmap invert
+
+instance Group a => Group (Dual a) where invert (Dual a) = Dual (invert a)
+
+instance Group (Proxy a) where invert Proxy = Proxy
+
+instance Group a => Group (Const a b) where invert (Const a) = Const (invert a)
+
+instance Group b => Group (a -> b) where invert = (.) invert
+
+instance Group a => Group (Base.IO a) where invert = fmap invert
+
+instance Group (Sum Integer) where invert (Sum a) = Sum (Base.negate a)
+
+(+) :: Semigroup (Sum a) => a -> a -> a
+a + b = getSum (Sum a <> Sum b)
+
+(-) :: (Semigroup (Sum a), Group (Sum a)) => a -> a -> a
+a - b = getSum (Sum a <> invert (Sum b))
+
+(*) :: Semigroup (Product a) => a -> a -> a
+a * b = getProduct (Product a <> Product b)
+
+(/) :: (Semigroup (Product a), Group (Product a)) => a -> a -> a
+a / b = getProduct (Product a <> invert (Product b))
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+© 2017 CE M Farkas-Dyck
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the author nor the names of his contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/alg.cabal b/alg.cabal
new file mode 100644
--- /dev/null
+++ b/alg.cabal
@@ -0,0 +1,28 @@
+name:                alg
+version:             0.1.0.0
+synopsis:            Algebraic structures
+-- description:         
+license:             BSD3
+license-file:        LICENSE
+author:              M Farkas-Dyck
+maintainer:          strake888@gmail.com
+-- copyright:           
+category:            Math
+build-type:          Simple
+-- extra-source-files:  
+cabal-version:       >=1.10
+
+library
+  exposed-modules:     Algebra
+  -- other-modules:       
+  other-extensions:    
+  build-depends:       base >=4.9 && <5
+  -- hs-source-dirs:      
+  default-language:    Haskell2010
+  default-extensions:  NoImplicitPrelude
+                     , LambdaCase
+                     , EmptyCase
+                     , TypeOperators
+                     , ConstraintKinds
+                     , PolyKinds
+  ghc-options:         -Wall
