Cool. 
You can just use “data” in replacement of “newtype”. It makes no difference to 
the generated code. 

It would be cool to hear more about your project!

Cheers
Dierk

sent from:mobile 

> Am 17.11.2017 um 11:13 schrieb zhou6...@163.com:
> 
> In scheme, I can implement my co-routine by defining a function like this:
> 
> (define (spawn prog)
>  (call/cc
>   (lambda (start)
>     (let ((suspend (lambda ()
>                 (call/cc
>                  (lambda (k)
>                        (start k))))))
>       (prog suspend)))))
> 
> Recently I use Frege to program android, I notice that  Control.Monad.Cont is 
> not available, I try to define it follow the book 
> https://en.wikibooks.org/wiki/Haskell/Continuation_passing_style
> 
> newtype Cont r a = Cont { runCont :: ((a -> r) -> r) } -- r is the final 
> result type of the whole computation 
>  
> instance Monad (Cont r) where 
>     return a       = Cont $ \k -> k a                       -- i.e. return a 
> = \k -> k a 
>     (Cont c) >>= f = Cont $ \k -> c (\a -> runCont (f a) k) -- i.e. c >>= f = 
> \k -> c (\a -> f a k)
> 
> But no luck, 'newtype' is not supported by Frege
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Frege Programming Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to frege-programming-language+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Frege Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to frege-programming-language+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to