Haskell w/ delimited continuations

My understanding of these things is limited, but what would stop me,
theoretically speaking, of making a version of ghc with these
primitives added:
type Prompt r
reset :: (Prompt r -> r) -> r
shift :: Prompt r -> ((a -> _) -> r) -> a
(Where _ is either r or forall b. b)
--
Taral

You might want to take a look at
http://www.haskell.org/pipermail/haskell/2007-December/020034.html
which shows an implementation of delimited continuations in Haskell98
and possibly gets rid of any requirement of implementing primitives.
-- ryan
On 2/22/08, Taral
My understanding of these things is limited, but what would stop me, theoretically speaking, of making a version of ghc with these primitives added:
type Prompt r
reset :: (Prompt r -> r) -> r shift :: Prompt r -> ((a -> _) -> r) -> a
(Where _ is either r or forall b. b)
-- Taral
"Please let me know if there's any further trouble I can give you." -- Unknown _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

See also, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/CC-delcont "An implementation of multi-prompt delimited continuations based on the paper, A Monadic Framework for Delimited Continuations, by R. Kent Dybvig, Simon Peyton Jones and Amr Sabry" reset :: MonadDelimitedCont p s m => (p a -> m a) -> m a shift :: MonadDelimitedCont p s m => p b -> ((m a -> m b) -> m b) -> m a ryani.spam:
You might want to take a look at http://www.haskell.org/pipermail/haskell/2007-December/020034.html
which shows an implementation of delimited continuations in Haskell98 and possibly gets rid of any requirement of implementing primitives.
-- ryan
On 2/22/08, Taral
wrote: My understanding of these things is limited, but what would stop me, theoretically speaking, of making a version of ghc with these primitives added:
type Prompt r
reset :: (Prompt r -> r) -> r shift :: Prompt r -> ((a -> _) -> r) -> a
(Where _ is either r or forall b. b)
-- Taral
"Please let me know if there's any further trouble I can give you." -- Unknown _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 2/22/08, Taral
reset :: (Prompt r -> r) -> r shift :: Prompt r -> ((a -> _) -> r) -> a
The point of the question is about shift/reset with *these types*. I
know there are implementations with other types.
--
Taral

On Fri, 2008-02-22 at 14:27 -0800, Taral wrote:
On 2/22/08, Taral
wrote: reset :: (Prompt r -> r) -> r shift :: Prompt r -> ((a -> _) -> r) -> a
The point of the question is about shift/reset with *these types*. I know there are implementations with other types.
Nothing but sanity is stopping you. If you make a new language, you can do whatever you like. However, with shift and reset you can represent any effect, so you would utterly lose purity.

On 2/22/08, Derek Elkins
Nothing but sanity is stopping you. If you make a new language, you can do whatever you like. However, with shift and reset you can represent any effect, so you would utterly lose purity.
Can you give an example of an impure function created using these primitives?
--
Taral

On Fri, 2008-02-22 at 15:13 -0800, Taral wrote:
On 2/22/08, Derek Elkins
wrote: Nothing but sanity is stopping you. If you make a new language, you can do whatever you like. However, with shift and reset you can represent any effect, so you would utterly lose purity.
Can you give an example of an impure function created using these primitives?
shift and reset but see these slides http://cs.ioc.ee/mpc-amast06/msfp/filinski-slides.pdf and/or one or both of http://citeseer.ist.psu.edu/filinski94representing.html http://citeseer.ist.psu.edu/filinski99representing.html

On Fri, 2008-02-22 at 19:04 -0800, Taral wrote:
On 2/22/08, Derek Elkins
wrote: shift and reset
I was under the impression that reset was a pure function. What side effects does it have?
It depends on how you define "pure function". It's not particularly relevant and I mostly included it as I consider them a pair.
participants (4)
-
Derek Elkins
-
Don Stewart
-
Ryan Ingram
-
Taral