diff --git a/BeautifyTeXOutput.hs b/BeautifyTeXOutput.hs
new file mode 100644
--- /dev/null
+++ b/BeautifyTeXOutput.hs
@@ -0,0 +1,55 @@
+module BeautifyTeXOutput
+   ( beautifyFormula
+   ) where
+
+import Data.List (foldl', isPrefixOf)
+
+
+beautifyFormula :: String -> String
+
+beautifyFormula =
+   subscripts . dictReplace . unlines . map cups . lines
+
+dictReplace :: String -> String
+dictReplace s = foldl' f s dictionary
+   where f input (text, subst) = replace text subst input
+
+
+replace :: String -> String -> String -> String
+replace text subst = go
+   where go input | text `isPrefixOf` input =
+            subst ++ go (drop (length text) input)
+         go (x:xs) = x : go xs
+         go [] = []
+
+
+-- The following is stuff by Florian Stenger
+
+-- The left-hand sides of tuples are to be replaced by
+-- the corresponding right-hand sides.
+dictionary =
+   [ ("->^{seq,=}", "relseqeq")
+   , ("->^{seq,[=}", "relseqineq")
+   , ("^{-1}", " invfun")
+   , ("_|_", "undefined")
+   , ("[=", "blw")
+   ]
+
+-- If a line starts with "u", replace "u" by "cup". Preceeding spaces are ignored.
+cups :: String -> String
+cups (' ':xs)     = " " ++ cups xs
+cups ('u':' ':xs) = "cup " ++ xs
+cups s            = s
+
+-- Makes subscripts a little prettier by removing curly braces.
+subscripts :: String -> String
+subscripts [] = []
+subscripts ('_':'{':xs) =
+   '_' : subscripts' xs
+subscripts (x:xs) =
+   x : subscripts xs
+
+subscripts' :: String -> String
+subscripts' ('}':xs) = subscripts xs
+subscripts' (x:xs) =
+   x : subscripts' xs
diff --git a/FTTools.hs b/FTTools.hs
new file mode 100644
--- /dev/null
+++ b/FTTools.hs
@@ -0,0 +1,132 @@
+{-# LANGUAGE TypeSynonymInstances #-}
+module FTTools
+   ( parseTypeString
+   , specialiseAll
+   , specialiseAllInverse
+   , isInequational
+   , parseDeclarations
+   , rawFunctionName
+   , rawDeclarationName
+   , filterDataDeclarations
+   , filterTypeDeclarations
+   , filterClassDeclarations
+   )
+where
+
+import Language.Haskell.FreeTheorems
+import Language.Haskell.FreeTheorems.Theorems (Theorem, UnfoldedLift, UnfoldedClass)
+import Language.Haskell.FreeTheorems.Parser.Hsx (parse)
+import Language.Haskell.FreeTheorems.BasicSyntax
+   ( signatureName
+   , unpackIdent
+   , getDeclarationName
+   , Declaration (DataDecl, TypeDecl, ClassDecl) -- for the "filter" functions
+   )
+
+import Data.List (find, isInfixOf, foldl')
+
+
+parseDeclarations :: [ValidDeclaration] -> String -> Either String [ValidDeclaration]
+parseDeclarations oldDecls text =
+   let (decls, errors) = runChecks (parse text >>= checkAgainst oldDecls)
+   in case errors of
+      (e:_) -> Left (show e)
+      []    -> Right decls
+
+
+specialiseAll :: Intermediate -> Intermediate
+specialiseAll im = foldl' specialise im $ relationVariables im
+
+specialiseAllInverse :: Intermediate -> Intermediate
+specialiseAllInverse im = foldl' specialiseInverse im $ relationVariables im
+
+isInequational :: LanguageSubset -> Bool
+isInequational (SubsetWithFix InequationalTheorem) = True
+isInequational (SubsetWithSeq InequationalTheorem) = True
+isInequational _ = False
+
+
+instance Eq (ValidDeclaration) where
+   x == y = rawDeclaration x == rawDeclaration y
+
+instance Show (ValidDeclaration) where
+   show = show . prettyDeclaration . rawDeclaration
+
+instance Show (ValidSignature) where
+   show = show . prettySignature . rawSignature
+
+instance Show (Theorem) where
+   show = show . prettyTheorem []
+
+instance Show (UnfoldedLift) where
+   show = show . prettyUnfoldedLift []
+
+instance Show (UnfoldedClass) where
+   show = show . prettyUnfoldedClass []
+
+
+{- From FTBase.hs -}
+
+-- Parses a type string and returns the named type obtained from parsing or an
+-- error if no type was found. The function works as follows:
+--
+--   * If the input contains "::", then it is parsed as a named type.
+--
+--   * If the input is only one word, the function tries to find a type with
+--     that name in the list of predefined types. If it can be found, that type
+--     is parsed as a named type.
+--
+--   * Otherwise the input is parsed as a type without name, while a new name is
+--     generated.
+
+parseTypeString :: [ValidDeclaration] -> String -> Either String ValidSignature
+
+parseTypeString oldDecls input | containsTwoColons input =
+      parseNamedType oldDecls input
+
+parseTypeString oldDecls input | isOneWord input =
+      case find ((input==) . rawFunctionName) knownSignatures of
+         Just vsig -> Right vsig
+         Nothing   -> parseType oldDecls input
+   where knownSignatures = filterSignatures oldDecls
+
+parseTypeString oldDecls input =
+      parseType oldDecls input
+
+
+parseType :: [ValidDeclaration] -> String -> Either String ValidSignature
+parseType oldDecls s = parseNamedType oldDecls ("f::"++s)
+
+parseNamedType :: [ValidDeclaration] -> String -> Either String ValidSignature
+parseNamedType oldDecls s = do
+   vs <- parseDeclarations oldDecls s
+   case filterSignatures vs of
+      [sig] -> Right sig
+      _     -> Left "no valid type signature"
+
+
+containsTwoColons = isInfixOf "::"
+
+isOneWord = (1==) . length . words
+
+rawFunctionName :: ValidSignature -> String
+rawFunctionName = unpackIdent . signatureName . rawSignature
+
+rawDeclarationName :: ValidDeclaration -> String
+rawDeclarationName = unpackIdent . getDeclarationName . rawDeclaration
+
+
+filterDataDeclarations = filter $ \vd ->
+   case rawDeclaration vd of
+      DataDecl _ -> True
+      _ -> False
+
+filterTypeDeclarations = filter $ \vd ->
+   case rawDeclaration vd of
+      TypeDecl _ -> True
+      _ -> False
+
+filterClassDeclarations = filter $ \vd ->
+   case rawDeclaration vd of
+      ClassDecl _ -> True
+      _ -> False
diff --git a/GeneratePDF.hs b/GeneratePDF.hs
new file mode 100644
--- /dev/null
+++ b/GeneratePDF.hs
@@ -0,0 +1,107 @@
+module GeneratePDF where
+
+import Network.CGI
+import System.FilePath (replaceExtension, (</>))
+import System.Directory (removeFile)
+import System.IO (openTempFile, hClose, hPutStr, getContents)
+import System (system)
+import Data.List (intercalate)
+import qualified Data.ByteString.Lazy as B
+
+import Language.Haskell.FreeTheorems
+
+import FTTools
+import BeautifyTeXOutput (beautifyFormula)
+import Paths (getTemporaryDirectory, getPathToAdditionalTeXFiles)
+
+
+
+newtype PDF = PDF { fromPDF :: B.ByteString }
+
+generatePDF model showTheorem decls sig im = do
+   setHeader "Content-type" "application/pdf"
+   pdf <- liftIO (typeset $ asTeX model showTheorem decls sig im)
+   outputFPS (fromPDF pdf)
+
+generateTeX model showTheorem decls sig im = do
+   setHeader "Content-type" "text/plain"
+   output $ asTeX model showTheorem decls sig im
+
+
+asTeX model showTheorem decls sig im =
+  intercalate "\n" $
+    [ "\\documentclass{article}"
+    , "\\usepackage{amsmath}"
+    , "\\pagestyle{empty}"
+    , "\\parindent 0"
+    , ""
+    , "\\begin{document}"
+    , "\\input{lambdaTeX}"
+    , ""
+    , "The theorem generated for functions of the type"
+    , ""
+    , formula (show sig)
+
+    , "in the sublanguage of Haskell with " ++ show model ++ ", is:"
+    , ""
+    , formula (showTheorem (ifAllowed simplify $ asTheorem im))
+    , formula (intercalate parBreak (map (show . ifAllowed simplifyUnfoldedLift) (unfoldLifts decls im)))
+    , formula (intercalate parBreak (map show (unfoldClasses decls im)))
+
+    , "Reducing all permissible relation variables to functions yields:"
+    , ""
+    , formula ((showTheorem (ifAllowed simplify $ asTheorem im2)))
+    , formula (intercalate parBreak (map (show . ifAllowed simplifyUnfoldedLift) (unfoldLifts decls im2)))
+    , formula (intercalate parBreak (map show (unfoldClasses decls im2)))
+
+    ] ++ (if isInequational model
+             then [ "Instead reducing all permissible relation variables to the inverses of functions yields:"
+                  , ""
+                  , formula (showTheorem (ifAllowed simplify $ asTheorem im3))
+                  , formula (intercalate parBreak (map (show . ifAllowed simplifyUnfoldedLift) (unfoldLifts decls im3)))
+                  , formula (intercalate parBreak (map show (unfoldClasses decls im3)))
+                  ]
+             else []
+         ) ++
+    [ "\\end{document}"
+    ]
+    where
+       -- Return the argument if simplifications are allowed
+       ifAllowed smpl = case model of
+                            BasicSubset -> smpl
+                            SubsetWithFix _ -> smpl
+                            _ -> id
+       im2 = specialiseAll im
+       im3 = specialiseAllInverse im
+       parBreak = "\n\n"
+
+       formula = unlines . map ("> "++) . lines . beautifyFormula
+
+
+instance Show LanguageSubset where
+  show BasicSubset = "with no bottoms"
+  show (SubsetWithFix EquationalTheorem) = "with general recursion but no selective strictness, equational style"
+  show (SubsetWithFix InequationalTheorem) = "with general recursion but no selective strictness, inequational style"
+  show (SubsetWithSeq EquationalTheorem) = "with general recursion and selective strictness, equational style"
+  show (SubsetWithSeq InequationalTheorem) = "with general recursion and selective strictness, inequational style"
+
+
+typeset texSource = do
+   tmp_dir <- liftIO getTemporaryDirectory
+   (tempPath, tempHandle) <- openTempFile tmp_dir "temp.tex"
+   let pathTo ext = replaceExtension tempPath ext
+
+   hPutStr tempHandle texSource
+   hClose tempHandle
+
+
+   tex_dir <- getPathToAdditionalTeXFiles
+   system $ "TEXINPUTS=\"" ++ tex_dir ++ ":$TEXINPUTS\" pdflatex -interaction=batchmode --output-dir=\"" ++ tmp_dir ++ "\" " ++ pathTo "tex" ++ " > /dev/null"
+   removeFile $ pathTo "tex"
+   removeFile $ pathTo "aux"
+   removeFile $ pathTo "log"
+
+   pdfData <- B.readFile $ pathTo "pdf"
+   removeFile $ pathTo "pdf"
+
+   return $ PDF pdfData
diff --git a/KnownDeclarations.hs b/KnownDeclarations.hs
new file mode 100644
--- /dev/null
+++ b/KnownDeclarations.hs
@@ -0,0 +1,39 @@
+module KnownDeclarations
+   ( knownDeclarations
+   , arbitraryButFixedTypes
+   , standardHaskellDeclarations
+   ) where
+
+import Language.Haskell.FreeTheorems.BasicSyntax
+import Language.Haskell.FreeTheorems.ValidSyntax
+
+{- All known declarations in parsed form. -}
+knownDeclarations :: [ValidDeclaration]
+knownDeclarations = arbitraryButFixedTypes ++ standardHaskellDeclarations
+
+
+arbitraryButFixedTypes =
+   let arbitraryTypeNumber n =
+         dataDecl name [simpleCons name] where name = ("T"++show n)
+   in map arbitraryTypeNumber [0..9]
+
+standardHaskellDeclarations = [ValidDeclaration {rawDeclaration = DataDecl (Data {dataName = Ident {unpackIdent = "Bool"}, dataVars = [], dataCons = [DataCon {dataConName = Ident {unpackIdent = "False"}, dataConTypes = []},DataCon {dataConName = Ident {unpackIdent = "True"}, dataConTypes = []}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "(&&)"}, signatureType = TypeFun (TypeCon (Con (Ident {unpackIdent = "Bool"})) []) (TypeFun (TypeCon (Con (Ident {unpackIdent = "Bool"})) []) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "(||)"}, signatureType = TypeFun (TypeCon (Con (Ident {unpackIdent = "Bool"})) []) (TypeFun (TypeCon (Con (Ident {unpackIdent = "Bool"})) []) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "not"}, signatureType = TypeFun (TypeCon (Con (Ident {unpackIdent = "Bool"})) []) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "otherwise"}, signatureType = TypeCon (Con (Ident {unpackIdent = "Bool"})) []}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = DataDecl (Data {dataName = Ident {unpackIdent = "Maybe"}, dataVars = [TV (Ident {unpackIdent = "a"})], dataCons = [DataCon {dataConName = Ident {unpackIdent = "Nothing"}, dataConTypes = []},DataCon {dataConName = Ident {unpackIdent = "Just"}, dataConTypes = [Unbanged {withoutBang = TypeVar (TV (Ident {unpackIdent = "a"}))}]}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "maybe"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"})))) (TypeFun (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "b"})))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = DataDecl (Data {dataName = Ident {unpackIdent = "Either"}, dataVars = [TV (Ident {unpackIdent = "a"}),TV (Ident {unpackIdent = "b"})], dataCons = [DataCon {dataConName = Ident {unpackIdent = "Left"}, dataConTypes = [Unbanged {withoutBang = TypeVar (TV (Ident {unpackIdent = "a"}))}]},DataCon {dataConName = Ident {unpackIdent = "Right"}, dataConTypes = [Unbanged {withoutBang = TypeVar (TV (Ident {unpackIdent = "b"}))}]}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "either"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "c"})))) (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "c"})))) (TypeFun (TypeCon (Con (Ident {unpackIdent = "Either"})) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeVar (TV (Ident {unpackIdent = "c"}))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = DataDecl (Data {dataName = Ident {unpackIdent = "Ordering"}, dataVars = [], dataCons = [DataCon {dataConName = Ident {unpackIdent = "LT"}, dataConTypes = []},DataCon {dataConName = Ident {unpackIdent = "EQ"}, dataConTypes = []},DataCon {dataConName = Ident {unpackIdent = "GT"}, dataConTypes = []}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeDecl (Type {typeName = Ident {unpackIdent = "String"}, typeVars = [], typeRhs = TypeCon ConList [TypeCon ConChar []]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "fst"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "snd"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeVar (TV (Ident {unpackIdent = "b"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "curry"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeFun (TypeFun (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeVar (TV (Ident {unpackIdent = "c"})))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "c"}))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "uncurry"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "c"}))))) (TypeFun (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeVar (TV (Ident {unpackIdent = "c"})))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [], className = Ident {unpackIdent = "Eq"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "(==)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))},Signature {signatureName = Ident {unpackIdent = "(/=)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [TC (Ident {unpackIdent = "Eq"})], className = Ident {unpackIdent = "Ord"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "compare"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Ordering"})) []))},Signature {signatureName = Ident {unpackIdent = "(<)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))},Signature {signatureName = Ident {unpackIdent = "(<=)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))},Signature {signatureName = Ident {unpackIdent = "(>)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))},Signature {signatureName = Ident {unpackIdent = "(>=)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "max"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "min"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [], className = Ident {unpackIdent = "Enum"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "succ"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "pred"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "toEnum"}, signatureType = TypeFun (TypeCon ConInt []) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "fromEnum"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConInt [])},Signature {signatureName = Ident {unpackIdent = "enumFrom"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])},Signature {signatureName = Ident {unpackIdent = "enumFromThen"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))},Signature {signatureName = Ident {unpackIdent = "enumFromTo"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))},Signature {signatureName = Ident {unpackIdent = "enumFromThenTo"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [], className = Ident {unpackIdent = "Bounded"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "minBound"}, signatureType = TypeVar (TV (Ident {unpackIdent = "a"}))},Signature {signatureName = Ident {unpackIdent = "maxBound"}, signatureType = TypeVar (TV (Ident {unpackIdent = "a"}))}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeDecl (Type {typeName = Ident {unpackIdent = "Rational"}, typeVars = [], typeRhs = TypeCon (Con (Ident {unpackIdent = "Ratio"})) [TypeCon ConInteger []]}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [TC (Ident {unpackIdent = "Eq"}),TC (Ident {unpackIdent = "Show"})], className = Ident {unpackIdent = "Num"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "(+)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "(-)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "(*)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "negate"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "abs"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "signum"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "fromInteger"}, signatureType = TypeFun (TypeCon ConInteger []) (TypeVar (TV (Ident {unpackIdent = "a"})))}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [TC (Ident {unpackIdent = "Num"}),TC (Ident {unpackIdent = "Ord"})], className = Ident {unpackIdent = "Real"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "toRational"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Ratio"})) [TypeCon ConInteger []])}]}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [TC (Ident {unpackIdent = "Real"}),TC (Ident {unpackIdent = "Enum"})], className = Ident {unpackIdent = "Integral"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "quot"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "rem"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "div"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "mod"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "quotRem"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "a"}))]))},Signature {signatureName = Ident {unpackIdent = "divMod"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "a"}))]))},Signature {signatureName = Ident {unpackIdent = "toInteger"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConInteger [])}]}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [TC (Ident {unpackIdent = "Num"})], className = Ident {unpackIdent = "Fractional"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "(/)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "recip"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "fromRational"}, signatureType = TypeFun (TypeCon (Con (Ident {unpackIdent = "Ratio"})) [TypeCon ConInteger []]) (TypeVar (TV (Ident {unpackIdent = "a"})))}]}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [TC (Ident {unpackIdent = "Fractional"})], className = Ident {unpackIdent = "Floating"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "pi"}, signatureType = TypeVar (TV (Ident {unpackIdent = "a"}))},Signature {signatureName = Ident {unpackIdent = "exp"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "log"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "sqrt"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "(**)"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "logBase"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "sin"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "cos"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "tan"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "asin"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "acos"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "atan"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "sinh"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "cosh"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "tanh"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "asinh"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "acosh"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "atanh"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))}]}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [TC (Ident {unpackIdent = "Real"}),TC (Ident {unpackIdent = "Fractional"})], className = Ident {unpackIdent = "RealFrac"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "properFraction"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "b"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "a"}))]))},Signature {signatureName = Ident {unpackIdent = "truncate"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "b"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"}))))},Signature {signatureName = Ident {unpackIdent = "round"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "b"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"}))))},Signature {signatureName = Ident {unpackIdent = "ceiling"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "b"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"}))))},Signature {signatureName = Ident {unpackIdent = "floor"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "b"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"}))))}]}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [TC (Ident {unpackIdent = "RealFrac"}),TC (Ident {unpackIdent = "Floating"})], className = Ident {unpackIdent = "RealFloat"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "floatRadix"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConInteger [])},Signature {signatureName = Ident {unpackIdent = "floatDigits"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConInt [])},Signature {signatureName = Ident {unpackIdent = "floatRange"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (ConTuple 2) [TypeCon ConInt [],TypeCon ConInt []])},Signature {signatureName = Ident {unpackIdent = "decodeFloat"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (ConTuple 2) [TypeCon ConInteger [],TypeCon ConInt []])},Signature {signatureName = Ident {unpackIdent = "encodeFloat"}, signatureType = TypeFun (TypeCon ConInteger []) (TypeFun (TypeCon ConInt []) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "exponent"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConInt [])},Signature {signatureName = Ident {unpackIdent = "significand"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))},Signature {signatureName = Ident {unpackIdent = "scaleFloat"}, signatureType = TypeFun (TypeCon ConInt []) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "isNaN"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])},Signature {signatureName = Ident {unpackIdent = "isInfinite"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])},Signature {signatureName = Ident {unpackIdent = "isDenormalized"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])},Signature {signatureName = Ident {unpackIdent = "isNegativeZero"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])},Signature {signatureName = Ident {unpackIdent = "isIEEE"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])},Signature {signatureName = Ident {unpackIdent = "atan2"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))}]}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "subtract"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Num"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "even"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "odd"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "gcd"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "lcm"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "(^)"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Num"})] (TypeAbs (TV (Ident {unpackIdent = "b"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "(^^)"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Fractional"})] (TypeAbs (TV (Ident {unpackIdent = "b"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "fromIntegral"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Integral"})] (TypeAbs (TV (Ident {unpackIdent = "b"})) [TC (Ident {unpackIdent = "Num"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"})))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "realToFrac"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Real"})] (TypeAbs (TV (Ident {unpackIdent = "b"})) [TC (Ident {unpackIdent = "Fractional"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"})))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "id"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "const"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "(.)"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "c"})))) (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"})))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "c"}))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "flip"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "c"}))))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "c"}))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "($)"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"})))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"}))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "until"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])) (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "asTypeOf"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "error"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "undefined"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeVar (TV (Ident {unpackIdent = "a"})))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "seq"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "b"}))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "($!)"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"})))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"}))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "map"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"})))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "(++)"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "filter"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "head"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "last"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "tail"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "init"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "null"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "length"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConInt []))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "(!!)"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConInt []) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "reverse"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "foldl"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeVar (TV (Ident {unpackIdent = "a"})))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "foldl1"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "foldr"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "b"}))))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "b"})))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "foldr1"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "and"}, signatureType = TypeFun (TypeCon ConList [TypeCon (Con (Ident {unpackIdent = "Bool"})) []]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "or"}, signatureType = TypeFun (TypeCon ConList [TypeCon (Con (Ident {unpackIdent = "Bool"})) []]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "any"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "all"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "sum"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Num"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "product"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Num"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "concat"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "concatMap"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "maximum"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Ord"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "minimum"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Ord"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "scanl"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "scanl1"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "scanr"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "b"}))))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))])))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "scanr1"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "iterate"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"})))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "repeat"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "replicate"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConInt []) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "cycle"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "take"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConInt []) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "drop"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConInt []) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "splitAt"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConInt []) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (ConTuple 2) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "takeWhile"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "dropWhile"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "span"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (ConTuple 2) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "break"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (ConTuple 2) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "elem"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "notElem"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "lookup"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"}))]]) (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "b"}))]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zip"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeCon ConList [TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"}))]]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zip3"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]) (TypeCon ConList [TypeCon (ConTuple 3) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "c"}))]]))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zipWith"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "c"}))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zipWith3"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "c"}))) (TypeVar (TV (Ident {unpackIdent = "d"})))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))]))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "unzip"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeCon ConList [TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"}))]]) (TypeCon (ConTuple 2) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "unzip3"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeFun (TypeCon ConList [TypeCon (ConTuple 3) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "c"}))]]) (TypeCon (ConTuple 3) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "lines"}, signatureType = TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon ConList [TypeCon ConChar []]])}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "words"}, signatureType = TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon ConList [TypeCon ConChar []]])}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "unlines"}, signatureType = TypeFun (TypeCon ConList [TypeCon ConList [TypeCon ConChar []]]) (TypeCon ConList [TypeCon ConChar []])}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "unwords"}, signatureType = TypeFun (TypeCon ConList [TypeCon ConList [TypeCon ConChar []]]) (TypeCon ConList [TypeCon ConChar []])}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeDecl (Type {typeName = Ident {unpackIdent = "ShowS"}, typeVars = [], typeRhs = TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon ConChar []])}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [], className = Ident {unpackIdent = "Show"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "showsPrec"}, signatureType = TypeFun (TypeCon ConInt []) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon ConChar []])))},Signature {signatureName = Ident {unpackIdent = "show"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConList [TypeCon ConChar []])},Signature {signatureName = Ident {unpackIdent = "showList"}, signatureType = TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon ConChar []]))}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "shows"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Show"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon ConChar []])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "showChar"}, signatureType = TypeFun (TypeCon ConChar []) (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon ConChar []]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "showString"}, signatureType = TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon ConChar []]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "showParen"}, signatureType = TypeFun (TypeCon (Con (Ident {unpackIdent = "Bool"})) []) (TypeFun (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon ConChar []])) (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon ConChar []])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeDecl (Type {typeName = Ident {unpackIdent = "ReadS"}, typeVars = [TV (Ident {unpackIdent = "a"})], typeRhs = TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeCon ConList [TypeCon ConChar []]]])}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [], className = Ident {unpackIdent = "Read"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "readsPrec"}, signatureType = TypeFun (TypeCon ConInt []) (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeCon ConList [TypeCon ConChar []]]]))},Signature {signatureName = Ident {unpackIdent = "readList"}, signatureType = TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon (ConTuple 2) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeCon ConChar []]]])}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "reads"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Read"})] (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeCon ConList [TypeCon ConChar []]]]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "readParen"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Bool"})) []) (TypeFun (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeCon ConList [TypeCon ConChar []]]])) (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeCon ConList [TypeCon ConChar []]]]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "read"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Read"})] (TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "lex"}, signatureType = TypeFun (TypeCon ConList [TypeCon ConChar []]) (TypeCon ConList [TypeCon (ConTuple 2) [TypeCon ConList [TypeCon ConChar []],TypeCon ConList [TypeCon ConChar []]]])}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeDecl (Type {typeName = Ident {unpackIdent = "FilePath"}, typeVars = [], typeRhs = TypeCon ConList [TypeCon ConChar []]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = DataDecl (Data {dataName = Ident {unpackIdent = "Complex"}, dataVars = [TV (Ident {unpackIdent = "a"})], dataCons = [DataCon {dataConName = Ident {unpackIdent = "(:+)"}, dataConTypes = [Banged {withoutBang = TypeVar (TV (Ident {unpackIdent = "a"}))},Banged {withoutBang = TypeVar (TV (Ident {unpackIdent = "a"}))}]}]}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "realPart"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "RealFloat"})] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Complex"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "imagPart"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "RealFloat"})] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Complex"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "mkPolar"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "RealFloat"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Complex"})) [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "cis"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "RealFloat"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Complex"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "polar"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "RealFloat"})] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Complex"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "magnitude"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "RealFloat"})] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Complex"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "phase"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "RealFloat"})] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Complex"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "conjugate"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "RealFloat"})] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Complex"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Complex"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "intersperse"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "transpose"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]]) (TypeCon ConList [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "foldl'"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeVar (TV (Ident {unpackIdent = "a"})))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "foldl1'"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "mapAccumL"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "acc"})) [] (TypeAbs (TV (Ident {unpackIdent = "x"})) [] (TypeAbs (TV (Ident {unpackIdent = "y"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "acc"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "x"}))) (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "acc"})),TypeVar (TV (Ident {unpackIdent = "y"}))]))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "acc"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "x"}))]) (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "acc"})),TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "y"}))]]))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "mapAccumR"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "acc"})) [] (TypeAbs (TV (Ident {unpackIdent = "x"})) [] (TypeAbs (TV (Ident {unpackIdent = "y"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "acc"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "x"}))) (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "acc"})),TypeVar (TV (Ident {unpackIdent = "y"}))]))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "acc"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "x"}))]) (TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "acc"})),TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "y"}))]]))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "unfoldr"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeCon (ConTuple 2) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"}))]])) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "group"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "inits"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "tails"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "isPrefixOf"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "isSuffixOf"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "find"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "partition"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) [])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (ConTuple 2) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zip4"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))]) (TypeCon ConList [TypeCon (ConTuple 4) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "c"})),TypeVar (TV (Ident {unpackIdent = "d"}))]]))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zip5"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeAbs (TV (Ident {unpackIdent = "e"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "e"}))]) (TypeCon ConList [TypeCon (ConTuple 5) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "c"})),TypeVar (TV (Ident {unpackIdent = "d"})),TypeVar (TV (Ident {unpackIdent = "e"}))]]))))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zip6"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeAbs (TV (Ident {unpackIdent = "e"})) [] (TypeAbs (TV (Ident {unpackIdent = "f"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "e"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "f"}))]) (TypeCon ConList [TypeCon (ConTuple 6) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "c"})),TypeVar (TV (Ident {unpackIdent = "d"})),TypeVar (TV (Ident {unpackIdent = "e"})),TypeVar (TV (Ident {unpackIdent = "f"}))]]))))))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zip7"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeAbs (TV (Ident {unpackIdent = "e"})) [] (TypeAbs (TV (Ident {unpackIdent = "f"})) [] (TypeAbs (TV (Ident {unpackIdent = "g"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "e"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "f"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "g"}))]) (TypeCon ConList [TypeCon (ConTuple 7) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "c"})),TypeVar (TV (Ident {unpackIdent = "d"})),TypeVar (TV (Ident {unpackIdent = "e"})),TypeVar (TV (Ident {unpackIdent = "f"})),TypeVar (TV (Ident {unpackIdent = "g"}))]]))))))))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zipWith4"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeAbs (TV (Ident {unpackIdent = "e"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "c"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "d"}))) (TypeVar (TV (Ident {unpackIdent = "e"}))))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "e"}))]))))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zipWith5"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeAbs (TV (Ident {unpackIdent = "e"})) [] (TypeAbs (TV (Ident {unpackIdent = "f"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "c"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "d"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "e"}))) (TypeVar (TV (Ident {unpackIdent = "f"})))))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "e"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "f"}))]))))))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zipWith6"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeAbs (TV (Ident {unpackIdent = "e"})) [] (TypeAbs (TV (Ident {unpackIdent = "f"})) [] (TypeAbs (TV (Ident {unpackIdent = "g"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "c"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "d"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "e"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "f"}))) (TypeVar (TV (Ident {unpackIdent = "g"}))))))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "e"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "f"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "g"}))]))))))))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "zipWith7"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeAbs (TV (Ident {unpackIdent = "e"})) [] (TypeAbs (TV (Ident {unpackIdent = "f"})) [] (TypeAbs (TV (Ident {unpackIdent = "g"})) [] (TypeAbs (TV (Ident {unpackIdent = "h"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "b"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "c"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "d"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "e"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "f"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "g"}))) (TypeVar (TV (Ident {unpackIdent = "h"})))))))))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "e"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "f"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "g"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "h"}))]))))))))))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "unzip4"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeFun (TypeCon ConList [TypeCon (ConTuple 4) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "c"})),TypeVar (TV (Ident {unpackIdent = "d"}))]]) (TypeCon (ConTuple 4) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))]])))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "unzip5"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeAbs (TV (Ident {unpackIdent = "e"})) [] (TypeFun (TypeCon ConList [TypeCon (ConTuple 5) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "c"})),TypeVar (TV (Ident {unpackIdent = "d"})),TypeVar (TV (Ident {unpackIdent = "e"}))]]) (TypeCon (ConTuple 5) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "e"}))]]))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "unzip6"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeAbs (TV (Ident {unpackIdent = "e"})) [] (TypeAbs (TV (Ident {unpackIdent = "f"})) [] (TypeFun (TypeCon ConList [TypeCon (ConTuple 6) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "c"})),TypeVar (TV (Ident {unpackIdent = "d"})),TypeVar (TV (Ident {unpackIdent = "e"})),TypeVar (TV (Ident {unpackIdent = "f"}))]]) (TypeCon (ConTuple 6) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "e"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "f"}))]])))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "unzip7"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "c"})) [] (TypeAbs (TV (Ident {unpackIdent = "d"})) [] (TypeAbs (TV (Ident {unpackIdent = "e"})) [] (TypeAbs (TV (Ident {unpackIdent = "f"})) [] (TypeAbs (TV (Ident {unpackIdent = "g"})) [] (TypeFun (TypeCon ConList [TypeCon (ConTuple 7) [TypeVar (TV (Ident {unpackIdent = "a"})),TypeVar (TV (Ident {unpackIdent = "b"})),TypeVar (TV (Ident {unpackIdent = "c"})),TypeVar (TV (Ident {unpackIdent = "d"})),TypeVar (TV (Ident {unpackIdent = "e"})),TypeVar (TV (Ident {unpackIdent = "f"})),TypeVar (TV (Ident {unpackIdent = "g"}))]]) (TypeCon (ConTuple 7) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "c"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "d"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "e"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "f"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "g"}))]]))))))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "nub"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "delete"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "(\\\\)"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "union"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "intersect"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Eq"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "sort"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Ord"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "insert"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Ord"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "nubBy"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "deleteBy"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "deleteFirstsBy"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "unionBy"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "intersectBy"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "groupBy"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "sortBy"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Ordering"})) []))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "insertBy"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Ordering"})) []))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "maximumBy"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Ordering"})) []))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "minimumBy"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Ordering"})) []))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "genericLength"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "i"})) [TC (Ident {unpackIdent = "Num"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeVar (TV (Ident {unpackIdent = "i"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "genericTake"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "i"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "i"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "genericDrop"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "i"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "i"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "genericSplitAt"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "i"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "i"}))) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeCon (ConTuple 2) [TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))],TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]]))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "genericIndex"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "b"}))))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "genericReplicate"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "i"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "i"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "isJust"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "isNothing"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Bool"})) []))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "fromJust"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "fromMaybe"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"})))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "listToMaybe"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "maybeToList"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "catMaybes"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeFun (TypeCon ConList [TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "mapMaybe"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [] (TypeAbs (TV (Ident {unpackIdent = "b"})) [] (TypeFun (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Maybe"})) [TypeVar (TV (Ident {unpackIdent = "b"}))])) (TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "b"}))]))))}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = ClassDecl (Class {superClasses = [], className = Ident {unpackIdent = "Monoid"}, classVar = TV (Ident {unpackIdent = "a"}), classFuns = [Signature {signatureName = Ident {unpackIdent = "mempty"}, signatureType = TypeVar (TV (Ident {unpackIdent = "a"}))},Signature {signatureName = Ident {unpackIdent = "mappend"}, signatureType = TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeVar (TV (Ident {unpackIdent = "a"}))))},Signature {signatureName = Ident {unpackIdent = "mconcat"}, signatureType = TypeFun (TypeCon ConList [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"})))}]}), isStrictDeclaration = False},ValidDeclaration {rawDeclaration = DataDecl (Data {dataName = Ident {unpackIdent = "Ratio"}, dataVars = [TV (Ident {unpackIdent = "a"})], dataCons = [DataCon {dataConName = Ident {unpackIdent = "(:%)"}, dataConTypes = [Banged {withoutBang = TypeVar (TV (Ident {unpackIdent = "a"}))},Banged {withoutBang = TypeVar (TV (Ident {unpackIdent = "a"}))}]}]}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "(%)"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Ratio"})) [TypeVar (TV (Ident {unpackIdent = "a"}))])))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "numerator"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Ratio"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "denominator"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "Integral"})] (TypeFun (TypeCon (Con (Ident {unpackIdent = "Ratio"})) [TypeVar (TV (Ident {unpackIdent = "a"}))]) (TypeVar (TV (Ident {unpackIdent = "a"}))))}), isStrictDeclaration = True},ValidDeclaration {rawDeclaration = TypeSig (Signature {signatureName = Ident {unpackIdent = "approxRational"}, signatureType = TypeAbs (TV (Ident {unpackIdent = "a"})) [TC (Ident {unpackIdent = "RealFrac"})] (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeFun (TypeVar (TV (Ident {unpackIdent = "a"}))) (TypeCon (Con (Ident {unpackIdent = "Ratio"})) [TypeCon ConInteger []])))}), isStrictDeclaration = True}]
+
+
+{- Functions to construct some abstract syntax elements -}
+
+dataDecl name constructors =
+   ValidDeclaration
+      { rawDeclaration = DataDecl (Data
+            { dataName = Ident {unpackIdent = name}
+            , dataVars = []
+            , dataCons = constructors
+            })
+      , isStrictDeclaration = False
+      }
+
+simpleCons name =
+   DataCon
+      { dataConName = Ident {unpackIdent = name}
+      , dataConTypes = []
+      }
diff --git a/LogRequests.hs b/LogRequests.hs
new file mode 100644
--- /dev/null
+++ b/LogRequests.hs
@@ -0,0 +1,40 @@
+module LogRequests where
+
+import Data.Time.LocalTime
+import System.IO
+import System.FilePath ((</>))
+import Network.CGI
+import Text.CSV
+import Data.Maybe (fromMaybe, isJust)
+
+import Paths (getLogDirectory)
+
+
+logRequest inputs = do
+   timestamp <- getTimestamp
+   maybeHost <- remoteHost
+   ip        <- remoteAddr
+   log_dir   <- liftIO getLogDirectory
+   liftIO $ appendFile (log_dir </> "requests.csv") $ printCSV
+     [[ timestamp
+      , maybeHost `orIfNothing` ip
+      , inputFor "type"
+      , inputFor "model"
+      , inputFor "style"
+      , inputFor "format"
+      , show (hasInputFor "hideTypeInstantiations")
+      --, inputFor "xtraSrc" -- may contain multiple lines
+     ]]
+
+   where inputFor key = fromMaybe "" (lookup key inputs)
+         hasInputFor key = isJust (lookup key inputs)
+
+
+getTimestamp :: CGI String
+getTimestamp = do
+   t <- liftIO getZonedTime
+   return $ show $ zonedTimeToLocalTime t
+
+orIfNothing :: Maybe a -> a -> a
+orIfNothing (Just x) y = x
+orIfNothing Nothing  y = y
diff --git a/Main.hs b/Main.hs
new file mode 100644
--- /dev/null
+++ b/Main.hs
@@ -0,0 +1,168 @@
+{-# LANGUAGE FlexibleInstances, Rank2Types #-}
+module Main where
+
+import Network.CGI
+import Text.XHtml
+import Data.List (intercalate, (\\))
+import Data.Maybe (fromMaybe)
+import Control.Monad (MonadPlus, mzero)
+
+import Language.Haskell.FreeTheorems
+import Language.Haskell.FreeTheorems.Theorems (Theorem)
+
+import KnownDeclarations (knownDeclarations, arbitraryButFixedTypes)
+import Pages (input_page, help_page)
+import FTTools
+import GeneratePDF (generatePDF, generateTeX)
+import TypesetAsImage (typesetAsHtmlImg)
+import LogRequests (logRequest)
+
+
+
+
+main = runCGI (handleErrors cgiMain)
+
+cgiMain :: CGI CGIResult
+cgiMain = do
+   mb_help <- getInput "help"
+   case mb_help of
+      Nothing -> cgiInputPage
+      Just _  -> cgiHelpPage
+
+cgiInputPage :: CGI CGIResult
+cgiInputPage = do
+   inputs <- getInputs
+   logRequest inputs
+   let generate = case lookup "format" inputs of
+                     Nothing          -> generateHTML Graphical inputs
+                     Just "html+png"  -> generateHTML Graphical inputs
+                     Just "html+text" -> generateHTML PlainText inputs
+                     Just "tex"       -> generateTeX
+                     Just "pdf"       -> generatePDF
+       model   = modelFromOptions inputs
+       xtraSrc = fromMaybe "" $ lookup "xtraSrc" inputs
+       showTheorem = showTheoremFromOptions inputs
+       outputHtml = output . renderHtml . input_page inputs
+       reportError title text = outputHtml $ errorBox title text
+   case lookup "type" inputs of
+      Nothing -> outputHtml noHtml
+      Just type_ ->
+         if null type_
+            then reportError "Error: Missing type" "Please enter a type in the input field."
+            else case parseDeclarations knownDeclarations xtraSrc of
+               Left err -> reportError "Error while parsing extra declarations" err
+               Right xtraDecls ->
+                  let decls = knownDeclarations ++ xtraDecls
+                  in case parseTypeString decls type_ of
+                     Left err -> reportError "Error while parsing type string" err
+                     Right sig ->
+                        case interpret decls model sig of
+                           Nothing -> reportError "Error while interpreting signature" "not possible"
+                           Just im -> generate model showTheorem decls sig im
+
+modelFromOptions opts =
+   case lookup "model" opts of
+      Nothing      -> BasicSubset
+      Just "basic" -> BasicSubset
+      Just "fix"   -> SubsetWithFix style
+      Just "seq"   -> SubsetWithSeq style
+   where
+      style = maybe EquationalTheorem styleFromOption $ lookup "style" opts
+      styleFromOption "eq"   = EquationalTheorem
+      styleFromOption "ineq" = InequationalTheorem
+
+showTheoremFromOptions opts =
+   case lookup "hideTypeInstantiations" opts of
+      Just "yes" -> show . prettyTheorem [OmitTypeInstantiations]
+      Nothing    -> show . prettyTheorem []
+
+
+data FormulaeFormat = Graphical -- Formulae are rendered as graphics
+                    | PlainText -- Formulae are rendered as plain text
+
+generateHTML formulaeFormat inputs model showTheorem decls sig im = do
+
+  -- Select the appropriate rendering action
+  let (renderTheorem, renderLifts, renderClasses) =
+         case formulaeFormat of
+            Graphical ->
+               -- Convert to string and pass to the TeX renderer.
+               ( liftIO . typesetAsHtmlImg      . showTheorem . asTheorem
+               , liftIO . mapM typesetAsHtmlImg . map show
+               , liftIO . mapM typesetAsHtmlImg . map show
+               )
+            PlainText ->
+               -- Just convert everything to string.
+               ( return . stringToHtml . showTheorem . asTheorem
+               , return . map (stringToHtml . show)
+               , return . map (stringToHtml . show)
+               )
+
+  -- Render all formulae to Html/[Html] with the selected method
+  theorem            <- renderTheorem im
+  special_theorem    <- renderTheorem special_im
+  specialInv_theorem <- renderTheorem specialInv_im
+  lifts              <- renderLifts   (unfoldLifts decls im)
+  special_lifts      <- renderLifts   (unfoldLifts decls special_im)
+  specialInv_lifts   <- renderLifts   (unfoldLifts decls specialInv_im)
+  classes            <- renderClasses (unfoldClasses decls im)
+  special_classes    <- renderClasses (unfoldClasses decls special_im)
+  specialInv_classes <- renderClasses (unfoldClasses decls specialInv_im)
+
+  -- Display the result page
+  output $ renderHtml $ input_page inputs $
+      thediv <<
+         [ h3 << ("The Free Theorem for \"" ++ show sig ++ "\"")
+         , pre << theorem
+         , pre `aroundEach` lifts
+         , pre `aroundEach` classes
+         , h3 << "Reducing all permissable relation variables to functions"
+         , pre << special_theorem
+         , pre `aroundEach` special_lifts
+         , pre `aroundEach` special_classes
+         , concatHtml $ onlyIf (isInequational model)
+            [ h3 << "Reducing all permissable relation variables to the inverse of functions"
+            , pre << specialInv_theorem
+            , pre `aroundEach` specialInv_lifts
+            , pre `aroundEach` specialInv_classes
+            ]
+         ]
+      where
+         special_im    = specialiseAll im
+         specialInv_im = specialiseAllInverse im
+
+
+
+onlyIf :: MonadPlus m => Bool -> m a -> m a
+onlyIf True  x = x
+onlyIf False _ = mzero
+
+aroundEach :: (HTML a) => (Html -> Html) -> [a] -> Html
+aroundEach elem (x:xs) = elem (toHtml x) +++ aroundEach elem xs
+aroundEach _    []     = noHtml
+
+errorBox :: String -> String -> Html
+errorBox title text =
+   thediv ! [theclass "error"] <<
+      [ h3 << title
+      , p << text
+      ]
+
+
+cgiHelpPage :: CGI CGIResult
+cgiHelpPage =
+   output $ renderHtml $ help_page << html
+      where html = map generateDeclarationBox
+               [ ("Types of predefined functions", map show . filterSignatures)
+               , ("Supported algebraic data types (excluding T0 to T9)", map rawDeclarationName . filterDataDeclarations)
+               , ("Supported type synonyms", map rawDeclarationName . filterTypeDeclarations)
+               , ("Supported type classes", map rawDeclarationName . filterClassDeclarations)
+               ]
+            generateDeclarationBox (text, f) =
+               thediv <<
+                  [ h3 << text
+                  -- Not all known declarations are shown here, just the standard Haskell ones.
+                  -- This excludes the arbitrary but fixed types T0 to T9
+                  , pre << (unlines $ f $ knownDeclarations \\ arbitraryButFixedTypes)
+                  ]
+
diff --git a/Pages.hs b/Pages.hs
new file mode 100644
--- /dev/null
+++ b/Pages.hs
@@ -0,0 +1,141 @@
+module Pages (input_page, help_page) where
+
+import Text.XHtml
+import Data.Maybe (fromMaybe, isJust)
+
+import Paths (relativeURLOf)
+
+-- The hackage URL of a package
+hackage :: String -> URL
+hackage pkgName = "http://hackage.haskell.org/cgi-bin/hackage-scripts/package/" ++ pkgName
+
+-- Link text to url
+at :: (HTML a) => a -> URL -> HotLink
+text `at` url = hotlink url << text
+
+
+page_template title_text content =
+   thehtml <<
+      [ header <<
+         [ thetitle << title_text
+         , thelink ! [rel "stylesheet", thetype "text/css", href (relativeURLOf "style.css")] << ""
+         ]
+      , body <<
+         [ thediv ! [identifier "header"] <<
+            [ h1 << "Haskell"
+            , h2 << title_text
+            ]
+         , thediv ! [identifier "content"] << content
+         ]
+      ]
+
+
+input_page :: [(String, String)] -> Html -> Html
+input_page inputs additionalContent =
+   let title_text = "Automatic generation of free theorems"
+   in page_template title_text <<
+         [ p ! [identifier "help"] << "Help" `at` "?help"
+         , thediv <<
+            [ p << ("This tool allows to generate free theorems for sublanguages of Haskell as described " +++ "here" `at` "?help"  +++ ".")
+            , p << ("The source code of the underlying library and a shell-based application using it is available " +++ "here" `at` hackage "free-theorems" +++ " and " +++ "here" `at` hackage "ftshell" +++ ".")
+            , p << ("You may also want to try the following related tools:" +++ ulist << [ li << "Automatically Generating Counterexamples to Naive Free Theorems" `at` "http://www-ps.iai.uni-bonn.de/cgi-bin/exfind.cgi"
+                                                                                         , li << "Taming Selective Strictness" `at` "http://www-ps.iai.uni-bonn.de/cgi-bin/polyseq.cgi"
+                                                                                         ])
+            ]
+         , thediv <<
+            form ! [method "POST", theclass "float-container"] <<
+               [ thediv <<
+                  [ p << "Please enter a (polymorphic) type, e.g. \"(a -> Bool) -> [a] -> [a]\" or simply \"filter\":"
+                  , p << textfield' "type" ! [theclass "type", size "50", maxlength 1024]
+                  , p << "Please choose a sublanguage of Haskell:"
+                  , p << (check radioOption' { o_name = "model", o_value = "basic", o_label = "no bottoms (hence no general recursion and no selective strictness)" })
+                  , p << (      radioOption' { o_name = "model", o_value = "fix"  , o_label = "general recursion but no selective strictness" })
+                  , p << (      radioOption' { o_name = "model", o_value = "seq"  , o_label = "general recursion and selective strictness" })
+                  , p << "Please choose a theorem style (without effect in the sublanguage with no bottoms):"
+                  , p << (check radioOption' { o_name = "style", o_value = "eq"   , o_label = "equational" })
+                  , p << (      radioOption' { o_name = "style", o_value = "ineq" , o_label = "inequational" })
+                  ]
+               , thediv <<
+                  [ p << "If you need additional declarations you can enter them here:"
+                  , p << textarea' "xtraSrc"
+                  ]
+               , thediv ! [theclass "clear"] <<
+                  [ submit "" "Generate"
+                  , thespan <<
+                     yesNoOption' { o_name = "hideTypeInstantiations", o_value = "yes", o_label = "hide type instantiations", o_title = "Hide type instantiations in theorems for better readability." }
+                  , thespan <<
+                     [ check radioOption' { o_name = "format", o_value = "html+png" , o_label = "PNG"  , o_title = "Show result with graphical formulae"  }
+                     ,       radioOption' { o_name = "format", o_value = "html+text", o_label = "Plain", o_title = "Show result with plain text formulae" }
+                     ,       radioOption' { o_name = "format", o_value = "tex"      , o_label = "TeX"  , o_title = "Export as TeX" }
+                     ,       radioOption' { o_name = "format", o_value = "pdf"      , o_label = "PDF"  , o_title = "Export as PDF" }
+                     ] +++ " " +++ ("?" `at` "?help#format" ! [title "Help on output formats"])
+                  ]
+               ]
+         , additionalContent
+         ]
+   where
+      -- Define versions of all used input elements which
+      -- implicitly use the values from the "inputs" parameter.
+      -- This causes input elements to keep their values after form submission,
+      -- provided the result from getInputs is passed to this function.
+      radioOption' = radioOption { o_inputs = inputs }
+      yesNoOption' = yesNoOption { o_inputs = inputs }
+      textfield' name_ = (! [value $ fromMaybe "" $ lookup name_ inputs]) textfield name_
+      textarea'  name_ = textarea ! [name name_] << (fromMaybe "" $ lookup name_ inputs)
+
+
+data Option = Option { o_type :: String, o_name :: String, o_value :: String, o_label :: String, o_title :: String, o_checked :: Bool, o_inputs :: [(String, String)] }
+
+check :: Option -> Option
+check opt = opt { o_checked = True }
+
+instance HTML Option where
+   toHtml (Option tp n v l t c inputs) =
+      toHtml (input ! attributes +++ label ! [thefor input_id] << l)
+         where attributes = [thetype tp, name n, value v, title t, identifier input_id] ++ if maybe c (v==) (lookup n inputs) then [checked] else []
+               input_id   = n ++ "_" ++ v
+
+yesNoOption = Option "checkbox" "" "" "" "" False []
+radioOption = Option "radio"    "" "" "" "" False []
+
+
+
+help_page :: Html -> Html
+help_page additionalContent =
+   let title_text = "Help on: Automatic generation of free theorems"
+   in page_template title_text <<
+         [ thediv << ("This is the help page for the " +++ "Free Theorem Generator" `at` "?" +++ ".")
+         , thediv <<
+            [ h3 << "Free Theorems"
+            , p << ("Free Theorems were first described in the paper " +++ "\"Theorems for free!\"" `at` "http://doi.acm.org/10.1145/99370.99404" +++ " by Philip Wadler. " +++
+                    "Their special property is that they can be derived solely from the type of a function. The key idea is to interpret types as relations. " +++
+                    "To reflect the structure of types, a relational action, which maps relations to a relation, is defined for every type constructor. " +++
+                    "Using relational actions, a relation can be constructed for every type, and, by applying the definitions of these relational actions, free theorems are obtained.")
+            , p << ("General recursion and selective strictness weaken free theorems. " +++
+                    "To show the influences caused by adding these constructs, several sublanguages of Haskell are supported in this tool. " +++
+                    "The theoretical foundations are described in the paper " +++ "\"Free theorems in the presence of seq\"" `at` "http://doi.acm.org/10.1145/982962.964010" +++ " by Patricia Johann and Janis Voigtländer. " +++
+                    "As motivated there, it is possible to derive both equational and inequational free theorems.")
+            ]
+         , thediv <<
+            [ h3 << "Types"
+            , p << [ thespan << "Types can be entered in two ways, either with a name or without one. Examples would be "
+                   , pre << "g :: forall b . (Int -> b -> b) -> b -> b"
+                   , thespan << " or "
+                   , pre << "[a] -> [a]"
+                   ]
+            , p << "It is also possible to simply enter the name of a predefined Haskell function (see the list given below). The tool knows about standard Haskell data types, type synonyms, and type classes (again, see the lists below)."
+            , p << "Additionally, T0 to T9 may be used as placeholders for arbitrary but fixed types."
+            ]
+         , anchor ! [ identifier "format" ] << ""
+         , thediv <<
+            [ h3 << "Output formats"
+            , p << "The following output formats can be selected:"
+            , defList
+                 [ ("PNG",  "Result is displayed on webpage, formulae are rendered as PNG images — " +++ emphasize << "This is the default.")
+                 , ("Plain", stringToHtml "Result is displayed on webpage, formulae are rendered as plain text.")
+                 , ("TeX",  "A TeX file is generated. You need " +++ "lambdaTeX.tex" `at` relativeURLOf "lambdaTeX.tex" +++ " (adapted from Patryk Zadarnowski) and pdflatex to get the same result as by selecting the 'PDF' option.")
+                 , ("PDF",   stringToHtml "A PDF file is generated.")
+                 ]
+            ]
+         , additionalContent
+         ]
diff --git a/RunLocalServer.hs b/RunLocalServer.hs
new file mode 100644
--- /dev/null
+++ b/RunLocalServer.hs
@@ -0,0 +1,11 @@
+import System
+import Data.List
+
+import Paths_free_theorems_webui
+
+main = do
+   -- Locate the Python script in the data directory and run it.
+   fname <- getDataFileName "runLocalServer.py"
+   bin_dir <- getBinDir
+   data_dir <- getDataDir
+   system $ intercalate " " ["python", fname, bin_dir, data_dir]
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/TypesetAsImage.hs b/TypesetAsImage.hs
new file mode 100644
--- /dev/null
+++ b/TypesetAsImage.hs
@@ -0,0 +1,75 @@
+module TypesetAsImage where
+
+import System.FilePath (replaceExtension)
+import System.Directory (removeFile)
+import System.IO (openTempFile, hClose, hPutStr, getContents)
+import System (system)
+import Data.List (intercalate)
+import Data.Char
+-- Needs package: base64-string
+import Codec.Binary.Base64.String as Base64
+import Text.XHtml
+
+import System.IO.Unsafe (unsafeInterleaveIO)
+
+import BeautifyTeXOutput (beautifyFormula)
+
+import Paths (getTemporaryDirectory, getPathToAdditionalTeXFiles)
+
+
+typesetAsHtmlImg formula = do
+   pngImage <- typesetAsPNG formula
+
+
+   return $ asHtml pngImage
+ where
+   asHtml pngImage =
+     let
+       header = drop 16 pngImage
+       w = sum $ zipWith (*) [256^3, 256^2, 256, 1] $ map ord $ take 4 header
+       h = sum $ zipWith (*) [256^3, 256^2, 256, 1] $ map ord $ take 4 $ drop 4 header
+     in
+       image ! [ src $ "data:image/png;base64," ++ Base64.encode pngImage
+               , alt formula
+               , width  (show (w `div` 2))
+               , height (show (h `div` 2))
+               ]
+
+
+typesetAsPNG formula = unsafeInterleaveIO $ do
+   tmp_dir <- getTemporaryDirectory
+   (tempPath, tempHandle) <- openTempFile tmp_dir "temp.tex"
+   let pathTo ext = replaceExtension tempPath ext
+
+   let texSource = asTeX formula
+   hPutStr tempHandle texSource
+   hClose tempHandle
+
+   tex_dir <- getPathToAdditionalTeXFiles
+   system $ "TEXINPUTS=\"" ++ tex_dir ++ ":$TEXINPUTS\" latex -interaction=batchmode --output-dir=\"" ++ tmp_dir ++ "\" " ++ pathTo "tex" ++ " > /dev/null"
+   removeFile $ pathTo "tex"
+   removeFile $ pathTo "aux"
+   removeFile $ pathTo "log"
+
+   system $ "dvipng -x 2400 -T tight -z 9 -bg transparent -o " ++ pathTo "png" ++ " " ++ pathTo "dvi" ++ " > /dev/null"
+   removeFile $ pathTo "dvi"
+
+   pngImage <- readFile $ pathTo "png"
+   removeFile $ pathTo "png"
+
+   return pngImage
+
+
+asTeX formula =
+  intercalate "\n" $
+    [ "\\documentclass{article}"
+    , "\\usepackage{amsmath}"
+    , "\\pagestyle{empty}"
+    , ""
+    , "\\begin{document}"
+    , "\\input{lambdaTeX}"
+    , ""
+    , unlines $ map ("> "++) $ lines $ beautifyFormula formula
+    , ""
+    , "\\end{document}"
+    ]
diff --git a/default_config/Paths.hs b/default_config/Paths.hs
new file mode 100644
--- /dev/null
+++ b/default_config/Paths.hs
@@ -0,0 +1,20 @@
+module Paths
+   ( getTemporaryDirectory
+   , getPathToAdditionalTeXFiles
+   , getLogDirectory
+   , relativeURLOf
+   )
+where
+
+import Paths_free_theorems_webui (getDataDir)
+import qualified System.Directory
+
+getTemporaryDirectory =
+   catch (System.Directory.getTemporaryDirectory)
+         (\_ -> return ".")
+
+getPathToAdditionalTeXFiles = getDataDir
+
+getLogDirectory = getTemporaryDirectory
+
+relativeURLOf filename = "../" ++ filename
diff --git a/free-theorems-webui.cabal b/free-theorems-webui.cabal
new file mode 100644
--- /dev/null
+++ b/free-theorems-webui.cabal
@@ -0,0 +1,76 @@
+Name:     free-theorems-webui
+Version:  0.1
+
+Synopsis: CGI-based web interface for the free-theorems package.
+Description:
+   This package provides access to the functionality of <http://hackage.haskell.org/package/free-theorems>
+   through a web interface.
+   .
+   An online version can be seen at <http://www-ps.iai.uni-bonn.de/ft/>,
+   where you can also find a more detailed description of the functionality.
+   .
+   There is also a shell based interface: <http://hackage.haskell.org/package/ftshell>.
+   .
+   The CGI binary is called "free-theorems-webui.cgi".
+   .
+   To start it locally for offline usage, just call "free-theorems-webui" after installation. (This needs python)
+License:    PublicDomain
+Category:   Language
+Maintainer: bartsch@cs.uni-bonn.de
+
+Cabal-Version: >= 1.2
+
+Build-type: Simple
+
+Data-files:
+   style.css
+   lambdaTeX.tex
+   runLocalServer.py
+
+Extra-source-files:
+   BeautifyTeXOutput.hs
+   FTTools.hs
+   GeneratePDF.hs
+   KnownDeclarations.hs
+   LogRequests.hs
+   Main.hs
+   Pages.hs
+   TypesetAsImage.hs
+   default_config/Paths.hs
+   our_server_config/Paths.hs
+
+
+Flag our_server
+   description:
+      Use the path configuration from "our_server_config/"
+      instead of "default_config/".
+      .
+      After compilation, the application will only work
+      with the folder layout on our server.
+      .
+      See "our_server_config/Paths.hs" for details.
+   default:
+      False
+
+Executable free-theorems-webui.cgi
+   main-is: Main.hs
+   build-depends: base          >= 3.0.3.1 && <5
+                , free-theorems >= 0.3.1.2
+                , csv           >= 0.1.1
+                , cgi           >= 3001.1.7.1
+                , time          >= 1.1.4
+                , bytestring    >= 0.9.1.4
+                , directory     >= 1.0.0.2
+                , filepath      >= 1.1.0.1
+                , xhtml         >= 3000-2-0-1
+                , base64-string >= 0.2
+                , haskell98
+   if flag(our_server)
+      hs-source-dirs: . our_server_config
+   else
+      hs-source-dirs: . default_config
+
+-- This is just a wrapper for the included Python script
+-- used to start a local CGI server for offline use.
+Executable free-theorems-webui
+   main-is: RunLocalServer.hs
diff --git a/lambdaTeX.tex b/lambdaTeX.tex
new file mode 100644
--- /dev/null
+++ b/lambdaTeX.tex
@@ -0,0 +1,1514 @@
+% Copyright © 2000 Patryk Zadarnowski «pat@jantar.org»
+%
+% 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)  The name of  any author may
+% not  be used  to  endorse or  promote  products derived  from this  software
+% without their specific prior written permission.
+%
+% THIS SOFTWARE IS  PROVIDED ``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 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.
+
+
+%% lambdaTeX v1.0.5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Limitations:
+%
+%       - no support for nested comments
+%       - no support for LaTeX mode
+%       - no support for non-literate mode
+%       - no support for strings in inline mode
+%       - function names must be marked as such explicitely
+%       - < > as the first character in math mode don't work.
+%       - code lines don't wrap well.
+%
+% Quirks:
+%
+%       1. HaskellTeX reserves <, > and " as active characters, but, of
+%          course restores their meaning of < and > in math mode. However,
+%          this doesn't work as well as expected. When TeX sees the $
+%          character, it reads the following character to see if it is
+%          another $ beginning a math display. If that character is active,
+%          it attempts to expand it (a bug in TeX?! or just a mis-feature?
+%          I couldn't find anything in the TeXbook.) So, you must write
+%          $ >$ rather than $>$. Oh well. To make amends for this, I define
+%          \lt and \gt math macros to complement \le and \ge already in
+%          plain TeX, as $\gt$ looks better than $ >$. Fortunately, one rarely
+%          needs to write a relational operator as the first character in
+%          a formula, and, of course, $a>b$ works as expected.
+%
+%       2. When parsing comments, the lexical analyzer temporarily switches
+%          out of Haskell mode, so normal fonts, etc can take effect.
+%          Specifically, it switches out of TeX mode after processing the
+%          initial <dashes> token of a comment. This means that it must
+%          process the token immediately following the dashes, too, before
+%          leaving Haskell mode. Therefore, if this token is an active
+%          character, it will not work as expected (its category code will
+%          be 12.) Again, this normally is not a problem as the character
+%          immediately following the -- should be a space, anyway.
+
+\catcode`@=11
+
+\newskip\hsparskip      \hsparskip=8pt
+\newdimen\hsleftskip    \hsleftskip=30pt
+\newdimen\hsrightskip   \hsrightskip=10pt
+\newdimen\hscommentskip \hscommentskip=1em
+\newdimen\hswordspace   \hswordspace=.3em
+\newdimen\hsspacewidth  \hsspacewidth=1em
+\newdimen\hstabwidth    \hstabwidth=8em
+
+\def\everyhs{}
+\def\beforehs{\vskip 14pt plus3pt minus1pt}
+\def\afterhs{\vskip 14pt plus3pt minus1pt}
+
+\font\hs@keyface=phvb at 9pt
+\font\hs@funface=phvr at 9pt
+\font\hs@sfunface=phvr at 7pt % (added by florian)
+\font\hs@varface=phvro at 9pt
+\font\hs@conface=phvrc at 9pt
+\font\hs@numface=phvr at 9pt
+\font\hs@strface=pcrr at 9pt
+\font\hs@symface=phvr at 9pt
+\font\hs@ssymface=phvr at 7pt
+\font\hs@sssymface=phvr at 5.8pt
+
+\hyphenchar\hs@keyface=-1
+\hyphenchar\hs@funface=-1
+\hyphenchar\hs@varface=-1
+\hyphenchar\hs@conface=-1
+\hyphenchar\hs@symface=-1
+\hyphenchar\hs@numface=-1
+\hyphenchar\hs@strface=-1
+\hyphenchar\hs@ssymface=-1
+\hyphenchar\hs@sssymface=-1
+
+
+%%% Lexical modes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% The lexical analyzer can operate in one of three modes:
+%
+%       0. Inline - Haskell code appearing within a paragraph
+%       1. Bird   - Bird-style literate Haskell code
+%
+% The Inline mode is used to typeset a short fragment of Haskell code
+% in the middle of a paragraph, for example when referring to a variable
+% defined within the program. The mode is entered by the " character.
+% The lexical analyzer exits when it encounters another " character.
+% Newlines are treated as simple whitespace, and comments are illegal.
+% Because the " character is reserved, strings cannot appear in the Inline
+% mode.
+%
+% The Bird mode is used to process Bird-style literate scripts. The mode
+% is entered by the > character (note that this is a hack - in Haskell, >
+% designates literate code only when it appears as the first character on
+% a line.) The mode exits when it encounters a blank line. The text is typeset
+% as a separate paragraph, idented by \hsleftskip on the left and \hsrightskip
+% on the right. The \beforehs macro is inserted before the fragment of code
+% and \afterhs is inserted after it. The > character itself is not displayed.
+
+% In both modes, the \everyhs macro is inserted immediately after entering
+% the Haskell mode.
+%
+% One thing worth noting is that, because spaces are skipped following active
+% characters, in the Inline mode any spaces immediately following the operning
+% " are ignored. For consistency, we also ignore any spaces preceeding the
+% closing ". In Bird mode, TeX swallows spaces following the opening >, so
+% the lexical analyzer _assumes_ that the > was followed by a single space,
+% and strips one space-worth of indentation from all remaining lines in the
+% code fragment.
+
+\newif\ifhs@inline
+
+% The \lambdaTeX macro:
+\def\lambdaTeX{$\lambda$\kern-1.5pt\TeX}
+
+% The amount to kern the current token by:
+\newdimen\hs@space
+\newdimen\hs@guardpos
+\newdimen\hs@previndent
+\newdimen\hs@indent
+
+% The boxes used to build up the current line:
+\newbox\voidb@x % permanently void
+\newbox\hs@i
+\newbox\hs@ii
+\newbox\hs@iii
+
+% Macros for requesting special formatting of a specific lexeme:
+\def\typeset#1#2{\expandafter\def\csname<#1>\endcsname{#2}}
+
+% Define the Haskell keywords:
+\typeset{case}{{\hs@keyface case}}
+\typeset{class}{{\hs@keyface class}}
+\typeset{data}{{\hs@keyface data}}
+\typeset{default}{{\hs@keyface default}}
+\typeset{deriving}{{\hs@keyface deriving}}
+\typeset{do}{{\hs@keyface do}}
+\typeset{else}{{\hs@keyface else}}
+%\typeset{if}{{\hs@keyface if}}
+\typeset{import}{{\hs@keyface import}}
+\typeset{in}{$\in$}
+\typeset{infix}{{\hs@keyface infix}}
+\typeset{infixl}{{\hs@keyface infixl}}
+\typeset{infixr}{{\hs@keyface infixr}}
+\typeset{instance}{{\hs@keyface instance}}
+\typeset{let}{{\hs@keyface let}}
+\typeset{module}{{\hs@keyface module}}
+\typeset{newtype}{{\hs@keyface newtype}}
+\typeset{of}{{\hs@keyface of}}
+\typeset{then}{{\hs@keyface then}}
+\typeset{type}{{\hs@keyface type}}
+\typeset{where}{{\hs@keyface where}}
+\typeset{as}{{\hs@keyface as}}
+\typeset{qualified}{{\hs@keyface qualified}}
+\typeset{hiding}{{\hs@keyface hiding}}
+\typeset{otherwise}{{\hs@keyface otherwise}}
+\typeset{blw}{$\sqsubseteq$}
+\typeset{abv}{$\sqsupseteq$}
+
+\newlength{\spacewidth} % (added by florian).
+\settowidth{\spacewidth}{ } % (added by florian).
+\typeset{invfun}{$\hspace{-\spacewidth}^{-1}$} % (added by florian).
+\typeset{relseqeq}{$\rightarrow^{\text{{\hs@sfunface seq}},=}$} % (added by florian).
+\typeset{relseqineq}{$\rightarrow^{\text{{\hs@sfunface seq}},\sqsubseteq}$} % (added by florian).
+\typeset{lift}{{\hs@conface lift}} % (added by florian).
+
+%\typeset{xii}{\edef\hs@sub{j}\edef\hs@tok{x}\hs@emitvar}
+
+% Define Greek letters:
+\typeset{alpha}{$\alpha^{\hs@sup}_{\hs@sub}$}
+\typeset{beta}{$\beta^{\hs@sup}_{\hs@sub}$}
+\typeset{gamma}{$\gamma^{\hs@sup}_{\hs@sub}$}
+\typeset{delta}{$\delta^{\hs@sup}_{\hs@sub}$}
+\typeset{epsilon}{$\epsilon^{\hs@sup}_{\hs@sub}$}
+\typeset{zeta}{$\zeta^{\hs@sup}_{\hs@sub}$}
+\typeset{eta}{$\eta^{\hs@sup}_{\hs@sub}$}
+\typeset{theta}{$\theta^{\hs@sup}_{\hs@sub}$}
+\typeset{iota}{$\iota^{\hs@sup}_{\hs@sub}$}
+\typeset{kappa}{$\kappa^{\hs@sup}_{\hs@sub}$}
+\typeset{lambda}{$\lambda^{\hs@sup}_{\hs@sub}$}
+\typeset{mu}{$\mu^{\hs@sup}_{\hs@sub}$}
+\typeset{nu}{$\nu^{\hs@sup}_{\hs@sub}$}
+\typeset{xi}{$\xi^{\hs@sup}_{\hs@sub}$}
+\typeset{pi}{$\pi^{\hs@sup}_{\hs@sub}$}
+\typeset{rho}{$\rho^{\hs@sup}_{\hs@sub}$}
+\typeset{sigma}{$\sigma^{\hs@sup}_{\hs@sub}$}
+\typeset{tau}{$\tau^{\hs@sup}_{\hs@sub}$}
+\typeset{upsilon}{$\upsilon^{\hs@sup}_{\hs@sub}$}
+\typeset{phi}{$\phi^{\hs@sup}_{\hs@sub}$}
+\typeset{chi}{$\chi^{\hs@sup}_{\hs@sub}$}
+\typeset{psi}{$\psi^{\hs@sup}_{\hs@sub}$}
+\typeset{omega}{$\omega^{\hs@sup}_{\hs@sub}$}
+
+\typeset{Alpha}{$\mit A^{\hs@sup}_{\hs@sub}$}
+\typeset{Beta}{$\mit B^{\hs@sup}_{\hs@sub}$}
+\typeset{Gamma}{$\mit\Gamma^{\hs@sup}_{\hs@sub}$}
+\typeset{Delta}{$\mit\Delta^{\hs@sup}_{\hs@sub}$}
+\typeset{Epsilon}{$\mit E^{\hs@sup}_{\hs@sub}$}
+\typeset{Zeta}{$\mit Z^{\hs@sup}_{\hs@sub}$}
+\typeset{Eta}{$\mit H^{\hs@sup}_{\hs@sub}$}
+\typeset{Theta}{$\mit\Theta^{\hs@sup}_{\hs@sub}$}
+\typeset{Iota}{$\mit I^{\hs@sup}_{\hs@sub}$}
+\typeset{Kappa}{$\mit K^{\hs@sup}_{\hs@sub}$}
+\typeset{Lambda}{$\mit\Lambda^{\hs@sup}_{\hs@sub}$}
+\typeset{Mu}{$\mit M^{\hs@sup}_{\hs@sub}$}
+\typeset{Nu}{$\mit N^{\hs@sup}_{\hs@sub}$}
+\typeset{Xi}{$\mit\Xi^{\hs@sup}_{\hs@sub}$}
+\typeset{Pi}{$\mit\Pi^{\hs@sup}_{\hs@sub}$}
+\typeset{Rho}{$\mit P^{\hs@sup}_{\hs@sub}$}
+\typeset{Sigma}{$\mit\Sigma^{\hs@sup}_{\hs@sub}$}
+\typeset{Tau}{$\mit T^{\hs@sup}_{\hs@sub}$}
+\typeset{Upsilon}{$\mit\Upsilon^{\hs@sup}_{\hs@sub}$}
+\typeset{Phi}{$\mit\Phi^{\hs@sup}_{\hs@sub}$}
+\typeset{Chi}{$\mit X^{\hs@sup}_{\hs@sub}$}
+\typeset{Psi}{$\mit\Psi^{\hs@sup}_{\hs@sub}$}
+\typeset{Omega}{$\mit\Omega^{\hs@sup}_{\hs@sub}$}
+
+\typeset{ALPHA}{$\rm A^{\hs@sup}_{\hs@sub}$}
+\typeset{BETA}{$\rm B^{\hs@sup}_{\hs@sub}$}
+\typeset{GAMMA}{$\Gamma^{\hs@sup}_{\hs@sub}$}
+\typeset{DELTA}{$\Delta^{\hs@sup}_{\hs@sub}$}
+\typeset{EPSILON}{$\rm E^{\hs@sup}_{\hs@sub}$}
+\typeset{ZETA}{$\rm Z^{\hs@sup}_{\hs@sub}$}
+\typeset{ETA}{$\rm H^{\hs@sup}_{\hs@sub}$}
+\typeset{THETA}{$\Theta^{\hs@sup}_{\hs@sub}$}
+\typeset{IOTA}{$\rm I^{\hs@sup}_{\hs@sub}$}
+\typeset{KAPPA}{$\rm K^{\hs@sup}_{\hs@sub}$}
+\typeset{LAMBDA}{$\Lambda^{\hs@sup}_{\hs@sub}$}
+\typeset{MU}{$\rm M^{\hs@sup}_{\hs@sub}$}
+\typeset{NU}{$\rm N^{\hs@sup}_{\hs@sub}$}
+\typeset{XI}{$\Xi^{\hs@sup}_{\hs@sub}$}
+\typeset{PI}{$\Pi^{\hs@sup}_{\hs@sub}$}
+\typeset{RHO}{$\rm P^{\hs@sup}_{\hs@sub}$}
+\typeset{SIGMA}{$\Sigma^{\hs@sup}_{\hs@sub}$}
+\typeset{TAU}{$\rm T^{\hs@sup}_{\hs@sub}$}
+\typeset{UPSILON}{$\Upsilon^{\hs@sup}_{\hs@sub}$}
+\typeset{PHI}{$\Phi^{\hs@sup}_{\hs@sub}$}
+\typeset{CHI}{$\rm X^{\hs@sup}_{\hs@sub}$}
+\typeset{PSI}{$\Psi^{\hs@sup}_{\hs@sub}$}
+\typeset{OMEGA}{$\Omega^{\hs@sup}_{\hs@sub}$}
+
+% Other math letters:
+\typeset{aleph}{$\aleph$}
+\typeset{infinity}{$\infty$}
+\typeset{nabla}{$\nabla$}
+\typeset{any}{$\exists$}
+\typeset{all}{$\forall$}
+\typeset{sum}{$\sum$}
+\typeset{product}{$\prod$}
+%\typeset{and}{$\bigwedge$}
+\typeset{or}{$\bigvee$}
+\typeset{undefined}{$\bot$}
+\typeset{forall}{$\forall$}
+\typeset{cup}{$\cup$}
+\typeset{bigsqcup}{$\bigsqcup$}
+
+% Define common symbols:
+\typeset{=}{{\hs@symface=}}
+\typeset{<-}{$\leftarrow$}
+\typeset{->}{$\rightarrow$}
+\typeset{=>}{$\Rightarrow$}
+\typeset{++}{$+\kern-5pt+$}
+\typeset{==}{$=$}
+\typeset{/=}{${\mit/}\kern-.65em=$}
+\typeset{<=}{$\leq$}
+\typeset{>=}{$\geq$}
+\typeset{||}{$\vee$}
+\typeset{&&}{$\wedge$}
+\typeset{==>}{$\Rightarrow$}
+\typeset{<=>}{$\Leftrightarrow$}
+
+% Symbols with a backslash are a little tricky:
+{\catcode`/=0\catcode92=12
+ /expandafter/xdef/csname<\>/endcsname{$/lambda$}}
+
+% Define a space letter (used in a few places)
+{\catcode32=12\gdef\hs@{ }}
+
+% Prepare the character codes, etc for use in haskell mode:
+\def\hs@preparecodemode{%
+ \textfont15=\hs@symface
+ \scriptfont15=\hs@ssymface
+ \scriptscriptfont15=\hs@sssymface
+ % Category codes:
+ \chardef\hs@catcodeIX=\catcode9 \catcode9=12
+ \chardef\hs@catcodeXIII=\catcode13 \catcode13=12
+ \chardef\hs@catcodeXXXII=\catcode32 \catcode32=12
+ \chardef\hs@catcodeXXXIII=\catcode33 \catcode33=12
+ \chardef\hs@catcodeXXXIV=\catcode34 \catcode34=12
+ \chardef\hs@catcodeXXXV=\catcode35 \catcode35=12
+ \chardef\hs@catcodeXXXVI=\catcode36 \catcode36=12
+ \chardef\hs@catcodeXXXVII=\catcode37 \catcode37=12
+ \chardef\hs@catcodeXXXVIII=\catcode38 \catcode38=12
+ \chardef\hs@catcodeXXXIX=\catcode39 \catcode39=12
+ \chardef\hs@catcodeXL=\catcode40 \catcode40=12
+ \chardef\hs@catcodeXLI=\catcode41 \catcode41=12
+ \chardef\hs@catcodeXLII=\catcode42 \catcode42=12
+ \chardef\hs@catcodeXLIII=\catcode43 \catcode43=12
+ \chardef\hs@catcodeXLIV=\catcode44 \catcode44=12
+ \chardef\hs@catcodeXLV=\catcode45 \catcode45=12
+ \chardef\hs@catcodeXLVI=\catcode46 \catcode46=12
+ \chardef\hs@catcodeXLVII=\catcode47 \catcode47=12
+ \chardef\hs@catcodeLVIII=\catcode58 \catcode58=12
+ \chardef\hs@catcodeLIX=\catcode59 \catcode59=12
+ \chardef\hs@catcodeLX=\catcode60 \catcode60=12
+ \chardef\hs@catcodeLXI=\catcode61 \catcode61=12
+ \chardef\hs@catcodeLXII=\catcode62 \catcode62=12
+ \chardef\hs@catcodeLXIII=\catcode63 \catcode63=12
+ \chardef\hs@catcodeLXIV=\catcode64 \catcode64=12
+ \chardef\hs@catcodeXCI=\catcode91 \catcode91=12
+ \chardef\hs@catcodeXCII=\catcode92 \catcode92=12
+ \chardef\hs@catcodeXCIII=\catcode93 \catcode93=12
+ \chardef\hs@catcodeXCIV=\catcode94 \catcode94=12
+ \chardef\hs@catcodeXCV=\catcode95 \catcode95=12
+ \chardef\hs@catcodeXCVI=\catcode96 \catcode96=12
+ \chardef\hs@catcodeCXXIII=\catcode123 \catcode123=12
+ \chardef\hs@catcodeCXXIV=\catcode124 \catcode124=12
+ \chardef\hs@catcodeCXXV=\catcode125 \catcode125=12
+ \chardef\hs@catcodeCXXVI=\catcode126 \catcode126=12
+ % Math codes for Haskell symbols:
+ \mathchardef\hs@mathcodeXXXIII=\mathcode33 \mathcode33="0F21 % !
+ \mathchardef\hs@mathcodeXXXV=\mathcode35 \mathcode35="0F23 % #
+ \mathchardef\hs@mathcodeXXXVI=\mathcode36 \mathcode36="0F24 % $
+ \mathchardef\hs@mathcodeXXXVII=\mathcode37 \mathcode37="0F25 % %
+ \mathchardef\hs@mathcodeXXXVIII=\mathcode38 \mathcode38="0F26 % &
+ \mathchardef\hs@mathcodeXL=\mathcode40 \mathcode41="0028 % (
+ \mathchardef\hs@mathcodeXLI=\mathcode41 \mathcode41="0029 % )
+ \mathchardef\hs@mathcodeXLII=\mathcode42 \mathcode42="0203 % *
+ \mathchardef\hs@mathcodeXLIII=\mathcode43 \mathcode43="002B % +
+ \mathchardef\hs@mathcodeXLIV=\mathcode44 \mathcode44="0F2C % ,
+ \mathchardef\hs@mathcodeXLV=\mathcode45 \mathcode45="0200 % -
+ \mathchardef\hs@mathcodeXLVI=\mathcode46 \mathcode46="0F2E % .
+ \mathchardef\hs@mathcodeXLVII=\mathcode47 \mathcode47="002F % /
+ \mathchardef\hs@mathcodeLVIII=\mathcode58 \mathcode58="003A % :
+ \mathchardef\hs@mathcodeLVIX=\mathcode59 \mathcode59="0F3B % ;
+ \mathchardef\hs@mathcodeLX=\mathcode60 \mathcode60="013C % <
+ \mathchardef\hs@mathcodeLXI=\mathcode61 \mathcode61="003D % =
+ \mathchardef\hs@mathcodeLXII=\mathcode62 \mathcode62="013E % >
+ \mathchardef\hs@mathcodeLXIII=\mathcode63 \mathcode63="0F3F % ?
+ \mathchardef\hs@mathcodeLXIV=\mathcode64 \mathcode64="0F40 % @
+ \mathchardef\hs@mathcodeXCI=\mathcode91 \mathcode91="005B % [
+ \mathchardef\hs@mathcodeXCII=\mathcode92 \mathcode92="026E % \
+ \mathchardef\hs@mathcodeXCIII=\mathcode93 \mathcode93="005D % ]
+ \mathchardef\hs@mathcodeXCVI=\mathcode96 \mathcode96="0012 % `
+ \mathchardef\hs@mathcodeCXXIII=\mathcode123 \mathcode123="0266 % {
+ \mathchardef\hs@mathcodeCXXIV=\mathcode124 \mathcode124="007C % |
+ \mathchardef\hs@mathcodeCXXV=\mathcode125 \mathcode125="0267 % {
+ \mathchardef\hs@mathcodeCXXVI=\mathcode126 \mathcode126="0F7E % ~
+ \relax}
+
+% Restore "normal" TeX environment within haskell comments:
+\def\hs@preparecommentmode{%
+ % Category codes:
+ \catcode9=\hs@catcodeIX
+ \catcode13=\hs@catcodeXIII
+ \catcode32=\hs@catcodeXXXII
+ \catcode33=\hs@catcodeXXXIII
+ \catcode34=\hs@catcodeXXXIV
+ \catcode35=\hs@catcodeXXXV
+ \catcode36=\hs@catcodeXXXVI
+ \catcode37=\hs@catcodeXXXVII
+ \catcode38=\hs@catcodeXXXVIII
+ \catcode39=\hs@catcodeXXXIX
+ \catcode40=\hs@catcodeXL
+ \catcode41=\hs@catcodeXLI
+ \catcode42=\hs@catcodeXLII
+ \catcode43=\hs@catcodeXLIII
+ \catcode44=\hs@catcodeXLIV
+ \catcode45=\hs@catcodeXLV
+ \catcode46=\hs@catcodeXLVI
+ \catcode47=\hs@catcodeXLVII
+ \catcode58=\hs@catcodeLVIII
+ \catcode59=\hs@catcodeLIX
+ \catcode60=\hs@catcodeLX
+ \catcode61=\hs@catcodeLXI
+ \catcode62=\hs@catcodeLXII
+ \catcode63=\hs@catcodeLXIII
+ \catcode64=\hs@catcodeLXIV
+ \catcode91=\hs@catcodeXCI
+ \catcode92=\hs@catcodeXCII
+ \catcode93=\hs@catcodeXCIII
+ \catcode94=\hs@catcodeXCIV
+ \catcode95=\hs@catcodeXCV
+ \catcode96=\hs@catcodeXCVI
+ \catcode123=\hs@catcodeCXXIII
+ \catcode124=\hs@catcodeCXXIV
+ \catcode125=\hs@catcodeCXXV
+ \catcode126=\hs@catcodeCXXVI
+ % Math codes for Haskell symbols:
+ \mathcode33=\hs@mathcodeXXXIII % !
+ \mathcode35=\hs@mathcodeXXXV % #
+ \mathcode36=\hs@mathcodeXXXVI % $
+ \mathcode37=\hs@mathcodeXXXVII % %
+ \mathcode38=\hs@mathcodeXXXVIII % &
+ \mathcode40=\hs@mathcodeXL % (
+ \mathcode41=\hs@mathcodeXLI % )
+ \mathcode42=\hs@mathcodeXLII % *
+ \mathcode43=\hs@mathcodeXLIII % +
+ \mathcode44=\hs@mathcodeXLIV % ,
+ \mathcode45=\hs@mathcodeXLV % -
+ \mathcode46=\hs@mathcodeXLVI % .
+ \mathcode47=\hs@mathcodeXLVII % /
+ \mathcode58=\hs@mathcodeLVIII % :
+ \mathcode59=\hs@mathcodeLVIX % ;
+ \mathcode60=\hs@mathcodeLX % <
+ \mathcode61=\hs@mathcodeLXI % =
+ \mathcode62=\hs@mathcodeLXII % >
+ \mathcode63=\hs@mathcodeLXIII % ?
+ \mathcode64=\hs@mathcodeLXIV % @
+ \mathcode91=\hs@mathcodeXCI % [
+ \mathcode92=\hs@mathcodeXCII % \
+ \mathcode93=\hs@mathcodeXCIII % ]
+ \mathcode96=\hs@mathcodeXCVI % `
+ \mathcode123=\hs@mathcodeCXXIII % {
+ \mathcode124=\hs@mathcodeCXXIV % |
+ \mathcode125=\hs@mathcodeCXXV % {
+ \mathcode126=\hs@mathcodeCXXVI % ~
+ \relax}
+
+% Entry points for each of the three modes:
+\def\hs@preparehaskell{%
+ % Initial token "registers":
+ \xdef\hs@tok{}\edef\hs@sup{}\edef\hs@sub{}\hs@space=0pt
+ \hs@preparecodemode}
+
+\def\hs@beginInline{%
+ \begingroup
+ \hs@inlinetrue
+ \everyhs
+ \hs@preparehaskell\hs@lex@state}
+\def\hs@endInline{%
+ \endgroup}
+
+\def\hs@beginBird{%
+ \beforehs
+ \begingroup
+ \hs@inlinefalse
+ \everyhs
+ \offinterlineskip
+ \def\hs@parskip{}%
+ \hs@preparehaskell
+ \hs@previndent=0pt
+ \hs@indent=\hsleftskip
+ \hs@code@state}
+
+% Entry point for the italic mode:
+{\catcode`>=\active
+ \gdef\hs@beginitalic{\begingroup\it\catcode`>=\active\let>=\endgroup}}
+
+% Lexeme formatting macros:
+\def\hs@emitvar{%
+ \if\csname<\hs@tok>\endcsname\relax
+  \setbox255=\hbox{\hs@varface\hs@tok\/$^{\hs@sup}_{\hs@sub}$}%
+ \else
+  \setbox255=\hbox{\csname<\hs@tok>\endcsname}%
+ \fi
+ \hs@emit}
+
+\def\hs@emitcon{%
+ \if\csname<\hs@tok>\endcsname\relax
+  \setbox255=\hbox{\hs@conface\hs@tok$^{\hs@sup}_{\hs@sub}$}%
+ \else
+  \setbox255=\hbox{\csname<\hs@tok>\endcsname}%
+ \fi
+ \hs@emit}
+
+\def\hs@emitsym{%
+ \def\hs@guard{|}%
+ \ifx\hs@tok\hs@guard
+  \ifhs@inline
+   \kern\hs@space\hbox{$|$}%
+  \else
+   \ifhbox\hs@i
+    % Set the new guard position:
+    \hs@guardpos=\hs@indent
+    \advance\hs@guardpos by \wd\hs@i
+    \advance\hs@guardpos by \hs@space
+   \else
+    % Align the guard with the previous one:
+    \ifdim\hs@guardpos>0pt\hs@indent=\hs@guardpos\fi
+   \fi
+   \global\setbox\hs@i=\hbox{%
+    \ifhbox\hs@i\unhbox\hs@i\fi\kern\hs@space\vrule width.17pt\ }%
+   \hs@afteremit
+  \fi
+ \else
+  \if\csname<\hs@tok>\endcsname\relax
+   \setbox255=\hbox{$\hs@tok$}%
+  \else
+   \setbox255=\hbox{\csname<\hs@tok>\endcsname}%
+  \fi
+  \hs@emit
+ \fi}
+
+\def\hs@emitnum#1{%
+ \if\csname<#1\hs@tok>\endcsname\relax
+  \setbox255=\hbox{\hs@numface\hs@tok$_{\hs@sub}$}%
+ \else
+  \setbox255=\hbox{\csname<#1\hs@tok>\endcsname}%
+ \fi
+ \hs@emit}
+
+\def\hs@emitchr{%
+ \if\csname<\hs@tok>\endcsname\relax
+  \setbox255=\hbox{\hs@symface`{\hs@strface\hs@tok}'}%
+ \else
+  \setbox255=\hbox{\csname<\hs@tok>\endcsname}%
+ \fi
+ \hs@emit}
+
+\def\hs@emit{%
+ \ifhs@inline
+  \kern\hs@space\box255
+ \else
+  \global\setbox\hs@i=\hbox{\ifhbox\hs@i\unhbox\hs@i\fi\kern\hs@space\box255}%
+ \fi
+ \hs@afteremit}
+\def\hs@afteremit{%
+ \xdef\hs@tok{}\edef\hs@sup{}\edef\hs@sub{}\hs@space=0pt}
+
+\def\hs@outputline{%
+ \ifhbox\hs@i
+  % Emit the previous line:
+  \dimen255=\hsize
+  \advance\dimen255 by -\hsrightskip
+  \ifdim\wd\hs@i>\dimen255
+   \dimen255=-\dimen255 \advance\dimen255 by \wd\hs@i
+   \count255=\inputlineno \advance\count255 by -1
+   \immediate\write16{}%
+   \immediate\write16{%
+    Overful \hbox (\the\dimen255\hs@ too wide)
+    in Haskell code at line \the\count255}%
+   \global\setbox\hs@i=\hbox{\unhbox\hs@i\vrule width\overfullrule}%
+  \fi
+  \hs@parskip
+  \hbox{\strut\kern\hs@indent\unhbox\hs@i}%
+  % Reset the guard position if necessary:
+  \ifdim\hs@indent>\hs@previndent\else
+   \hs@guardpos=0pt
+  \fi
+  % Update indentation levels:
+  \hs@previndent=\hs@indent
+  \hs@indent=\hsleftskip
+ \fi}
+
+% Entry point for the comment mode:
+\def\hs@emitdashes{%
+ \setbox255=\hbox{\hskip\hscommentskip\hs@symface---\hs@tok}\hs@emit}
+\def\hs@preparecomment{%
+ \hs@emitdashes
+ \begingroup
+ \hs@preparecommentmode
+ \catcode13=12
+ \relax}
+{\catcode13=12\gdef\hs@comment@state#1^^M{\hs@emitcomment{#1}}}
+\def\hs@emitcomment#1{%
+ \endgroup
+ \ifhs@inline
+  \errmessage{Comment in inline Haskell mode}%
+ \else
+  \setbox255=\hbox{#1\hfill}\hs@emit
+  \let\next=\hs@newline@state
+ \fi
+ \next}
+
+% \endgroup
+% \begingroup
+% \hs@inlinefalse
+% \everyhs
+% \offinterlineskip
+% \def\hs@parskip{}%
+% \hs@preparehaskell
+% \hs@previndent=0pt
+% \hs@indent=\hsleftskip
+% \hs@newline@state}
+
+%%% Function detection %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Haskell syntax does not distinguish between functions and variables, but
+% we would like to typeset each kind of names differently. Therefore, I
+% define a convinient \functions macro which accepts a comma-separated list
+% of function names. To change a function back into a variable, prefix its
+% name in the list with the ! character.
+
+\def\functions(#1){\def\hs@tok{}\hs@funbegin#1\relax}
+\def\hs@funbegin#1{%
+ \ifx#1\relax
+  \let\next=\relax
+ \else\ifx#1,
+  \let\next=\hs@funbegin
+ \else\ifnum`#1=9
+  \let\next=\hs@funbegin
+ \else\ifnum`#1=32
+  \let\next=\hs@funbegin
+ \else\if#1!
+  \xdef\hs@tok{}%
+  \let\next=\hs@varcollect
+ \else 
+  \xdef\hs@tok{#1}%
+  \let\next=\hs@funcollect
+ \fi\fi\fi\fi\fi
+ \next}
+\def\hs@funcollect#1{%
+ \ifx#1\relax
+  \typeset{\hs@tok}{{\hs@funface\hs@tok$^{\hs@sup}_{\hs@sub}$}}%
+  \let\next=\relax
+ \else\ifx#1,
+  \typeset{\hs@tok}{{\hs@funface\hs@tok$^{\hs@sup}_{\hs@sub}$}}%
+  \let\next=\hs@funbegin
+ \else\ifnum`#1=9
+  \typeset{\hs@tok}{{\hs@funface\hs@tok$^{\hs@sup}_{\hs@sub}$}}%
+  \let\next=\hs@funbegin
+ \else\ifnum`#1=32
+  \typeset{\hs@tok}{{\hs@funface\hs@tok$^{\hs@sup}_{\hs@sub}$}}%
+  \let\next=\hs@funbegin
+ \else 
+  \xdef\hs@tok{\hs@tok#1}%
+  \let\next=\hs@funcollect
+ \fi\fi\fi\fi
+ \next}
+\def\hs@varcollect#1{%
+ \ifx#1\relax
+  \typeset{\hs@tok}{{\hs@varface\hs@tok$^{\hs@sup}_{\hs@sub}$}}%
+  \let\next=\relax
+ \else\ifx#1,
+  \typeset{\hs@tok}{{\hs@varface\hs@tok$^{\hs@sup}_{\hs@sub}$}}%
+  \let\next=\hs@funbegin
+ \else\ifnum`#1=9
+  \typeset{\hs@tok}{{\hs@varface\hs@tok$^{\hs@sup}_{\hs@sub}$}}%
+  \let\next=\hs@funbegin
+ \else\ifnum`#1=32
+  \typeset{\hs@tok}{{\hs@varface\hs@tok$^{\hs@sup}_{\hs@sub}$}}%
+  \let\next=\hs@funbegin
+ \else 
+  \xdef\hs@tok{\hs@tok#1}%
+  \let\next=\hs@varcollect
+ \fi\fi\fi\fi
+ \next}
+
+% Define standard prelude functions:
+% Prelude:
+\functions (succ,pred,toEnum,fromEnum,enumFrom,enumFromThen,enumFromTo,
+ enumFromThenTo,minBound,maxBound,negate,abs,signum,fromInteger,toRational,
+ quot,rem,div,mod,quotRem,divMod,toInteger,recip,fromRational,exp,log,sqrt,
+ logBase,sin,cos,tan,asin,acos,atan,sinh,cosh,tanh,asinh,acosh,atanh,
+ properFraction,truncate,round,ceiling,floor,floatRadix,floatDigits,floatRange,
+ decodeFloat,encodeFloat,exponent,significand,scaleFloat,isNaN,isInfinite,
+ isDenormalized,isIEEE,isNegativeZero,atan2,return,fail,fmap,mapM,
+ sequence,maybe,either,not,otherwise,subtract,even,odd,gcd,lcm,
+ fromIntegral,realToFrac,fst,snd,curry,uncurry,id,const,flip,until,
+ asTypeOf,error,seq)
+% PreludeList:
+\functions (map,filter,concat,head,last,tail,init,null,length,foldl,scanl,
+ foldr,scanr,iterate,repeat,replicate,cycle,take,drop,splitAt,takeWhile,
+ dropWhile,span,break,lines,words,unlines,unwords,reverse,elem,notElem,lookup,
+ maximum,minimum,concatMap,zip,zipWith,unzip)
+% PreludeText:
+\functions (readsProc,readList,showsProc,showList,reads,shows,show,read,lex,
+ showChar,showString,readParen,showParen)
+% PreludeIO:
+\functions (ioError,userError,catch,putChar,putStr,putStrLn,print,getChar,
+ getLine,getContents,interact,readFile,writeFile,appendFile,readIO,readLn)
+% other typeclass-methods:
+\functions (compare, showsPrec, readsPrec, mempty, mappend, mconcat)
+
+
+%%% Haskell category codes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% In a moment we will implement a relatively complete lexical analyser for
+% Haskell. To make our job simpler, we collect all ASCII characters into
+% the following ten equivalence classes:
+%
+%       0. SP - space
+%       1. LC - lowercase letters
+%       2. UC - uppercase letters
+%       3. DI - digits
+%       4. SY - symbols
+%       5. PU - punctuators
+%       6. AP - apostrophe
+%       7. QT - double quotation mark
+%       8. NL - newline
+
+\chardef\hs@SP=0
+\chardef\hs@LC=1
+\chardef\hs@UC=2
+\chardef\hs@DI=3
+\chardef\hs@SY=4
+\chardef\hs@PU=5
+\chardef\hs@AP=6
+\chardef\hs@QT=7
+\chardef\hs@NL=8
+
+% The macro \hs@getcc#1 computes the Haskell category code of its argument
+% ans stores it in the counter variable \hs@cc.
+
+\newcount\hs@cc
+\def\hs@getcc#1{%
+  \hs@cc=`#1
+  \ifnum\hs@cc<65 %%% NUL - @
+    \ifnum\hs@cc<32 %%% NUL - US
+     \ifnum\hs@cc=9
+       \hs@cc=\hs@SP
+     \else\ifnum\hs@cc=13
+       \hs@cc=\hs@NL
+     \else
+       \hs@cc=-1
+     \fi\fi
+    \else %%% SP - @
+     \ifnum\hs@cc<48 %%% SP - /
+       \ifnum\hs@cc=32 %%% SP
+         \hs@cc=\hs@SP
+       \else\ifnum\hs@cc=34 %%% "
+         \hs@cc=\hs@QT
+       \else\ifnum\hs@cc=39 %%% '
+         \hs@cc=\hs@AP
+       \else\ifnum\hs@cc=40 %%% (
+         \hs@cc=\hs@PU
+       \else\ifnum\hs@cc=41 %%% )
+         \hs@cc=\hs@PU
+       \else\ifnum\hs@cc=44 %%% ,
+         \hs@cc=\hs@PU
+       \else
+         \hs@cc=\hs@SY
+       \fi\fi\fi\fi\fi\fi
+     \else %%% 0 - @
+       \ifnum\hs@cc<58 %%% 0 - 9
+         \hs@cc=\hs@DI
+       \else\ifnum\hs@cc=59 %%% ;
+         \hs@cc=\hs@PU
+       \else
+         \hs@cc=\hs@SY
+       \fi\fi
+     \fi
+    \fi      
+  \else %%% A - DEL
+    \ifnum\hs@cc<97 %%% A - `
+      \ifnum\hs@cc<91 %%% A - Z
+        \hs@cc=\hs@UC
+      \else\ifnum\hs@cc=92 %%% \
+        \hs@cc=\hs@SY
+      \else\ifnum\hs@cc=94 %%% ^
+        \hs@cc=\hs@SY
+      % \else\ifnum\hs@cc=95 %%% _
+      %  \hs@cc=\hs@LC
+      \else %%% [ ] `
+        \hs@cc=\hs@PU
+      \fi\fi\fi%\fi
+    \else %%% a - DEL
+      \ifnum\hs@cc<123 %%% a - z
+        \hs@cc=\hs@LC
+      \else\ifnum\hs@cc=123 %%% {
+        \hs@cc=\hs@PU
+      \else\ifnum\hs@cc=124 %%% |
+        \hs@cc=\hs@SY
+      \else\ifnum\hs@cc=125 %%% }
+        \hs@cc=\hs@PU
+      \else\ifnum\hs@cc=126 %%% ~
+        \hs@cc=\hs@SY
+      \else
+        \hs@cc=-1
+      \fi\fi\fi\fi\fi
+    \fi
+  \fi}
+
+%%% The lexical analyzer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Now we are ready to implement the actual lexical analyzer.
+%
+
+\def\hs@code@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \ifnum`#1=9\advance\hs@indent by \hstabwidth
+        \else\advance\hs@indent by \hsspacewidth\fi
+        \let\next=\hs@code@state
+   \or  % LC - lowercase letters
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@var@state
+   \or  % UC - uppercase letters
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@con@state
+   \or  % DI - digits
+        \xdef\hs@tok{#1}%
+        \ifx#10\let\next=\hs@zero@state\else\let\next=\hs@dec@state\fi
+   \or  % SY - symbols
+        \xdef\hs@tok{#1}%
+        \ifx#1-\let\next=\hs@dash@state\else\let\next=\hs@sym@state\fi
+   \or  % PU - punctuators
+        \xdef\hs@tok{#1}%
+        \hs@emitsym
+        \let\next=\hs@lex@state
+   \or  % AP - apostrophe
+        \let\next=\hs@chr@state
+   \or  % QT - double quotation mark
+        \let\next=\hs@str@state
+   \or  % NL - newline
+        \def\hs@parskip{\vskip\hsparskip\def\hs@parskip{}}%
+        \let\next=\hs@newline@state
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+
+\def\hs@newline@state#1{%
+ \hs@outputline
+ \ifx#1>
+  \hs@space=0pt
+  \let\next=\hs@code@state
+ \else
+  % It must be a space or a newline; just drop it.
+  \par
+  \endgroup
+  \afterhs
+  \par\noindent\ignorespaces
+  \let\next=\relax
+ \fi
+ \next}
+
+\def\hs@lex@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \hs@space=\hswordspace
+        \let\next=\hs@lex@state
+   \or  % LC - lowercase letters
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@var@state
+   \or  % UC - uppercase letters
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@con@state
+   \or  % DI - digits
+        \xdef\hs@tok{#1}%
+        \ifx#10\let\next=\hs@zero@state\else\let\next=\hs@dec@state\fi
+   \or  % SY - symbols
+        \xdef\hs@tok{#1}%
+        \ifx#1-\let\next=\hs@dash@state\else\let\next=\hs@sym@state\fi
+   \or  % PU - punctuators
+        \xdef\hs@tok{#1}%
+        \hs@emitsym
+        \let\next=\hs@lex@state
+   \or  % AP - apostrophe
+        \xdef\hs@tok{}%
+        \let\next=\hs@chr@state
+   \or  % QT - double quotation mark
+        \ifhs@inline
+         \hs@endInline
+         \let\next=\relax
+        \else
+         \xdef\hs@tok{}%
+         \let\next=\hs@str@state
+        \fi
+   \or  % NL - newline
+        \ifhs@inline
+         \hs@space=\hswordspace
+         \let\next=\hs@lex@state
+        \else
+         \let\next=\hs@newline@state
+        \fi
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+
+\def\hs@var@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \hs@emitvar
+        \hs@space=\hswordspace
+        \let\next=\hs@lex@state
+   \or  % LC - lowercase letters
+        \xdef\hs@tok{\hs@tok#1}%
+        \let\next=\hs@var@state
+   \or  % UC - uppercase letters
+        \xdef\hs@tok{\hs@tok#1}%
+        \let\next=\hs@var@state
+   \or  % DI - digits
+        \edef\hs@sub{\hs@sub#1}%
+        \let\next=\hs@var@state
+   \or  % SY - symbols
+        \hs@emitvar
+        \xdef\hs@tok{#1}%
+        \ifx#1-\let\next=\hs@dash@state\else\let\next=\hs@sym@state\fi
+   \or  % PU - punctuators
+        \hs@emitvar
+        \xdef\hs@tok{#1}%
+        \hs@emitsym
+        \let\next=\hs@lex@state
+   \or  % AP - apostrophe
+        \edef\hs@sup{\hs@sup\prime}%
+        \let\next=\hs@var@state
+   \or  % QT - double quotation mark
+        \hs@emitvar
+        \ifhs@inline
+         \hs@endInline
+         \let\next=\relax
+        \else
+         \let\next=\hs@str@state
+        \fi
+   \or  % NL - newline
+        \hs@emitvar
+        \ifhs@inline
+         \hs@space=\hswordspace
+         \let\next=\hs@lex@state
+        \else
+         \let\next=\hs@newline@state
+        \fi
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+        
+\def\hs@con@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \hs@emitcon
+        \hs@space=\hswordspace
+        \let\next=\hs@lex@state
+   \or  % LC - lowercase letters
+        \xdef\hs@tok{\hs@tok#1}%
+        \let\next=\hs@con@state
+   \or  % UC - uppercase letters
+        \xdef\hs@tok{\hs@tok#1}%
+        \let\next=\hs@con@state
+   \or  % DI - digits
+        \edef\hs@sub{\hs@sub#1}%
+        \let\next=\hs@con@state
+   \or  % SY - symbols
+        \hs@emitcon
+        \xdef\hs@tok{#1}%
+        \ifx#1-\let\next=\hs@dash@state\else\let\next=\hs@sym@state\fi
+   \or  % PU - punctuators
+        \hs@emitcon
+        \xdef\hs@tok{#1}%
+        \hs@emitsym
+        \let\next=\hs@lex@state
+   \or  % AP - apostrophe
+        \edef\hs@sup{\hs@sup\prime}%
+        \let\next=\hs@con@state
+   \or  % QT - double quotation mark
+        \hs@emitcon
+        \ifhs@inline
+         \hs@endInline
+         \let\next=\relax
+        \else
+         \let\next=\hs@str@state
+        \fi
+   \or  % NL - newline
+        \hs@emitcon
+        \ifhs@inline
+         \hs@space=\hswordspace
+         \let\next=\hs@lex@state
+        \else
+         \let\next=\hs@newline@state
+        \fi
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+        
+\def\hs@sym@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \hs@emitsym
+        \hs@space=\hswordspace
+        \let\next=\hs@lex@state
+   \or  % LC - lowercase letters
+        \hs@emitsym
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@var@state
+   \or  % UC - uppercase letters
+        \hs@emitsym
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@con@state
+   \or  % DI - digits
+        \hs@emitsym
+        \xdef\hs@tok{#1}%
+        \ifx#10\let\next=\hs@zero@state\else\let\next=\hs@dec@state\fi
+   \or  % SY - symbols
+        \xdef\hs@tok{\hs@tok#1}%
+        \let\next=\hs@sym@state
+   \or  % PU - punctuators
+        \hs@emitsym
+        \xdef\hs@tok{#1}%
+        \hs@emitsym
+        \let\next=\hs@lex@state
+   \or  % AP - apostrophe
+        \hs@emitsym
+        \xdef\hs@tok{}%
+        \let\next=\hs@chr@state
+   \or  % QT - double quotation mark
+        \hs@emitsym
+        \ifhs@inline
+         \hs@endInline
+         \let\next=\relax
+        \else
+         \xdef\hs@tok{}%
+         \let\next=\hs@str@state
+        \fi
+   \or  % NL - newline
+        \hs@emitsym
+        \ifhs@inline
+         \hs@space=\hswordspace
+         \let\next=\hs@lex@state
+        \else
+         \let\next=\hs@newline@state
+        \fi
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+
+\def\hs@dash@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \hs@emitsym
+        \hs@space=\hswordspace
+        \let\next=\hs@lex@state
+   \or  % LC - lowercase letters
+        \hs@emitsym
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@var@state
+   \or  % UC - uppercase letters
+        \hs@emitsym
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@con@state
+   \or  % DI - digits
+        \hs@emitsym
+        \xdef\hs@tok{#1}%
+        \ifx#10\let\next=\hs@zero@state\else\let\next=\hs@dec@state\fi
+   \or  % SY - symbols
+        \xdef\hs@tok{\hs@tok#1}%
+        \ifx#1-\let\next=\hs@dashdash@state\else\let\next=\hs@sym@state\fi
+   \or  % PU - punctuators
+        \hs@emitsym
+        \xdef\hs@tok{#1}%
+        \hs@emitsym
+        \let\next=\hs@lex@state
+   \or  % AP - apostrophe
+        \hs@emitsym
+        \xdef\hs@tok{}%
+        \let\next=\hs@chr@state
+   \or  % QT - double quotation mark
+        \hs@emitsym
+        \ifhs@inline
+         \hs@endInline
+         \let\next=\relax
+        \else
+         \xdef\hs@tok{}%
+         \let\next=\hs@str@state
+        \fi
+   \or  % NL - newline
+        \hs@emitsym
+        \ifhs@inline
+         \hs@space=\hswordspace
+         \let\next=\hs@lex@state
+        \else
+         \let\next=\hs@newline@state
+        \fi
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+
+%%% XXX
+\def\hs@dashdash@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \xdef\hs@tok{\hs@}%
+        \hs@preparecomment
+        \let\next=\hs@comment@state
+   \or  % LC - lowercase letters
+        \xdef\hs@tok{#1}%
+        \hs@preparecomment
+        \let\next=\hs@comment@state
+   \or  % UC - uppercase letters
+        \xdef\hs@tok{#1}%
+        \hs@preparecomment
+        \let\next=\hs@comment@state
+   \or  % DI - digits
+        \xdef\hs@tok{#1}%
+        \hs@preparecomment
+        \let\next=\hs@comment@state
+   \or  % SY - symbols
+        \xdef\hs@tok{\hs@tok#1}%
+        \ifx#1-\let\next=\hs@dashdash@state\else\let\next=\hs@sym@state\fi
+   \or  % PU - punctuators
+        \xdef\hs@tok{#1}%
+        \hs@preparecomment
+        \let\next=\hs@comment@state
+   \or  % AP - apostrophe
+        \xdef\hs@tok{#1}%
+        \hs@preparecomment
+        \let\next=\hs@comment@state
+   \or  % QT - double quotation mark
+        \xdef\hs@tok{#1}%
+        \hs@preparecomment
+        \let\next=\hs@comment@state
+   \or  % NL - newline
+        \ifhs@inline
+         \errmessage{Comment in inline Haskell mode}%
+        \else
+         \xdef\hs@tok{}%
+         \hs@emitdashes
+         \let\next=\hs@newline@state
+        \fi
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+
+\def\hs@zero@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \hs@emitnum{}%
+        \hs@space=\hswordspace
+        \let\next=\hs@lex@state
+   \or  % LC - lowercase letters
+        \ifx#1o
+         \edef\hs@sub{8}%
+         \xdef\hs@tok{}%
+         \let\next=\hs@oct@state
+        \else\ifx#1x
+         \edef\hs@sub{16}%
+         \xdef\hs@tok{}%
+         \let\next=\hs@hex@state
+        \else
+         \hs@emitnum{}%
+         \xdef\hs@tok{#1}%
+         \let\next=\hs@var@state
+        \fi\fi
+   \or  % UC - uppercase letters
+        \ifx#1O
+         \edef\hs@sub{8}%
+         \xdef\hs@tok{}%
+         \let\next=\hs@oct@state
+        \else\ifx#1X
+         \edef\hs@sub{16}%
+         \xdef\hs@tok{}%
+         \let\next=\hs@hex@state
+        \else
+         \hs@emitnum{}%
+         \xdef\hs@tok{#1}%
+         \let\next=\hs@con@state
+        \fi\fi
+   \or  % DI - digits
+        \xdef\hs@tok{\hs@tok#1}%
+        \let\next=\hs@dec@state
+   \or  % SY - symbols
+        \hs@emitnum{}%
+        \xdef\hs@tok{#1}%
+        \ifx#1-\let\next=\hs@dash@state\else\let\next=\hs@sym@state\fi
+   \or  % PU - punctuators
+        \hs@emitnum{}%
+        \xdef\hs@tok{#1}%
+        \hs@emitsym
+        \let\next=\hs@lex@state
+   \or  % AP - apostrophe
+        \hs@emitnum{}%
+        \xdef\hs@tok{}%
+        \let\next=\hs@chr@state
+   \or  % QT - double quotation mark
+        \hs@emitnum{}%
+        \ifhs@inline
+         \hs@endInline
+         \let\next=\relax
+        \else
+         \xdef\hs@tok{}%
+         \let\next=\hs@str@state
+        \fi
+   \or  % NL - newline
+        \hs@emitnum{}%
+        \ifhs@inline
+         \hs@space=\hswordspace
+         \let\next=\hs@lex@state
+        \else
+         \let\next=\hs@newline@state
+        \fi
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+
+\def\hs@dec@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \hs@emitnum{}%
+        \hs@space=\hswordspace
+        \let\next=\hs@lex@state
+   \or  % LC - lowercase letters
+        \hs@emitnum{}%
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@var@state
+   \or  % UC - uppercase letters
+        \hs@emitnum{}%
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@con@state
+   \or  % DI - digits
+        \xdef\hs@tok{\hs@tok#1}%
+        \let\next=\hs@dec@state
+   \or  % SY - symbols
+        \hs@emitnum{}%
+        \xdef\hs@tok{#1}%
+        \ifx#1-\let\next=\hs@dash@state\else\let\next=\hs@sym@state\fi
+   \or  % PU - punctuators
+        \hs@emitnum{}%
+        \xdef\hs@tok{#1}%
+        \hs@emitsym
+        \let\next=\hs@lex@state
+   \or  % AP - apostrophe
+        \hs@emitnum{}%
+        \xdef\hs@tok{}%
+        \let\next=\hs@chr@state
+   \or  % QT - double quotation mark
+        \hs@emitnum{}%
+        \ifhs@inline
+         \hs@endInline
+         \let\next=\relax
+        \else
+         \xdef\hs@tok{}%
+         \let\next=\hs@str@state
+        \fi
+   \or  % NL - newline
+        \hs@emitnum{}%
+        \ifhs@inline
+         \hs@space=\hswordspace
+         \let\next=\hs@lex@state
+        \else
+         \let\next=\hs@newline@state
+        \fi
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+
+\def\hs@oct@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \hs@emitnum{0o}%
+        \hs@space=\hswordspace
+        \let\next=\hs@lex@state
+   \or  % LC - lowercase letters
+        \hs@emitnum{0o}%
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@var@state
+   \or  % UC - uppercase letters
+        \hs@emitnum{0o}%
+        \xdef\hs@tok{#1}%
+        \let\next=\hs@con@state
+   \or  % DI - digits
+        \ifnum`#1<`8
+         \xdef\hs@tok{\hs@tok#1}%
+         \let\next=\hs@oct@state
+        \else
+         \hs@emitnum{0o}%
+         \xdef\hs@tok{#1}%
+         \let\next=\hs@dec@state
+        \fi
+   \or  % SY - symbols
+        \hs@emitnum{0o}%
+        \xdef\hs@tok{#1}%
+        \ifx#1-\let\next=\hs@dash@state\else\let\next=\hs@sym@state\fi
+   \or  % PU - punctuators
+        \hs@emitnum{0o}%
+        \xdef\hs@tok{#1}%
+        \hs@emitsym
+        \let\next=\hs@lex@state
+   \or  % AP - apostrophe
+        \hs@emitnum{0o}%
+        \xdef\hs@tok{}%
+        \let\next=\hs@chr@state
+   \or  % QT - double quotation mark
+        \hs@emitnum{0o}%
+        \ifhs@inline
+         \hs@endInline
+         \let\next=\relax
+        \else
+         \xdef\hs@tok{}%
+         \let\next=\hs@str@state
+        \fi
+   \or  % NL - newline
+        \hs@emitnum{0o}%
+        \ifhs@inline
+         \hs@space=\hswordspace
+         \let\next=\hs@lex@state
+        \else
+         \let\next=\hs@newline@state
+        \fi
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+
+\def\hs@hex@state#1{%
+ \hs@getcc#1%
+ \ifcase\hs@cc
+        % SP - space
+        \hs@emitnum{0x}%
+        \hs@space=\hswordspace
+        \let\next=\hs@lex@state
+   \or  % LC - lowercase letters
+        \ifnum`#1<`g
+         \xdef\hs@tok{\hs@tok#1}%
+         \let\next=\hs@hex@state
+        \else
+         \hs@emitnum{0x}%
+         \xdef\hs@tok{#1}%
+         \let\next=\hs@var@state
+        \fi
+   \or  % UC - uppercase letters
+        \ifnum`#1<`G
+         \xdef\hs@tok{\hs@tok#1}%
+         \let\next=\hs@hex@state
+        \else
+         \hs@emitnum{0x}%
+         \xdef\hs@tok{#1}%
+         \let\next=\hs@con@state
+        \fi
+   \or  % DI - digits
+        \xdef\hs@tok{\hs@tok#1}%
+        \let\next=\hs@hex@state
+   \or  % SY - symbols
+        \hs@emitnum{0x}%
+        \xdef\hs@tok{#1}%
+        \ifx#1-\let\next=\hs@dash@state\else\let\next=\hs@sym@state\fi
+   \or  % PU - punctuators
+        \hs@emitnum{0x}%
+        \xdef\hs@tok{#1}%
+        \hs@emitsym
+        \let\next=\hs@lex@state
+   \or  % AP - apostrophe
+        \hs@emitnum{0x}%
+        \xdef\hs@tok{}%
+        \let\next=\hs@chr@state
+   \or  % QT - double quotation mark
+        \hs@emitnum{0x}%
+        \ifhs@inline
+         \hs@endInline
+         \let\next=\relax
+        \else
+         \xdef\hs@tok{}%
+         \let\next=\hs@str@state
+        \fi
+   \or  % NL - newline
+        \hs@emitnum{0x}%
+        \ifhs@inline
+         \hs@space=\hswordspace
+         \let\next=\hs@lex@state
+        \else
+         \let\next=\hs@newline@state
+        \fi
+   \else
+        \errmessage{Illegal character in Haskell mode: #1}%
+ \fi
+ \next}
+
+\def\hs@chr@state#1{%
+ \ifnum`#1=`'
+  \hs@emitchr
+  \let\next=\hs@lex@state
+ \else\ifnum`#1=92
+  \xdef\hs@tok{\hs@tok#1}%
+  \let\next=\hs@chresc@state
+ \else
+  \xdef\hs@tok{\hs@tok#1}%
+  \let\next=\hs@chr@state
+ \fi\fi
+ \next}
+
+\def\hs@chresc@state#1{%
+ \xdef\hs@tok{\hs@tok#1}\hs@chr@state}
+
+\def\hs@str@state{%
+ \def\hs@strprefix{\hs@symface``}%
+ \hs@strchr@state}
+
+\def\hs@strchr@state#1{%
+ \ifx#1"
+  \setbox255=\hbox{\hs@strprefix\hs@strface\hs@tok\hs@symface''}%
+  \hs@emit
+  \let\next=\hs@lex@state
+ \else\ifnum`#1=92
+  \xdef\hs@tok{\hs@tok#1}%
+  \let\next=\hs@stresc@state
+ \else
+  \xdef\hs@tok{\hs@tok#1}%
+  \let\next=\hs@strchr@state
+ \fi\fi
+ \next}
+
+\def\hs@stresc@state#1{%
+ \hs@getcc#1%
+ \ifnum\hs@cc=\hs@SP
+  \let\next=\hs@gap@state
+ \else\ifnum\hs@cc=\hs@NL
+  \let\next=\hs@gapnewline@state
+ \else
+  \xdef\hs@tok{\hs@tok#1}%
+  \let\next=\hs@strchr@state
+ \fi\fi
+ \next}
+
+\def\hs@gap@state#1{%
+ \hs@getcc#1%
+ \ifnum\hs@cc=\hs@SP
+  \let\next=\hs@gap@state
+ \else\ifnum\hs@cc=\hs@NL
+  \let\next=\hs@gapnewline@state
+ \else
+  \ifnum`#1=92
+   \xdef\hs@tok{\hs@tok\hs@#1}%
+   \let\next=\hs@strchr@state
+  \else
+   \errmessage{Unexpected character in a gap: #1}%
+  \fi
+ \fi\fi
+ \next}
+
+\def\hs@gapnewline@state#1{%
+ \setbox255=\hbox{\hs@strprefix\hs@strface\hs@tok}%
+ \hs@emit
+ \hs@outputline
+ \ifx#1>
+  \def\hs@strprefix{}%
+  \hs@space=0pt
+  \let\next=\hs@gapcode@state
+ \else
+  \errmessage{Literate comments cannot appear in a gap}
+ \fi
+ \next}
+
+\def\hs@gapcode@state#1{%
+ \hs@getcc#1%
+ \ifnum\hs@cc=\hs@SP
+  \ifnum`#1=9\advance\hs@indent by \hstabwidth
+  \else\advance\hs@indent by \hsspacewidth\fi
+  \let\next=\hs@gapcode@state
+ \else\ifnum\hs@cc=\hs@NL
+  \def\hs@parskip{\vskip\hsparskip\def\hs@parskip{}}%
+  \let\next=\hs@gapnewline@state
+ \else
+  \ifnum`#1=92
+   \xdef\hs@tok{#1}%
+   \let\next=\hs@strchr@state
+  \else
+   \errmessage{Unexpected character in a gap: #1}%
+  \fi
+ \fi\fi
+ \next}
+
+%%% The "hidden" environment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+
+\newbox\hs@junkbox
+\def\beginhidden{\begingroup\setbox\hs@junkbox=\vbox\bgroup}
+\def\endhidden{\egroup\endgroup}
+
+%%% Activate active characters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% As we've already confiscated > as an active character, let's take < too
+% and use <...> to typeset ... in italic.
+
+% To make amends for the above quirk, I define \lt and \gt math macros
+% to complement the \le, \ge, etc. already in plain TeX:
+\def\inch{"}
+\def\lt{<}
+\def\gt{>}
+
+% Finally, we are ready to active our three active characters:
+\catcode`"=\active \let"=\hs@beginInline
+\catcode`>=\active \let>=\hs@beginBird
+\catcode`<=\active \let<=\hs@beginitalic
+
+% Restore the meaning of < and > in math mode.
+% WARNING: this doesn't work as well as expected. When TeX sees the $
+% character, it reads the following character to see if it is another $.
+% If that character is active, it attempts to expand it (a bug in TeX?!
+% or just a mis-feature?) So, you must write $ >$ rather than $>$. Oh well.
+\everymath{\let<\lt\let>\gt\relax}
+\everydisplay{\let<\lt\let>\gt\relax}
+
+
+\catcode`@=12
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% THE END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/our_server_config/Paths.hs b/our_server_config/Paths.hs
new file mode 100644
--- /dev/null
+++ b/our_server_config/Paths.hs
@@ -0,0 +1,32 @@
+{-# LANGUAGE NoMonomorphismRestriction #-}
+module Paths
+   ( getTemporaryDirectory
+   , getPathToAdditionalTeXFiles
+   , getLogDirectory
+   , relativeURLOf
+   )
+where
+
+{-
+ -  root/
+ -    |-- cgi-bin/
+ -    |-- free-theorems/
+ -         |-- lambdaTeX.tex
+ -         |-- style.css
+ -    |-- tmp/
+ -         |-- free-theorems/
+ -              |-- requests.csv
+ -
+ -}
+
+import qualified System.Directory
+
+getTemporaryDirectory =
+   catch (System.Directory.getTemporaryDirectory)
+         (\_ -> return ".")
+
+getPathToAdditionalTeXFiles = return "../free-theorems"
+
+getLogDirectory = return "../tmp/free-theorems"
+
+relativeURLOf filename = "../free-theorems/" ++ filename
diff --git a/runLocalServer.py b/runLocalServer.py
new file mode 100644
--- /dev/null
+++ b/runLocalServer.py
@@ -0,0 +1,46 @@
+# This script starts a CGI server.
+#
+# It expects 2-3 arguments:
+#    1. path to the folder containing the "free-theorems-webui.cgi" binary.
+#    2. path to the folder containing static files (like "style.css" etc.)
+#    3. optional port number (default is 8080)
+#
+from CGIHTTPServer import *
+from BaseHTTPServer import *
+
+import sys, os
+import webbrowser
+
+bin_dir = sys.argv[1]
+data_dir = sys.argv[2]
+
+if len(sys.argv) > 3:
+   port = int(sys.argv[3])
+else:
+   port = 8080
+
+
+def is_cgi(path):
+   return path == "/" or path.startswith("/?")
+
+class CustomHandler (CGIHTTPRequestHandler):
+
+   def is_cgi(self):
+      if is_cgi(self.path):
+         self.cgi_info = ("", self.path) # no directory portion, no filename (has to be set)
+         return True
+
+   def translate_path(self, path):
+      if is_cgi(path):
+         return os.path.join (bin_dir, "free-theorems-webui.cgi")
+      else:
+         return os.path.join (data_dir, *path.split("/"))
+
+
+server = HTTPServer(('',port), CustomHandler)
+
+url = "http://localhost:%d" % server.server_port
+print "Starting server at %s..." % url
+
+webbrowser.open(url)
+server.serve_forever()
diff --git a/style.css b/style.css
new file mode 100644
--- /dev/null
+++ b/style.css
@@ -0,0 +1,67 @@
+body { padding:0px; margin: 0px; }
+
+/* renamed from "div.top" */
+#header {
+   margin:0px; padding:10px; margin-bottom:20px;
+   background-color:#efefef;
+   border-bottom:1px solid black;
+}
+
+/* renamed from "span.title" */
+h1 {
+   display: inline;
+   font-size: xx-large;
+   font-weight: bold;
+}
+/* renamed from "span.subtitle" */
+h2 {
+   display: inline;
+   font-size: large;
+   font-weight: normal;
+   padding-left:30px;
+}
+#help {
+   position: absolute;
+   top:   0em;
+   right: 1em;
+}
+
+#content > div {
+   border:1px dotted black;
+   padding:10px; margin:10px;
+}
+
+/* renamed from "div.submain" */
+#footer { padding:10px; margin:11px; }
+
+p.subtitle { font-size:large; font-weight:bold; }
+
+input.type { font-family:monospace; }
+
+input[type="submit"] { font-family:monospace; background-color:#efefef; }
+
+span.mono { font-family:monospace; }
+
+pre {
+   margin:10px; margin-left:20px; padding:10px;
+	border:1px solid black;
+}
+
+p { text-align:justify; }
+
+/* Added later */
+.error { background: #fcc; }
+
+textarea { height: 20em; width: 30em; }
+
+/* These classes can be used to align elements side by side.
+ * Mark the parent as .float-container and some element at the end
+ * as .clear. The .clear element will end the float.
+ * If there is no such element in your markup already,
+ * add something like a <br/> for this.
+ */
+.float-container > * {
+   float: left;
+   margin-right: 3em;
+}
+.clear { float: none; clear: both; }
