haskell - Need help to understand the usage of `liftBase` -


i reading through (for self studying purpose) source code of bryan o'sullivan's popular pool library.

and have question in function takeresource, ask haskell experts here. function defined as:

takeresource :: pool -> io (a, localpool a) takeresource pool@pool{..} =   local@localpool{..} <- getlocalpool pool   resource <- liftbase . join . atomically $   ents <- readtvar entries   case ents of     (entry{..}:es) -> writetvar entries es >> return (return entry)     [] ->       used <- readtvar inuse       when (used == maxresources) retry       writetvar inuse $! used + 1       return $         create `onexception` atomically (modifytvar_ inuse (subtract 1))   return (resource, local) 

the line having problem is

... resource <- liftbase . join . atomically $ ... 

why here usage of liftbase necessary? can write instead

... resource <- join . atomically $ ... 

the compiler accepts both versions. missing here trivial or why liftbase here necessary?

thank in advance tips!

i think i'm responsible that. no, there's no purpose there, can removed. think necessary before refactoring. send pull request , part of awesome library :)


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -