diff --git a/ChangeLog b/ChangeLog
new file mode 100644
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,1 @@
+0.9.0: Initial version
diff --git a/Data/Sequence/FastCatQueue.hs b/Data/Sequence/FastCatQueue.hs
new file mode 100644
--- /dev/null
+++ b/Data/Sequence/FastCatQueue.hs
@@ -0,0 +1,21 @@
+
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.Sequence.FastCatQueue
+-- Copyright   :  (c) Atze van der Ploeg 2014
+-- License     :  BSD-style
+-- Maintainer  :  atzeus@gmail.org
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-- A sequence, a catanable queue, with worst case constant time: '><', '|>', '<|' and 'tviewl'.
+--
+-----------------------------------------------------------------------------
+module Data.Sequence.FastCatQueue(module Data.SequenceClass, FastTCQueue) where
+
+import Data.SequenceClass
+import Data.Sequence.FastQueue
+import Data.Sequence.ToCatQueue
+
+type FastTCQueue =  ToCatQueue FastQueue
diff --git a/Data/Sequence/FastQueue.hs b/Data/Sequence/FastQueue.hs
new file mode 100644
--- /dev/null
+++ b/Data/Sequence/FastQueue.hs
@@ -0,0 +1,63 @@
+{-# LANGUAGE GADTs, ViewPatterns, TypeOperators #-}
+
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.Sequence.FastQueue
+-- Copyright   :  (c) Atze van der Ploeg 2014
+-- License     :  BSD-style
+-- Maintainer  :  atzeus@gmail.org
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-- A sequence, a queue, with worst case constant time: '|>', and 'tviewl'.
+--
+-- Based on: "Simple and Efficient Purely Functional Queues and Deques", Chris Okasaki,
+-- Journal of Functional Programming 1995
+--
+-----------------------------------------------------------------------------
+
+module Data.Sequence.FastQueue(module Data.SequenceClass, FastQueue) where
+import Data.SequenceClass
+import Data.Foldable
+import Prelude hiding (foldr,foldl)
+
+
+revAppend l r = rotate l r []
+-- precondtion : |a| = |f| - (|r| - 1)
+-- postcondition: |a| = |f| - |r|
+rotate :: [a] -> [a]-> [a] -> [a]
+rotate []  [y] r = y : r
+rotate (x : f) (y : r) a = x : rotate f r (y : a)
+rotate f        a     r  = error "Invariant |a| = |f| - (|r| - 1) broken"
+
+data FastQueue a where
+  RQ :: ![a] -> ![a] -> ![a] -> FastQueue a
+
+queue :: [a] -> [a] -> [a] -> FastQueue a
+queue f r [] = let f' = revAppend f r 
+                 in RQ f' [] f'
+queue f r (h : t) = RQ f r t
+
+instance Functor FastQueue where
+  fmap phi (RQ a b c) = RQ (fmap phi a) (fmap phi b) (fmap phi c)
+
+instance Foldable FastQueue where
+  foldl f = loop where
+    loop i s = case viewl s of
+          EmptyL -> i
+          h :< t -> loop (f i h) t
+  foldr f i s = foldr f i (reverse $ toRevList s)
+    where toRevList s = case viewl s of
+           EmptyL -> []
+           h :< t -> h : toRevList t
+
+instance Sequence FastQueue where
+ empty = RQ [] [] []
+ singleton x = let c = [x] in queue c [] c
+ (RQ f r a) |> x = queue f (x : r) a
+
+ viewl (RQ [] [] []) = EmptyL
+ viewl (RQ (h : t) f a) = h :< queue t f a
+
+
diff --git a/Data/Sequence/Queue.hs b/Data/Sequence/Queue.hs
new file mode 100644
--- /dev/null
+++ b/Data/Sequence/Queue.hs
@@ -0,0 +1,82 @@
+{-# LANGUAGE Rank2Types,GADTs, DataKinds, TypeOperators #-}
+
+
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.Sequence.Queue
+-- Copyright   :  (c) Atze van der Ploeg 2014
+-- License     :  BSD-style
+-- Maintainer  :  atzeus@gmail.org
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-- A sequence, a queue, with amortized constant time: '|>', and 'tviewl'.
+--
+-- A simplified version of Okasaki's implicit recursive
+-- slowdown queues. 
+-- See purely functional data structures by Chris Okasaki 
+-- section 8.4: Queues based on implicit recursive slowdown
+--
+-----------------------------------------------------------------------------
+module Data.Sequence.Queue(module Data.SequenceClass,Queue)  where
+import Data.Foldable
+import Prelude hiding (foldr,foldl)
+import Data.SequenceClass
+
+data P a = a :* a 
+
+instance Functor P where
+  fmap f (a :* b) = f a :* f b
+
+data B a where
+  B1 :: a    -> B a
+  B2 :: !(P a)  -> B a
+
+instance Functor B where
+ fmap phi (B1 c) = B1 (phi c)
+ fmap phi (B2 p) = B2 (fmap phi p)
+
+data Queue a  where
+  Q0 :: Queue a 
+  Q1 :: a  -> Queue a
+  QN :: !(B a) -> Queue (P a) -> !(B a) -> Queue a
+
+instance Functor Queue where
+  fmap f Q0 = Q0
+  fmap f (Q1 x) = Q1 (f x)
+  fmap f (QN l m r) = QN (fmap f l) (fmap (fmap f) m) (fmap f r)
+
+instance Foldable Queue where
+  foldl f = loop where
+    loop i s = case viewl s of
+          EmptyL -> i
+          h :< t -> loop (f i h) t
+  foldr f i s = foldr f i (reverse $ toRevList s)
+    where toRevList s = case viewl s of
+           EmptyL -> []
+           h :< t -> h : toRevList t
+
+instance Sequence Queue where
+  empty = Q0
+  singleton = Q1 
+  q |> b = case q of
+    Q0             -> Q1 b
+    Q1 a           -> QN (B1 a) Q0 (B1 b)
+    QN l m (B1 a)  -> QN l m (B2 (a :* b)) 
+    QN l m (B2 r)  -> QN l (m |> r) (B1 b)
+
+  viewl q = case q of
+    Q0                    -> EmptyL
+    Q1 a                  -> a :< Q0
+    QN (B2 (a :* b)) m r  -> a :< QN (B1 b) m r
+    QN (B1 a) m r         -> a :< shiftLeft m r
+    where  
+           shiftLeft q r = case viewl q of
+               EmptyL -> buf2queue r
+               l :< m -> QN (B2 l) m r
+           buf2queue (B1 a)        = Q1 a
+           buf2queue(B2 (a :* b))  = QN (B1 a) Q0 (B1 b)
+
+
+
diff --git a/Data/Sequence/ToCatQueue.hs b/Data/Sequence/ToCatQueue.hs
new file mode 100644
--- /dev/null
+++ b/Data/Sequence/ToCatQueue.hs
@@ -0,0 +1,63 @@
+{-# LANGUAGE GADTs #-}
+
+
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.Sequence.ToCatQueue
+-- Copyright   :  (c) Atze van der Ploeg 2013
+-- License     :  BSD-style
+-- Maintainer  :  atzeus@gmail.org
+-- Stability   :  provisional
+-- Portability :  portable
+--
+-- A purely functional catenable queue representation with
+-- that turns takes a purely functional queue and turns in it into
+-- a catenable queue, i.e. with the same complexity for '><' as for '|>'
+-- Based on Purely functional data structures by Chris Okasaki 
+-- section 7.2: Catenable lists
+--
+-----------------------------------------------------------------------------
+
+module Data.Sequence.ToCatQueue(module Data.SequenceClass,ToCatQueue) where
+import Data.Foldable
+import Prelude hiding (foldr,foldl)
+import Data.SequenceClass
+
+-- | The catenable queue type. The first type argument is the 
+-- type of the queue we use (|>)
+data ToCatQueue q a where
+  C0 :: ToCatQueue q a
+  CN :: a -> !(q (ToCatQueue q a)) -> ToCatQueue q a
+
+instance Functor q => Functor (ToCatQueue q) where
+  fmap f C0 = C0
+  fmap f (CN l m) = CN (f l) (fmap (fmap f) m)
+
+instance Sequence q => Foldable (ToCatQueue q) where
+  foldl f = loop where
+    loop i s = case viewl s of
+          EmptyL -> i
+          h :< t -> loop (f i h) t
+  foldr f i s = foldr f i (reverse $ toRevList s)
+    where toRevList s = case viewl s of
+           EmptyL -> []
+           h :< t -> h : toRevList t
+
+instance Sequence q => Sequence (ToCatQueue q) where
+ empty       = C0
+ singleton a = CN a empty
+ C0        >< ys  = ys
+ xs        >< C0  = xs
+ (CN x q)  >< ys  = CN x (q |> ys)
+
+ viewl C0        = EmptyL
+ viewl (CN h t)  = h :< linkAll t
+   where 
+    linkAll :: Sequence q =>  q (ToCatQueue q a)  -> ToCatQueue q a
+    linkAll v = case viewl v of
+     EmptyL     -> C0
+     CN x q :< t  -> CN x (q `snoc` linkAll t)
+    snoc q C0  = q
+    snoc q r   = q |> r
+
diff --git a/Data/SequenceClass.hs b/Data/SequenceClass.hs
new file mode 100644
--- /dev/null
+++ b/Data/SequenceClass.hs
@@ -0,0 +1,123 @@
+{-# LANGUAGE UndecidableInstances, GADTs,TypeSynonymInstances,FlexibleInstances,Rank2Types #-}
+
+
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.SequenceClass
+-- Copyright   :  (c) Atze van der Ploeg 2014
+-- License     :  BSD-style
+-- Maintainer  :  atzeus@gmail.org
+-- Stability   :  provisional
+-- Portability :  portable
+-- A type class for sequences.
+--
+-- See the package type-aligned for a generalization of this type class sequences.
+-- 
+-----------------------------------------------------------------------------
+module Data.SequenceClass(Sequence(..), ViewL(..), ViewR(..)) where
+
+import Data.Monoid
+import Data.Foldable
+import qualified Data.Sequence as S
+
+infixr 5 <|
+infixl 5 |>
+infix 5 ><
+{- | A type class for (finite) sequences
+ 
+Minimal complete defention: 'empty' and 'singleton' and ('viewl' or 'viewr') and ('><' or '|>' or '<|')
+
+Instances should satisfy the following laws:
+
+Monoid laws:
+> empty >< x == x
+> x >< empty == x
+> (x >< y) >< z = x >< (y >< z)
+
+Observation laws:
+> viewl (singleton e >< s) == e :< s
+> viewl empty == EmptyL
+
+The behaviour of '<|','|>', and 'viewr' is implied by the above laws and their default definitions.
+-}
+class (Functor s, Foldable s) => Sequence s where
+
+  empty     :: s c 
+  singleton :: c  -> s c 
+  -- | Append two sequences
+  (><)       :: s c  -> s c   -> s c 
+  -- | View a sequence from the left
+  viewl     :: s c  -> ViewL s c 
+{- | View a sequence from the right
+         
+Default definition:
+> viewr q = case viewl q of 
+>    EmptyL -> EmptyR
+>    h :< t -> case viewr t of
+>        EmptyR -> empty   :> h
+>        p :> l   -> (h <| p) :> l
+-}
+  viewr     :: s c -> ViewR s c 
+{- | Append a single element to the right
+
+Default definition:
+> l |> r = l >< singleton r
+-}
+  (|>)       :: s c -> c  -> s c 
+{- | Append a single element to the left
+
+Default definition:
+> l <| r = tsingleton l >< r
+-}
+  (<|)       :: c  -> s c -> s c
+  
+  l |> r = l >< singleton r
+  l <| r = singleton l >< r
+  l >< r = case viewl l of
+    EmptyL -> r
+    h :< t  -> h <| (t >< r)
+
+  viewl q = case viewr q of 
+    EmptyR -> EmptyL
+    p :> l -> case viewl p of
+        EmptyL -> l :< empty
+        h :< t   -> h :< (t |> l)
+
+  viewr q = case viewl q of 
+    EmptyL -> EmptyR
+    h :< t -> case viewr t of
+        EmptyR -> empty   :> h
+        p :> l   -> (h <| p) :> l
+
+data ViewL s c where
+   EmptyL  :: ViewL s c 
+   (:<)    :: c  -> s c  -> ViewL s c 
+
+data ViewR s c  where
+   EmptyR  :: ViewR s c 
+   (:>)     :: s c -> c -> ViewR s c 
+
+ 
+instance Sequence S.Seq where
+ empty = S.empty
+ singleton = S.singleton
+ (<|) = (S.<|)
+ (|>) = (S.|>)
+ (><) = (S.><)
+ viewl s = case S.viewl s of
+   S.EmptyL -> EmptyL
+   h S.:< t -> h :< t
+ viewr s = case S.viewr s of
+   S.EmptyR -> EmptyR
+   t S.:> h -> t :> h
+
+instance Sequence [] where
+  empty = []
+  singleton x = [x]
+  (<|) = (:)
+  viewl [] = EmptyL
+  viewl (h : t) = h :< t 
+
+
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,11 @@
+Copyright (c) 2014, Atze van der Ploeg
+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 Atze van der Ploeg nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,3 @@
+
+import Distribution.Simple
+main = defaultMain
diff --git a/sequence.cabal b/sequence.cabal
new file mode 100644
--- /dev/null
+++ b/sequence.cabal
@@ -0,0 +1,22 @@
+Name:                sequence
+Version:             0.9.0
+Synopsis:	         A type class for sequences and various sequence data structures.
+Description:         A type class for sequences and various sequence data structures.
+License:             BSD3
+License-file:        LICENSE
+Author:              Atze van der Ploeg
+Maintainer:          atzeus@gmail.com
+Homepage:            https://github.com/atzeus/sequence
+Build-Type:          Simple
+Cabal-Version:       >=1.6
+Data-files:          ChangeLog
+Category:            Data, Data Structures
+Tested-With:         GHC==7.6.3
+Library
+  Build-Depends: base >= 2 && <= 6
+  Exposed-modules: Data.SequenceClass, Data.Sequence.Queue, Data.Sequence.FastQueue, Data.Sequence.FastCatQueue,  Data.Sequence.ToCatQueue
+  Extensions:	
+
+source-repository head
+    type:     git
+    location:  https://github.com/atzeus/type-aligned
