Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added haddock generated documentation (there are still some formating…

… problems).
  • Loading branch information...
commit b77977d2e6cc8c9de18208ad13bb0493dc48cc29 1 parent b9f9f73
@Palmik authored
Showing with 1,075 additions and 30 deletions.
  1. +25 −0 dist/doc/html/snaplet-mongodb-minimalistic/Snap-Snaplet-MongoDB-Core.html
  2. +4 −0 dist/doc/html/snaplet-mongodb-minimalistic/Snap-Snaplet-MongoDB-Functions-M.html
  3. +37 −0 dist/doc/html/snaplet-mongodb-minimalistic/Snap-Snaplet-MongoDB-Functions-S.html
  4. +4 −0 dist/doc/html/snaplet-mongodb-minimalistic/Snap-Snaplet-MongoDB-Functions.html
  5. +4 −0 dist/doc/html/snaplet-mongodb-minimalistic/Snap-Snaplet-MongoDB.html
  6. +4 −0 dist/doc/html/snaplet-mongodb-minimalistic/doc-index.html
  7. +28 −0 dist/doc/html/snaplet-mongodb-minimalistic/frames.html
  8. +344 −0 dist/doc/html/snaplet-mongodb-minimalistic/haddock-util.js
  9. BIN  dist/doc/html/snaplet-mongodb-minimalistic/hslogo-16.png
  10. +4 −0 dist/doc/html/snaplet-mongodb-minimalistic/index-frames.html
  11. +5 −0 dist/doc/html/snaplet-mongodb-minimalistic/index.html
  12. +4 −0 dist/doc/html/snaplet-mongodb-minimalistic/mini_Snap-Snaplet-MongoDB-Core.html
  13. +4 −0 dist/doc/html/snaplet-mongodb-minimalistic/mini_Snap-Snaplet-MongoDB-Functions-M.html
  14. +4 −0 dist/doc/html/snaplet-mongodb-minimalistic/mini_Snap-Snaplet-MongoDB-Functions-S.html
  15. +4 −0 dist/doc/html/snaplet-mongodb-minimalistic/mini_Snap-Snaplet-MongoDB-Functions.html
  16. +4 −0 dist/doc/html/snaplet-mongodb-minimalistic/mini_Snap-Snaplet-MongoDB.html
  17. BIN  dist/doc/html/snaplet-mongodb-minimalistic/minus.gif
  18. +542 −0 dist/doc/html/snaplet-mongodb-minimalistic/ocean.css
  19. BIN  dist/doc/html/snaplet-mongodb-minimalistic/plus.gif
  20. BIN  dist/doc/html/snaplet-mongodb-minimalistic/snaplet-mongodb-minimalistic.haddock
  21. BIN  dist/doc/html/snaplet-mongodb-minimalistic/synopsis.png
  22. +19 −18 src/Snap/Snaplet/MongoDB/Core.hs
  23. +7 −6 src/Snap/Snaplet/MongoDB/Functions/M.hs
  24. +28 −6 src/Snap/Snaplet/MongoDB/Functions/S.hs
