Skip to content

Commit

Permalink
clean up useless constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
berewt committed Apr 1, 2023
1 parent 64998e9 commit b8024db
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions marconi-core/src/Marconi/Core/Experiment.hs
Expand Up @@ -69,6 +69,7 @@ import Database.SQLite.Simple qualified as SQL
-- instead of an event.
-- The reason is that you may not want to always carry around a point when you manipulate an event.
type family Point desc

-- |
-- A an element that you want to capture from a given input.
-- A given point in time will always correspond to an event.
Expand All @@ -78,7 +79,6 @@ type family Point desc
type family Event desc



-- | A query is a data family that take a query descriptor.
-- A query is tied to an indexer by a typeclass, this design choice has two main reasons:
-- * we want to be able to define different query for the same indexer
Expand Down Expand Up @@ -122,6 +122,12 @@ class Monad m => IsIndex indexer desc m where
lastSyncPoint :: indexer desc -> m (Maybe (Point desc))
{-# MINIMAL index, lastSyncPoint #-}

-- | Check if the given point is ahead of the last syncPoint of an indexer,
isNotAheadOfSync ::
(Ord (Point desc), IsIndex indexer desc m) =>
Point desc -> indexer desc -> m Bool
isNotAheadOfSync p indexer = maybe False (p <=) <$> lastSyncPoint indexer


-- | Error that can occurs when you query an indexer
data QueryError desc
Expand All @@ -147,12 +153,6 @@ class MonadError (QueryError query) m => Queryable indexer desc query m where
-- what is your answer to this query?"
query :: Ord (Point desc) => Point desc -> Query query -> indexer desc -> m (Result query)

-- | Check if the given point is ahead of the last syncPoint of an indexer, throw an error if it's the case
isNotAheadOfSync ::
(Ord (Point desc), MonadError (QueryError query) m, IsIndex indexer desc m) =>
Point desc -> indexer desc -> m Bool
isNotAheadOfSync p indexer = maybe False (p <=) <$> lastSyncPoint indexer

-- | We can reset an indexer to a previous `Point`
-- * @indexer@ is the indexer implementation type
-- * @desc@ the descriptor of the indexer, fixing the @Point@ types
Expand Down

0 comments on commit b8024db

Please sign in to comment.