Skip to content

Instantly share code, notes, and snippets.

@AlexeyRaga
Created June 27, 2018 10:40
Show Gist options
  • Save AlexeyRaga/b8d72412a4b7a83dcbd12e2f3ac504ac to your computer and use it in GitHub Desktop.
Save AlexeyRaga/b8d72412a4b7a83dcbd12e2f3ac504ac to your computer and use it in GitHub Desktop.
"Object Oriented Programming" in Haskell
class Monad m => NotificationQueue m where
readNotifications :: m [Message]
ackNotification :: Message -> m ()
class Repository m where
readRules :: S3Location -> m (Maybe [Rule])
writePolicies :: S3Location -> [Policy] -> m (Maybe ETag)
readSubmissions :: ( NotificationQueue m
, Repository m
, Logging m) => m ()
readSubmissions = do
msgs <- readNotifications
logInfo ("Received messages: " ++ show (length msgs))
forM_ msgs $ \msg -> do
rules <- readRules (locationFromMessage msg)
error "Implement me"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment