diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,7 @@
+2022-04-21 Ivan Perez <ivan.perez@keera.co.uk>
+        * bearriver.cabal: Version bump (0.13.4) (#280), declare changelog file
+          (#273), declare subdir of source-repository (#272).
+        * CHANGELOG: Add CHANGELOG file (#273).
+        * src/: Hide conflicting function in import (#275), fix error in
+          reactimate (#266), fix error in implementation of afterEachCat
+          (#243), syntax rules (#277).
diff --git a/bearriver.cabal b/bearriver.cabal
--- a/bearriver.cabal
+++ b/bearriver.cabal
@@ -1,17 +1,44 @@
-name:                bearriver
-version:             0.13.3
-homepage:            keera.co.uk
-license:             BSD3
-license-file:        LICENSE
-author:              Ivan Perez and Manuel Bärenz
-maintainer:          ivan.perez@keera.co.uk
--- copyright:
-category:            FRP
-build-type:          Simple
--- extra-source-files:
-cabal-version:       >=1.10
+-- Copyright (c) 2016 - Ivan Perez and Manuel Bärenz - All rights reserved
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions are met:
+--
+--     * Redistributions of source code must retain the above copyright
+--       notice, this list of conditions and the following disclaimer.
+--
+--     * Redistributions in binary form must reproduce the above
+--       copyright notice, this list of conditions and the following
+--       disclaimer in the documentation and/or other materials provided
+--       with the distribution.
+--
+--     * Neither the name of Ivan Perez and Manuel Bärenz nor the names of
+--       other contributors may be used to endorse or promote products derived
+--       from this software without specific prior written permission.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cabal-version: >= 1.10
+build-type:    Simple
 
-synopsis:            FRP Yampa replacement implemented with Monadic Stream Functions.
+name:          bearriver
+version:       0.13.4
+author:        Ivan Perez, Manuel Bärenz
+maintainer:    ivan.perez@keera.co.uk
+homepage:      https://github.com/ivanperez-keera/dunai
+license:       BSD3
+license-file:  LICENSE
+copyright:     Copyright (c) 2016 - Ivan Perez and Manuel Bärenz
+category:      FRP
+synopsis:      FRP Yampa replacement implemented with Monadic Stream Functions.
 description:
   <https://hackage.haskell.org/package/Yampa Yampa> is a popular Functional
   Reactive Programming (FRP) implementation that has been used extensively for
@@ -32,14 +59,32 @@
   this implementation is faster than traditional Yampa for medium-sized and
   large applications.
 
-library
-  exposed-modules:     FRP.Yampa,
-                       FRP.BearRiver
 
-  build-depends:       base >=4.6 && <5, transformers >=0.3, mtl, dunai >= 0.6.0 && < 0.9, MonadRandom, simple-affine-space
-  hs-source-dirs:      src/
-  default-language:    Haskell2010
+extra-source-files:
+  CHANGELOG
 
+
 source-repository head
   type:     git
   location: git@github.com:ivanperez-keera/dunai.git
+  subdir:   dunai-frp-bearriver
+
+
+library
+  exposed-modules:
+    FRP.BearRiver
+    FRP.Yampa
+
+  build-depends:
+      base >= 4.6 && <5
+    , dunai >= 0.6.0 && < 0.9
+    , MonadRandom
+    , mtl
+    , simple-affine-space
+    , transformers >= 0.3
+
+  default-language:
+    Haskell2010
+
+  hs-source-dirs:
+    src/
diff --git a/src/FRP/BearRiver.hs b/src/FRP/BearRiver.hs
--- a/src/FRP/BearRiver.hs
+++ b/src/FRP/BearRiver.hs
@@ -1,6 +1,9 @@
 {-# LANGUAGE Arrows     #-}
 {-# LANGUAGE CPP        #-}
 {-# LANGUAGE RankNTypes #-}
+-- Copyright  : (c) Ivan Perez and Manuel Baerenz, 2016
+-- License    : BSD3
+-- Maintainer : ivan.perez@keera.co.uk
 module FRP.BearRiver
   (module FRP.BearRiver, module X)
  where
@@ -12,44 +15,56 @@
 -- switches, etc.) our goal is to show that the approach is promising and that
 -- there do not seem to exist any obvious limitations.
 
+-- External imports
 import           Control.Applicative
-import           Control.Arrow                                  as X
-import qualified Control.Category                               as Category
-import           Control.Monad                                  (mapM)
+import           Control.Arrow             as X
+import qualified Control.Category          as Category
+import           Control.Monad             (mapM)
 import           Control.Monad.Random
 import           Control.Monad.Trans.Maybe
-import           Control.Monad.Trans.MSF                        hiding (switch)
-import qualified Control.Monad.Trans.MSF                        as MSF
-import           Control.Monad.Trans.MSF.Except                 as MSF hiding
-                                                                        (switch)
-import           Control.Monad.Trans.MSF.List                   (sequenceS,
-                                                                 widthFirst)
-import           Control.Monad.Trans.MSF.Random
 import           Data.Functor.Identity
 import           Data.Maybe
-import           Data.MonadicStreamFunction                     as X hiding (reactimate,
-                                                                      repeatedly,
-                                                                      sum,
-                                                                      switch,
-                                                                      trace)
-import qualified Data.MonadicStreamFunction                     as MSF
-import           Data.MonadicStreamFunction.Instances.ArrowLoop
+import           Data.Traversable          as T
+import           Data.VectorSpace          as X
+
+-- Internal imports
+import           Control.Monad.Trans.MSF                 hiding (dSwitch,
+                                                          switch)
+import qualified Control.Monad.Trans.MSF                 as MSF
+import           Control.Monad.Trans.MSF.Except          as MSF hiding (dSwitch,
+                                                                 switch)
+import           Control.Monad.Trans.MSF.List            (sequenceS, widthFirst)
+import           Control.Monad.Trans.MSF.Random
+import           Data.MonadicStreamFunction              as X hiding (dSwitch,
+                                                               reactimate,
+                                                               repeatedly, sum,
+                                                               switch, trace)
+import qualified Data.MonadicStreamFunction              as MSF
 import           Data.MonadicStreamFunction.InternalCore
-import           Data.Traversable                               as T
-import           Data.VectorSpace                               as X
 
+-- Internal imports (instances)
+import Data.MonadicStreamFunction.Instances.ArrowLoop
+
 infixr 0 -->, -:>, >--, >=-
 
 -- * Basic definitions
 
+-- | Absolute time.
 type Time  = Double
 
+-- | Time deltas or increments (conceptually positive).
 type DTime = Double
 
+-- | Extensible signal function (signal function with a notion of time, but
+-- which can be extended with actions).
 type SF m        = MSF (ClockInfo m)
 
+-- | Information on the progress of time.
 type ClockInfo m = ReaderT DTime m
 
+-- | A value that may or may not exist.
+--
+-- Used to represent discrete-time signals.
 data Event a = Event a | NoEvent
  deriving (Eq, Show)
 
@@ -191,15 +206,26 @@
 afterEachCat = afterEachCat' 0
   where
     afterEachCat' :: Monad m => Time -> [(Time,b)] -> SF m a (Event [b])
-    afterEachCat' _ []  = never
+    afterEachCat' _ [] = never
     afterEachCat' t qxs = MSF $ \_ -> do
       dt <- ask
-      let t' = t + dt
-          (qxsNow, qxsLater) = span (\p -> fst p <= t') qxs
-          ev = if null qxsNow then NoEvent else Event (map snd qxsNow)
-      return (ev, afterEachCat' t' qxsLater)
+      let (ev, t', qxs') = fireEvents [] (t + dt) qxs
+          ev' = if null ev
+                  then NoEvent
+                  else Event (reverse ev)
 
+      return (ev', afterEachCat' t' qxs')
 
+    fireEvents :: [b] -> Time -> [(Time,b)] -> ([b], Time, [(Time,b)])
+    fireEvents ev t [] = (ev, t, [])
+    fireEvents ev t (qx:qxs)
+      | fst qx < 0 = error "bearriver: afterEachCat: Non-positive period."
+      | otherwise =
+          let overdue = t - fst qx in
+          if overdue >= 0
+            then fireEvents (snd qx:ev) overdue qxs
+            else (ev, t, qx:qxs)
+
 -- * Events
 
 -- | Apply an 'MSF' to every input. Freezes temporarily if the input is
@@ -563,19 +589,10 @@
  where sfIO        = morphS (return.runIdentity) (runReaderS sf)
 
        -- Sense
-       senseSF     = MSF.switch senseFirst senseRest
+       senseSF     = MSF.dSwitch senseFirst senseRest
 
        -- Sense: First sample
-       senseFirst = ftp >>> arrM senseOnce
-
-       -- senseOnce :: Bool -> SF m () a
-       senseOnce True  = senseI >>= \x -> return ((0, x), Nothing)
-       senseOnce False = return ((0, undefined), Just undefined)
-
-       -- First time point: outputs True at the first sample, and False after
-       -- that. Conceptually this is like True --> constant False
-       -- ftp :: Monad m => SF m a Bool
-       ftp = feedback True $ arr $ \(_, x) -> (x, False)
+       senseFirst = constM senseI >>> arr (\x -> ((0, x), Just x))
 
        -- Sense: Remaining samples
        senseRest a = constM (sense True) >>> (arr id *** keepLast a)
diff --git a/src/FRP/Yampa.hs b/src/FRP/Yampa.hs
--- a/src/FRP/Yampa.hs
+++ b/src/FRP/Yampa.hs
@@ -1,8 +1,22 @@
+-- |
+-- Copyright  : (c) Ivan Perez and Manuel Baerenz, 2016
+-- License    : BSD3
+-- Maintainer : ivan.perez@keera.co.uk
 module FRP.Yampa (module X, SF, FutureSF) where
 
-import           FRP.BearRiver         as X hiding (andThen, SF)
-import           Data.Functor.Identity
-import qualified FRP.BearRiver         as BR
+-- External imports
+import Data.Functor.Identity
 
+-- Internal imports
+import           FRP.BearRiver as X hiding (SF, andThen)
+import qualified FRP.BearRiver as BR
+
+-- | Signal function (conceptually, a function between signals that respects
+-- causality).
 type SF       = BR.SF Identity
+
+-- | Future signal function (conceptually, a function between fugure signals
+-- that respects causality).
+--
+-- A future signal is a signal that is only defined for positive times.
 type FutureSF = BR.SF Identity
