Skip to content

Instantly share code, notes, and snippets.

@tel tel/Yana.hs
Last active Mar 30, 2017

Embed
What would you like to do?
-- Example code
example :: (Context m, MonadLog m, AreaDao m) => [Actor] -> m ()
example list =
forM list $ \actor -> do
logInfo $ "Actor being read: " ++ actorCode actor
areaList <- getArea actor
case areaList of
[] -> return () -- do nothing
(area : _) -> do
setActorArea actor area
logInfo $
"Area{" ++ show area ++ "} is fetched for actor {" ++ actorCode actor ++ "}"
setReadCount 1
-- Assumed preliminaries
data Actor
data Area
class MonadLog m
class AreaDao m
class Context m
logInfo :: MonadLog m => String -> m ()
actorCode :: Actor -> String
getArea :: AreaDao m => Actor -> m [Area]
setActorArea :: AreaDao m => Actor -> Area -> m ()
setReadCount :: Context m => Int -> m ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.