diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c)2012, Ivan Perez
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of Ivan Perez nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT
+OWNER 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/MissingK.cabal b/MissingK.cabal
new file mode 100644
--- /dev/null
+++ b/MissingK.cabal
@@ -0,0 +1,68 @@
+-- hails.cabal auto-generated by cabal init. For additional options,
+-- see
+-- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr.
+-- The name of the package.
+Name:                MissingK
+
+-- The package version. See the Haskell package versioning policy
+-- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for
+-- standards guiding when and how versions should be incremented.
+Version:             0.0.0.2
+
+-- A short (one-line) description of the package.
+Synopsis:            Useful types and definitions missing from other libraries
+
+-- A longer description of the package.
+-- Description:         
+
+-- URL for the project homepage or repository.
+Homepage:            http://www.keera.es/blog/community/
+
+-- The license under which the package is released.
+License:             BSD3
+
+-- The file containing the license text.
+License-file:        LICENSE
+
+-- The package author(s).
+Author:              Ivan Perez
+
+-- An email address to which users can send suggestions, bug reports,
+-- and patches.
+Maintainer:          ivan.perez@keera.es
+
+-- A copyright notice.
+-- Copyright:           
+
+Category:            Development
+
+Build-type:          Simple
+
+-- Extra files to be distributed with the package, such as examples or
+-- a README.
+-- Extra-source-files:  
+
+-- Constraint on the version of Cabal needed to build this package.
+Cabal-version:       >=1.2
+
+Library
+  hs-source-dirs: src/
+  
+  ghc-options: -Wall -fno-warn-unused-do-bind -O2
+
+  -- Modules exported by the library.
+  Exposed-modules: Data.Stack
+                 , Data.String.Extra
+                 , Data.List.Extra
+                 , System.Environment.SetEnv
+                 , Control.Arrow.Extra
+                 , Control.Exception.Extra
+
+                 -- from haskell-prmvc-helpers
+                 , Language.Haskell.TH.DeriveField
+                 , Data.ExtraVersion
+  
+  -- Packages needed in order to build this package.
+  Build-depends: base >= 4 && < 5
+               , template-haskell
+               , glib
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/src/Control/Arrow/Extra.hs b/src/Control/Arrow/Extra.hs
new file mode 100644
--- /dev/null
+++ b/src/Control/Arrow/Extra.hs
@@ -0,0 +1,13 @@
+module Control.Arrow.Extra
+  ( module Control.Arrow.Extra
+  , module Control.Arrow
+  )
+ where
+
+import Control.Arrow
+
+both :: (a -> b) -> (a, a) -> (b, b)
+both f (x, y) = (f x, f y)
+
+both2 :: (a -> b -> c) -> (a, a) -> (b, b) -> (c, c)
+both2 f (x1, x2) (y1, y2) = (f x1 y1, f x2 y2)
diff --git a/src/Control/Exception/Extra.hs b/src/Control/Exception/Extra.hs
new file mode 100644
--- /dev/null
+++ b/src/Control/Exception/Extra.hs
@@ -0,0 +1,27 @@
+module Control.Exception.Extra where
+
+import           GHC.Conc
+import           System.Glib.GError
+import qualified Control.Exception as E
+
+-- | Returns a given computation ignoring an exception
+anyway :: a -> E.SomeException -> a
+anyway f _ = f
+
+handleExceptions :: IO a -> IO a -> IO a
+handleExceptions handler = E.handle (anyway handler)
+
+-- | Tries to execute all the IO computations
+-- until one succeeds
+trySeq :: [IO ()] -> IO ()
+trySeq []     = return ()
+trySeq (x:xs) = E.handle (anyway (trySeq xs)) x
+
+-- | Handles any exception (apparently the default handle won't handle all)
+handleAllExceptions :: IO () -> IO () -> IO ()
+handleAllExceptions handler op = do
+  setUncaughtExceptionHandler (anyway handler)
+  E.handle (anyway handler) $ handleGError (anywayG handler) op
+
+anywayG :: IO a -> GError -> IO a
+anywayG x (GError _dom _code _msg) = x
diff --git a/src/Data/ExtraVersion.hs b/src/Data/ExtraVersion.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/ExtraVersion.hs
@@ -0,0 +1,28 @@
+module Data.ExtraVersion where
+
+data Version = Version
+ { vMajor  :: Int
+ , vMinor  :: Int
+ , vStatus :: VersionStatus
+ , vIter   :: Int
+ }
+ deriving (Eq, Ord, Show, Read)
+
+data VersionStatus = None
+                   | Alpha
+                   | Beta
+                   | ReleaseCandidate
+                   | Final
+ deriving (Eq, Ord, Show, Enum, Read)
+
+versionToString :: Version -> String
+versionToString v = mj ++ "." ++ mn ++ "-" ++ st ++ it
+  where mj = show $ vMajor v
+        mn = show $ vMinor v
+        st = case vStatus v of
+              Alpha            -> "alpha"
+              Beta             -> "beta"
+              ReleaseCandidate -> "rc"
+              Final            -> "r"
+              None             -> ""
+        it = show $ vIter v
diff --git a/src/Data/List/Extra.hs b/src/Data/List/Extra.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/List/Extra.hs
@@ -0,0 +1,42 @@
+module Data.List.Extra where
+
+updateAt :: Int -> a -> [a] -> [a]
+updateAt _ _ []     = []
+updateAt 0 x (_:xs) = x : xs
+updateAt i x (y:xs) = y : updateAt (i-1) x xs
+
+deleteAt :: Int -> [a] -> [a]
+deleteAt _ []     = []
+deleteAt 0 (_:xs) = xs
+deleteAt i (x:xs) = x : deleteAt (i-1) xs
+
+elemAt :: Int -> [a] -> Maybe a
+elemAt _ []     = Nothing
+elemAt 0 (x:_)  = Just x
+elemAt i (_:xs) = elemAt (i-1) xs
+
+shiftLeftWith :: (a -> Bool) -> [a] -> [a]
+shiftLeftWith f (x1:x2:xs)
+ | f x2      = x2 : x1 : xs
+ | otherwise = x1 : shiftLeftWith f (x2:xs)
+shiftLeftWith _  xs = xs
+
+shiftRightWith :: (a -> Bool) -> [a] -> [a]
+shiftRightWith f (x1:x2:xs)
+ | f x1      = x2 : x1 : xs
+ | otherwise = x1 : shiftRightWith f (x2:xs)
+shiftRightWith _ xs = xs
+
+shiftLeftAt :: Int -> [a] -> [a]
+shiftLeftAt i ls@(x1:x2:xs)
+ | i < 1     = ls
+ | i == 1    = x2 : x1 : xs
+ | otherwise = x1 : shiftLeftAt (i - 1) (x2:xs)
+shiftLeftAt _  xs = xs
+
+shiftRightAt :: Int -> [a] -> [a]
+shiftRightAt i ls@(x1:x2:xs)
+ | i < 0     = ls
+ | i == 0    = x2 : x1 : xs
+ | otherwise = x1 : shiftRightAt (i - 1) (x2:xs)
+shiftRightAt _  xs = xs
diff --git a/src/Data/Stack.hs b/src/Data/Stack.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/Stack.hs
@@ -0,0 +1,12 @@
+module Data.Stack where
+
+type Stack a = [a]
+
+pop :: Stack a -> (a, Stack a)
+pop (x:xs) = (x,xs)
+
+push :: a -> Stack a -> Stack a
+push = (:)
+
+empty :: Stack a
+empty = []
diff --git a/src/Data/String/Extra.hs b/src/Data/String/Extra.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/String/Extra.hs
@@ -0,0 +1,15 @@
+module Data.String.Extra
+ (trim)
+ where
+
+-- | Auxiliary string functions. I can't believe no module declares these
+-- FIXME: Check that no existing module declares these.
+trim :: String -> String
+trim = trimEnd . trimBeginning
+
+trimBeginning :: String -> String
+trimBeginning = dropWhile (== ' ')
+
+-- FIXME: Use dropWhileEnd from 4.5.0.0
+trimEnd :: String -> String
+trimEnd = reverse . trimBeginning . reverse
diff --git a/src/Language/Haskell/TH/DeriveField.hs b/src/Language/Haskell/TH/DeriveField.hs
new file mode 100644
--- /dev/null
+++ b/src/Language/Haskell/TH/DeriveField.hs
@@ -0,0 +1,10 @@
+module Language.Haskell.TH.DeriveField where
+
+import Language.Haskell.TH.Syntax
+import Language.Haskell.TH.Lib
+
+deriveField :: String -> String -> String -> Name -> Q [Dec]
+deriveField cls clsOp fld name = sequenceQ
+ [ instanceD (cxt []) (appT (conT (mkName cls)) (conT name))
+   [ funD (mkName clsOp) [ clause [] (normalB (varE (mkName fld))) [] ] ]
+ ]
diff --git a/src/System/Environment/SetEnv.hs b/src/System/Environment/SetEnv.hs
new file mode 100644
--- /dev/null
+++ b/src/System/Environment/SetEnv.hs
@@ -0,0 +1,47 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+module System.Environment.SetEnv (setEnv) where
+
+#ifdef linux_HOST_OS
+import           Foreign.C.Error  ( throwErrnoIfMinus1_ )
+import           Foreign.C.String
+import           Foreign.C.Types  ( CInt(CInt) )
+import           System.Posix.Internals
+
+{- |The 'setEnv' function inserts or resets the environment variable name in
+    the current environment list.  If the variable @name@ does not exist in the
+    list, it is inserted with the given value.  If the variable does exist,
+    the argument @overwrite@ is tested; if @overwrite@ is @False@, the variable is
+    not reset, otherwise it is reset to the given value.
+ -}
+
+setEnv :: String -> String -> IO ()
+setEnv key value =
+  withFilePath key $ \ keyP ->
+    withFilePath value $ \ valueP ->
+      throwErrnoIfMinus1_ "setenv" $
+        c_setenv keyP valueP (fromIntegral (fromEnum True))
+
+foreign import ccall unsafe "setenv"
+   c_setenv :: CString -> CString -> CInt -> IO CInt
+#else
+
+import Foreign.C.String
+
+foreign import ccall unsafe "putenv"
+  c_putenv :: CString -> IO ()
+
+setEnv :: String -> String -> IO()
+setEnv key value = 
+ withCString (key ++ "=" ++ value) $ \c_pair ->
+ c_putenv c_pair
+
+-- foreign import stdcall unsafe "windows.h SetEnvironmentVariableW"
+--  c_SetEnvironmentVariable :: LPCTSTR -> LPCTSTR -> IO Bool
+-- 
+-- setEnvironmentVariable :: String -> String -> IO Bool
+-- setEnvironmentVariable key value = 
+--  withTString key $ \c_key ->
+--  withTString value $ \c_value ->
+--  c_SetEnvironmentVariable c_key c_value
+#endif