View
25 dist/doc/html/snaplet-mongodb-minimalistic/Snap-Snaplet-MongoDB-Core.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Snap.Snaplet.MongoDB.Core</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();setSynopsis("mini_Snap-Snaplet-MongoDB-Core.html");};
+//]]>
+</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet.</p></div><div id="content"><div id="module-header"><p class="caption">Snap.Snaplet.MongoDB.Core</p></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:MongoDB">MongoDB</a> = <a href="#v:MongoDB">MongoDB</a> {<ul class="subs"><li><a href="#v:mongoPool">mongoPool</a> :: Pool <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO-Error.html#t:IOError">IOError</a> Pipe</li><li><a href="#v:mongoDatabase">mongoDatabase</a> :: Database</li></ul>}</li><li class="src short"><span class="keyword">class</span> <a href="#t:HasMongoDB">HasMongoDB</a> app <span class="keyword">where</span><ul class="subs"><li><a href="#v:getMongoDB">getMongoDB</a> :: app -&gt; <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">MongoDB</a></li></ul></li><li class="src short"><a href="#v:mongoDBInit">mongoDBInit</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Int.html#t:Int">Int</a> -&gt; Host -&gt; Database -&gt; SnapletInit app <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">MongoDB</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:MongoDB" class="def">MongoDB</a> </p><div class="doc"><p>Snaplet's data type.
+</p><p>Example:
+</p><pre> data App = App
+ { _heist :: Snaplet (Heist App)
+ , _database :: Snaplet MongoDB
+ }
+</pre></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:MongoDB" class="def">MongoDB</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:mongoPool" class="def">mongoPool</a> :: Pool <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO-Error.html#t:IOError">IOError</a> Pipe</dt><dd class="doc empty">&nbsp;</dd><dt class="src"><a name="v:mongoDatabase" class="def">mongoDatabase</a> :: Database</dt><dd class="doc empty">&nbsp;</dd></dl><div class="clear"></div></div></td></tr></table></div></div><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:HasMongoDB" class="def">HasMongoDB</a> app <span class="keyword">where</span></p><div class="doc"><p>Snaplet's type-class.
+</p><p>Example:
+</p><pre> instance HasMongoDB App where
+ getMongoDB = getL (snapletValue . database)
+</pre><p>Note: The <code>(.)</code> is from <code>Control.Category</code>.
+</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:getMongoDB" class="def">getMongoDB</a> :: app -&gt; <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">MongoDB</a></p></div></div><div class="top"><p class="src"><a name="v:mongoDBInit" class="def">mongoDBInit</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Int.html#t:Int">Int</a> -&gt; Host -&gt; Database -&gt; SnapletInit app <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">MongoDB</a></p><div class="doc"><p>Initializer function.
+</p><ol><li> argument: Maximum pool size.
+</li><li> argument: Host (e.g. return value of MongoDB's host function).
+</li><li> argument: Database name.
+</li></ol><p>Example:
+</p><pre> app :: SnapletInit App App
+ app = makeSnaplet &quot;app&quot; &quot;Example application.&quot; Nothing $ do
+ h &lt;- nestSnaplet &quot;heist&quot; heist $ heistInit &quot;resources/templates&quot;
+ d &lt;- nestSnaplet &quot;database&quot; database $ mongoDBInit 10 (host &quot;127.0.0.1&quot;) &quot;Snaplet-MongoDB&quot;
+ return $ App h d
+</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.4</p></div></body></html>
View
4 dist/doc/html/snaplet-mongodb-minimalistic/Snap-Snaplet-MongoDB-Functions-M.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Snap.Snaplet.MongoDB.Functions.M</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();setSynopsis("mini_Snap-Snaplet-MongoDB-Functions-M.html");};
+//]]>
+</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet.</p></div><div id="content"><div id="module-header"><p class="caption">Snap.Snaplet.MongoDB.Functions.M</p></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:eitherWithDB-39-" class="def">eitherWithDB'</a> :: MonadState' app m =&gt; Lens app (Snaplet <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">MongoDB</a>) -&gt; AccessMode -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Either.html#t:Either">Either</a> Failure a)</p></div><div class="top"><p class="src"><a name="v:eitherWithDB" class="def">eitherWithDB</a> :: MonadState' app m =&gt; Lens app (Snaplet <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">MongoDB</a>) -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Either.html#t:Either">Either</a> Failure a)</p></div><div class="top"><p class="src"><a name="v:maybeWithDB" class="def">maybeWithDB</a> :: MonadState' app m =&gt; Lens app (Snaplet <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">MongoDB</a>) -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</p></div><div class="top"><p class="src"><a name="v:maybeWithDB-39-" class="def">maybeWithDB'</a> :: MonadState' app m =&gt; Lens app (Snaplet <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">MongoDB</a>) -&gt; AccessMode -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</p></div><div class="top"><p class="src"><a name="v:unsafeWithDB" class="def">unsafeWithDB</a> :: MonadState' app m =&gt; Lens app (Snaplet <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">MongoDB</a>) -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m a</p></div><div class="top"><p class="src"><a name="v:unsafeWithDB-39-" class="def">unsafeWithDB'</a> :: MonadState' app m =&gt; Lens app (Snaplet <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">MongoDB</a>) -&gt; AccessMode -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m a</p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.4</p></div></body></html>
View
37 dist/doc/html/snaplet-mongodb-minimalistic/Snap-Snaplet-MongoDB-Functions-S.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Snap.Snaplet.MongoDB.Functions.S</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();setSynopsis("mini_Snap-Snaplet-MongoDB-Functions-S.html");};
+//]]>
+</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet.</p></div><div id="content"><div id="module-header"><p class="caption">Snap.Snaplet.MongoDB.Functions.S</p></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:eitherWithDB-39-">eitherWithDB'</a> :: HasMongoDB' app m =&gt; AccessMode -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Either.html#t:Either">Either</a> Failure a)</li><li class="src short"><a href="#v:eitherWithDB">eitherWithDB</a> :: HasMongoDB' app m =&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Either.html#t:Either">Either</a> Failure a)</li><li class="src short"><a href="#v:maybeWithDB">maybeWithDB</a> :: HasMongoDB' app m =&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:maybeWithDB-39-">maybeWithDB'</a> :: HasMongoDB' app m =&gt; AccessMode -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:unsafeWithDB">unsafeWithDB</a> :: HasMongoDB' app m =&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m a</li><li class="src short"><a href="#v:unsafeWithDB-39-">unsafeWithDB'</a> :: HasMongoDB' app m =&gt; AccessMode -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m a</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:eitherWithDB-39-" class="def">eitherWithDB'</a> :: HasMongoDB' app m =&gt; AccessMode -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Either.html#t:Either">Either</a> Failure a)</p><div class="doc"><p>Database access function.
+</p><ol><li> argument: AccessMode.
+</li><li> argument: Action to perform.
+</li></ol><p>Returns: Either Failure or the action's result.
+</p><p>Example:
+</p><pre> eitherWithDB' UnconfirmedWrites $ insert &quot;test-collection&quot; [&quot;some_field&quot; = &quot;something&quot; ]
+</pre></div></div><div class="top"><p class="src"><a name="v:eitherWithDB" class="def">eitherWithDB</a> :: HasMongoDB' app m =&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Either.html#t:Either">Either</a> Failure a)</p><div class="doc"><p>Database access function.
+</p><ol><li> argument: Action to perform. (Defaults to UnconfirmedWrites AccessMode)
+</li></ol><p>Returns: Either Failure or the action's result.
+</p><p>Example:
+</p><pre> eitherWithDB $ insert &quot;test-collection&quot; [&quot;some_field&quot; = &quot;something&quot; ]
+</pre></div></div><div class="top"><p class="src"><a name="v:maybeWithDB" class="def">maybeWithDB</a> :: HasMongoDB' app m =&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</p><div class="doc"><p>Database access function.
+</p><ol><li> argument: Action to perform. (Defaults to UnconfirmedWrites AccessMode)
+</li></ol><p>Returns: Nothing in case of failure or Just the rsult of the action.
+</p><p>Example:
+</p><pre> maybeWithDB $ insert &quot;test-collection&quot; [&quot;some_field&quot; = &quot;something&quot; ]
+</pre></div></div><div class="top"><p class="src"><a name="v:maybeWithDB-39-" class="def">maybeWithDB'</a> :: HasMongoDB' app m =&gt; AccessMode -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m (<a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</p><div class="doc"><p>Database access function.
+</p><ol><li> argument: AccessMode.
+</li><li> argument: Action to perform.
+</li></ol><p>Returns: Nothing in case of failure or Just the rsult of the action.
+</p><p>Example:
+</p><pre> maybeWithDB' UnconfirmedWrites $ insert &quot;test-collection&quot; [&quot;some_field&quot; = &quot;something&quot; ]
+</pre></div></div><div class="top"><p class="src"><a name="v:unsafeWithDB" class="def">unsafeWithDB</a> :: HasMongoDB' app m =&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m a</p><div class="doc"><p>Database access function.
+</p><ol><li> argument: Action to perform. (Defaults to UnconfirmedWrites AccessMode)
+</li></ol><p>Returns: The action's result; in case of failure error is called.
+</p><p>Example:
+</p><pre> unsafeWithDB $ insert &quot;test-collection&quot; [&quot;some_field&quot; = &quot;something&quot; ]
+</pre></div></div><div class="top"><p class="src"><a name="v:unsafeWithDB-39-" class="def">unsafeWithDB'</a> :: HasMongoDB' app m =&gt; AccessMode -&gt; Action <a href="/usr/share/doc/ghc/html/libraries/base-4.4.1.0/System-IO.html#t:IO">IO</a> a -&gt; m a</p><div class="doc"><p>Database access function.
+</p><ol><li> argument: AccessMode.
+</li><li> argument: Action to perform.
+</li></ol><p>Returns: The action's result; in case of failure error is called.
+</p><p>Example:
+</p><pre> unsafeWithDB' UnconfirmedWrites $ insert &quot;test-collection&quot; [&quot;some_field&quot; = &quot;something&quot; ]
+</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.4</p></div></body></html>
View
4 dist/doc/html/snaplet-mongodb-minimalistic/Snap-Snaplet-MongoDB-Functions.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Snap.Snaplet.MongoDB.Functions</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();setSynopsis("mini_Snap-Snaplet-MongoDB-Functions.html");};
+//]]>
+</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet.</p></div><div id="content"><div id="module-header"><p class="caption">Snap.Snaplet.MongoDB.Functions</p></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src">module <a href="Snap-Snaplet-MongoDB-Functions-S.html">Snap.Snaplet.MongoDB.Functions.S</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.4</p></div></body></html>
View
4 dist/doc/html/snaplet-mongodb-minimalistic/Snap-Snaplet-MongoDB.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Snap.Snaplet.MongoDB</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();setSynopsis("mini_Snap-Snaplet-MongoDB.html");};
+//]]>
+</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet.</p></div><div id="content"><div id="module-header"><p class="caption">Snap.Snaplet.MongoDB</p></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src">module <a href="Snap-Snaplet-MongoDB-Core.html">Snap.Snaplet.MongoDB.Core</a></p></div><div class="top"><p class="src">module <a href="Snap-Snaplet-MongoDB-Functions.html">Snap.Snaplet.MongoDB.Functions</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.4</p></div></body></html>
View
4 dist/doc/html/snaplet-mongodb-minimalistic/doc-index.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet. (Index)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();};
+//]]>
+</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet.</p></div><div id="content"><div id="index"><p class="caption">Index</p><table><tr><td class="src">eitherWithDB</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:eitherWithDB">Snap.Snaplet.MongoDB.Functions.S</a>, Snap.Snaplet.MongoDB.Functions, Snap.Snaplet.MongoDB</td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:eitherWithDB">Snap.Snaplet.MongoDB.Functions.M</a></td></tr><tr><td class="src">eitherWithDB'</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:eitherWithDB-39-">Snap.Snaplet.MongoDB.Functions.S</a>, Snap.Snaplet.MongoDB.Functions, Snap.Snaplet.MongoDB</td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:eitherWithDB-39-">Snap.Snaplet.MongoDB.Functions.M</a></td></tr><tr><td class="src">getMongoDB</td><td class="module"><a href="Snap-Snaplet-MongoDB-Core.html#v:getMongoDB">Snap.Snaplet.MongoDB.Core</a>, Snap.Snaplet.MongoDB</td></tr><tr><td class="src">HasMongoDB</td><td class="module"><a href="Snap-Snaplet-MongoDB-Core.html#t:HasMongoDB">Snap.Snaplet.MongoDB.Core</a>, Snap.Snaplet.MongoDB</td></tr><tr><td class="src">maybeWithDB</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:maybeWithDB">Snap.Snaplet.MongoDB.Functions.S</a>, Snap.Snaplet.MongoDB.Functions, Snap.Snaplet.MongoDB</td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:maybeWithDB">Snap.Snaplet.MongoDB.Functions.M</a></td></tr><tr><td class="src">maybeWithDB'</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:maybeWithDB-39-">Snap.Snaplet.MongoDB.Functions.S</a>, Snap.Snaplet.MongoDB.Functions, Snap.Snaplet.MongoDB</td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:maybeWithDB-39-">Snap.Snaplet.MongoDB.Functions.M</a></td></tr><tr><td class="src">mongoDatabase</td><td class="module"><a href="Snap-Snaplet-MongoDB-Core.html#v:mongoDatabase">Snap.Snaplet.MongoDB.Core</a>, Snap.Snaplet.MongoDB</td></tr><tr><td class="src">MongoDB</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB">Snap.Snaplet.MongoDB.Core</a>, Snap.Snaplet.MongoDB</td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Core.html#v:MongoDB">Snap.Snaplet.MongoDB.Core</a>, Snap.Snaplet.MongoDB</td></tr><tr><td class="src">mongoDBInit</td><td class="module"><a href="Snap-Snaplet-MongoDB-Core.html#v:mongoDBInit">Snap.Snaplet.MongoDB.Core</a>, Snap.Snaplet.MongoDB</td></tr><tr><td class="src">mongoPool</td><td class="module"><a href="Snap-Snaplet-MongoDB-Core.html#v:mongoPool">Snap.Snaplet.MongoDB.Core</a>, Snap.Snaplet.MongoDB</td></tr><tr><td class="src">unsafeWithDB</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:unsafeWithDB">Snap.Snaplet.MongoDB.Functions.S</a>, Snap.Snaplet.MongoDB.Functions, Snap.Snaplet.MongoDB</td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:unsafeWithDB">Snap.Snaplet.MongoDB.Functions.M</a></td></tr><tr><td class="src">unsafeWithDB'</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:unsafeWithDB-39-">Snap.Snaplet.MongoDB.Functions.S</a>, Snap.Snaplet.MongoDB.Functions, Snap.Snaplet.MongoDB</td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:unsafeWithDB-39-">Snap.Snaplet.MongoDB.Functions.M</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.4</p></div></body></html>
View
28 dist/doc/html/snaplet-mongodb-minimalistic/frames.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script src="haddock-util.js" type="text/javascript"></script>
+<script type="text/javascript"><!--
+/*
+
+ The synopsis frame needs to be updated using javascript, so we hide
+ it by default and only show it if javascript is enabled.
+
+ TODO: provide some means to disable it.
+*/
+function load() {
+ var d = document.getElementById("inner-fs");
+ d.rows = "50%,50%";
+ postReframe();
+}
+--></script>
+<frameset id="outer-fs" cols="25%,75%" onload="load()">
+ <frameset id="inner-fs" rows="100%,0%">
+ <frame src="index-frames.html" name="modules">
+ <frame src="" name="synopsis">
+ </frameset>
+ <frame src="index.html" name="main">
+</frameset>
+</html>
View
344 dist/doc/html/snaplet-mongodb-minimalistic/haddock-util.js
@@ -0,0 +1,344 @@
+// Haddock JavaScript utilities
+
+var rspace = /\s\s+/g,
+ rtrim = /^\s+|\s+$/g;
+
+function spaced(s) { return (" " + s + " ").replace(rspace, " "); }
+function trim(s) { return s.replace(rtrim, ""); }
+
+function hasClass(elem, value) {
+ var className = spaced(elem.className || "");
+ return className.indexOf( " " + value + " " ) >= 0;
+}
+
+function addClass(elem, value) {
+ var className = spaced(elem.className || "");
+ if ( className.indexOf( " " + value + " " ) < 0 ) {
+ elem.className = trim(className + " " + value);
+ }
+}
+
+function removeClass(elem, value) {
+ var className = spaced(elem.className || "");
+ className = className.replace(" " + value + " ", " ");
+ elem.className = trim(className);
+}
+
+function toggleClass(elem, valueOn, valueOff, bool) {
+ if (bool == null) { bool = ! hasClass(elem, valueOn); }
+ if (bool) {
+ removeClass(elem, valueOff);
+ addClass(elem, valueOn);
+ }
+ else {
+ removeClass(elem, valueOn);
+ addClass(elem, valueOff);
+ }
+ return bool;
+}
+
+
+function makeClassToggle(valueOn, valueOff)
+{
+ return function(elem, bool) {
+ return toggleClass(elem, valueOn, valueOff, bool);
+ }
+}
+
+toggleShow = makeClassToggle("show", "hide");
+toggleCollapser = makeClassToggle("collapser", "expander");
+
+function toggleSection(id)
+{
+ var b = toggleShow(document.getElementById("section." + id));
+ toggleCollapser(document.getElementById("control." + id), b);
+ rememberCollapsed(id, b);
+ return b;
+}
+
+var collapsed = {};
+function rememberCollapsed(id, b)
+{
+ if(b)
+ delete collapsed[id]
+ else
+ collapsed[id] = null;
+
+ var sections = [];
+ for(var i in collapsed)
+ {
+ if(collapsed.hasOwnProperty(i))
+ sections.push(i);
+ }
+ // cookie specific to this page; don't use setCookie which sets path=/
+ document.cookie = "collapsed=" + escape(sections.join('+'));
+}
+
+function restoreCollapsed()
+{
+ var cookie = getCookie("collapsed");
+ if(!cookie)
+ return;
+
+ var ids = cookie.split('+');
+ for(var i in ids)
+ {
+ if(document.getElementById("section." + ids[i]))
+ toggleSection(ids[i]);
+ }
+}
+
+function setCookie(name, value) {
+ document.cookie = name + "=" + escape(value) + ";path=/;";
+}
+
+function clearCookie(name) {
+ document.cookie = name + "=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT;";
+}
+
+function getCookie(name) {
+ var nameEQ = name + "=";
+ var ca = document.cookie.split(';');
+ for(var i=0;i < ca.length;i++) {
+ var c = ca[i];
+ while (c.charAt(0)==' ') c = c.substring(1,c.length);
+ if (c.indexOf(nameEQ) == 0) {
+ return unescape(c.substring(nameEQ.length,c.length));
+ }
+ }
+ return null;
+}
+
+
+
+var max_results = 75; // 50 is not enough to search for map in the base libraries
+var shown_range = null;
+var last_search = null;
+
+function quick_search()
+{
+ perform_search(false);
+}
+
+function full_search()
+{
+ perform_search(true);
+}
+
+
+function perform_search(full)
+{
+ var text = document.getElementById("searchbox").value.toLowerCase();
+ if (text == last_search && !full) return;
+ last_search = text;
+
+ var table = document.getElementById("indexlist");
+ var status = document.getElementById("searchmsg");
+ var children = table.firstChild.childNodes;
+
+ // first figure out the first node with the prefix
+ var first = bisect(-1);
+ var last = (first == -1 ? -1 : bisect(1));
+
+ if (first == -1)
+ {
+ table.className = "";
+ status.innerHTML = "No results found, displaying all";
+ }
+ else if (first == 0 && last == children.length - 1)
+ {
+ table.className = "";
+ status.innerHTML = "";
+ }
+ else if (last - first >= max_results && !full)
+ {
+ table.className = "";
+ status.innerHTML = "More than " + max_results + ", press Search to display";
+ }
+ else
+ {
+ // decide what you need to clear/show
+ if (shown_range)
+ setclass(shown_range[0], shown_range[1], "indexrow");
+ setclass(first, last, "indexshow");
+ shown_range = [first, last];
+ table.className = "indexsearch";
+ status.innerHTML = "";
+ }
+
+
+ function setclass(first, last, status)
+ {
+ for (var i = first; i <= last; i++)
+ {
+ children[i].className = status;
+ }
+ }
+
+
+ // do a binary search, treating 0 as ...
+ // return either -1 (no 0's found) or location of most far match
+ function bisect(dir)
+ {
+ var first = 0, finish = children.length - 1;
+ var mid, success = false;
+
+ while (finish - first > 3)
+ {
+ mid = Math.floor((finish + first) / 2);
+
+ var i = checkitem(mid);
+ if (i == 0) i = dir;
+ if (i == -1)
+ finish = mid;
+ else
+ first = mid;
+ }
+ var a = (dir == 1 ? first : finish);
+ var b = (dir == 1 ? finish : first);
+ for (var i = b; i != a - dir; i -= dir)
+ {
+ if (checkitem(i) == 0) return i;
+ }
+ return -1;
+ }
+
+
+ // from an index, decide what the result is
+ // 0 = match, -1 is lower, 1 is higher
+ function checkitem(i)
+ {
+ var s = getitem(i).toLowerCase().substr(0, text.length);
+ if (s == text) return 0;
+ else return (s > text ? -1 : 1);
+ }
+
+
+ // from an index, get its string
+ // this abstracts over alternates
+ function getitem(i)
+ {
+ for ( ; i >= 0; i--)
+ {
+ var s = children[i].firstChild.firstChild.data;
+ if (s.indexOf(' ') == -1)
+ return s;
+ }
+ return ""; // should never be reached
+ }
+}
+
+function setSynopsis(filename) {
+ if (parent.window.synopsis) {
+ if (parent.window.synopsis.location.replace) {
+ // In Firefox this avoids adding the change to the history.
+ parent.window.synopsis.location.replace(filename);
+ } else {
+ parent.window.synopsis.location = filename;
+ }
+ }
+}
+
+function addMenuItem(html) {
+ var menu = document.getElementById("page-menu");
+ if (menu) {
+ var btn = menu.firstChild.cloneNode(false);
+ btn.innerHTML = html;
+ menu.appendChild(btn);
+ }
+}
+
+function adjustForFrames() {
+ var bodyCls;
+
+ if (parent.location.href == window.location.href) {
+ // not in frames, so add Frames button
+ addMenuItem("<a href='#' onclick='reframe();return true;'>Frames</a>");
+ bodyCls = "no-frame";
+ }
+ else {
+ bodyCls = "in-frame";
+ }
+ addClass(document.body, bodyCls);
+}
+
+function reframe() {
+ setCookie("haddock-reframe", document.URL);
+ window.location = "frames.html";
+}
+
+function postReframe() {
+ var s = getCookie("haddock-reframe");
+ if (s) {
+ parent.window.main.location = s;
+ clearCookie("haddock-reframe");
+ }
+}
+
+function styles() {
+ var i, a, es = document.getElementsByTagName("link"), rs = [];
+ for (i = 0; a = es[i]; i++) {
+ if(a.rel.indexOf("style") != -1 && a.title) {
+ rs.push(a);
+ }
+ }
+ return rs;
+}
+
+function addStyleMenu() {
+ var as = styles();
+ var i, a, btns = "";
+ for(i=0; a = as[i]; i++) {
+ btns += "<li><a href='#' onclick=\"setActiveStyleSheet('"
+ + a.title + "'); return false;\">"
+ + a.title + "</a></li>"
+ }
+ if (as.length > 1) {
+ var h = "<div id='style-menu-holder'>"
+ + "<a href='#' onclick='styleMenu(); return false;'>Style &#9662;</a>"
+ + "<ul id='style-menu' class='hide'>" + btns + "</ul>"
+ + "</div>";
+ addMenuItem(h);
+ }
+}
+
+function setActiveStyleSheet(title) {
+ var as = styles();
+ var i, a, found;
+ for(i=0; a = as[i]; i++) {
+ a.disabled = true;
+ // need to do this always, some browsers are edge triggered
+ if(a.title == title) {
+ found = a;
+ }
+ }
+ if (found) {
+ found.disabled = false;
+ setCookie("haddock-style", title);
+ }
+ else {
+ as[0].disabled = false;
+ clearCookie("haddock-style");
+ }
+ styleMenu(false);
+}
+
+function resetStyle() {
+ var s = getCookie("haddock-style");
+ if (s) setActiveStyleSheet(s);
+}
+
+
+function styleMenu(show) {
+ var m = document.getElementById('style-menu');
+ if (m) toggleShow(m, show);
+}
+
+
+function pageLoad() {
+ addStyleMenu();
+ adjustForFrames();
+ resetStyle();
+ restoreCollapsed();
+}
+
View
BIN  dist/doc/html/snaplet-mongodb-minimalistic/hslogo-16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 dist/doc/html/snaplet-mongodb-minimalistic/index-frames.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet.</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();};
+//]]>
+</script></head><body id="mini"><div id="module-list"><p class="caption">Modules</p><ul><li class="module"><a href="Snap-Snaplet-MongoDB.html" target="main">Snap.Snaplet.MongoDB</a></li><li class="module"><a href="Snap-Snaplet-MongoDB-Core.html" target="main">Snap.Snaplet.MongoDB.Core</a></li><li class="module"><a href="Snap-Snaplet-MongoDB-Functions.html" target="main">Snap.Snaplet.MongoDB.Functions</a></li><li class="module"><a href="Snap-Snaplet-MongoDB-Functions-M.html" target="main">Snap.Snaplet.MongoDB.Functions.M</a></li><li class="module"><a href="Snap-Snaplet-MongoDB-Functions-S.html" target="main">Snap.Snaplet.MongoDB.Functions.S</a></li></ul></div></body></html>
View
5 dist/doc/html/snaplet-mongodb-minimalistic/index.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet.</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();};
+//]]>
+</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet.</p></div><div id="content"><div id="description"><h1>snaplet-mongodb-minimalistic-0.0.4: Minimalistic MongoDB Snaplet.</h1><div class="doc"><p>Minimalistic MongoDB Snaplet.
+</p></div></div><div id="module-list"><p class="caption">Modules</p><ul><li><span id="control.n.1" class="module collapser" onclick="toggleSection('n.1')">Snap</span><ul id="section.n.1" class="show"><li><span id="control.n.1.1" class="module collapser" onclick="toggleSection('n.1.1')">Snaplet</span><ul id="section.n.1.1" class="show"><li><span class="module"><span id="control.n.1.1.1" class="collapser" onclick="toggleSection('n.1.1.1')">&nbsp;</span><a href="Snap-Snaplet-MongoDB.html">Snap.Snaplet.MongoDB</a></span><ul id="section.n.1.1.1" class="show"><li><span class="module"><a href="Snap-Snaplet-MongoDB-Core.html">Snap.Snaplet.MongoDB.Core</a></span></li><li><span class="module"><span id="control.n.1.1.1.2" class="collapser" onclick="toggleSection('n.1.1.1.2')">&nbsp;</span><a href="Snap-Snaplet-MongoDB-Functions.html">Snap.Snaplet.MongoDB.Functions</a></span><ul id="section.n.1.1.1.2" class="show"><li><span class="module"><a href="Snap-Snaplet-MongoDB-Functions-M.html">Snap.Snaplet.MongoDB.Functions.M</a></span></li><li><span class="module"><a href="Snap-Snaplet-MongoDB-Functions-S.html">Snap.Snaplet.MongoDB.Functions.S</a></span></li></ul></li></ul></li></ul></li></ul></li></ul></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.4</p></div></body></html>
View
4 dist/doc/html/snaplet-mongodb-minimalistic/mini_Snap-Snaplet-MongoDB-Core.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Snap.Snaplet.MongoDB.Core</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();};
+//]]>
+</script></head><body id="mini"><div id="module-header"><p class="caption">Snap.Snaplet.MongoDB.Core</p></div><div id="interface"><div class="top"><p class="src"><span class="keyword">data</span> <a href="Snap-Snaplet-MongoDB-Core.html#t:MongoDB" target="main">MongoDB</a> </p></div><div class="top"><p class="src"><span class="keyword">class</span> <a href="Snap-Snaplet-MongoDB-Core.html#t:HasMongoDB" target="main">HasMongoDB</a> app</p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Core.html#v:mongoDBInit" target="main">mongoDBInit</a></p></div></div></body></html>
View
4 dist/doc/html/snaplet-mongodb-minimalistic/mini_Snap-Snaplet-MongoDB-Functions-M.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Snap.Snaplet.MongoDB.Functions.M</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();};
+//]]>
+</script></head><body id="mini"><div id="module-header"><p class="caption">Snap.Snaplet.MongoDB.Functions.M</p></div><div id="interface"><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:eitherWithDB-39-" target="main">eitherWithDB'</a></p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:eitherWithDB" target="main">eitherWithDB</a></p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:maybeWithDB" target="main">maybeWithDB</a></p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:maybeWithDB-39-" target="main">maybeWithDB'</a></p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:unsafeWithDB" target="main">unsafeWithDB</a></p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-M.html#v:unsafeWithDB-39-" target="main">unsafeWithDB'</a></p></div></div></body></html>
View
4 dist/doc/html/snaplet-mongodb-minimalistic/mini_Snap-Snaplet-MongoDB-Functions-S.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Snap.Snaplet.MongoDB.Functions.S</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();};
+//]]>
+</script></head><body id="mini"><div id="module-header"><p class="caption">Snap.Snaplet.MongoDB.Functions.S</p></div><div id="interface"><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:eitherWithDB-39-" target="main">eitherWithDB'</a></p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:eitherWithDB" target="main">eitherWithDB</a></p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:maybeWithDB" target="main">maybeWithDB</a></p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:maybeWithDB-39-" target="main">maybeWithDB'</a></p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:unsafeWithDB" target="main">unsafeWithDB</a></p></div><div class="top"><p class="src"><a href="Snap-Snaplet-MongoDB-Functions-S.html#v:unsafeWithDB-39-" target="main">unsafeWithDB'</a></p></div></div></body></html>
View
4 dist/doc/html/snaplet-mongodb-minimalistic/mini_Snap-Snaplet-MongoDB-Functions.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Snap.Snaplet.MongoDB.Functions</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();};
+//]]>
+</script></head><body id="mini"><div id="module-header"><p class="caption">Snap.Snaplet.MongoDB.Functions</p></div><div id="interface"></div></body></html>
View
4 dist/doc/html/snaplet-mongodb-minimalistic/mini_Snap-Snaplet-MongoDB.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Snap.Snaplet.MongoDB</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
+window.onload = function () {pageLoad();};
+//]]>
+</script></head><body id="mini"><div id="module-header"><p class="caption">Snap.Snaplet.MongoDB</p></div><div id="interface"></div></body></html>
View
BIN  dist/doc/html/snaplet-mongodb-minimalistic/minus.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
542 dist/doc/html/snaplet-mongodb-minimalistic/ocean.css
@@ -0,0 +1,542 @@
+/* @group Fundamentals */
+
+* { margin: 0; padding: 0 }
+
+/* Is this portable? */
+html {
+ background-color: white;
+ width: 100%;
+ height: 100%;
+}
+
+body {
+ background: white;
+ color: black;
+ text-align: left;
+ min-height: 100%;
+ position: relative;
+}
+
+p {
+ margin: 0.8em 0;
+}
+
+ul, ol {
+ margin: 0.8em 0 0.8em 2em;
+}
+
+dl {
+ margin: 0.8em 0;
+}
+
+dt {
+ font-weight: bold;
+}
+dd {
+ margin-left: 2em;
+}
+
+a { text-decoration: none; }
+a[href]:link { color: rgb(196,69,29); }
+a[href]:visited { color: rgb(171,105,84); }
+a[href]:hover { text-decoration:underline; }
+
+/* @end */
+
+/* @group Fonts & Sizes */
+
+/* Basic technique & IE workarounds from YUI 3
+ For reasons, see:
+ http://yui.yahooapis.com/3.1.1/build/cssfonts/fonts.css
+ */
+
+body {
+ font:13px/1.4 sans-serif;
+ *font-size:small; /* for IE */
+ *font:x-small; /* for IE in quirks mode */
+}
+
+h1 { font-size: 146.5%; /* 19pt */ }
+h2 { font-size: 131%; /* 17pt */ }
+h3 { font-size: 116%; /* 15pt */ }
+h4 { font-size: 100%; /* 13pt */ }
+h5 { font-size: 100%; /* 13pt */ }
+
+select, input, button, textarea {
+ font:99% sans-serif;
+}
+
+table {
+ font-size:inherit;
+ font:100%;
+}
+
+pre, code, kbd, samp, tt, .src {
+ font-family:monospace;
+ *font-size:108%;
+ line-height: 124%;
+}
+
+.links, .link {
+ font-size: 85%; /* 11pt */
+}
+
+#module-header .caption {
+ font-size: 182%; /* 24pt */
+}
+
+.info {
+ font-size: 85%; /* 11pt */
+}
+
+#table-of-contents, #synopsis {
+ /* font-size: 85%; /* 11pt */
+}
+
+
+/* @end */
+
+/* @group Common */
+
+.caption, h1, h2, h3, h4, h5, h6 {
+ font-weight: bold;
+ color: rgb(78,98,114);
+ margin: 0.8em 0 0.4em;
+}
+
+* + h1, * + h2, * + h3, * + h4, * + h5, * + h6 {
+ margin-top: 2em;
+}
+
+h1 + h2, h2 + h3, h3 + h4, h4 + h5, h5 + h6 {
+ margin-top: inherit;
+}
+
+ul.links {
+ list-style: none;
+ text-align: left;
+ float: right;
+ display: inline-table;
+ margin: 0 0 0 1em;
+}
+
+ul.links li {
+ display: inline;
+ border-left: 1px solid #d5d5d5;
+ white-space: nowrap;
+ padding: 0;
+}
+
+ul.links li a {
+ padding: 0.2em 0.5em;
+}
+
+.hide { display: none; }
+.show { display: inherit; }
+.clear { clear: both; }
+
+.collapser {
+ background-image: url(minus.gif);
+ background-repeat: no-repeat;
+}
+.expander {
+ background-image: url(plus.gif);
+ background-repeat: no-repeat;
+}
+p.caption.collapser,
+p.caption.expander {
+ background-position: 0 0.4em;
+}
+.collapser, .expander {
+ padding-left: 14px;
+ margin-left: -14px;
+ cursor: pointer;
+}
+
+pre {
+ padding: 0.25em;
+ margin: 0.8em 0;
+ background: rgb(229,237,244);
+ overflow: auto;
+ border-bottom: 0.25em solid white;
+ /* white border adds some space below the box to compensate
+ for visual extra space that paragraphs have between baseline
+ and the bounding box */
+}
+
+.src {
+ background: #f0f0f0;
+ padding: 0.2em 0.5em;
+}
+
+.keyword { font-weight: normal; }
+.def { font-weight: bold; }
+
+
+/* @end */
+
+/* @group Page Structure */
+
+#content {
+ margin: 0 auto;
+ padding: 0 2em 6em;
+}
+
+#package-header {
+ background: rgb(41,56,69);
+ border-top: 5px solid rgb(78,98,114);
+ color: #ddd;
+ padding: 0.2em;
+ position: relative;
+ text-align: left;
+}
+
+#package-header .caption {
+ background: url(hslogo-16.png) no-repeat 0em;
+ color: white;
+ margin: 0 2em;
+ font-weight: normal;
+ font-style: normal;
+ padding-left: 2em;
+}
+
+#package-header a:link, #package-header a:visited { color: white; }
+#package-header a:hover { background: rgb(78,98,114); }
+
+#module-header .caption {
+ color: rgb(78,98,114);
+ font-weight: bold;
+ border-bottom: 1px solid #ddd;
+}
+
+table.info {
+ float: right;
+ padding: 0.5em 1em;
+ border: 1px solid #ddd;
+ color: rgb(78,98,114);
+ background-color: #fff;
+ max-width: 40%;
+ border-spacing: 0;
+ position: relative;
+ top: -0.5em;
+ margin: 0 0 0 2em;
+}
+
+.info th {
+ padding: 0 1em 0 0;
+}
+
+div#style-menu-holder {
+ position: relative;
+ z-index: 2;
+ display: inline;
+}
+
+#style-menu {
+ position: absolute;
+ z-index: 1;
+ overflow: visible;
+ background: #374c5e;
+ margin: 0;
+ text-align: center;
+ right: 0;
+ padding: 0;
+ top: 1.25em;
+}
+
+#style-menu li {
+ display: list-item;
+ border-style: none;
+ margin: 0;
+ padding: 0;
+ color: #000;
+ list-style-type: none;
+}
+
+#style-menu li + li {
+ border-top: 1px solid #919191;
+}
+
+#style-menu a {
+ width: 6em;
+ padding: 3px;
+ display: block;
+}
+
+#footer {
+ background: #ddd;
+ border-top: 1px solid #aaa;
+ padding: 0.5em 0;
+ color: #666;
+ text-align: center;
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+ height: 3em;
+}
+
+/* @end */
+
+/* @group Front Matter */
+
+#table-of-contents {
+ float: right;
+ clear: right;
+ background: #faf9dc;
+ border: 1px solid #d8d7ad;
+ padding: 0.5em 1em;
+ max-width: 20em;
+ margin: 0.5em 0 1em 1em;
+}
+
+#table-of-contents .caption {
+ text-align: center;
+ margin: 0;
+}
+
+#table-of-contents ul {
+ list-style: none;
+ margin: 0;
+}
+
+#table-of-contents ul ul {
+ margin-left: 2em;
+}
+
+#description .caption {
+ display: none;
+}
+
+#synopsis {
+ display: none;
+}
+
+.no-frame #synopsis {
+ display: block;
+ position: fixed;
+ right: 0;
+ height: 80%;
+ top: 10%;
+ padding: 0;
+}
+
+#synopsis .caption {
+ float: left;
+ width: 29px;
+ color: rgba(255,255,255,0);
+ height: 110px;
+ margin: 0;
+ font-size: 1px;
+ padding: 0;
+}
+
+#synopsis p.caption.collapser {
+ background: url(synopsis.png) no-repeat -64px -8px;
+}
+
+#synopsis p.caption.expander {
+ background: url(synopsis.png) no-repeat 0px -8px;
+}
+
+#synopsis ul {
+ height: 100%;
+ overflow: auto;
+ padding: 0.5em;
+ margin: 0;
+}
+
+#synopsis ul ul {
+ overflow: hidden;
+}
+
+#synopsis ul,
+#synopsis ul li.src {
+ background-color: #faf9dc;
+ white-space: nowrap;
+ list-style: none;
+ margin-left: 0;
+}
+
+/* @end */
+
+/* @group Main Content */
+
+#interface div.top { margin: 2em 0; }
+#interface h1 + div.top,
+#interface h2 + div.top,
+#interface h3 + div.top,
+#interface h4 + div.top,
+#interface h5 + div.top {
+ margin-top: 1em;
+}
+#interface p.src .link {
+ float: right;
+ color: #919191;
+ border-left: 1px solid #919191;
+ background: #f0f0f0;
+ padding: 0 0.5em 0.2em;
+ margin: 0 -0.5em 0 0.5em;
+}
+
+#interface table { border-spacing: 2px; }
+#interface td {
+ vertical-align: top;
+ padding-left: 0.5em;
+}
+#interface td.src {
+ white-space: nowrap;
+}
+#interface td.doc p {
+ margin: 0;
+}
+#interface td.doc p + p {
+ margin-top: 0.8em;
+}
+
+.subs dl {
+ margin: 0;
+}
+
+.subs dt {
+ float: left;
+ clear: left;
+ display: block;
+ margin: 1px 0;
+}
+
+.subs dd {
+ float: right;
+ width: 90%;
+ display: block;
+ padding-left: 0.5em;
+ margin-bottom: 0.5em;
+}
+
+.subs dd.empty {
+ display: none;
+}
+
+.subs dd p {
+ margin: 0;
+}
+
+.top p.src {
+ border-top: 1px solid #ccc;
+}
+
+.subs, .doc {
+ /* use this selector for one level of indent */
+ padding-left: 2em;
+}
+
+.arguments {
+ margin-top: -0.4em;
+}
+.arguments .caption {
+ display: none;
+}
+
+.fields { padding-left: 1em; }
+
+.fields .caption { display: none; }
+
+.fields p { margin: 0 0; }
+
+/* this seems bulky to me
+.methods, .constructors {
+ background: #f8f8f8;
+ border: 1px solid #eee;
+}
+*/
+
+/* @end */
+
+/* @group Auxillary Pages */
+
+#mini {
+ margin: 0 auto;
+ padding: 0 1em 1em;
+}
+
+#mini > * {
+ font-size: 93%; /* 12pt */
+}
+
+#mini #module-list .caption,
+#mini #module-header .caption {
+ font-size: 125%; /* 15pt */
+}
+
+#mini #interface h1,
+#mini #interface h2,
+#mini #interface h3,
+#mini #interface h4 {
+ font-size: 109%; /* 13pt */
+ margin: 1em 0 0;
+}
+
+#mini #interface .top,
+#mini #interface .src {
+ margin: 0;
+}
+
+#mini #module-list ul {
+ list-style: none;
+ margin: 0;
+}
+
+#alphabet ul {
+ list-style: none;
+ padding: 0;
+ margin: 0.5em 0 0;
+ text-align: center;
+}
+
+#alphabet li {
+ display: inline;
+ margin: 0 0.25em;
+}
+
+#alphabet a {
+ font-weight: bold;
+}
+
+#index .caption,
+#module-list .caption { font-size: 131%; /* 17pt */ }
+
+#index table {
+ margin-left: 2em;
+}
+
+#index .src {
+ font-weight: bold;
+}
+#index .alt {
+ font-size: 77%; /* 10pt */
+ font-style: italic;
+ padding-left: 2em;
+}
+
+#index td + td {
+ padding-left: 1em;
+}
+
+#module-list ul {
+ list-style: none;
+ margin: 0 0 0 2em;
+}
+
+#module-list li {
+ clear: right;
+}
+
+#module-list span.collapser,
+#module-list span.expander {
+ background-position: 0 0.3em;
+}
+
+#module-list .package {
+ float: right;
+}
+
+/* @end */
View
BIN  dist/doc/html/snaplet-mongodb-minimalistic/plus.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  dist/doc/html/snaplet-mongodb-minimalistic/snaplet-mongodb-minimalistic.haddock
Binary file not shown
View
BIN  dist/doc/html/snaplet-mongodb-minimalistic/synopsis.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
37 src/Snap/Snaplet/MongoDB/Core.hs
@@ -22,12 +22,11 @@ description = "Minimalistic MongoDB Snaplet."
-- | Snaplet's data type.
--
-- Example:
--- @
--- data App = App
--- { _heist :: Snaplet (Heist App)
--- , _database :: Snaplet MongoDB
--- }
--- @
+--
+-- > data App = App
+-- > { _heist :: Snaplet (Heist App)
+-- > , _database :: Snaplet MongoDB
+-- > }
data MongoDB = MongoDB
{ mongoPool :: Pool IOError Pipe
, mongoDatabase :: Database
@@ -37,29 +36,31 @@ data MongoDB = MongoDB
-- | Snaplet's type-class.
--
-- Example:
--- @
--- instance HasMongoDB App where
--- getMongoDB = getL (snapletValue . database)
--- @
--
--- Note: The (.) is from Control.Category.
+--
+-- > instance HasMongoDB App where
+-- > getMongoDB = getL (snapletValue . database)
+--
+-- Note: The @(.)@ is from 'Control.Category'.
class HasMongoDB app where
getMongoDB :: app -> MongoDB
------------------------------------------------------------------------------
-- | Initializer function.
+--
-- 1. argument: Maximum pool size.
+--
-- 2. argument: Host (e.g. return value of MongoDB's host function).
+--
-- 3. argument: Database name.
--
-- Example:
--- @
--- app :: SnapletInit App App
--- app = makeSnaplet "app" "An snaplet example application." Nothing $ do
--- h <- nestSnaplet "heist" heist $ heistInit "resources/templates"
--- d <- nestSnaplet "database" database $ mongoDBInit 10 (host "127.0.0.1") "Snaplet-MongoDB"
--- return $ App h d
--- @
+--
+-- > app :: SnapletInit App App
+-- > app = makeSnaplet "app" "Example application." Nothing $ do
+-- > h <- nestSnaplet "heist" heist $ heistInit "resources/templates"
+-- > d <- nestSnaplet "database" database $ mongoDBInit 10 (host "127.0.0.1") "Snaplet-MongoDB"
+-- > return $ App h d
mongoDBInit :: Int -> Host -> Database -> SnapletInit app MongoDB
mongoDBInit n h d = makeSnaplet "snaplet-mongodb" description Nothing $ do
pool <- liftIO $ newPool (Factory (connect h) close isClosed) n
View
13 src/Snap/Snaplet/MongoDB/Functions/M.hs
@@ -30,12 +30,13 @@ instance (MonadIO m, MonadState app m) => MonadState' app m
------------------------------------------------------------------------------
-- | Database access function.
+--
-- 1. argument: The snaplet (database) on which you want the action to be run.
-- 2. argument: Action to perform. (Defaults to UnconfirmedWrites AccessMode)
-- Returns: The action's result; in case of failure error is called.
--
-- Example:
--- > unsafeWithDB accountDB $ insert "test-collection" ["some_field" = " something" ]
+-- > unsafeWithDB accountDB $ insert "test-collection" ["some_field" = "something" ]
unsafeWithDB :: (MonadState' app m) => Lens app (Snaplet MongoDB) -> Action IO a -> m a
unsafeWithDB snaplet = unsafeWithDB' snaplet UnconfirmedWrites
@@ -47,7 +48,7 @@ unsafeWithDB snaplet = unsafeWithDB' snaplet UnconfirmedWrites
-- Returns: The action's result; in case of failure error is called.
--
-- Example:
--- > unsafeWithDB' accountDB UnconfirmedWrites $ insert "test-collection" ["some_field" = " something" ]
+-- > unsafeWithDB' accountDB UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]
unsafeWithDB' :: (MonadState' app m) => Lens app (Snaplet MongoDB) -> AccessMode -> Action IO a -> m a
unsafeWithDB' snaplet mode action = do
res <- (eitherWithDB' snaplet mode action)
@@ -60,7 +61,7 @@ unsafeWithDB' snaplet mode action = do
-- Returns: Nothing in case of failure or Just the rsult of the action.
--
-- Example:
--- > maybeWithDB accountDB $ insert "test-collection" ["some_field" = " something" ]
+-- > maybeWithDB accountDB $ insert "test-collection" ["some_field" = "something" ]
maybeWithDB :: (MonadState' app m) => Lens app (Snaplet MongoDB) -> Action IO a -> m (Maybe a)
maybeWithDB snaplet = maybeWithDB' snaplet UnconfirmedWrites
@@ -72,7 +73,7 @@ maybeWithDB snaplet = maybeWithDB' snaplet UnconfirmedWrites
-- Returns: Nothing in case of failure or Just the rsult of the action.
--
-- Example:
--- > maybeWithDB' accountDB UnconfirmedWrites $ insert "test-collection" ["some_field" = " something" ]
+-- > maybeWithDB' accountDB UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]
maybeWithDB' :: (MonadState' app m) => Lens app (Snaplet MongoDB) -> AccessMode -> Action IO a -> m (Maybe a)
maybeWithDB' snaplet mode action = do
res <- (eitherWithDB' snaplet mode action)
@@ -85,7 +86,7 @@ maybeWithDB' snaplet mode action = do
-- Returns: Either Failure or the action's result.
--
-- Example:
--- > eitherWithDB accountDB $ insert "test-collection" ["some_field" = " something" ]
+-- > eitherWithDB accountDB $ insert "test-collection" ["some_field" = "something" ]
eitherWithDB :: (MonadState' app m) => Lens app (Snaplet MongoDB) -> Action IO a -> m (Either Failure a)
eitherWithDB snaplet = eitherWithDB' snaplet UnconfirmedWrites
@@ -97,7 +98,7 @@ eitherWithDB snaplet = eitherWithDB' snaplet UnconfirmedWrites
-- Returns: Either Failure or the action's result.
--
-- Example:
--- > eitherWithDB' accountDB UnconfirmedWrites $ insert "test-collection" ["some_field" = " something" ]
+-- > eitherWithDB' accountDB UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]
eitherWithDB' :: (MonadState' app m) => Lens app (Snaplet MongoDB) -> AccessMode -> Action IO a -> m (Either Failure a)
eitherWithDB' snaplet mode action = do
(MongoDB pool database) <- gets (getL ((C..) snapletValue snaplet))
View
34 src/Snap/Snaplet/MongoDB/Functions/S.hs
@@ -25,6 +25,7 @@ import qualified Control.Category as C ((.))
------------------------------------------------------------------------------
-- | These classes are here just for convenience.
+--
class (MonadIO m, MonadState app m) => MonadState' app m
instance (MonadIO m, MonadState app m) => MonadState' app m
@@ -33,22 +34,29 @@ instance (MonadState' app m, HasMongoDB app) => HasMongoDB' app m
------------------------------------------------------------------------------
-- | Database access function.
+--
-- 1. argument: Action to perform. (Defaults to UnconfirmedWrites AccessMode)
+--
-- Returns: The action's result; in case of failure error is called.
--
-- Example:
--- > unsafeWithDB $ insert "test-collection" ["some_field" = " something" ]
+--
+-- > unsafeWithDB $ insert "test-collection" ["some_field" = "something" ]
unsafeWithDB :: (HasMongoDB' app m) => Action IO a -> m a
unsafeWithDB = unsafeWithDB' UnconfirmedWrites
------------------------------------------------------------------------------
-- | Database access function.
+--
-- 1. argument: AccessMode.
+--
-- 2. argument: Action to perform.
+--
-- Returns: The action's result; in case of failure error is called.
--
-- Example:
--- > unsafeWithDB' UnconfirmedWrites $ insert "test-collection" ["some_field" = " something" ]
+--
+-- > unsafeWithDB' UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]
unsafeWithDB' :: (HasMongoDB' app m) => AccessMode -> Action IO a -> m a
unsafeWithDB' mode action = do
res <- (eitherWithDB' mode action)
@@ -56,22 +64,29 @@ unsafeWithDB' mode action = do
------------------------------------------------------------------------------
-- | Database access function.
+--
-- 1. argument: Action to perform. (Defaults to UnconfirmedWrites AccessMode)
+--
-- Returns: Nothing in case of failure or Just the rsult of the action.
--
-- Example:
--- > maybeWithDB $ insert "test-collection" ["some_field" = " something" ]
+--
+-- > maybeWithDB $ insert "test-collection" ["some_field" = "something" ]
maybeWithDB :: (HasMongoDB' app m) => Action IO a -> m (Maybe a)
maybeWithDB = maybeWithDB' UnconfirmedWrites
------------------------------------------------------------------------------
-- | Database access function.
+--
-- 1. argument: AccessMode.
+--
-- 2. argument: Action to perform.
+--
-- Returns: Nothing in case of failure or Just the rsult of the action.
--
-- Example:
--- > maybeWithDB' UnconfirmedWrites $ insert "test-collection" ["some_field" = " something" ]
+--
+-- > maybeWithDB' UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]
maybeWithDB' :: (HasMongoDB' app m) => AccessMode -> Action IO a -> m (Maybe a)
maybeWithDB' mode action = do
res <- (eitherWithDB' mode action)
@@ -79,22 +94,29 @@ maybeWithDB' mode action = do
------------------------------------------------------------------------------
-- | Database access function.
+--
-- 1. argument: Action to perform. (Defaults to UnconfirmedWrites AccessMode)
+--
-- Returns: Either Failure or the action's result.
--
-- Example:
--- > eitherWithDB $ insert "test-collection" ["some_field" = " something" ]
+--
+-- > eitherWithDB $ insert "test-collection" ["some_field" = "something" ]
eitherWithDB :: (HasMongoDB' app m) => Action IO a -> m (Either Failure a)
eitherWithDB = eitherWithDB' UnconfirmedWrites
------------------------------------------------------------------------------
-- | Database access function.
+--
-- 1. argument: AccessMode.
+--
-- 2. argument: Action to perform.
+--
-- Returns: Either Failure or the action's result.
--
-- Example:
--- > eitherWithDB' UnconfirmedWrites $ insert "test-collection" ["some_field" = " something" ]
+--
+-- > eitherWithDB' UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]
eitherWithDB' :: (HasMongoDB' app m) => AccessMode -> Action IO a -> m (Either Failure a)
eitherWithDB' mode action = do
(MongoDB pool database) <- gets getMongoDB
Please sign in to comment.
Something went wrong with that request. Please try again.