Re: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Miguel Mitrofanov
On 19 May 2009, at 09:06, Ryan Ingram wrote: This is a common problem with trying to use do-notation; there are some cases where you can't make the object an instance of Monad. The same problem holds for Data.Set; you'd can write setBind :: Ord b = Set a - (a - Set b) - Set b setBind m f =

Re: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Jason Dusek
2009/05/18 Miguel Mitrofanov miguelim...@yandex.ru: On 19 May 2009, at 09:06, Ryan Ingram wrote: This is a common problem with trying to use do-notation; there are some cases where you can't make the object an instance of Monad.  The same problem holds for Data.Set; you'd can write setBind

Re: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Taral
On Mon, May 18, 2009 at 10:06 PM, Ryan Ingram ryani.s...@gmail.com wrote: On Mon, May 18, 2009 at 3:05 PM, Taral tar...@gmail.com wrote: Will this do? (=) :: (NFData sa, NFData b) = LI sa - (sa - LI b) - LI b No, the problem is that = on monads has no constraints, it must have the type LI

[Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Henning Thielemann
On Mon, 18 May 2009, Nicolas Pouillard wrote: Excerpts from Jason Dusek's message of Sun May 17 15:45:25 +0200 2009: From the documentation: LI could be a strict monad and a strict applicative functor. However it is not a lazy monad nor a lazy applicative functor as required

[Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Nicolas Pouillard
Excerpts from Taral's message of Tue May 19 00:05:39 +0200 2009: On Mon, May 18, 2009 at 10:30 AM, Nicolas Pouillard nicolas.pouill...@gmail.com wrote: The type I would need for bind is this one:  (=) :: NFData sa = LI sa - (sa - LI b) - LI b Will this do? (=) :: (NFData sa, NFData

Re: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Ryan Ingram
To be fair, you can do this with some extensions; I first saw this in a paper on Oleg's site [1]. Here's some sample code: {-# LANGUAGE NoImplicitPrelude, TypeFamilies, MultiParamTypeClasses #-} module SetMonad where import qualified Data.Set as S import qualified Prelude as P (Monad, (=), (),

Re: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Miguel Mitrofanov
I've posted it once or twice. newtype C m r a = C ((a - m r) - m r) It's a monad, regardless of whether m is one or not. If you have something like return and bind, but not exactly the same, you can make casting functions m a - C m r a and backwards. Jason Dusek wrote on 19.05.2009 10:23:

Re: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Nicolas Pouillard
Excerpts from Ryan Ingram's message of Tue May 19 10:23:01 +0200 2009: To be fair, you can do this with some extensions; I first saw this in a paper on Oleg's site [1]. Here's some sample code: This seems like the same trick as the rmonad package:

Re: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Ryan Ingram
Minor addition, optimize (I couldn't help myself!) -- ryan instance Ord b = ConstrainedBind (S.Set a) (S.Set b) where type BindElem (S.Set a) = a m = f = S.unions $ map f $ S.toList m m n = if S.null m then S.empty else n ___

RE: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Sittampalam, Ganesh
Nicolas Pouillard wrote: Excerpts from Ryan Ingram's message of Tue May 19 10:23:01 +0200 2009: To be fair, you can do this with some extensions; I first saw this in a paper on Oleg's site [1]. Here's some sample code: This seems like the same trick as the rmonad package:

Re: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-19 Thread Ryan Ingram
On Tue, May 19, 2009 at 12:54 AM, Miguel Mitrofanov miguelim...@yandex.ru wrote: I've posted it once or twice. newtype C m r a = C ((a - m r) - m r) It's a monad, regardless of whether m is one or not. If you have something like return and bind, but not exactly the same, you can make casting

[Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-18 Thread Nicolas Pouillard
Excerpts from Jason Dusek's message of Sun May 17 15:45:25 +0200 2009: From the documentation: LI could be a strict monad and a strict applicative functor. However it is not a lazy monad nor a lazy applicative functor as required Haskell. Hopefully it is a lazy (pointed)

[Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-18 Thread Taral
On Mon, May 18, 2009 at 10:30 AM, Nicolas Pouillard nicolas.pouill...@gmail.com wrote: The type I would need for bind is this one:  (=) :: NFData sa = LI sa - (sa - LI b) - LI b Will this do? (=) :: (NFData sa, NFData b) = LI sa - (sa - LI b) - LI b -- Taral tar...@gmail.com Please let me

Re: [Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-18 Thread Ryan Ingram
On Mon, May 18, 2009 at 3:05 PM, Taral tar...@gmail.com wrote: Will this do? (=) :: (NFData sa, NFData b) = LI sa - (sa - LI b) - LI b No, the problem is that = on monads has no constraints, it must have the type LI a - (a - LI b) - LI b This is a common problem with trying to use

[Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-05-17 Thread Jason Dusek
From the documentation: LI could be a strict monad and a strict applicative functor. However it is not a lazy monad nor a lazy applicative functor as required Haskell. Hopefully it is a lazy (pointed) functor at least. I'd like to understand this better -- how is LI

[Haskell-cafe] Re: [Haskell] [ANN] Safe Lazy IO in Haskell

2009-03-20 Thread Felipe Lessa
On Fri, Mar 20, 2009 at 07:42:28PM +0100, Nicolas Pouillard wrote: We have good news (nevertheless we hope) for all the lazy guys standing there. Since their birth, lazy IOs have been a great way to modularly leverage all the good things we have with *pure*, *lazy*, *Haskell* functions to the