[bump
ekmett@gmail.com**20090412100032
Ignore-this: 4c65bf0552a7f3f4944c02d9f6696d90
] {
hunk ./doc/html/monad-cps/Control-Monad-CPS-Codensity.html 22
->monad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.unCodensitygetCodensitymonad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.Applicative (Cont r)
| |
Constructors | | Instances | |
|
|
|
|
monad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.unIdentitygetIdentitymonad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.unRWSgetRWSmonad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.runRangetRanmonad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.unReadergetReadermonad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.monad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.unWritergetWritermonad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.module Control.Monad.CPS.Identitymodule Control.Monad.CPS.Codensitymodule Control.Monad.CPS.Readermodule Control.Monad.CPS.Contmodule Control.Monad.CPS.Writermodule Control.Monad.CPS.Identitymodule Control.Monad.CPS.Statemodule Control.Monad.CPS.Maybemodule Control.Monad.CPS.Contmodule Control.Monad.CPS.Ranmodule Control.Monad.CPS.Codensitymodule Control.Monad.CPS.Readermodule Control.Monad.CPS.Ranmodule Control.Monad.CPS.State
|
module Control.Monad.CPS.Writermonad-cps-0.0.2: CPS implementations of common monads. (Index)monad-cps-0.0.3: CPS implementations of common monads. (Index)monad-cps-0.0.2: CPS implementations of common monads. | monad-cps-0.0.3: CPS implementations of common monads.Control.Monad.CPS.RWS, Control.Monad.CPS.Writer, Control.Monad.CPSControl.Monad.CPS.Writer, Control.Monad.CPS.RWS, Control.Monad.CPSCont' |
1 (Type/Class) | Control.Monad.CPS.Cont, Control.Monad.CPS |
2 (Data Constructor) | Control.Monad.CPS.Cont, Control.Monad.CPS |
getCodensityControl.Monad.CPS.Codensity, Control.Monad.CPS |
getCont' | Control.Monad.CPS.Cont, Control.Monad.CPS |
getIdentity | Control.Monad.CPS.Identity, Control.Monad.CPS |
getMaybe' | Control.Monad.CPS.Maybe, Control.Monad.CPS |
getRan | Control.Monad.CPS.Ran, Control.Monad.CPS |
getReader | Control.Monad.CPS.Reader, Control.Monad.CPS |
getRWS | Control.Monad.CPS.RWS |
getWriter | Control.Monad.CPS.Writer, Control.Monad.CPS |
Control.Monad.CPS.RWS, Control.Monad.CPS.Writer, Control.Monad.CPS | Control.Monad.CPS.Writer, Control.Monad.CPS.RWS, Control.Monad.CPSControl.Monad.CPS.RWS, Control.Monad.CPS.Writer, Control.Monad.CPSControl.Monad.CPS.Writer, Control.Monad.CPS.RWS, Control.Monad.CPSMaybe' |
1 (Type/Class) | Control.Monad.CPS.Maybe, Control.Monad.CPS |
2 (Data Constructor) | Control.Monad.CPS.Maybe, Control.Monad.CPS |
Control.Monad.CPS.RWS, Control.Monad.CPS.Writer, Control.Monad.CPSControl.Monad.CPS.Writer, Control.Monad.CPS.RWS, Control.Monad.CPSControl.Monad.CPS.RWS, Control.Monad.CPS.Writer, Control.Monad.CPSControl.Monad.CPS.Writer, Control.Monad.CPS.RWS, Control.Monad.CPSrunCont'Control.Monad.CPS.Cont, Control.Monad.CPS |
runRan | runMaybe'Control.Monad.CPS.RanControl.Monad.CPS.MaybeControl.Monad.CPS.RWS, Control.Monad.CPS.Writer, Control.Monad.CPS
unCodensity | Control.Monad.CPS.Codensity, Control.Monad.CPS |
unIdentity | Control.Monad.CPS.Identity, Control.Monad.CPS |
unReader | Control.Monad.CPS.Reader, Control.Monad.CPS |
unRWS | Control.Monad.CPS.RWS |
unWriter | Control.Monad.CPS.Writer, Control.Monad.CPS | Control.Monad.CPS.Writer, Control.Monad.CPS.RWS, Control.Monad.CPSmonad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.monad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.monad-cps-0.0.2: CPS implementations of common monads.monad-cps-0.0.3: CPS implementations of common monads.Control.Monad.CPS.Maybe | |
( Codensity(Codensity, unCodensity)
+ ( Codensity(Codensity, getCodensity)
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Codensity.html 18
-newtype Codensity f a = Codensity { unCodensity :: forall o. (a -> f o) -> f o }
+newtype Codensity f a = Codensity { getCodensity :: forall o. (a -> f o) -> f o }
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Codensity.html 29
- Codensity g >>= f = Codensity (\k -> g (\a -> unCodensity (f a) k))
+ Codensity g >>= f = Codensity (\k -> g (\a -> getCodensity (f a) k))
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Cont.html 17
- , 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))
+ , Cont'(..)
+ , runCont'
+ , module Control.Monad.Cont.Class
+ ) where
+
+import Control.Applicative
+import Control.Monad
+import Control.Monad.CPS.Codensity
+import Unsafe.Coerce
+import Control.Monad.Cont.Class
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Cont.html 28
-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))
-
-
-withCont :: ((b -> r) -> (a -> r)) -> Cont r a -> Cont r b
-withCont f (Cont g) = Cont (g . f)
-
-
-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))
+newtype Cont r a = Cont {getCont :: forall o. (a -> r) -> (r -> o) -> o}
+
+instance Functor (Cont r) where
+ fmap f (Cont g) = Cont (\k -> g (k . f))
+
+instance Applicative (Cont r) where
+ pure = return
+ (<*>) = ap
+
+instance Monad (Cont r) where
+ return a = Cont (\k z -> z (k a))
+ Cont g >>= f = Cont (\k -> g (\a -> getCont (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))
+
+
+withCont :: ((b -> r) -> (a -> r)) -> Cont r a -> Cont r b
+withCont f (Cont g) = Cont (g . f)
+
+
+instance MonadCont (Cont r) where
+ callCC f = Cont (\k -> getCont (f (\a -> Cont (\_ h -> (h . k) a))) k)
+
+shift :: ((a -> Cont s r) -> Cont r r) -> Cont r a
+shift f = Cont (\k -> getCont (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))
+
+
+newtype Cont' r a = Cont' { getCont' :: Codensity (Const r) a }
+ deriving (Functor,Applicative,Monad)
+
+instance MonadCont (Cont' r) where
+ callCC f = Cont' (Codensity (\k -> getCodensity (getCont' (f (\a -> Cont' (Codensity (\_ -> Const (getConst ((k a)))))))) k))
+
+runCont' :: Cont' r a -> (a -> r) -> r
+runCont' (Cont' f) k = getConst (getCodensity f (Const . k))
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Identity.html 10
- ( Identity(Identity, unIdentity)
+ ( Identity(Identity, getIdentity)
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Identity.html 17
-newtype Identity a = Identity {unIdentity :: forall o. (a -> o) -> o}
+newtype Identity a = Identity {getIdentity :: forall o. (a -> o) -> o}
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Identity.html 29
- Identity g >>= f = Identity (\k -> g (\a -> unIdentity (f a) k))
+ Identity g >>= f = Identity (\k -> g (\a -> getIdentity (f a) k))
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-RWS.html 11
- ( RWS(RWS,unRWS)
+ ( RWS(RWS,getRWS)
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-RWS.html 21
-newtype RWS r w s a = RWS { unRWS :: forall o. (a -> w -> s -> o) -> r -> s -> o }
+newtype RWS r w s a = RWS { getRWS :: forall o. (a -> w -> s -> o) -> r -> s -> o }
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-RWS.html 32
- RWS g >>= f = RWS (\k r -> g (\a w -> unRWS (f a) (\b w' -> k b (w `mappend` w')) r) r)
+ RWS g >>= f = RWS (\k r -> g (\a w -> getRWS (f a) (\b w' -> k b (w `mappend` w')) r) r)
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Ran.html 10
- ( Ran(Ran,runRan)
+ ( Ran(Ran,getRan)
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Ran.html 13
-newtype Ran g h a = Ran { runRan :: forall b. (a -> g b) -> h b }
+newtype Ran g h a = Ran { getRan :: forall b. (a -> g b) -> h b }
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Ran.html 16
- fmap f m = Ran (\k -> runRan m (k . f))
+ fmap f m = Ran (\k -> getRan m (k . f))
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Reader.html 11
- , Reader(Reader, unReader)
+ , Reader(Reader, getReader)
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Reader.html 19
-newtype Reader r a = Reader { unReader :: forall o. (a -> o) -> r -> o }
+newtype Reader r a = Reader { getReader :: forall o. (a -> o) -> r -> o }
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Reader.html 26
- Reader g >>= f = Reader (\k r -> g (\a -> unReader (f a) k r) r)
+ Reader g >>= f = Reader (\k r -> g (\a -> getReader (f a) k r) r)
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-State.html 23
-newtype State s a = State { unState :: forall o. (a -> s -> o) -> s -> o }
+newtype State s a = State { getState :: forall o. (a -> s -> o) -> s -> o }
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-State.html 34
- State g >>= f = State (\k -> g (\a -> unState (f a) k))
+ State g >>= f = State (\k -> g (\a -> getState (f a) k))
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-State.html 43
-newtype State' s a = State' { unState' :: Codensity ((->)s) a }
+newtype State' s a = State' { getState' :: Codensity ((->)s) a }
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-State.html 51
-runState' = flip unCodensity (,) . unState'
+runState' = flip getCodensity (,) . getState'
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Writer.html 12
- , Writer(Writer, unWriter)
+ , Writer(Writer, getWriter)
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Writer.html 24
-newtype Writer w a = Writer { unWriter :: forall o. (a -> w -> o) -> o }
+newtype Writer w a = Writer { getWriter :: forall o. (a -> w -> o) -> o }
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Writer.html 35
- Writer g >>= f = Writer (\k -> g (\a w -> unWriter (f a) (\a w' -> k a (w `mappend` w'))))
+ Writer g >>= f = Writer (\k -> g (\a w -> getWriter (f a) (\a w' -> k a (w `mappend` w'))))
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Writer.html 46
-newtype Writer' w a = Writer' { unWriter' :: forall o. (a -> w -> o) -> w -> o }
+newtype Writer' w a = Writer' { getWriter' :: forall o. (a -> w -> o) -> w -> o }
hunk ./doc/html/monad-cps/src/Control-Monad-CPS-Writer.html 57
- Writer' g >>= f = Writer' (\k -> g (\a -> unWriter' (f a) k))
+ Writer' g >>= f = Writer' (\k -> g (\a -> getWriter' (f a) k))
hunk ./doc/html/monad-cps/src/Control-Monad-CPS.html 10
- ( 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
+ ( module Control.Monad.CPS.Codensity
+ , module Control.Monad.CPS.Cont
+ , module Control.Monad.CPS.Identity
+ , module Control.Monad.CPS.Maybe
+ , module Control.Monad.CPS.Ran
+ , module Control.Monad.CPS.Reader
+ , module Control.Monad.CPS.State
+ , module Control.Monad.CPS.Writer
+ ) where
+
+import Control.Monad.CPS.Codensity
+import Control.Monad.CPS.Cont
+import Control.Monad.CPS.Identity
+import Control.Monad.CPS.Maybe
+import Control.Monad.CPS.Ran
+import Control.Monad.CPS.Reader
+import Control.Monad.CPS.State
+import Control.Monad.CPS.Writer
}
|