Diwali hacks
November 12, 2015After quite a long time, I got some spare hours to hack on open source projects during this Diwali holidays. I added a helper function in persistent which in my opinion is super cool:
The liftSqlPersistMPool
is simply defined like this:
liftSqlPersistMPool :: MonadIO m => SqlPersistM a -> Pool SqlBackend -> m a
= liftIO (runSqlPersistMPool x pool) liftSqlPersistMPool x pool
And this will help in converting code like this:
main :: IO ()
= runStderrLoggingT $ withPostgresqlPool conn 10 $ \pool -> liftIO $ do
main flip runSqlPersistMPool pool $ do
runMigration migrateAll
to:
main :: IO ()
in = runStderrLoggingT $ withPostgresqlPool conn 10 $ liftSqlPersistMPool $ do
runMigration migrateAll
Ain’t that neat? :-)
The other patches for persistent included some cleanup, some documentation and a ownership related patch. Although, I plan to work on the ownership related code later. (See Issue 390 for more details.)
Also, I briefly hacked on the emacs haskell-mode package. Sent some minor patch related to hayoo and cleanup.
With respect to mathematics, I was not able to progress much besides reading some pages in Chapter 5. But I’m almost at the end of the chapter 5.