runExperiment :: Free ExpInstr a -> RunHRRBackend a
runExperiment m conn = iterM run m
  where
    run :: ExpInstr (IO a) -> IO a
    run (LookupAssignment eid uid k) = do
      a <- queryAssignment eid uid conn
      k a
    run (NewAssignment eid uid k) = do
      insertAssignment' eid uid undefined conn
      k undefined
    run (NewReward eid uid rew k) = do
      updateReward eid uid rew conn
      k

-- | Queries the database
runExperiment :: Free ExpInstr a -> RunHRRBackend a
runExperiment m conn = iterM run m
  where
    run :: ExpInstr (IO a) -> IO a
    run (LookupAssignment eid uid k) = do
      a <- queryAssignment eid uid conn
      k a
    run (NewAssignment eid uid k) = do
      insertAssignment' eid uid undefined conn
      k undefined
    run (NewReward eid uid rew k) = do
      updateReward eid uid rew conn
      k

-- | Queries the database
runExperiment m conn = iterM run m
  where
    run :: ExpInstr (IO a) -> IO a
    run (LookupAssignment eid uid k) = do
      a <- queryAssignment eid uid conn
      k a
    run (NewAssignment eid uid k) = do
      insertAssignment' eid uid undefined conn
      k undefined
    run (NewReward eid uid rew k) = do
      updateReward eid uid rew conn
      k

-- | Queries the database