[documentation initialized ekmett@gmail.com**20090412081025 Ignore-this: 9792ccc4cdad14caa022a2977bce22df ] { adddir ./doc adddir ./doc/html adddir ./doc/html/monad-cps addfile ./doc/html/monad-cps/Control-Monad-CPS-Codensity.html hunk ./doc/html/monad-cps/Control-Monad-CPS-Codensity.html 1 + + +Control.Monad.CPS.Codensity
 monad-cps-0.0.2: CPS implementations of common monads.Source codeContentsIndex
Control.Monad.CPS.Codensity
Documentation
newtype Codensity f a Source
Constructors
Codensity
unCodensity :: forall o. (a -> f o) -> f o
show/hide Instances
runCodensity :: Monad f => Codensity f a -> f aSource
runCodensityApp :: Applicative f => Codensity f a -> f aSource
Produced by Haddock version 2.3.0
addfile ./doc/html/monad-cps/Control-Monad-CPS-Cont.html hunk ./doc/html/monad-cps/Control-Monad-CPS-Cont.html 1 + + +Control.Monad.CPS.Cont
 monad-cps-0.0.2: CPS implementations of common monads.Source codeContentsIndex
Control.Monad.CPS.Cont
Documentation
data Cont r a Source
show/hide Instances
runCont :: Cont r a -> (a -> r) -> rSource
idCont :: Cont a a -> aSource
mapCont :: (r -> r) -> Cont r a -> Cont r aSource
withCont :: ((b -> r) -> a -> r) -> Cont r a -> Cont r bSource
shift :: ((a -> Cont s r) -> Cont r r) -> Cont r aSource
reset :: Cont a a -> Cont r aSource
Produced by Haddock version 2.3.0
addfile ./doc/html/monad-cps/Control-Monad-CPS-Identity.html hunk ./doc/html/monad-cps/Control-Monad-CPS-Identity.html 1 + + +Control.Monad.CPS.Identity
 monad-cps-0.0.2: CPS implementations of common monads.Source codeContentsIndex
Control.Monad.CPS.Identity
Documentation
newtype Identity a Source
Constructors
Identity
unIdentity :: forall o. (a -> o) -> o
show/hide Instances
runIdentity :: Identity a -> aSource
Produced by Haddock version 2.3.0
addfile ./doc/html/monad-cps/Control-Monad-CPS-RWS.html hunk ./doc/html/monad-cps/Control-Monad-CPS-RWS.html 1 + + +Control.Monad.CPS.RWS
 monad-cps-0.0.2: CPS implementations of common monads.Source codeContentsIndex
Control.Monad.CPS.RWS
Documentation
newtype RWS r w s a Source
Constructors
RWS
unRWS :: forall o. (a -> w -> s -> o) -> r -> s -> o
show/hide Instances
Monoid w => MonadReader r (RWS r w s)
Monoid w => MonadState s (RWS r w s)
Monoid w => MonadWriter w (RWS r w s)
Monoid w => Monad (RWS r w s)
Monoid w => Functor (RWS r w s)
runRWS :: RWS r w s a -> r -> s -> (a, w, s)Source
Produced by Haddock version 2.3.0
addfile ./doc/html/monad-cps/Control-Monad-CPS-Ran.html hunk ./doc/html/monad-cps/Control-Monad-CPS-Ran.html 1 + + +Control.Monad.CPS.Ran
 monad-cps-0.0.2: CPS implementations of common monads.Source codeContentsIndex
Control.Monad.CPS.Ran
Documentation
newtype Ran g h a Source
Constructors
Ran
runRan :: forall b. (a -> g b) -> h b
show/hide Instances
Functor (Ran g h)
Produced by Haddock version 2.3.0
addfile ./doc/html/monad-cps/Control-Monad-CPS-Reader.html hunk ./doc/html/monad-cps/Control-Monad-CPS-Reader.html 1 + + +Control.Monad.CPS.Reader
 monad-cps-0.0.2: CPS implementations of common monads.Source codeContentsIndex
Control.Monad.CPS.Reader
Documentation
newtype Reader r a Source
Constructors
Reader
unReader :: forall o. (a -> o) -> r -> o
show/hide Instances
runReader :: Reader r a -> r -> aSource
Produced by Haddock version 2.3.0
addfile ./doc/html/monad-cps/Control-Monad-CPS-State.html hunk ./doc/html/monad-cps/Control-Monad-CPS-State.html 1 + + +Control.Monad.CPS.State
 monad-cps-0.0.2: CPS implementations of common monads.Source codeContentsIndex
Control.Monad.CPS.State
Documentation
data State s a Source
show/hide Instances
runState :: State s a -> s -> (a, s)Source
data State' s a Source
show/hide Instances
runState' :: State' s a -> s -> (a, s)Source
Produced by Haddock version 2.3.0
addfile ./doc/html/monad-cps/Control-Monad-CPS-Writer.html hunk ./doc/html/monad-cps/Control-Monad-CPS-Writer.html 1 + + +Control.Monad.CPS.Writer
 monad-cps-0.0.2: CPS implementations of common monads.Source codeContentsIndex
Control.Monad.CPS.Writer
Documentation
newtype Writer w a Source
Constructors
Writer
unWriter :: forall o. (a -> w -> o) -> o
show/hide Instances
runWriter :: Writer w a -> (a, w)Source
data Writer' w a Source
show/hide Instances
runWriter' :: Monoid w => Writer' w a -> (a, w)Source
Produced by Haddock version 2.3.0
addfile ./doc/html/monad-cps/Control-Monad-CPS.html hunk ./doc/html/monad-cps/Control-Monad-CPS.html 1 + + +Control.Monad.CPS
 monad-cps-0.0.2: CPS implementations of common monads.Source codeContentsIndex
Control.Monad.CPS
Documentation
module Control.Monad.CPS.Identity
module Control.Monad.CPS.Reader
module Control.Monad.CPS.Writer
module Control.Monad.CPS.State
module Control.Monad.CPS.Cont
module Control.Monad.CPS.Codensity
module Control.Monad.CPS.Ran
Produced by Haddock version 2.3.0
addfile ./doc/html/monad-cps/doc-index.html hunk ./doc/html/monad-cps/doc-index.html 1 + + +monad-cps-0.0.2: CPS implementations of common monads. (Index)
 monad-cps-0.0.2: CPS implementations of common monads.ContentsIndex
Search:
ask
asks
callCC
censor
Codensity
1 (Type/Class)
2 (Data Constructor)
Cont
get
gets
idCont
Identity
1 (Type/Class)
2 (Data Constructor)
listen
listens
local
mapCont
modify
MonadCont
MonadReader
MonadState
MonadWriter
pass
put
Ran
1 (Type/Class)
2 (Data Constructor)
Reader
1 (Type/Class)
2 (Data Constructor)
reset
runCodensity
runCodensityApp
runCont
runIdentity
runRan
runReader
runRWS
runState
runState'
runWriter
runWriter'
RWS
1 (Type/Class)
2 (Data Constructor)
shift
State
State'
tell
unCodensity
unIdentity
unReader
unRWS
unWriter
withCont
Writer
1 (Type/Class)
2 (Data Constructor)
Writer'
addfile ./doc/html/monad-cps/haddock-util.js hunk ./doc/html/monad-cps/haddock-util.js 1 +// Haddock JavaScript utilities +function toggle(button,id) +{ + var n = document.getElementById(id).style; + if (n.display == "none") + { + button.src = "minus.gif"; + n.display = "block"; + } + else + { + button.src = "plus.gif"; + n.display = "none"; + } +} + + +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 + } +} addfile ./doc/html/monad-cps/haddock.css hunk ./doc/html/monad-cps/haddock.css 1 +/* -------- Global things --------- */ + +BODY { + background-color: #ffffff; + color: #000000; + font-family: sans-serif; + } + +A:link { color: #0000e0; text-decoration: none } +A:visited { color: #0000a0; text-decoration: none } +A:hover { background-color: #e0e0ff; text-decoration: none } + +TABLE.vanilla { + width: 100%; + border-width: 0px; + /* I can't seem to specify cellspacing or cellpadding properly using CSS... */ +} + +TABLE.vanilla2 { + border-width: 0px; +} + +/* font is a little too small in MSIE */ +TT { font-size: 100%; } +PRE { font-size: 100%; } + +LI P { margin: 0pt } + +TD { + border-width: 0px; +} + +TABLE.narrow { + border-width: 0px; +} + +TD.s8 { height: 8px; } +TD.s15 { height: 15px; } + +SPAN.keyword { text-decoration: underline; } + +/* Resize the buttom image to match the text size */ +IMG.coll { width : 0.75em; height: 0.75em; margin-bottom: 0; margin-right: 0.5em } + +/* --------- Contents page ---------- */ + +DIV.node { + padding-left: 3em; +} + +DIV.cnode { + padding-left: 1.75em; +} + +SPAN.pkg { + position: absolute; + left: 50em; +} + +/* --------- Documentation elements ---------- */ + +TD.children { + padding-left: 25px; + } + +TD.synopsis { + padding: 2px; + background-color: #f0f0f0; + font-family: monospace + } + +TD.decl { + padding: 2px; + background-color: #f0f0f0; + font-family: monospace; + vertical-align: top; + } + +TD.topdecl { + padding: 2px; + background-color: #f0f0f0; + font-family: monospace; + vertical-align: top; +} + +TABLE.declbar { + border-spacing: 0px; + } + +TD.declname { + width: 100%; + } + +TD.declbut { + padding-left: 5px; + padding-right: 5px; + border-left-width: 1px; + border-left-color: #000099; + border-left-style: solid; + white-space: nowrap; + font-size: small; + } + +/* + arg is just like decl, except that wrapping is not allowed. It is + used for function and constructor arguments which have a text box + to the right, where if wrapping is allowed the text box squashes up + the declaration by wrapping it. +*/ +TD.arg { + padding: 2px; + background-color: #f0f0f0; + font-family: monospace; + vertical-align: top; + white-space: nowrap; + } + +TD.recfield { padding-left: 20px } + +TD.doc { + padding-top: 2px; + padding-left: 10px; + } + +TD.ndoc { + padding: 2px; + } + +TD.rdoc { + padding: 2px; + padding-left: 10px; + width: 100%; + } + +TD.body { + padding-left: 10px + } + +TD.pkg { + width: 100%; + padding-left: 10px +} + +TABLE.indexsearch TR.indexrow { + display: none; +} +TABLE.indexsearch TR.indexshow { + display: table-row; +} + +TD.indexentry { + vertical-align: top; + padding-right: 10px + } + +TD.indexannot { + vertical-align: top; + padding-left: 20px; + white-space: nowrap + } + +TD.indexlinks { + width: 100% + } + +/* ------- Section Headings ------- */ + +TD.section1 { + padding-top: 15px; + font-weight: bold; + font-size: 150% + } + +TD.section2 { + padding-top: 10px; + font-weight: bold; + font-size: 130% + } + +TD.section3 { + padding-top: 5px; + font-weight: bold; + font-size: 110% + } + +TD.section4 { + font-weight: bold; + font-size: 100% + } + +/* -------------- The title bar at the top of the page */ + +TD.infohead { + color: #ffffff; + font-weight: bold; + padding-right: 10px; + text-align: left; +} + +TD.infoval { + color: #ffffff; + padding-right: 10px; + text-align: left; +} + +TD.topbar { + background-color: #000099; + padding: 5px; +} + +TD.title { + color: #ffffff; + padding-left: 10px; + width: 100% + } + +TD.topbut { + padding-left: 5px; + padding-right: 5px; + border-left-width: 1px; + border-left-color: #ffffff; + border-left-style: solid; + white-space: nowrap; + } + +TD.topbut A:link { + color: #ffffff + } + +TD.topbut A:visited { + color: #ffff00 + } + +TD.topbut A:hover { + background-color: #6060ff; + } + +TD.topbut:hover { + background-color: #6060ff + } + +TD.modulebar { + background-color: #0077dd; + padding: 5px; + border-top-width: 1px; + border-top-color: #ffffff; + border-top-style: solid; + } + +/* --------- The page footer --------- */ + +TD.botbar { + background-color: #000099; + color: #ffffff; + padding: 5px + } +TD.botbar A:link { + color: #ffffff; + text-decoration: underline + } +TD.botbar A:visited { + color: #ffff00 + } +TD.botbar A:hover { + background-color: #6060ff + } + addfile ./doc/html/monad-cps/haskell_icon.gif binary ./doc/html/monad-cps/haskell_icon.gif oldhex * newhex *47494638376110001000f70f00000000800000008000808000000080800080008080c0c0c08080 *80ff000000ff00ffff000000ffff00ff00ffffffffff0000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *000000000000000000000000000000000000000000000000000000000000000000000000000000 *0021f90401000000002c000000001000100007086c0001007840b0a0418202073e38b0b021c387 *07143e2440c0a143040e091cd0787021c686151f84347800e343901d4b12646870e44a930d0952 *3ca832a6cc990555b2bc2992e4c79d3847ea2c88b3a7c89a2c8b8aa43874e941a60810003840b5 *aa55aa511346ddca75abc080003b addfile ./doc/html/monad-cps/index.html hunk ./doc/html/monad-cps/index.html 1 + + +monad-cps-0.0.2: CPS implementations of common monads.
 monad-cps-0.0.2: CPS implementations of common monads.ContentsIndex
monad-cps-0.0.2: CPS implementations of common monads.
. +
Modules
show/hideControl
show/hideMonad
show/hideControl.Monad.CPS
Control.Monad.CPS.Codensity
Control.Monad.CPS.Cont
Control.Monad.CPS.Identity
Control.Monad.CPS.RWS
Control.Monad.CPS.Ran
Control.Monad.CPS.Reader
Control.Monad.CPS.State
Control.Monad.CPS.Writer
Produced by Haddock version 2.3.0
addfile ./doc/html/monad-cps/minus.gif binary ./doc/html/monad-cps/minus.gif oldhex * newhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002118c8f *a00bc6eb5e0b40583b6596f1a11f14003b addfile ./doc/html/monad-cps/monad-cps.haddock binary ./doc/html/monad-cps/monad-cps.haddock oldhex * newhex *0d0cface00040000000000000e1500000000000008c72500000000000000000000000000000000 *000000000000000100000000000000010000000000000000000000000000000100000000000000 *020000000000000000000000000000000100000000000000030000000000000000000000000000 *000100000000000000040000000000000000000000000000000200000000000000050000000000 *000000000000000000000200000000000000060000000000000000000000000000000200000000 *000000070000000000000000000000000000000300000000000000080000000000000000000000 *0000000003000000000000000900000000000000000000000000000003000000000000000a0000 *0000000000000000000000000003000000000000000b0000000000000000000000000000000300 *0000000000000c00000000000000000000000000000004000000000000000d0000000000000000 *0000000000000004000000000000000e0000000000000000000000000000000400000000000000 *0f0000000000000000000000000000000400000000000000100000000000000000000000000000 *000400000000000000110000000000000000000000000000000400000000000000120000000000 *000000000000000000000400000000000000130000000000000000000000000000000500000000 *000000140000000000000000000000000000000500000000000000150000000000000000000000 *000000000500000000000000160000000000000000000000000000000500000000000000170000 *000000000000000000000000000600000000000000180000000000000000000000000000000600 *0000000000001900000000000000000000000000000006000000000000001a0000000000000000 *0000000000000006000000000000001b0000000000000000000000000000000600000000000000 *1c00000000000000000000000000000006000000000000001d0000000000000000000000000000 *0007000000000000001e00000000000000000000000000000007000000000000001f0000000000 *000000000000000000000700000000000000200000000000000000000000000000000700000000 *000000210000000000000000000000000000000800000000000000220000000000000000000000 *000000000800000000000000230000000000000000000000000000000800000000000000240000 *000000000000000000000000000809000000000000000000000000000000010000000000040000 *000000000000000000000000000100000000000000020000000000000003040000000000000000 *000000000000000100000000000000020000000000000003000000000000000000000000000000 *020000000000030000000000000004000000000000000500000000000000060300000000000000 *040000000000000005000000000000000600000000000000000000000000000003000000000005 *000000000000000700000000000000080000000000000009000000000000000a00000000000000 *0b05000000000000000700000000000000080000000000000009000000000000000a0000000000 *00000b000000000000000000000000000000040000000000090000000000000025000000000000 *0026000000000000000c000000000000000d000000000000000e000000000000000f0000000000 *0000100000000000000011000000000000001207000000000000000c000000000000000d000000 *000000000e000000000000000f0000000000000010000000000000001100000000000000120000 *000000000000000000000000000500000000000900000000000000270000000000000028000000 *0000000029000000000000002a000000000000002b000000000000001300000000000000140000 *000000000015000000000000001604000000000000001400000000000000150000000000000013 *00000000000000160000000000000000000000000000000600000000000c000000000000002c00 *0000000000002d000000000000002e000000000000002f00000000000000300000000000000031 *000000000000001700000000000000180000000000000019000000000000001a00000000000000 *1b000000000000001c0600000000000000180000000000000019000000000000001a0000000000 *00001b0000000000000017000000000000001c0000000000000000000000000000000700000000 *000800000000000000320000000000000033000000000000003400000000000000350000000000 *00001d000000000000001e000000000000001f000000000000002004000000000000001d000000 *000000001e000000000000001f0000000000000020000000000000000000000000000000080000 *000000040000000000000021000000000000002200000000000000230000000000000024040000 *000000000021000000000000002200000000000000230000000000000024000000000000000000 *000000000000090000000000320000000000000025000000000000002600000000000000320000 *000000000033000000000000003400000000000000350000000000000027000000000000002800 *00000000000029000000000000002a000000000000002b000000000000002c000000000000002d *000000000000002e000000000000002f0000000000000030000000000000003100000000000000 *040000000000000005000000000000000600000000000000070000000000000008000000000000 *0009000000000000000a000000000000000b000000000000000c000000000000000d0000000000 *00000e000000000000000f00000000000000100000000000000011000000000000001200000000 *000000130000000000000014000000000000001500000000000000160000000000000017000000 *00000000180000000000000019000000000000001a000000000000001b000000000000001c0000 *00000000001d000000000000001e000000000000001f0000000000000020000000000000002100 *000000000000220000000000000023000000000000002400000000000000003600000000000000 *00000000000000000103000000000000000a000000000000000000000000000000010100000000 *0000000a0000000000000000000000000000000100000000000000000b00000000000000000000 *00000000000100000000000000000c000000000000000000000000000000020300000000000000 *0d0000000000000000000000000000000201000000000000000d00000000000000000000000000 *00000200000000000000000e0000000000000000000000000000000303000000000000000f0000 *000000000000000000000000000301000000000000000f00000000000000000000000000000003 *000000000000000010000000000000000000000000000000030000000000000000110000000000 *000000000000000000000300000000000000001200000000000000000000000000000004030000 *000000000013000000000000000000000000000000040000000000000000140000000000000000 *000000000000000400000000000000001500000000000000000000000000000004000000000000 *000016000000000000000000000000000000040000000000000000170000000000000000000000 *000000000400000000000000001800000000000000000000000000000004000000000000000019 *0000000000000000000000000000000503000000000000001a0000000000000000000000000000 *000503000000000000001b0000000000000000000000000000000500000000000000001c000000 *0000000000000000000000000500000000000000001d0000000000000000000000000000000603 *000000000000001e0000000000000000000000000000000603000000000000001f000000000000 *0000000000000000000601000000000000001f0000000000000000000000000000000600000000 *000000002000000000000000000000000000000006000000000000000021000000000000000000 *000000000000060000000000000000220000000000000000000000000000000703000000000000 *002300000000000000000000000000000007010000000000000023000000000000000000000000 *000000070000000000000000240000000000000000000000000000000700000000000000002500 *000000000000000000000000000008030000000000000026000000000000000000000000000000 *080100000000000000260000000000000000000000000000000800000000000000002700000000 *0000000000000000000000080000000000000000280000000000000029000000000000002a0000 *0000000000002b0000000000000029000000000000002a03000000000000002c00000000000000 *29000000000000002d00000000000000002e0000000000000029000000000000002d0000000000 *0000002f0000000000000029000000000000002d00000000000000003000000000000000290000 *00000000002d0000000000000000310000000000000029000000000000002d0300000000000000 *320000000000000029000000000000003300000000000000003400000000000000290000000000 *000033000000000000000035000000000000002900000000000000330000000000000000360000 *000000000029000000000000003300000000000000003700000000000000290000000000000033 *000000000000000038000000000000002900000000000000330300000000000000390000000000 *000029000000000000003a00000000000000003b0000000000000029000000000000003a000000 *00000000003c0000000000000029000000000000003a00000000000000003d0000000000000029 *000000000000003a03000000000000003e000000000000003f000000000000000f6d6f6e61642d *6370732d302e302e320000000000000015436f6e74726f6c2e4d6f6e61642e4350532e52575300 *00000000000015436f6e74726f6c2e4d6f6e61642e4350532e52616e000000000000001b436f6e *74726f6c2e4d6f6e61642e4350532e436f64656e736974790000000000000016436f6e74726f6c *2e4d6f6e61642e4350532e436f6e740000000000000017436f6e74726f6c2e4d6f6e61642e4350 *532e53746174650000000000000018436f6e74726f6c2e4d6f6e61642e4350532e577269746572 *0000000000000018436f6e74726f6c2e4d6f6e61642e4350532e52656164657200000000000000 *1a436f6e74726f6c2e4d6f6e61642e4350532e4964656e746974790000000000000011436f6e74 *726f6c2e4d6f6e61642e43505300000000000000035257530000000000000005756e5257530000 *00000000000672756e525753000000000000000352616e000000000000000672756e52616e0000 *000000000009436f64656e73697479000000000000000b756e436f64656e736974790000000000 *00000c72756e436f64656e73697479000000000000000f72756e436f64656e7369747941707000 *00000000000004436f6e74000000000000000772756e436f6e7400000000000000066964436f6e *7400000000000000076d6170436f6e74000000000000000877697468436f6e7400000000000000 *057368696674000000000000000572657365740000000000000006537461746527000000000000 *00055374617465000000000000000872756e5374617465000000000000000972756e5374617465 *270000000000000007577269746572270000000000000006577269746572000000000000000875 *6e577269746572000000000000000972756e577269746572000000000000000a72756e57726974 *65722700000000000000065265616465720000000000000008756e526561646572000000000000 *000972756e52656164657200000000000000084964656e74697479000000000000000a756e4964 *656e74697479000000000000000b72756e4964656e74697479000000000000000b6d746c2d312e *312e302e320000000000000018436f6e74726f6c2e4d6f6e61642e436f6e742e436c6173730000 *00000000000663616c6c434300000000000000094d6f6e6164436f6e740000000000000019436f *6e74726f6c2e4d6f6e61642e53746174652e436c61737300000000000000046765747300000000 *000000066d6f646966790000000000000003707574000000000000000367657400000000000000 *0a4d6f6e61645374617465000000000000001a436f6e74726f6c2e4d6f6e61642e577269746572 *2e436c617373000000000000000663656e736f7200000000000000076c697374656e7300000000 *000000047061737300000000000000066c697374656e000000000000000474656c6c0000000000 *00000b4d6f6e6164577269746572000000000000001a436f6e74726f6c2e4d6f6e61642e526561 *6465722e436c617373000000000000000461736b7300000000000000056c6f63616c0000000000 *00000361736b000000000000000b4d6f6e6164526561646572 addfile ./doc/html/monad-cps/plus.gif binary ./doc/html/monad-cps/plus.gif oldhex * newhex *47494638396109000900910000fefefe8282820202020000002c00000000090009000002148c8f *a00bb6b29c82ca897b5b7871cfce74085200003b adddir ./doc/html/monad-cps/src addfile ./doc/html/monad-cps/src/Control-Monad-CPS-Codensity.html hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Codensity.html 1 + + + + +src/Control/Monad/CPS/Codensity.hs + + + +
module Control.Monad.CPS.Codensity
+    ( Codensity(Codensity, unCodensity)
+    , runCodensity, runCodensityApp
+    ) where
+
+import Control.Monad
+import Control.Monad.Trans
+import Control.Applicative
+
+newtype Codensity f a = Codensity { unCodensity :: forall o. (a -> f o) -> f o }
+
+instance Functor (Codensity f) where
+    fmap f (Codensity g) = Codensity (\k -> g (\a -> k (f a)))
+
+instance Applicative (Codensity f) where
+    pure = return
+    (<*>) = ap 
+
+instance Monad (Codensity f) where
+    return a = Codensity (\k -> k a)
+    Codensity g >>= f = Codensity (\k -> g (\a -> unCodensity (f a) k))
+
+runCodensity :: Monad f => Codensity f a -> f a
+runCodensity (Codensity f) = f return
+
+runCodensityApp :: Applicative f => Codensity f a -> f a
+runCodensityApp (Codensity f) = f pure
+
+instance MonadTrans Codensity where
+    lift m = Codensity (m >>=)
+
+ addfile ./doc/html/monad-cps/src/Control-Monad-CPS-Cont.html hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Cont.html 1 + + + + +src/Control/Monad/CPS/Cont.hs + + + +
module Control.Monad.CPS.Cont 
+    ( Cont
+    , runCont
+    , idCont
+    , mapCont
+    , withCont
+    , shift
+    , reset
+    , module Control.Monad.Cont.Class
+    ) where
+
+import Control.Monad
+import Control.Monad.Cont.Class
+
+newtype Cont r a = Cont {unCont :: forall o. (a -> r) -> (r -> o) -> o}
+
+instance Functor (Cont r) where
+  fmap f (Cont g) = Cont (\k -> g (k . f))
+
+instance Monad (Cont r) where
+  return a = Cont (\k z -> z (k a))
+  Cont g >>= f = Cont (\k -> g (\a -> unCont (f a) k id))
+
+runCont :: Cont r a -> (a -> r) -> r
+runCont (Cont g) = flip g id
+
+idCont :: Cont a a -> a
+idCont = flip runCont id
+
+mapCont :: (r -> r) -> Cont r a -> Cont r a
+mapCont f (Cont g) = Cont (\k -> g (f . k))
+-- mapCont f (Cont g) = Cont (\k z -> g k (z . f))
+
+withCont :: ((b -> r) -> (a -> r)) -> Cont r a -> Cont r b
+withCont f (Cont g) = Cont (g . f)
+-- withCont f (Cont g) = Cont (\k -> g (f k))
+
+instance MonadCont (Cont r) where
+    callCC f = Cont (\k -> unCont (f (\a -> Cont (\_ h -> (h . k) a))) k)
+
+shift  :: ((a -> Cont s r) -> Cont r r) -> Cont r a
+shift f = Cont (\k -> unCont (f (\a -> Cont (\e h -> (h . e . k) a))) id)
+
+reset :: Cont a a -> Cont r a
+reset m = Cont (\k z -> (z . k) (runCont m id))
+
+ addfile ./doc/html/monad-cps/src/Control-Monad-CPS-Identity.html hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Identity.html 1 + + + + +src/Control/Monad/CPS/Identity.hs + + + +
module Control.Monad.CPS.Identity 
+    ( Identity(Identity, unIdentity)
+    , runIdentity
+    ) where
+
+import Control.Monad
+import Control.Applicative
+
+newtype Identity a = Identity {unIdentity :: forall o. (a -> o) -> o}
+
+instance Functor Identity where
+--  fmap f (Identity g) = Identity (\k -> g (\a -> k (f a)))
+    fmap f (Identity g) = Identity (\k -> g (k . f))
+
+instance Applicative Identity where
+    pure = return
+    (<*>) = ap
+
+instance Monad Identity where
+    return a = Identity (\k -> k a)
+    Identity g >>= f = Identity (\k -> g (\a -> unIdentity (f a) k))
+
+runIdentity :: Identity a -> a
+runIdentity (Identity f) = f id
+
+ addfile ./doc/html/monad-cps/src/Control-Monad-CPS-RWS.html hunk ./doc/html/monad-cps/src/Control-Monad-CPS-RWS.html 1 + + + + +src/Control/Monad/CPS/RWS.hs + + + +
{-# LANGUAGE MagicHash, UnboxedTuples #-}
+module Control.Monad.CPS.RWS 
+    ( RWS(RWS,unRWS)
+    , runRWS
+    ) where
+
+import Data.Monoid (Monoid(..))
+import Control.Monad.RWS.Class
+
+newtype RWS r w s a = RWS { unRWS :: forall o. (a -> w -> s -> o) -> r -> s -> o }
+
+instance Monoid w => Functor (RWS r w s) where
+    fmap f (RWS g) = RWS (\k -> g (\a -> k (f a)))
+
+--instance Monoid w => Applicative (RWS r w s) where
+--    pure a = RWS (\k _ -> k a mempty)
+--    RwS f <*> RWS x = RWS (\k r -> f (\f' s' w -> x (\x' s'' w' -> k (f' x') s'' (w `mappend` w')) r s'))
+
+instance Monoid w => Monad (RWS r w s) where
+    return a = RWS (\k _ -> k a mempty)
+    RWS g >>= f = RWS (\k r -> g (\a w -> unRWS (f a) (\b w' -> k b (w `mappend` w')) r) r)
+
+runRWS :: RWS r w s a -> r -> s -> (a, w, s)
+runRWS (RWS f) = f (,,)
+
+instance Monoid w => MonadState s (RWS r w s) where
+    get = RWS (\ k r s -> k s mempty s)
+    put s = RWS (\k _ _ -> k () mempty s)
+
+instance Monoid w => MonadWriter w (RWS r w s) where
+    tell w = RWS (\k _ -> k () w)
+    listen (RWS f) = RWS (\k -> f (\a w -> k (a,w) w))
+    pass (RWS f) = RWS (\k -> f (\(a,p) w -> k a (p w)))
+
+instance Monoid w => MonadReader r (RWS r w s) where
+    ask = RWS (\k r -> k r mempty)
+    local f (RWS g) = RWS (\k r -> g k (f r))
+
+ addfile ./doc/html/monad-cps/src/Control-Monad-CPS-Ran.html hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Ran.html 1 + + + + +src/Control/Monad/CPS/Ran.hs + + + +
module Control.Monad.CPS.Ran
+    ( Ran(Ran,runRan)
+    ) where
+
+newtype Ran g h a = Ran { runRan :: forall b. (a -> g b) -> h b } 
+
+instance Functor (Ran g h) where
+    fmap f m = Ran (\k -> runRan m (k . f))
+
+ addfile ./doc/html/monad-cps/src/Control-Monad-CPS-Reader.html hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Reader.html 1 + + + + +src/Control/Monad/CPS/Reader.hs + + + +
module Control.Monad.CPS.Reader 
+    ( module Control.Monad.Reader.Class
+    , Reader(Reader, unReader)
+    , runReader 
+    ) where
+
+import Control.Applicative
+import Control.Monad
+import Control.Monad.Reader.Class
+
+newtype Reader r a = Reader { unReader :: forall o. (a -> o) -> r -> o }
+
+instance Functor (Reader r) where
+    fmap f (Reader g) = Reader (\k -> g (\a -> k (f a)))
+
+instance Monad (Reader r) where
+    return a = Reader (\k _ -> k a)
+    Reader g >>= f = Reader (\k r -> g (\a -> unReader (f a) k r) r)
+
+runReader :: Reader r a -> r -> a
+runReader (Reader g) = g id
+
+instance MonadReader r (Reader r) where
+    ask = Reader id
+    local f (Reader g) = Reader (\k -> g k . f)
+
+ addfile ./doc/html/monad-cps/src/Control-Monad-CPS-State.html hunk ./doc/html/monad-cps/src/Control-Monad-CPS-State.html 1 + + + + +src/Control/Monad/CPS/State.hs + + + +
{-# LANGUAGE MagicHash, UnboxedTuples #-}
+module Control.Monad.CPS.State 
+    ( module Control.Monad.State.Class
+    , State
+    , runState
+    , State'
+    , runState'
+    ) where
+
+import Control.Monad
+import Control.Monad.CPS.Codensity
+import Control.Monad.State.Class
+import Control.Applicative
+
+newtype State s a = State { unState :: forall o. (a -> s -> o) -> s -> o }
+
+instance Functor (State s) where
+  fmap f (State g) = State (\k -> g (\a -> k (f a)))
+
+instance Applicative (State s) where
+  pure = return
+  (<*>) = ap
+
+instance Monad (State s) where
+  return a = State (\k -> k a)
+  State g >>= f = State (\k -> g (\a -> unState (f a) k))
+
+runState :: State s a -> s -> (a, s)
+runState (State g) = g (,)
+
+instance MonadState s (State s) where
+    get   = State (\k s -> k s s)
+    put s = State (\k _ -> k () s)
+
+newtype State' s a = State' { unState' :: Codensity ((->)s) a }
+    deriving (Functor,Applicative,Monad)
+
+instance MonadState s (State' s) where
+    get = State' (Codensity (\k s -> k s s))
+    put s = State' (Codensity (\k s -> k () s))
+
+runState' :: State' s a -> s -> (a, s)
+runState' = flip unCodensity (,) . unState'
+
+ addfile ./doc/html/monad-cps/src/Control-Monad-CPS-Writer.html hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Writer.html 1 + + + + +src/Control/Monad/CPS/Writer.hs + + + +
{-# LANGUAGE MagicHash, UnboxedTuples #-}
+module Control.Monad.CPS.Writer 
+    ( module Control.Monad.Writer.Class
+    , Writer(Writer, unWriter)
+    , runWriter
+    , Writer'
+    , runWriter'
+    ) where
+
+import Control.Applicative
+import Control.Monad
+import Control.Monad.Writer.Class
+import Data.Monoid (Monoid(..))
+
+-- CPS transformed writer, with all of the traditional mempty mappend baggage
+newtype Writer w a = Writer { unWriter :: forall o. (a -> w -> o) -> o }
+
+instance Functor (Writer w) where
+    fmap f (Writer g) = Writer (\k -> g (\a w -> k (f a) w))
+
+instance Monoid w => Applicative (Writer w) where
+    pure = return
+    (<*>) = ap 
+
+instance Monoid w => Monad (Writer w) where
+    return a = Writer (\k -> k a mempty)
+    Writer g >>= f = Writer (\k -> g (\a w -> unWriter (f a) (\a w' -> k a (w `mappend` w'))))
+
+runWriter :: Writer w a -> (a, w)
+runWriter (Writer g) = g (,)
+
+instance Monoid w => MonadWriter w (Writer w) where
+    tell w = Writer (\k -> k () w)
+    listen (Writer f) = Writer (\g -> f (\a w -> g (a,w) w))
+    pass (Writer f) = Writer (\g -> f (\(a,p) w -> g a (p w)))
+
+-- writer as CPS transformed state, only pays for mappend when actually writing
+newtype Writer' w a = Writer' { unWriter' :: forall o. (a -> w -> o) -> w -> o }
+
+instance Monoid w => Functor (Writer' w) where
+  fmap f (Writer' g) = Writer' (\k -> g (\a -> k (f a)))
+
+instance Monoid w => Applicative (Writer' w) where
+    pure = return
+    (<*>) = ap 
+
+instance Monoid w => Monad (Writer' w) where
+  return a = Writer' (\k -> k a)
+  Writer' g >>= f = Writer' (\k -> g (\a -> unWriter' (f a) k))
+
+runWriter' :: Monoid w => Writer' w a -> (a, w)
+runWriter' (Writer' g) = g (,) mempty
+
+instance Monoid w => MonadWriter w (Writer' w) where
+    tell w' = Writer' (\k w -> k () (w `mappend` w')) 
+    listen (Writer' f) = Writer' (\k -> f (\a w -> k (a,w) w))
+    pass (Writer' f) = Writer' (\k -> f (\(a,p) w -> k a (p w)))
+
+ addfile ./doc/html/monad-cps/src/Control-Monad-CPS.html hunk ./doc/html/monad-cps/src/Control-Monad-CPS.html 1 + + + + +src/Control/Monad/CPS.hs + + + +
module Control.Monad.CPS 
+    ( module Control.Monad.CPS.Identity
+    , module Control.Monad.CPS.Reader
+    , module Control.Monad.CPS.Writer
+    , module Control.Monad.CPS.State
+    , module Control.Monad.CPS.Cont
+    , module Control.Monad.CPS.Codensity
+    , module Control.Monad.CPS.Ran
+    ) where
+
+import Control.Monad.CPS.Identity
+import Control.Monad.CPS.Reader
+import Control.Monad.CPS.Writer
+import Control.Monad.CPS.State
+import Control.Monad.CPS.Cont
+import Control.Monad.CPS.Codensity
+import Control.Monad.CPS.Ran
+
+ addfile ./doc/html/monad-cps/src/hscolour.css hunk ./doc/html/monad-cps/src/hscolour.css 1 +.hs-keyglyph, .hs-layout {color: red;} +.hs-keyword {color: blue;} +.hs-comment, .hs-comment a {color: green;} +.hs-str, .hs-chr {color: teal;} +.hs-keyword, .hs-conid, .hs-varid, .hs-conop, .hs-varop, .hs-num, .hs-cpp, .hs-sel, .hs-definition {} }