diff --git a/System/Chatty/Commands.hs b/System/Chatty/Commands.hs
--- a/System/Chatty/Commands.hs
+++ b/System/Chatty/Commands.hs
@@ -1,5 +1,26 @@
 {-# LANGUAGE FlexibleInstances #-}
 
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 -- | Provides in-haskell implementations for some standard functions
 module System.Chatty.Commands where
 
diff --git a/System/Chatty/Misc.hs b/System/Chatty/Misc.hs
--- a/System/Chatty/Misc.hs
+++ b/System/Chatty/Misc.hs
@@ -1,3 +1,24 @@
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 -- | Provides typeclasses for clocks and randomizer environments
 module System.Chatty.Misc where
 
@@ -11,7 +32,7 @@
   mutctime :: m UTCTime
   -- | Get timestamp, guaranteed to grow
   mgetstamp :: m NominalDiffTime
-  mgetstamp = fmap (diffUTCTime (UTCTime (fromGregorian 1970 1 1) (secondsToDiffTime 0))) mutctime
+  mgetstamp = fmap (flip diffUTCTime (UTCTime (fromGregorian 1970 1 1) (secondsToDiffTime 0))) mutctime
 
 instance MonadClock IO where
   mutctime = getCurrentTime
diff --git a/System/Chatty/Spawn.hs b/System/Chatty/Spawn.hs
--- a/System/Chatty/Spawn.hs
+++ b/System/Chatty/Spawn.hs
@@ -1,3 +1,25 @@
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
+-- | Provides a typeclass for process spawning.
 module System.Chatty.Spawn where
 
 import Text.Chatty.Finalizer
diff --git a/System/Chatty/Spawn/Builtins.hs b/System/Chatty/Spawn/Builtins.hs
--- a/System/Chatty/Spawn/Builtins.hs
+++ b/System/Chatty/Spawn/Builtins.hs
@@ -1,3 +1,24 @@
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 -- | Provides builtins for some common commands.
 module System.Chatty.Spawn.Builtins (withBuiltins) where
 
diff --git a/System/Chatty/Spawn/Overlay.hs b/System/Chatty/Spawn/Overlay.hs
--- a/System/Chatty/Spawn/Overlay.hs
+++ b/System/Chatty/Spawn/Overlay.hs
@@ -1,3 +1,24 @@
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 -- | Provides a MonadSpawn overlay that may catch specific spawn calls and handle them itself.
 module System.Chatty.Spawn.Overlay where
 
diff --git a/Text/Chatty/Expansion.hs b/Text/Chatty/Expansion.hs
--- a/Text/Chatty/Expansion.hs
+++ b/Text/Chatty/Expansion.hs
@@ -1,104 +1,53 @@
-{-# LANGUAGE ExistentialQuantification, RankNTypes, Rank2Types #-}
-
--- | Provides generic string expansion and a variable expander
-module Text.Chatty.Expansion where
-
-import Data.List
-import Control.Arrow
-import Control.Monad
-import Control.Monad.IO.Class
-import Control.Monad.Trans.Class
-import System.Environment hiding (getEnv)
-import System.Posix.Env (getEnv, setEnv)
---import System.SetEnv
-
--- | Some environment variable
-data EnvVar = NotSet                       -- ^ Not set.
-            | Literal String               -- ^ An embeddable string.
-            | forall a.Show a => Scalar a  -- ^ Something we can show.
-            | Array [EnvVar]               -- ^ Array of that
-
-instance Show EnvVar where
-  show (Scalar s) = show s
-  show (Literal s) = s
-  show (Array ps) = unwords $ map show ps
-  show NotSet = ""
-
--- | Environment storage and variable expander.
-newtype ExpanderT m a = Expander {
-    runExpanderT :: [(String,EnvVar)] -> m (a,[(String,EnvVar)])
-  }
-
-instance Monad m => Monad (ExpanderT m) where
-  return a = Expander $ \vs -> return (a,vs)
-  (Expander e) >>= f = Expander $ \vs -> do (a,vs') <- e vs; runExpanderT (f a) vs'
-
-instance MonadTrans ExpanderT where
-  lift m = Expander $ \vs -> do a <- m; return (a,vs)
-
-instance MonadIO m => MonadIO (ExpanderT m) where
-  liftIO = lift . liftIO
-
-instance Monad m => Functor (ExpanderT m) where
-  fmap f a = Expander $ \vs -> do (a',vs') <- runExpanderT a vs; return (f a',vs')
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
 
--- | Run this function inside a blank environment.
-localEnvironment :: Functor m => ExpanderT m a -> m a
-localEnvironment m = fmap fst $ runExpanderT m []
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
 
--- | Run this function in a locally modifiable, but not exported environment
-forkEnvironment :: (Functor m,Monad m,MonadIO m) => ExpanderT m a -> m a
-forkEnvironment m = do
-  es <- liftIO getEnvironment
-  fmap fst $ runExpanderT m $ fmap (second Literal) es
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
 
--- | Export this local environment.
-exportAll :: (Monad m,MonadIO m) => ExpanderT m ()
-exportAll = Expander $ \vs -> do
-  liftIO $ forM_ vs $ \(k,v) -> setEnv k (show v) True
-  return ((),vs)
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
 
--- | Typeclass for all environment storages.
-class Monad ee => ExpanderEnv ee where
-  -- | Get environment variable
-  mgetv :: String -> ee EnvVar
-  -- | Put environment variable
-  mputv :: String -> EnvVar -> ee ()
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
 
-instance Monad m => ExpanderEnv (ExpanderT m) where
-  mgetv s = Expander $ \vs -> return $
-    case filter ((==s).fst) vs of
-      [] -> (NotSet,vs)
-      ((_,v):_) -> (v,vs)
-  mputv k v = Expander $ \vs -> return ((),(k,v):filter ((/=k).fst) vs)
+-- | Provides generic string expansion
+module Text.Chatty.Expansion where
 
-instance ExpanderEnv IO where
-  mgetv = fmap (\v -> case v of Nothing -> NotSet; Just v' -> Literal v') . getEnv
-  mputv k v = setEnv k (show v) True
+import Control.Monad
+import Control.Monad.IO.Class
+import Control.Monad.Trans.Class
 
 -- | Typeclass for all string-expanding monads.
 class Monad e => MonadExpand e where
   -- | Expand the given string.
   expand :: String -> e String
 
-instance MonadExpand IO where
-  expand = expandVars
+newtype NullExpanderT m a = NullExpander { runNullExpanderT :: m a }
 
-instance Monad m => MonadExpand (ExpanderT m) where
-  expand = expandVars
+instance Monad m => Monad (NullExpanderT m) where
+  return = NullExpander . return
+  (NullExpander ne) >>= f = NullExpander $ do ne' <- ne; runNullExpanderT (f ne')
 
--- | Expand $variables.
-expandVars :: (Monad m,Functor m,ExpanderEnv m) => String -> m String
-expandVars [] = return []
-expandVars ('$':ss) =
-  let nm = takeWhile isAnum ss
-      rm = dropWhile isAnum ss
-  in do
-    v <- fmap show $ mgetv nm
-    r <- expandVars rm
-    return (v++r)
-expandVars (s:ss) = do ss' <- expandVars ss; return (s:ss')
+instance MonadTrans NullExpanderT where
+  lift = NullExpander
 
--- | Is alphanumeric?
-isAnum = (`elem` (['a'..'z']++['A'..'Z']++"_"++['0'..'9']))
+instance Functor m => Functor (NullExpanderT m) where
+  fmap f (NullExpander ne) = NullExpander $ fmap f ne
 
+instance MonadIO m => MonadIO (NullExpanderT m) where
+  liftIO = lift . liftIO
+
+instance Monad m => MonadExpand (NullExpanderT m) where
+  expand = return
+
+withExpansion :: Monad m => NullExpanderT m a -> m a
+withExpansion = runNullExpanderT
diff --git a/Text/Chatty/Expansion/History.hs b/Text/Chatty/Expansion/History.hs
new file mode 100644
--- /dev/null
+++ b/Text/Chatty/Expansion/History.hs
@@ -0,0 +1,80 @@
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
+module Text.Chatty.Expansion.History where
+
+import Prelude hiding (id,(.))
+import Control.Arrow
+import Control.Category (id,(.))
+import Control.Monad
+import Control.Monad.IO.Class
+import Control.Monad.Trans.Class
+import Text.Chatty.Expansion
+
+newtype HistoryT m a = History {
+    runHistoryT :: [String] -> m (a,[String])
+  }
+
+instance Monad m => Monad (HistoryT m) where
+  return a = History $ \s -> return (a,s)
+  (History h) >>= f = History $ \s -> do (a,s') <- h s; runHistoryT (f a) s'
+
+instance MonadTrans HistoryT where
+  lift m = History $ \s -> do a <- m; return (a,s)
+
+instance MonadIO m => MonadIO (HistoryT m) where
+  liftIO = lift . liftIO
+
+instance Monad m => Functor (HistoryT m) where
+  fmap f a = History $ \s -> do (a',s') <- runHistoryT a s; return (f a',s')
+
+class Monad he => HistoryEnv he where
+  mcounth :: he Int
+  mgeth :: Int -> he String
+  mputh :: String -> he ()
+
+instance Monad m => HistoryEnv (HistoryT m) where
+  mcounth = History $ runKleisli (arr length &&& id)
+  mgeth i
+    | i <= 0 = let j = -i in History $ runKleisli (arr (!!j) &&& id)
+    | otherwise = History . runKleisli $ arr ((!!i).reverse &&& id)
+  mputh s = History . runKleisli $ arr (const () &&& (s:))
+
+expandHist :: HistoryEnv h => String -> h String
+expandHist [] = return []
+expandHist ('!':ss) =
+  let (nm,rm) = (takeWhile isNum &&& dropWhile isNum) ss
+      isNum a = elem a ['0'..'9'] || (a=='-')
+  in case nm of
+    [] -> do
+      ss' <- expandHist ss
+      return ('!':ss')
+    _ -> do
+      hs <- expandHist rm
+      h <- mgeth $ read nm
+      return (h++hs)
+expandHist (s:ss) = do ss' <- expandHist ss; return (s:ss')
+
+instance MonadExpand m => MonadExpand (HistoryT m) where
+  expand = lift . expand <=< expandHist
+
+withHistory :: Monad m => HistoryT m a -> m a
+withHistory = liftM fst . flip runHistoryT []
diff --git a/Text/Chatty/Expansion/Vars.hs b/Text/Chatty/Expansion/Vars.hs
new file mode 100644
--- /dev/null
+++ b/Text/Chatty/Expansion/Vars.hs
@@ -0,0 +1,117 @@
+{-# LANGUAGE ExistentialQuantification, RankNTypes, Rank2Types #-}
+
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
+module Text.Chatty.Expansion.Vars where
+
+import Control.Arrow
+import Control.Monad
+import Control.Monad.IO.Class
+import Control.Monad.Trans.Class
+import System.Environment hiding (getEnv)
+import System.Posix.Env (getEnv, setEnv)
+import Text.Chatty.Expansion
+
+-- | Some environment variable
+data EnvVar = NotSet                       -- ^ Not set.
+            | Literal String               -- ^ An embeddable string.
+            | forall a.Show a => Scalar a  -- ^ Something we can show.
+            | Array [EnvVar]               -- ^ Array of that
+
+instance Show EnvVar where
+  show (Scalar s) = show s
+  show (Literal s) = s
+  show (Array ps) = unwords $ map show ps
+  show NotSet = ""
+
+
+-- | Environment storage and variable expander.
+newtype ExpanderT m a = Expander {
+    runExpanderT :: [(String,EnvVar)] -> m (a,[(String,EnvVar)])
+  }
+
+instance Monad m => Monad (ExpanderT m) where
+  return a = Expander $ \vs -> return (a,vs)
+  (Expander e) >>= f = Expander $ \vs -> do (a,vs') <- e vs; runExpanderT (f a) vs'
+
+instance MonadTrans ExpanderT where
+  lift m = Expander $ \vs -> do a <- m; return (a,vs)
+
+instance MonadIO m => MonadIO (ExpanderT m) where
+  liftIO = lift . liftIO
+
+instance Monad m => Functor (ExpanderT m) where
+  fmap f a = Expander $ \vs -> do (a',vs') <- runExpanderT a vs; return (f a',vs')
+
+-- | Run this function inside a blank environment.
+localEnvironment :: Functor m => ExpanderT m a -> m a
+localEnvironment m = fmap fst $ runExpanderT m []
+
+-- | Run this function in a locally modifiable, but not exported environment
+forkEnvironment :: (Functor m,Monad m,MonadIO m) => ExpanderT m a -> m a
+forkEnvironment m = do
+  es <- liftIO getEnvironment
+  fmap fst $ runExpanderT m $ fmap (second Literal) es
+
+-- | Export this local environment.
+exportAll :: (Monad m,MonadIO m) => ExpanderT m ()
+exportAll = Expander $ \vs -> do
+  liftIO $ forM_ vs $ \(k,v) -> setEnv k (show v) True
+  return ((),vs)
+
+instance MonadExpand IO where
+  expand = expandVars
+
+instance MonadExpand m => MonadExpand (ExpanderT m) where
+  expand = lift . expand <=< expandVars
+
+-- | Expand $variables. TODO: ${var}
+expandVars :: (Monad m,Functor m,ExpanderEnv m) => String -> m String
+expandVars [] = return []
+expandVars ('$':ss) =
+  let (nm,rm) = (takeWhile isAnum &&& dropWhile isAnum) ss
+  in do
+    v <- fmap show $ mgetv nm
+    r <- expandVars rm
+    return (v++r)
+expandVars (s:ss) = do ss' <- expandVars ss; return (s:ss')
+
+-- | Is alphanumeric?
+isAnum = (`elem` (['a'..'z']++['A'..'Z']++"_"++['0'..'9']))
+
+-- | Typeclass for all environment storages.
+class Monad ee => ExpanderEnv ee where
+  -- | Get environment variable
+  mgetv :: String -> ee EnvVar
+  -- | Put environment variable
+  mputv :: String -> EnvVar -> ee ()
+
+instance Monad m => ExpanderEnv (ExpanderT m) where
+  mgetv s = Expander $ \vs -> return $
+    case filter ((==s).fst) vs of
+      [] -> (NotSet,vs)
+      ((_,v):_) -> (v,vs)
+  mputv k v = Expander $ \vs -> return ((),(k,v):filter ((/=k).fst) vs)
+
+instance ExpanderEnv IO where
+  mgetv = fmap (\v -> case v of Nothing -> NotSet; Just v' -> Literal v') . getEnv
+  mputv k v = setEnv k (show v) True
diff --git a/Text/Chatty/Extended/ANSI.hs b/Text/Chatty/Extended/ANSI.hs
--- a/Text/Chatty/Extended/ANSI.hs
+++ b/Text/Chatty/Extended/ANSI.hs
@@ -1,3 +1,24 @@
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 -- | Provides an ExtendedPrinter that handles colours using standardized ANSI codes.
 module Text.Chatty.Extended.ANSI where
 
diff --git a/Text/Chatty/Extended/HTML.hs b/Text/Chatty/Extended/HTML.hs
--- a/Text/Chatty/Extended/HTML.hs
+++ b/Text/Chatty/Extended/HTML.hs
@@ -1,3 +1,24 @@
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 -- | Provides an 'ExtendedPrinter' that handles colours using HTML output.
 module Text.Chatty.Extended.HTML where
 
@@ -40,19 +61,19 @@
 maskHtml c = [c]
 
 -- | Convert the given colour to its CSS representation.
-hexColour (Dull Green) = "004400"
+hexColour (Dull Green) = "007F00"
 hexColour (Vivid Green) = "00FF00"
-hexColour (Dull Red) = "440000"
+hexColour (Dull Red) = "7F0000"
 hexColour (Vivid Red) = "FF0000"
-hexColour (Dull Yellow) = "444400"
+hexColour (Dull Yellow) = "7F7F00"
 hexColour (Vivid Yellow) = "FFFF00"
-hexColour (Dull Blue) = "000044"
+hexColour (Dull Blue) = "00007F"
 hexColour (Vivid Blue) = "0000FF"
 hexColour (Dull Black) = "000000"
-hexColour (Vivid Black) = "444444"
-hexColour (Dull White) = "888888"
+hexColour (Vivid Black) = "606060"
+hexColour (Dull White) = "909090"
 hexColour (Vivid White) = "FFFFFF"
-hexColour (Dull Cyan) = "004444"
+hexColour (Dull Cyan) = "007F7F"
 hexColour (Vivid Cyan) = "00FFFF"
-hexColour (Dull Magenta) = "440044"
+hexColour (Dull Magenta) = "7F007F"
 hexColour (Vivid Magenta) = "FF00FF"
diff --git a/Text/Chatty/Extended/Printer.hs b/Text/Chatty/Extended/Printer.hs
--- a/Text/Chatty/Extended/Printer.hs
+++ b/Text/Chatty/Extended/Printer.hs
@@ -1,3 +1,24 @@
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 -- | Provides an extended printer class that supports colours.
 module Text.Chatty.Extended.Printer where
 
diff --git a/Text/Chatty/Finalizer.hs b/Text/Chatty/Finalizer.hs
--- a/Text/Chatty/Finalizer.hs
+++ b/Text/Chatty/Finalizer.hs
@@ -1,3 +1,25 @@
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
+-- | Provides handle-closing.
 module Text.Chatty.Finalizer where
 
 import Control.Monad
diff --git a/Text/Chatty/Interactor.hs b/Text/Chatty/Interactor.hs
--- a/Text/Chatty/Interactor.hs
+++ b/Text/Chatty/Interactor.hs
@@ -1,5 +1,26 @@
 {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FunctionalDependencies, TemplateHaskell #-}
 
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 -- | Provides a bunch of derived instances for the various typeclasses.
 module Text.Chatty.Interactor where
 
@@ -7,6 +28,8 @@
 import Text.Chatty.Scanner
 import Text.Chatty.Finalizer
 import Text.Chatty.Expansion
+import Text.Chatty.Expansion.Vars
+import Text.Chatty.Expansion.History
 import Text.Chatty.Extended.HTML
 import Text.Chatty.Extended.ANSI
 import System.Chatty.Misc
@@ -17,17 +40,19 @@
 import Control.Monad.Trans.Class
 import Control.Monad.Identity
 
-mkInteractor ''RecorderT mkScanner mkFinalizer mkExpander mkSpawn mkRandom mkClock
-mkInteractor ''DeafT mkScanner mkFinalizer mkExpander mkSpawn mkRandom mkClock
-mkInteractor ''OutRedirT mkScanner mkFinalizer mkExpander mkSpawn mkRandom mkClock
-mkInteractor ''HandleCloserT mkScanner mkPrinter mkExpander mkSpawn mkRandom mkClock
-mkInteractor ''ExpanderT mkScanner mkPrinter mkFinalizer mkSpawn mkRandom mkClock
-mkInteractor ''HereStringT mkPrinter mkExpander mkSpawn mkRandom mkClock
-mkInteractor ''QuietT mkPrinter mkExpander mkSpawn mkRandom mkClock
-mkInteractor ''InRedirT mkPrinter mkExpander mkSpawn mkRandom mkClock
-mkInteractor ''SpawnOverlayT mkPrinter mkScanner mkExpander mkFinalizer mkRandom mkClock
-mkInteractor ''HtmlPrinterT mkScanner mkExpander mkFinalizer mkSpawn mkRandom mkClock
-mkInteractor ''AnsiPrinterT mkScanner mkExpander mkFinalizer mkSpawn mkRandom mkClock
+mkInteractor ''RecorderT mkScanner mkFinalizer mkExpander mkExpanderEnv mkHistoryEnv mkSpawn mkRandom mkClock
+mkInteractor ''DeafT mkScanner mkFinalizer mkExpander mkExpanderEnv mkHistoryEnv mkSpawn mkRandom mkClock
+mkInteractor ''OutRedirT mkScanner mkFinalizer mkExpander mkExpanderEnv mkHistoryEnv mkSpawn mkRandom mkClock
+mkInteractor ''HandleCloserT mkScanner mkPrinter mkExpander mkExpanderEnv mkHistoryEnv mkSpawn mkRandom mkClock
+mkInteractor ''ExpanderT mkScanner mkPrinter mkFinalizer mkSpawn mkRandom mkClock mkHistoryEnv
+mkInteractor ''HereStringT mkPrinter mkExpander mkExpanderEnv mkHistoryEnv mkSpawn mkRandom mkClock
+mkInteractor ''QuietT mkPrinter mkExpander mkExpanderEnv mkHistoryEnv mkSpawn mkRandom mkClock
+mkInteractor ''InRedirT mkPrinter mkExpander mkExpanderEnv mkHistoryEnv mkSpawn mkRandom mkClock
+mkInteractor ''SpawnOverlayT mkPrinter mkScanner mkExpander mkExpanderEnv mkHistoryEnv mkFinalizer mkRandom mkClock
+mkInteractor ''HtmlPrinterT mkScanner mkExpander mkExpanderEnv mkHistoryEnv mkFinalizer mkSpawn mkRandom mkClock
+mkInteractor ''AnsiPrinterT mkScanner mkExpander mkExpanderEnv mkHistoryEnv mkFinalizer mkSpawn mkRandom mkClock
+mkInteractor ''NullExpanderT mkScanner mkPrinter mkFinalizer mkSpawn mkRandom mkClock
+mkInteractor ''HistoryT  mkScanner mkPrinter mkFinalizer mkSpawn mkRandom mkClock mkExpanderEnv
 
 -- | IgnorantT ignores all output and does not provide any input.
 type IgnorantT m = QuietT (DeafT m)
diff --git a/Text/Chatty/Interactor/Templates.hs b/Text/Chatty/Interactor/Templates.hs
--- a/Text/Chatty/Interactor/Templates.hs
+++ b/Text/Chatty/Interactor/Templates.hs
@@ -1,12 +1,35 @@
 {-# LANGUAGE TemplateHaskell, QuasiQuotes, FlexibleInstances #-}
 
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 -- | Declares serveral templates for comfortable instance derivation
-module Text.Chatty.Interactor.Templates (mkScanner, mkPrinter, mkFinalizer, mkExpander,mkInteractor,mkSpawn,mkRandom,mkClock,mkChatty) where
+module Text.Chatty.Interactor.Templates (mkScanner, mkPrinter, mkFinalizer, mkExpander,mkExpanderEnv,mkHistoryEnv,mkInteractor,mkSpawn,mkRandom,mkClock,mkChatty) where
 
 import Text.Chatty.Scanner
 import Text.Chatty.Printer
 import Text.Chatty.Finalizer
 import Text.Chatty.Expansion
+import Text.Chatty.Expansion.Vars
+import Text.Chatty.Expansion.History
 import System.Chatty.Spawn
 import Text.Chatty.Extended.Printer
 import Control.Monad
@@ -51,17 +74,33 @@
   |]               
   where sx = strToType s
 
--- | Automatically derives a MonadExpand and an ExpanderEnv instance for you.
+-- | Automatically derives a MonadExpand instance for you.
 mkExpander :: Name -> Q [Dec]
 mkExpander s = [d|
     instance MonadExpand m => MonadExpand ($sx m) where
       expand = lift . expand
+  |]
+  where sx = strToType s
+
+-- | Automatically derives an ExpanderEnv instance for you
+mkExpanderEnv :: Name -> Q [Dec]
+mkExpanderEnv s = [d|
     instance ExpanderEnv m => ExpanderEnv ($sx m) where
       mgetv = lift . mgetv
       mputv k v = lift $ mputv k v
   |]
   where sx = strToType s
 
+-- | Automatically derives a HistoryEnv instance for you
+mkHistoryEnv :: Name -> Q [Dec]
+mkHistoryEnv s = [d|
+    instance HistoryEnv m => HistoryEnv ($sx m) where
+      mcounth = lift mcounth
+      mgeth = lift . mgeth
+      mputh = lift . mputh
+  |]
+  where sx = strToType s
+
 -- | Automatically derives a MonadSpawn instance for you.
 mkSpawn :: Name -> Q [Dec]
 mkSpawn s = [d|
@@ -91,7 +130,7 @@
 
 -- | Automatically derives all chatty typeclasses for you.
 mkChatty :: Name -> Q [Dec]
-mkChatty s = mkInteractor s mkPrinter mkScanner mkFinalizer mkExpander mkSpawn mkRandom mkClock
+mkChatty s = mkInteractor s mkPrinter mkScanner mkFinalizer mkExpander mkSpawn mkRandom mkClock mkExpanderEnv mkHistoryEnv
 
 -- | Just a helper class for mkInteractor
 class InteractorMaker i where
diff --git a/Text/Chatty/Printer.hs b/Text/Chatty/Printer.hs
--- a/Text/Chatty/Printer.hs
+++ b/Text/Chatty/Printer.hs
@@ -1,5 +1,26 @@
 {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, FunctionalDependencies #-}
 
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 -- | Provides a typeclass for all monads that may print text.
 module Text.Chatty.Printer where
 
diff --git a/Text/Chatty/Scanner.hs b/Text/Chatty/Scanner.hs
--- a/Text/Chatty/Scanner.hs
+++ b/Text/Chatty/Scanner.hs
@@ -1,5 +1,27 @@
 {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, FunctionalDependencies #-}
 
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
+-- | Provides a typeclass for all monads that may scan text.
 module Text.Chatty.Scanner where
 
 import Text.Chatty.Finalizer
diff --git a/Text/Chatty/Templates.hs b/Text/Chatty/Templates.hs
--- a/Text/Chatty/Templates.hs
+++ b/Text/Chatty/Templates.hs
@@ -1,5 +1,26 @@
 {-# LANGUAGE FlexibleInstances #-}
 
+{-
+  This module is part of Chatty.
+  Copyleft (c) 2014 Marvin Cohrs
+
+  All wrongs reversed. Sharing is an act of love, not crime.
+  Please share Antisplice with everyone you like.
+
+  Chatty is free software: you can redistribute it and/or modify
+  it under the terms of the GNU Affero General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Chatty is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU Affero General Public License for more details.
+
+  You should have received a copy of the GNU Affero General Public License
+  along with Chatty. If not, see <http://www.gnu.org/licenses/>.
+-}
+
 module Text.Chatty.Templates where
 
 import Language.Haskell.TH
diff --git a/chatty.cabal b/chatty.cabal
--- a/chatty.cabal
+++ b/chatty.cabal
@@ -10,7 +10,7 @@
 -- PVP summary:      +-+------- breaking API changes
 --                   | | +----- non-breaking API additions
 --                   | | | +--- code changes with no API change
-version:             0.2.0.1
+version:             0.3.1.4
 
 -- A short (one-line) description of the package.
 synopsis:            Some monad transformers and typeclasses to simplify I/O on a transformer stack.
@@ -48,7 +48,7 @@
 
 library
   -- Modules exported by the library.
-  exposed-modules:     Text.Chatty.Expansion, System.Chatty.Commands, System.Chatty.Spawn, Text.Chatty.Printer, Text.Chatty.Finalizer, Text.Chatty.Templates, Text.Chatty.Scanner, Text.Chatty.Interactor, System.Chatty.Spawn.Overlay, System.Chatty.Spawn.Builtins, Text.Chatty.Interactor.Templates, System.Chatty.Misc, Text.Chatty.Extended.Printer, Text.Chatty.Extended.HTML, Text.Chatty.Extended.ANSI
+  exposed-modules:     Text.Chatty.Expansion, System.Chatty.Commands, System.Chatty.Spawn, Text.Chatty.Printer, Text.Chatty.Finalizer, Text.Chatty.Templates, Text.Chatty.Scanner, Text.Chatty.Interactor, System.Chatty.Spawn.Overlay, System.Chatty.Spawn.Builtins, Text.Chatty.Interactor.Templates, System.Chatty.Misc, Text.Chatty.Extended.Printer, Text.Chatty.Extended.HTML, Text.Chatty.Extended.ANSI, Text.Chatty.Expansion.Vars, Text.Chatty.Expansion.History
   
   -- Modules included in this library but not exported.
   -- other-modules:       
