diff --git a/patches/Decimal-0.5.1.patch b/patches/Decimal-0.5.1.patch
new file mode 100644
index 0000000000000000000000000000000000000000..d4774920ba1c08ea0bbe203017dbba88450bec8b
--- /dev/null
+++ b/patches/Decimal-0.5.1.patch
@@ -0,0 +1,15 @@
+diff --git a/src/Data/Decimal.hs b/src/Data/Decimal.hs
+index 340b49b..5fbd685 100644
+--- a/src/Data/Decimal.hs
++++ b/src/Data/Decimal.hs
+@@ -66,8 +66,8 @@ import Text.ParserCombinators.ReadP
+ -- will return \"1.500\". Conversely the "Read" instance will use the decimal
+ -- places to determine the precision.
+ data DecimalRaw i = Decimal {
+- decimalPlaces :: ! Word8,
+- decimalMantissa :: ! i}
++ decimalPlaces :: !Word8,
++ decimalMantissa :: !i}
+ deriving (Typeable)
+
+
diff --git a/patches/HTTP-4000.3.14.patch b/patches/HTTP-4000.3.14.patch
new file mode 100644
index 0000000000000000000000000000000000000000..d7601f91cf9a6d462aab0f8d529ef872a2dca569
--- /dev/null
+++ b/patches/HTTP-4000.3.14.patch
@@ -0,0 +1,13 @@
+diff --git a/Network/TCP.hs b/Network/TCP.hs
+index 6f20319..ce01117 100644
+--- a/Network/TCP.hs
++++ b/Network/TCP.hs
+@@ -89,7 +89,7 @@ instance Eq EndPoint where
+ map toLower host1 == map toLower host2 && port1 == port2
+
+ data Conn a
+- = MkConn { connSock :: ! Socket
++ = MkConn { connSock :: !Socket
+ , connHandle :: Handle
+ , connBuffer :: BufferOp a
+ , connInput :: Maybe a
diff --git a/patches/aivika-5.9.patch b/patches/aivika-5.9.patch
new file mode 100644
index 0000000000000000000000000000000000000000..f9e5582d19c30ddb13038a32149471d878a00dcb
--- /dev/null
+++ b/patches/aivika-5.9.patch
@@ -0,0 +1,65 @@
+diff --git a/Simulation/Aivika/Agent.hs b/Simulation/Aivika/Agent.hs
+index 7eae961..01ff777 100644
+--- a/Simulation/Aivika/Agent.hs
++++ b/Simulation/Aivika/Agent.hs
+@@ -211,7 +211,7 @@ selectState st =
+ "Use the setStateTransition function to define " ++
+ "the transition state: activateState."
+ ProcessingMode ->
+- do x0 @ (Just st0) <- readIORef (agentStateRef agent)
++ do x0@(Just st0) <- readIORef (agentStateRef agent)
+ invokeEvent p $ traversePath x0 st
+
+ -- | Set the activation computation for the specified state.
+diff --git a/Simulation/Aivika/DoubleLinkedList.hs b/Simulation/Aivika/DoubleLinkedList.hs
+index 66322c8..47a4a6f 100644
+--- a/Simulation/Aivika/DoubleLinkedList.hs
++++ b/Simulation/Aivika/DoubleLinkedList.hs
+@@ -201,10 +201,10 @@ listRemoveBy x p = readIORef (listHead x) >>= loop
+ (Nothing, Nothing) ->
+ do writeIORef (listHead x) Nothing
+ writeIORef (listTail x) Nothing
+- (Nothing, head' @ (Just item')) ->
++ (Nothing, head'@(Just item')) ->
+ do writeIORef (itemPrev item') Nothing
+ writeIORef (listHead x) head'
+- (tail' @ (Just item'), Nothing) ->
++ (tail'@(Just item'), Nothing) ->
+ do writeIORef (itemNext item') Nothing
+ writeIORef (listTail x) tail'
+ (Just prev', Just next') ->
+diff --git a/Simulation/Aivika/Internal/Cont.hs b/Simulation/Aivika/Internal/Cont.hs
+index 379c2dc..f7ce5f9 100644
+--- a/Simulation/Aivika/Internal/Cont.hs
++++ b/Simulation/Aivika/Internal/Cont.hs
+@@ -777,7 +777,7 @@ freezeContReentering c a m =
+ writeIORef rc Nothing
+ case c of
+ Nothing -> return Nothing
+- z @ (Just c) ->
++ z@(Just c) ->
+ do f <- invokeEvent p $
+ contPreemptionBegun $
+ contId $ contAux c
+diff --git a/Simulation/Aivika/Stream.hs b/Simulation/Aivika/Stream.hs
+index 74d126c..7daa04c 100644
+--- a/Simulation/Aivika/Stream.hs
++++ b/Simulation/Aivika/Stream.hs
+@@ -289,7 +289,7 @@ rightStream (Cons s) = Cons y where
+
+ -- | Replace the 'Left' values.
+ replaceLeftStream :: Stream (Either a b) -> Stream c -> Stream (Either c b)
+-replaceLeftStream (Cons sab) (ys0 @ ~(Cons sc)) = Cons z where
++replaceLeftStream (Cons sab) (ys0@(~(Cons sc))) = Cons z where
+ z = do (a, xs) <- sab
+ case a of
+ Left _ ->
+@@ -300,7 +300,7 @@ replaceLeftStream (Cons sab) (ys0 @ ~(Cons sc)) = Cons z where
+
+ -- | Replace the 'Right' values.
+ replaceRightStream :: Stream (Either a b) -> Stream c -> Stream (Either a c)
+-replaceRightStream (Cons sab) (ys0 @ ~(Cons sc)) = Cons z where
++replaceRightStream (Cons sab) (ys0@(~(Cons sc))) = Cons z where
+ z = do (a, xs) <- sab
+ case a of
+ Right _ ->
diff --git a/patches/aivika-transformers-5.9.patch b/patches/aivika-transformers-5.9.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c46f63bdb34058df7e03a11cb9cd3f28dd38b4bd
--- /dev/null
+++ b/patches/aivika-transformers-5.9.patch
@@ -0,0 +1,52 @@
+diff --git a/Simulation/Aivika/Trans/DoubleLinkedList.hs b/Simulation/Aivika/Trans/DoubleLinkedList.hs
+index 0dbb4b1..4c530a4 100644
+--- a/Simulation/Aivika/Trans/DoubleLinkedList.hs
++++ b/Simulation/Aivika/Trans/DoubleLinkedList.hs
+@@ -211,10 +211,10 @@ listRemoveBy x p = readRef (listHead x) >>= loop
+ (Nothing, Nothing) ->
+ do writeRef (listHead x) Nothing
+ writeRef (listTail x) Nothing
+- (Nothing, head' @ (Just item')) ->
++ (Nothing, head'@(Just item')) ->
+ do writeRef (itemPrev item') Nothing
+ writeRef (listHead x) head'
+- (tail' @ (Just item'), Nothing) ->
++ (tail'@(Just item'), Nothing) ->
+ do writeRef (itemNext item') Nothing
+ writeRef (listTail x) tail'
+ (Just prev', Just next') ->
+diff --git a/Simulation/Aivika/Trans/Internal/Cont.hs b/Simulation/Aivika/Trans/Internal/Cont.hs
+index 26736d3..d241f12 100644
+--- a/Simulation/Aivika/Trans/Internal/Cont.hs
++++ b/Simulation/Aivika/Trans/Internal/Cont.hs
+@@ -821,7 +821,7 @@ freezeContReentering c a m =
+ invokeEvent p $ writeRef rc Nothing
+ case c of
+ Nothing -> return Nothing
+- z @ (Just c) ->
++ z@(Just c) ->
+ do f <- invokeEvent p $
+ contPreemptionBegun $
+ contId $ contAux c
+diff --git a/Simulation/Aivika/Trans/Stream.hs b/Simulation/Aivika/Trans/Stream.hs
+index 1cc5017..82af37c 100644
+--- a/Simulation/Aivika/Trans/Stream.hs
++++ b/Simulation/Aivika/Trans/Stream.hs
+@@ -323,7 +323,7 @@ rightStream (Cons s) = Cons y where
+ -- | Replace the 'Left' values.
+ replaceLeftStream :: MonadDES m => Stream m (Either a b) -> Stream m c -> Stream m (Either c b)
+ {-# INLINABLE replaceLeftStream #-}
+-replaceLeftStream (Cons sab) (ys0 @ ~(Cons sc)) = Cons z where
++replaceLeftStream (Cons sab) (ys0@(~(Cons sc))) = Cons z where
+ z = do (a, xs) <- sab
+ case a of
+ Left _ ->
+@@ -335,7 +335,7 @@ replaceLeftStream (Cons sab) (ys0 @ ~(Cons sc)) = Cons z where
+ -- | Replace the 'Right' values.
+ replaceRightStream :: MonadDES m => Stream m (Either a b) -> Stream m c -> Stream m (Either a c)
+ {-# INLINABLE replaceRightStream #-}
+-replaceRightStream (Cons sab) (ys0 @ ~(Cons sc)) = Cons z where
++replaceRightStream (Cons sab) (ys0@(~(Cons sc))) = Cons z where
+ z = do (a, xs) <- sab
+ case a of
+ Right _ ->
diff --git a/patches/alex-3.2.5.patch b/patches/alex-3.2.5.patch
new file mode 100644
index 0000000000000000000000000000000000000000..46c8d4a880d4eafd815969bd3770049480dce96f
--- /dev/null
+++ b/patches/alex-3.2.5.patch
@@ -0,0 +1,17 @@
+diff --git a/src/DFAMin.hs b/src/DFAMin.hs
+index e75c593..e338c8b 100644
+--- a/src/DFAMin.hs
++++ b/src/DFAMin.hs
+@@ -32,9 +32,9 @@ import Data.List as List
+ -- end;
+
+ minimizeDFA :: Ord a => DFA Int a -> DFA Int a
+-minimizeDFA dfa@ DFA { dfa_start_states = starts,
+- dfa_states = statemap
+- }
++minimizeDFA dfa@DFA { dfa_start_states = starts,
++ dfa_states = statemap
++ }
+ = DFA { dfa_start_states = starts,
+ dfa_states = Map.fromList states }
+ where
diff --git a/patches/combinat-0.2.9.0.patch b/patches/combinat-0.2.9.0.patch
new file mode 100644
index 0000000000000000000000000000000000000000..f72642d04d688371dc75919ce4c549bd5ea2c3ee
--- /dev/null
+++ b/patches/combinat-0.2.9.0.patch
@@ -0,0 +1,43 @@
+diff --git a/Math/Combinat/Groups/Braid.hs b/Math/Combinat/Groups/Braid.hs
+index 3760cac..7030ea2 100644
+--- a/Math/Combinat/Groups/Braid.hs
++++ b/Math/Combinat/Groups/Braid.hs
+@@ -282,7 +282,7 @@ isPureBraid braid = (braidPermutation braid == P.identity n) where
+ -- we got the two-line notation of the permutation.
+ --
+ braidPermutation :: KnownNat n => Braid n -> Permutation
+-braidPermutation braid@ (Braid gens) = perm where
++braidPermutation braid@(Braid gens) = perm where
+ n = numberOfStrands braid
+ perm = _braidPermutation n (map brGenIdx gens)
+
+diff --git a/Math/Combinat/Numbers/Primes.hs b/Math/Combinat/Numbers/Primes.hs
+index 6cf837f..0122d6d 100644
+--- a/Math/Combinat/Numbers/Primes.hs
++++ b/Math/Combinat/Numbers/Primes.hs
+@@ -54,10 +54,10 @@ primesTMWE = 2:3:5:7: gaps 11 wheel (fold3t $ roll 11 wheel primes') where
+ pairs ((x:xs):ys:t) = (x : union xs ys) : pairs t
+ wheel = 2:4:2:4:6:2:6:4:2:4:6:6:2:6:4:2:6:4:6:8:4:2:4:2:
+ 4:8:6:4:6:2:4:6:2:6:6:4:2:4:6:2:6:4:2:4:2:10:2:10:wheel
+- gaps k ws@(w:t) cs@ ~(c:u)
++ gaps k ws@(w:t) cs@(~(c:u))
+ | k==c = gaps (k+w) t u
+ | True = k : gaps (k+w) t cs
+- roll k ws@(w:t) ps@ ~(p:u)
++ roll k ws@(w:t) ps@(~(p:u))
+ | k==p = scanl (\c d->c+p*d) (p*p) ws : roll (k+w) t u
+ | True = roll (k+w) t ps
+
+diff --git a/Math/Combinat/Tableaux/LittlewoodRichardson.hs b/Math/Combinat/Tableaux/LittlewoodRichardson.hs
+index a6a58e3..3e4229f 100644
+--- a/Math/Combinat/Tableaux/LittlewoodRichardson.hs
++++ b/Math/Combinat/Tableaux/LittlewoodRichardson.hs
+@@ -212,7 +212,7 @@ lrScalar :: SkewPartition -> SkewPartition -> Int
+ lrScalar lambdaMu alphaBeta = _lrScalar (fromSkewPartition lambdaMu) (fromSkewPartition alphaBeta)
+
+ _lrScalar :: (Partition,Partition) -> (Partition,Partition) -> Int
+-_lrScalar (plam @(Partition lam ) , pmu @(Partition mu0) )
++_lrScalar (plam@(Partition lam ) , pmu@(Partition mu0) )
+ (palpha@(Partition alpha) , pbeta@(Partition beta)) =
+ if not (pmu `isSubPartitionOf` plam )
+ || not (pbeta `isSubPartitionOf` palpha)
diff --git a/patches/ghc-typelits-knownnat-0.7.1.patch b/patches/ghc-typelits-knownnat-0.7.1.patch
index 81e08fab8a22cfb70b09715ca5550f095e6501ce..58e0aa1ea19684fd7bc67928114a4b0374c29341 100644
--- a/patches/ghc-typelits-knownnat-0.7.1.patch
+++ b/patches/ghc-typelits-knownnat-0.7.1.patch
@@ -1,3 +1,18 @@
+diff --git a/src/GHC/TypeLits/KnownNat.hs b/src/GHC/TypeLits/KnownNat.hs
+index f6ab0bf..c53d062 100644
+--- a/src/GHC/TypeLits/KnownNat.hs
++++ b/src/GHC/TypeLits/KnownNat.hs
+@@ -191,8 +191,8 @@ instance (KnownNat a, KnownNat b) => KnownNat2 $(nameToSymbol ''(*)) a b where
+
+ -- | 'KnownNat2' instance for "GHC.TypeLits"' 'GHC.TypeLits.^'
+ instance (KnownNat a, KnownNat b) => KnownNat2 $(nameToSymbol ''(^)) a b where
+- natSing2 = let x = natVal (Proxy @ a)
+- y = natVal (Proxy @ b)
++ natSing2 = let x = natVal (Proxy @a)
++ y = natVal (Proxy @b)
+ z = case x of
+ 2 -> shiftL 1 (fromIntegral y)
+ _ -> x ^ y
diff --git a/src/GHC/TypeLits/KnownNat/Solver.hs b/src/GHC/TypeLits/KnownNat/Solver.hs
index 028ae22..66f5524 100644
--- a/src/GHC/TypeLits/KnownNat/Solver.hs
diff --git a/patches/hxt-9.3.1.18.patch b/patches/hxt-9.3.1.18.patch
new file mode 100644
index 0000000000000000000000000000000000000000..ec5c6e3a38192bc106805d70864097ce58b05874
--- /dev/null
+++ b/patches/hxt-9.3.1.18.patch
@@ -0,0 +1,257 @@
+diff --git a/src/Text/XML/HXT/Arrow/XmlState/TypeDefs.hs b/src/Text/XML/HXT/Arrow/XmlState/TypeDefs.hs
+index 9a81bbd..8095180 100644
+--- a/src/Text/XML/HXT/Arrow/XmlState/TypeDefs.hs
++++ b/src/Text/XML/HXT/Arrow/XmlState/TypeDefs.hs
+@@ -59,8 +59,8 @@ import Text.XML.HXT.DOM.Interface
+ -- state datatype consists of a system state and a user state
+ -- the user state is not fixed
+
+-data XIOState us = XIOState { xioSysState :: ! XIOSysState
+- , xioUserState :: ! us
++data XIOState us = XIOState { xioSysState :: !XIOSysState
++ , xioUserState :: !us
+ }
+
+ instance (NFData us) => NFData (XIOState us) where
+@@ -152,42 +152,42 @@ withoutUserState = withOtherUserState ()
+ -- predefined system state data type with all components for the
+ -- system functions, like trace, error handling, ...
+
+-data XIOSysState = XIOSys { xioSysWriter :: ! XIOSysWriter
+- , xioSysEnv :: ! XIOSysEnv
++data XIOSysState = XIOSys { xioSysWriter :: !XIOSysWriter
++ , xioSysEnv :: !XIOSysEnv
+ }
+
+ instance NFData XIOSysState where
+ rnf x = seq x () -- all fields of interest are strict
+
+-data XIOSysWriter = XIOwrt { xioErrorStatus :: ! Int
+- , xioErrorMsgList :: ! XmlTrees
++data XIOSysWriter = XIOwrt { xioErrorStatus :: !Int
++ , xioErrorMsgList :: !XmlTrees
+ , xioExpatErrors :: IOSArrow XmlTree XmlTree
+- , xioRelaxNoOfErrors :: ! Int
+- , xioRelaxDefineId :: ! Int
++ , xioRelaxNoOfErrors :: !Int
++ , xioRelaxDefineId :: !Int
+ , xioRelaxAttrList :: AssocList String XmlTrees
+ }
+
+-data XIOSysEnv = XIOEnv { xioTraceLevel :: ! Int
++data XIOSysEnv = XIOEnv { xioTraceLevel :: !Int
+ , xioTraceCmd :: Int -> String -> IO ()
+ , xioErrorMsgHandler :: String -> IO ()
+- , xioErrorMsgCollect :: ! Bool
+- , xioBaseURI :: ! String
+- , xioDefaultBaseURI :: ! String
+- , xioAttrList :: ! Attributes
+- , xioInputConfig :: ! XIOInputConfig
+- , xioParseConfig :: ! XIOParseConfig
+- , xioOutputConfig :: ! XIOOutputConfig
+- , xioRelaxConfig :: ! XIORelaxConfig
+- , xioXmlSchemaConfig :: ! XIOXmlSchemaConfig
+- , xioCacheConfig :: ! XIOCacheConfig
++ , xioErrorMsgCollect :: !Bool
++ , xioBaseURI :: !String
++ , xioDefaultBaseURI :: !String
++ , xioAttrList :: !Attributes
++ , xioInputConfig :: !XIOInputConfig
++ , xioParseConfig :: !XIOParseConfig
++ , xioOutputConfig :: !XIOOutputConfig
++ , xioRelaxConfig :: !XIORelaxConfig
++ , xioXmlSchemaConfig :: !XIOXmlSchemaConfig
++ , xioCacheConfig :: !XIOCacheConfig
+ }
+
+-data XIOInputConfig = XIOIcgf { xioStrictInput :: ! Bool
+- , xioEncodingErrors :: ! Bool
++data XIOInputConfig = XIOIcgf { xioStrictInput :: !Bool
++ , xioEncodingErrors :: !Bool
+ , xioInputEncoding :: String
+ , xioHttpHandler :: IOSArrow XmlTree XmlTree
+- , xioInputOptions :: ! Attributes
+- , xioRedirect :: ! Bool
++ , xioInputOptions :: !Attributes
++ , xioRedirect :: !Bool
+ , xioProxy :: String
+ }
+
+@@ -196,59 +196,59 @@ data XIOParseConfig = XIOPcfg { xioMimeTypes :: MimeTypeTable
+ , xioMimeTypeFile :: String
+ , xioAcceptedMimeTypes :: [String]
+ , xioFileMimeType :: String
+- , xioWarnings :: ! Bool
+- , xioRemoveWS :: ! Bool
+- , xioParseByMimeType :: ! Bool
+- , xioParseHTML :: ! Bool
+- , xioLowerCaseNames :: ! Bool
+- , xioPreserveComment :: ! Bool
+- , xioValidate :: ! Bool
+- , xioSubstDTDEntities :: ! Bool
+- , xioSubstHTMLEntities :: ! Bool
+- , xioCheckNamespaces :: ! Bool
+- , xioCanonicalize :: ! Bool
+- , xioIgnoreNoneXmlContents :: ! Bool
+- , xioTagSoup :: ! Bool
++ , xioWarnings :: !Bool
++ , xioRemoveWS :: !Bool
++ , xioParseByMimeType :: !Bool
++ , xioParseHTML :: !Bool
++ , xioLowerCaseNames :: !Bool
++ , xioPreserveComment :: !Bool
++ , xioValidate :: !Bool
++ , xioSubstDTDEntities :: !Bool
++ , xioSubstHTMLEntities :: !Bool
++ , xioCheckNamespaces :: !Bool
++ , xioCanonicalize :: !Bool
++ , xioIgnoreNoneXmlContents :: !Bool
++ , xioTagSoup :: !Bool
+ , xioTagSoupParser :: IOSArrow XmlTree XmlTree
+- , xioExpat :: ! Bool
++ , xioExpat :: !Bool
+ , xioExpatParser :: IOSArrow XmlTree XmlTree
+ }
+
+-data XIOOutputConfig = XIOOcfg { xioIndent :: ! Bool
+- , xioOutputEncoding :: ! String
+- , xioOutputFmt :: ! XIOXoutConfig
+- , xioXmlPi :: ! Bool
+- , xioNoEmptyElemFor :: ! [String]
+- , xioAddDefaultDTD :: ! Bool
+- , xioTextMode :: ! Bool
+- , xioShowTree :: ! Bool
+- , xioShowHaskell :: ! Bool
++data XIOOutputConfig = XIOOcfg { xioIndent :: !Bool
++ , xioOutputEncoding :: !String
++ , xioOutputFmt :: !XIOXoutConfig
++ , xioXmlPi :: !Bool
++ , xioNoEmptyElemFor :: ![String]
++ , xioAddDefaultDTD :: !Bool
++ , xioTextMode :: !Bool
++ , xioShowTree :: !Bool
++ , xioShowHaskell :: !Bool
+ }
+ data XIOXoutConfig = XMLoutput | XHTMLoutput | HTMLoutput | PLAINoutput
+ deriving (Eq)
+
+-data XIORelaxConfig = XIORxc { xioRelaxValidate :: ! Bool
++data XIORelaxConfig = XIORxc { xioRelaxValidate :: !Bool
+ , xioRelaxSchema :: String
+- , xioRelaxCheckRestr :: ! Bool
+- , xioRelaxValidateExtRef :: ! Bool
+- , xioRelaxValidateInclude :: ! Bool
+- , xioRelaxCollectErrors :: ! Bool
++ , xioRelaxCheckRestr :: !Bool
++ , xioRelaxValidateExtRef :: !Bool
++ , xioRelaxValidateInclude :: !Bool
++ , xioRelaxCollectErrors :: !Bool
+ , xioRelaxValidator :: IOSArrow XmlTree XmlTree
+ }
+
+-data XIOXmlSchemaConfig = XIOScc { xioXmlSchemaValidate :: ! Bool
++data XIOXmlSchemaConfig = XIOScc { xioXmlSchemaValidate :: !Bool
+ , xioXmlSchemaSchema :: String
+ , xioXmlSchemaValidator :: IOSArrow XmlTree XmlTree
+ }
+
+ data XIOCacheConfig = XIOCch { xioBinaryCompression :: CompressionFct
+ , xioBinaryDeCompression :: DeCompressionFct
+- , xioWithCache :: ! Bool
+- , xioCacheDir :: ! String
+- , xioDocumentAge :: ! Int
+- , xioCache404Err :: ! Bool
++ , xioWithCache :: !Bool
++ , xioCacheDir :: !String
++ , xioDocumentAge :: !Int
++ , xioCache404Err :: !Bool
+ , xioCacheRead :: String -> IOSArrow XmlTree XmlTree
+- , xioStrictDeserialize :: ! Bool
++ , xioStrictDeserialize :: !Bool
+ }
+
+ type MimeTypeHandlers = M.Map String (IOSArrow XmlTree XmlTree)
+diff --git a/src/Text/XML/HXT/DOM/QualifiedName.hs b/src/Text/XML/HXT/DOM/QualifiedName.hs
+index 18ef9e6..7cf2b6b 100644
+--- a/src/Text/XML/HXT/DOM/QualifiedName.hs
++++ b/src/Text/XML/HXT/DOM/QualifiedName.hs
+@@ -110,7 +110,7 @@ import Data.Char.Properties.XMLCharProps (isXmlNCNameChar,
+ -- Names are always reduced to normal form, and they are stored internally in a name cache
+ -- for sharing equal names by the same data structure
+
+-data XName = XN { _idXN :: ! Int -- for optimization of equality test, see Eq instance
++data XName = XN { _idXN :: !Int -- for optimization of equality test, see Eq instance
+ , unXN :: String
+ }
+ deriving (Typeable)
+@@ -158,9 +158,9 @@ type NsEnv = AssocList XName XName
+ -- When dealing with namespaces, the document tree must be processed by 'Text.XML.HXT.Arrow.Namespace.propagateNamespaces'
+ -- to split names of structure \"prefix:localPart\" and label the name with the apropriate namespace uri
+
+-data QName = QN { localPart' :: ! XName
+- , namePrefix' :: ! XName
+- , namespaceUri' :: ! XName
++data QName = QN { localPart' :: !XName
++ , namePrefix' :: !XName
++ , namespaceUri' :: !XName
+ }
+ deriving (Typeable)
+
+@@ -507,9 +507,9 @@ toNsEnv = map (newXName *** newXName)
+
+ -- the name and string cache
+
+-data NameCache = NC { _newXN :: ! Int -- next free name id
+- , _xnCache :: ! (M.Map String XName)
+- , _qnCache :: ! (M.Map (XName, XName, XName) QName) -- we need another type than QName
++data NameCache = NC { _newXN :: !Int -- next free name id
++ , _xnCache :: !(M.Map String XName)
++ , _qnCache :: !(M.Map (XName, XName, XName) QName) -- we need another type than QName
+ } -- for the key because of the unusable
+ -- Eq instance of QName
+ type ChangeNameCache r = NameCache -> (NameCache, r)
+@@ -530,13 +530,13 @@ nullXName
+ , xmlNamespaceXName
+ , xmlXName :: XName
+
+-initialXNames@
+- [ nullXName
+- , xmlnsNamespaceXName
+- , xmlnsXName
+- , xmlNamespaceXName
+- , xmlXName
+- ] = zipWith XN [0..] $
++initialXNames@[ nullXName
++ , xmlnsNamespaceXName
++ , xmlnsXName
++ , xmlNamespaceXName
++ , xmlXName
++ ]
++ = zipWith XN [0..] $
+ [ ""
+ , xmlnsNamespace
+ , a_xmlns
+@@ -548,8 +548,8 @@ initialQNames :: [QName]
+
+ xmlnsQN :: QName
+
+-initialQNames@
+- [xmlnsQN] = [QN xmlnsXName nullXName xmlnsNamespaceXName]
++initialQNames@[xmlnsQN]
++ = [QN xmlnsXName nullXName xmlnsNamespaceXName]
+
+ initialCache :: NameCache
+ initialCache = NC
+diff --git a/src/Text/XML/HXT/Parser/XmlCharParser.hs b/src/Text/XML/HXT/Parser/XmlCharParser.hs
+index 702f847..4bc13b1 100644
+--- a/src/Text/XML/HXT/Parser/XmlCharParser.hs
++++ b/src/Text/XML/HXT/Parser/XmlCharParser.hs
+@@ -49,7 +49,7 @@ type XParser s a = GenParser Char (XPState s) a
+ type SimpleXParser a = XParser () a
+
+ data XPState s = XPState
+- { xps_normalizeNewline :: ! Bool
++ { xps_normalizeNewline :: !Bool
+ , xps_userState :: s
+ }
+
diff --git a/patches/hxt-regex-xmlschema-9.2.0.3.patch b/patches/hxt-regex-xmlschema-9.2.0.3.patch
new file mode 100644
index 0000000000000000000000000000000000000000..52ab5f9e521833aea6f186c8c9d461966a51e85c
--- /dev/null
+++ b/patches/hxt-regex-xmlschema-9.2.0.3.patch
@@ -0,0 +1,13 @@
+diff --git a/src/Text/Regex/XMLSchema/Generic/Matching.hs b/src/Text/Regex/XMLSchema/Generic/Matching.hs
+index d8d6931..1787839 100644
+--- a/src/Text/Regex/XMLSchema/Generic/Matching.hs
++++ b/src/Text/Regex/XMLSchema/Generic/Matching.hs
+@@ -244,7 +244,7 @@ tokenizeRE' re inp0
+ token1'' = token' re1 fcs
+
+ -- token' :: StringLike s => GenRegex s -> CharSet -> (s, Int) -> s -> [Either s s]
+- token' re' fcs' (uns, ! n) inp
++ token' re' fcs' (uns, !n) inp
+ | nullS inp = addUnmatched []
+ | otherwise = evalRes . splitWithRegexCS re' fcs' $ inp
+ where
diff --git a/patches/mono-traversable-1.0.13.0.patch b/patches/mono-traversable-1.0.13.0.patch
new file mode 100644
index 0000000000000000000000000000000000000000..1e5460e6d71a88a031badc5c55a559960f676af2
--- /dev/null
+++ b/patches/mono-traversable-1.0.13.0.patch
@@ -0,0 +1,22 @@
+diff --git a/src/Data/MonoTraversable.hs b/src/Data/MonoTraversable.hs
+index effab6b..5dd4bf6 100644
+--- a/src/Data/MonoTraversable.hs
++++ b/src/Data/MonoTraversable.hs
+@@ -1313,7 +1313,7 @@ class MonoFunctor mono => MonoComonad mono where
+ instance MonoComonad (ViewL a) where
+ oextract ~(x :< _) = x
+ {-# INLINE oextract #-}
+- oextend f w@ ~(_ :< xxs) =
++ oextend f w@(~(_ :< xxs)) =
+ f w :< case Seq.viewl xxs of
+ EmptyL -> Seq.empty
+ xs -> case oextend f xs of
+@@ -1323,7 +1323,7 @@ instance MonoComonad (ViewL a) where
+ instance MonoComonad (ViewR a) where
+ oextract ~(_ :> x) = x
+ {-# INLINE oextract #-}
+- oextend f w@ ~(xxs :> _) =
++ oextend f w@(~(xxs :> _)) =
+ (case Seq.viewr xxs of
+ EmptyR -> Seq.empty
+ xs -> case oextend f xs of
diff --git a/patches/regex-base-0.93.2.patch b/patches/regex-base-0.93.2.patch
index 7ad38b3d0b111efa64840d6330a2602c478d9897..af8e9cd1bcc5207f74939c2384bef09b7cff669a 100644
--- a/patches/regex-base-0.93.2.patch
+++ b/patches/regex-base-0.93.2.patch
@@ -1,5 +1,5 @@
diff --git a/Text/Regex/Base/Context.hs b/Text/Regex/Base/Context.hs
-index d01ce80..e88bd3f 100644
+index d01ce80..5d68039 100644
--- a/Text/Regex/Base/Context.hs
+++ b/Text/Regex/Base/Context.hs
@@ -187,6 +187,7 @@ Unused matches are 'empty' (defined via 'Extract')
@@ -45,6 +45,17 @@ index d01ce80..e88bd3f 100644
{-# INLINE actOn #-}
actOn f r s = case matchOnceText r s of
Nothing -> regexFailed
+@@ -297,8 +298,8 @@ instance (RegexLike a b) => RegexContext a b Int where
+ -- ** Instances based on matchOnce,matchOnceText
+
+ instance (RegexLike a b) => RegexContext a b (MatchOffset,MatchLength) where
+- match r s = maybe (-1,0) (!0) (matchOnce r s)
+- matchM r s = maybe regexFailed (return.(!0)) (matchOnce r s)
++ match r s = maybe (-1,0) (! 0) (matchOnce r s)
++ matchM r s = maybe regexFailed (return.(! 0)) (matchOnce r s)
+
+ instance (RegexLike a b) => RegexContext a b (MatchResult b) where
+ match r s = maybe (MR {mrBefore = s,mrMatch = empty,mrAfter = empty
diff --git a/Text/Regex/Base/Impl.hs b/Text/Regex/Base/Impl.hs
index b0b0454..f5ad9ab 100644
--- a/Text/Regex/Base/Impl.hs
diff --git a/patches/regex-base-0.94.0.0.patch b/patches/regex-base-0.94.0.0.patch
new file mode 100644
index 0000000000000000000000000000000000000000..89594a4a82d5f75ef2085edabad2ecb1b4184eed
--- /dev/null
+++ b/patches/regex-base-0.94.0.0.patch
@@ -0,0 +1,15 @@
+diff --git a/src/Text/Regex/Base/Context.hs b/src/Text/Regex/Base/Context.hs
+index 1067f73..60e95ad 100644
+--- a/src/Text/Regex/Base/Context.hs
++++ b/src/Text/Regex/Base/Context.hs
+@@ -300,8 +300,8 @@ instance (RegexLike a b) => RegexContext a b Int where
+ -- ** Instances based on matchOnce,matchOnceText
+
+ instance (RegexLike a b) => RegexContext a b (MatchOffset,MatchLength) where
+- match r s = maybe (-1,0) (!0) (matchOnce r s)
+- matchM r s = maybe regexFailed (return.(!0)) (matchOnce r s)
++ match r s = maybe (-1,0) (! 0) (matchOnce r s)
++ matchM r s = maybe regexFailed (return.(! 0)) (matchOnce r s)
+
+ instance (RegexLike a b) => RegexContext a b (MatchResult b) where
+ match r s = maybe (MR {mrBefore = s,mrMatch = empty,mrAfter = empty
diff --git a/patches/regex-compat-0.95.1.patch b/patches/regex-compat-0.95.1.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c5b98ca91bd3e252b7789347b34f70839cadf15b
--- /dev/null
+++ b/patches/regex-compat-0.95.1.patch
@@ -0,0 +1,13 @@
+diff --git a/Text/Regex.hs b/Text/Regex.hs
+index 2369ac2..66bd522 100644
+--- a/Text/Regex.hs
++++ b/Text/Regex.hs
+@@ -139,7 +139,7 @@ behavior of the the original Text.Regex API.
+ splitRegex :: Regex -> String -> [String]
+ splitRegex _ [] = []
+ splitRegex delim strIn =
+- let matches = map (!0) (matchAll delim strIn)
++ let matches = map (! 0) (matchAll delim strIn)
+ go _i str [] = str : []
+ go i str ((off,len):rest) =
+ let i' = off+len
diff --git a/patches/regex-compat-0.95.2.0.patch b/patches/regex-compat-0.95.2.0.patch
new file mode 100644
index 0000000000000000000000000000000000000000..47fa0aeb5c53925f232056512b4c0cd09b369da8
--- /dev/null
+++ b/patches/regex-compat-0.95.2.0.patch
@@ -0,0 +1,13 @@
+diff --git a/Text/Regex.hs b/Text/Regex.hs
+index 4a82fa0..2cd51b4 100644
+--- a/Text/Regex.hs
++++ b/Text/Regex.hs
+@@ -139,7 +139,7 @@ behavior of the the original Text.Regex API.
+ splitRegex :: Regex -> String -> [String]
+ splitRegex _ [] = []
+ splitRegex delim strIn =
+- let matches = map (!0) (matchAll delim strIn)
++ let matches = map (! 0) (matchAll delim strIn)
+ go _i str [] = str : []
+ go i str ((off,len):rest) =
+ let i' = off+len
diff --git a/patches/shakespeare-2.0.23.patch b/patches/shakespeare-2.0.23.patch
index d56a8bf22af69fdfe85c44bde90f5df0f9522d3d..e3a1ad8bd1c637e9304110900e72a43b7d35cdb5 100644
--- a/patches/shakespeare-2.0.23.patch
+++ b/patches/shakespeare-2.0.23.patch
@@ -34,7 +34,7 @@ index c8e4e78..8d56a3f 100644
toExp = c
where
diff --git a/Text/Internal/Css.hs b/Text/Internal/Css.hs
-index a76e4a5..31b8608 100644
+index a76e4a5..758b4de 100644
--- a/Text/Internal/Css.hs
+++ b/Text/Internal/Css.hs
@@ -1,6 +1,7 @@
@@ -45,6 +45,15 @@ index a76e4a5..31b8608 100644
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+@@ -266,7 +267,7 @@ cssRuntime toi2b parseBlocks fp cd render' = unsafePerformIO $ do
+ where
+ cs = either error mconcat $ mapM (contentToBuilderRT cd render') cs'
+ goTop scope (TopBlock b:rest) =
+- map TopBlock (either error ($[]) $ blockRuntime (addScope scope) render' b) ++
++ map TopBlock (either error ($ []) $ blockRuntime (addScope scope) render' b) ++
+ goTop scope rest
+ goTop scope (TopAtBlock name s' b:rest) =
+ TopAtBlock name s (foldr (either error id . blockRuntime (addScope scope) render') [] b) :
@@ -281,7 +282,11 @@ vtToExp :: (Deref, VarType) -> Q Exp
vtToExp (d, vt) = do
d' <- lift d
@@ -58,6 +67,19 @@ index a76e4a5..31b8608 100644
where
c :: VarType -> Q Exp
c VTPlain = [|CDPlain . toCss|]
+diff --git a/Text/Lucius.hs b/Text/Lucius.hs
+index f814263..83d4e6a 100644
+--- a/Text/Lucius.hs
++++ b/Text/Lucius.hs
+@@ -334,7 +334,7 @@ luciusRTInternal tl =
+ -> Block Unresolved
+ -> Either String [Block Resolved]
+ goBlock scope =
+- either Left (Right . ($[])) . blockRuntime scope' (error "luciusRT has no URLs")
++ either Left (Right . ($ [])) . blockRuntime scope' (error "luciusRT has no URLs")
+ where
+ scope' = map goScope scope
+
diff --git a/Text/Shakespeare.hs b/Text/Shakespeare.hs
index 56ff289..460c1e2 100644
--- a/Text/Shakespeare.hs
diff --git a/patches/sop-core-0.5.0.0.patch b/patches/sop-core-0.5.0.0.patch
index 84b1797737a987ee69a453e962d2a9c9be816aac..edfc61f3feecc6f13bcce75b985afd3376c0b449 100644
--- a/patches/sop-core-0.5.0.0.patch
+++ b/patches/sop-core-0.5.0.0.patch
@@ -1,3 +1,25 @@
+diff --git a/src/Data/SOP/Dict.hs b/src/Data/SOP/Dict.hs
+index 88ab501..bd51646 100644
+--- a/src/Data/SOP/Dict.hs
++++ b/src/Data/SOP/Dict.hs
+@@ -68,7 +68,7 @@ mapAll f Dict = (all_NP . hmap f . unAll_NP) Dict
+ mapAll2 :: forall c d xss .
+ (forall a . Dict c a -> Dict d a)
+ -> Dict (All2 c) xss -> Dict (All2 d) xss
+-mapAll2 f d @ Dict = (all2 . mapAll (mapAll f) . unAll2) d
++mapAll2 f d@Dict = (all2 . mapAll (mapAll f) . unAll2) d
+
+ -- | If two constraints 'c' and 'd' hold over a type-level
+ -- list 'xs', then the combination of both constraints holds
+@@ -77,7 +77,7 @@ mapAll2 f d @ Dict = (all2 . mapAll (mapAll f) . unAll2) d
+ -- @since 0.2
+ --
+ zipAll :: Dict (All c) xs -> Dict (All d) xs -> Dict (All (c `And` d)) xs
+-zipAll dc @ Dict dd = all_NP (hzipWith (\ Dict Dict -> Dict) (unAll_NP dc) (unAll_NP dd))
++zipAll dc@Dict dd = all_NP (hzipWith (\ Dict Dict -> Dict) (unAll_NP dc) (unAll_NP dd))
+
+ -- | If two constraints 'c' and 'd' hold over a type-level
+ -- list of lists 'xss', then the combination of both constraints
diff --git a/src/Data/SOP/Sing.hs b/src/Data/SOP/Sing.hs
index c805608..d1bffe6 100644
--- a/src/Data/SOP/Sing.hs