diff --git a/Data/Iterable.hs b/Data/Iterable.hs
new file mode 100644
--- /dev/null
+++ b/Data/Iterable.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE MultiParamTypeClasses #-}
+-- | Declares Iterable class for handling multi-level, heterogeneous, monomorphic collections that allow nested iteration.
+module Data.Iterable(Iterable(..)) where
+
+import Language.Haskell.TH.Syntax
+import Control.Monad.Identity(runIdentity,foldM)
+
+-- | Class for iterating all nested components `b` of type `a`.
+class Iterable a b where
+  imapM   :: (Monad m) => (b -> m b) -> a -> m a
+  imap    ::              (b ->   b) -> a ->   a
+  imap f e = runIdentity $ imapM (return . f) e
+  ifoldM  :: (Monad m) => (c -> b -> m c) -> c -> a -> m c
+  ifoldr  ::              (b -> c ->   c) -> c -> a ->   c
+  ifoldl  ::              (c -> b ->   c) -> c -> a ->   c
+  ifoldl' ::              (c -> b ->   c) -> c -> a ->   c
+  ilength :: b -> a -> Int -- NOTE: b is 'dummy' type argument to satisfy Iterable a b constraint
diff --git a/Data/Iterable/Instantiate.hs b/Data/Iterable/Instantiate.hs
new file mode 100644
--- /dev/null
+++ b/Data/Iterable/Instantiate.hs
@@ -0,0 +1,33 @@
+{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
+-- | Helpers for instantiating transitive and reflexive instances of Iterable.
+module Data.Iterable.Instantiate(self_iterable ,
+                                 trans_iterable) where
+
+import           Language.Haskell.TH.Syntax
+import           Data.Iterable
+
+-- | Generates convenience function for iterating over a single object.
+--self_iterable typA = gen_iterable typA typA [e| id |] [e| L.singleton |]
+self_iterable typA = 
+  [d| instance Iterable $(typA) $(typA) where
+        imapM f a     = f a 
+        ifoldM  f e a = f e a
+        ifoldr  f e a = f a e
+        ifoldl  f e a = f e a 
+        ifoldl' f e a = f e a
+        ilength   d a = 1
+    |]
+
+-- | Generates a transitive instance of `Iterable` between $typA and $typC,
+--   assuming existence of `Iterable` $typA $typB, and `Iterable` $typB $typC.
+trans_iterable typA typB typC = 
+  [d| instance Iterable $(typA) $(typC) where
+        imapM   f a   = (imapM   :: (Monad m) => ( $(typB) -> m $(typB) ) -> $(typA)   -> m $(typA) ) (imapM f) a 
+        imap    f a   = (imap    ::              ( $(typB) ->   $(typB) ) -> $(typA)   ->   $(typA) ) (imap  f) a 
+        ifoldM  f e a = (ifoldM  :: (Monad m) => (c -> $(typB)   -> m c) -> c   -> $(typA)   -> m c       ) (ifoldM  f) e a 
+        ifoldr  f e a = (ifoldr  ::              ($(typB) -> c   ->   c) -> c   -> $(typA)   ->   c       ) (\bb cc -> ifoldr  f cc bb) e a
+        ifoldl  f e a = (ifoldl  ::              (c -> $(typB)   ->   c) -> c   -> $(typA)   ->   c       ) (ifoldl  f) e a
+        ifoldl' f e a = (ifoldl' ::              (c -> $(typB)   ->   c) -> c   -> $(typA)   ->   c       ) (ifoldl' f) e a
+        ilength _   a = (ifoldl' ::              (c -> $(typB)   ->   c) -> c   -> $(typA)   ->   c       ) (\a b-> a + ilength (undefined :: $(typC)) b) 0 a
+    |]
+
diff --git a/Data/Iterable/Instantiate/Vector.hs b/Data/Iterable/Instantiate/Vector.hs
new file mode 100644
--- /dev/null
+++ b/Data/Iterable/Instantiate/Vector.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, FlexibleInstances #-}
+-- | Helpers for instantiating Iterable for types with Vector containers.
+module Data.Iterable.Instantiate.Vector(gen_vector_iterable) where
+
+import           Language.Haskell.TH.Syntax
+import           Data.Iterable
+import qualified Data.Vector as L
+
+-- | Generates a direct instance of iterable between $typA and $typB with
+--   given names of getter and setter, so that:
+--   $getter :: $typA -> $typB 
+--   $setter :: $typB -> $typA -> $typA
+gen_vector_iterable typA typB getter setter = 
+  [d| instance Iterable $(typA) $(typB) where
+        imapM f a =
+          do b' <- L.mapM f ( $(getter) a)
+             return $ $(setter) a b'
+        ifoldM  f e a  = do r <- L.foldM f e ( $(getter) a)
+                            return r
+        ifoldr  f e a = L.foldr  f e ( $(getter) a)
+        ifoldl  f e a = L.foldl  f e ( $(getter) a)
+        ifoldl' f e a = L.foldl' f e ( $(getter) a) 
+        ilength   d a = L.length ( $(getter) a)
+    |]
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,29 @@
+Haskell code in this package is subject to:
+
+Copyright (c) Michal J. Gajda 2010-2013
+
+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 REGENTS AND CONTRIBUTORS ``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/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+iterable
+========
+Typeclass and TemplateHaskell instantiating methods for accessing data within multilevel,
+monomorphic, heterogeneous collections.
+
+Used as a main interface to Protein Databank structures parsed by hPDB library.
+
+Details on official releases are on [Hackage](http://hackage.haskell.org/package/iterable).
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,18 @@
+#! /usr/bin/env runhaskell
+
+module Main(main) where
+
+import Distribution.Simple
+import System.Environment
+import Control.Monad(when)
+import Data.List(isPrefixOf)
+
+-- Defaults to installing in --user package database.
+isPkgDbOpts arg = ("--package-db" `isPrefixOf` arg  ) || (arg `elem` ["--user", "--global"])
+haveNotPkgDbOpts   = not . any isPkgDbOpts
+
+main = do args <- getArgs
+          defaultMainArgs $ if (length args > 0 && (head args `elem` ["configure", "install"]) && haveNotPkgDbOpts args)
+                              then (head args:"--user":tail args)
+                              else args
+            
diff --git a/iterable.cabal b/iterable.cabal
new file mode 100644
--- /dev/null
+++ b/iterable.cabal
@@ -0,0 +1,37 @@
+name:                iterable
+version:             1.0
+stability:           stable
+homepage:            https://github.com/mgajda/iterable
+package-url:         http://hackage.haskell.org/package/iterable
+synopsis:            API for hierarchical multilevel collections.
+description:         Two-argument typeclass that generalizes Foldable, Functor, and Traversable for monomorphic
+                     multi-level collections. Transitive instances allow for folding and mapping over any
+                     subordinate level of the hierarchy.
+                     .
+                     Main interface for hPDB library.
+                     .
+                     Contains convenience TemplateHaskell methods for generating Iterable instances that have Vector containers.
+category:            Data Structures
+license:             BSD3
+license-file:        LICENSE
+
+author:              Michal J. Gajda
+copyright:           Copyright by Michal J. Gajda '2013
+maintainer:          mjgajda@googlemail.com
+bug-reports:         mailto:mjgajda@googlemail.com
+
+build-type:          Simple
+cabal-version:       >=1.8
+tested-with:         GHC==7.0.3, GHC==7.2.1, GHC==7.4.2, GHC==7.6.2
+data-files:          README.md
+
+source-repository head
+  type:     git
+  location: git://github.com:mgajda/hpdb.git
+
+Library
+  build-depends:    base>4 && <=5, mtl >= 2.0, vector >= 0.9, template-haskell >= 2.7
+  other-extensions: TemplateHaskell, MultiParamTypeClasses, FlexibleInstances
+  exposed-modules:  Data.Iterable, Data.Iterable.Instantiate, Data.Iterable.Instantiate.Vector
+  exposed:          True
+
