[Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Michael Snoyman
I'm wondering if anyone's run into this problem before, and if there's a common solution. In Yesod, we have applicative forms (based originally on formlets). These forms are instances of Applicative, but not of Monad. Let's consider a situation where we want to get some user input to fill out a

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread John Lato
It's not a solution per se, but it seems to me that there's no need for the Monad superclass constraint on MonadIO. If that were removed, we could just have class LiftIO t where liftIO :: IO a - t a and it would Just Work. On Tue, Oct 1, 2013 at 1:58 AM, Michael Snoyman

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Alexey Uimanov
Maybe this is needed new typeclass ApplicativeTrans? 2013/10/1 Michael Snoyman mich...@snoyman.com I'm wondering if anyone's run into this problem before, and if there's a common solution. In Yesod, we have applicative forms (based originally on formlets). These forms are instances of

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread MigMit
What about (Compose Form IO) Blog type? Form is Applicative, IO — the same, their composition should be Applicative as well (one good thing about Applicatives — they really compose). Take a look at Control.Compose module. Отправлено с iPad 01 окт. 2013 г., в 10:58, Michael Snoyman

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Niklas Haas
On Tue, 1 Oct 2013 02:21:13 -0500, John Lato jwl...@gmail.com wrote: It's not a solution per se, but it seems to me that there's no need for the Monad superclass constraint on MonadIO. If that were removed, we could just have class LiftIO t where liftIO :: IO a - t a and it would

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Jose A. Lopes
On Tue, Oct 01, 2013 at 09:29:00AM +0200, Niklas Haas wrote: On Tue, 1 Oct 2013 02:21:13 -0500, John Lato jwl...@gmail.com wrote: It's not a solution per se, but it seems to me that there's no need for the Monad superclass constraint on MonadIO. If that were removed, we could just have

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Oliver Charles
On 10/01/2013 07:58 AM, Michael Snoyman wrote: I'm wondering if anyone's run into this problem before, and if there's a common solution. In Yesod, we have applicative forms (based originally on formlets). These forms are instances of Applicative, but not of Monad. Let's consider a situation

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Tom Ellis
On Tue, Oct 01, 2013 at 09:29:00AM +0200, Niklas Haas wrote: On Tue, 1 Oct 2013 02:21:13 -0500, John Lato jwl...@gmail.com wrote: It's not a solution per se, but it seems to me that there's no need for the Monad superclass constraint on MonadIO. If that were removed, we could just have

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Roman Cheplyaka
* Tom Ellis tom-lists-haskell-cafe-2...@jaguarpaw.co.uk [2013-10-01 09:20:23+0100] On Tue, Oct 01, 2013 at 09:29:00AM +0200, Niklas Haas wrote: On Tue, 1 Oct 2013 02:21:13 -0500, John Lato jwl...@gmail.com wrote: It's not a solution per se, but it seems to me that there's no need for

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Dan Burton
From what you've said, it sounds like you can already write: serverSide :: IO a - Form a This seems elegant enough to me for your needs. Just encourage it as an idiom specific to Forms. myBlogForm = Blog $ titleForm * serverSide getCurrentTime * contentsForm Could you abstract

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Tom Ellis
On Tue, Oct 01, 2013 at 12:11:23PM +0300, Roman Cheplyaka wrote: Shouldn't it be an *Applicative* constraint? class Applicative t = ApplicativeIO t where liftIO :: IO a - t a and require that liftIO (pure x) = pure x liftIO (f * x) = liftIO f * liftIO x

[Haskell-cafe] Haskell.org design is broken

2013-10-01 Thread Roman Cheplyaka
There is now a big white stripe in the Haskell.org's header (see the screenshot). Roman attachment: haskellorg.png signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Yitzchak Gale
Tom Ellis wrote: Shouldn't it be an *Applicative* constraint? class Applicative t = ApplicativeIO t where liftIO :: IO a - t a and require that liftIO (pure x) = pure x liftIO (f * x) = liftIO f * liftIO x Seems like ApplicativeIO makes more sense than MonadIO, which

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Yitzchak Gale
Dan Burton wrote: From what you've said, it sounds like you can already write: serverSide :: IO a - Form a This seems elegant enough to me for your needs. Just encourage it as an idiom specific to Forms. myBlogForm = Blog $ titleForm * serverSide getCurrentTime * contentsForm

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Tom Ellis
On Tue, Oct 01, 2013 at 03:17:40PM +0300, Yitzchak Gale wrote: Tom Ellis wrote: Shouldn't it be an *Applicative* constraint? class Applicative t = ApplicativeIO t where liftIO :: IO a - t a and require that liftIO (pure x) = pure x liftIO (f * x) = liftIO f *

[Haskell-cafe] [ANN] fclabels 2.0

2013-10-01 Thread Sebastiaan Visser
Hello everyone, I’m excited to announce a brand new major version of fclabels. This library provides first class labels that can act as bidirectional record fields. The labels are implemented as lenses. This new version contains some interesting new features like support for polymorphic updates

Re: [Haskell-cafe] HTML framework for web-ui

2013-10-01 Thread Christopher Done
Threepenny is now ready for public consumption, FIW. On 23 May 2013 08:34, Vlatko Basic vlatko.ba...@gmail.com wrote: Hi Heinrich, Looks simple and interesting. I browsed the git, but not much docs yet. Just examples, or have I looked at wrong places? I see that API is still under heavy

Re: [Haskell-cafe] Haskell.org design is broken

2013-10-01 Thread Dan Burton
The offending HTML is on line 93: pbr//p When I delete this paragraph element from the DOM, the ugly white bar goes away. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Haskell.org design is broken

2013-10-01 Thread Dan Burton
Apparently that element is generated by the wiki software, since most pages want the view source / history buttons above the rest of the content. jQuery('#mw-content-text p:first').hide() -- Dan Burton On Tue, Oct 1, 2013 at 8:17 AM, Dan Burton danburton.em...@gmail.comwrote: The offending

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Michael Snoyman
On Tue, Oct 1, 2013 at 12:15 PM, Dan Burton danburton.em...@gmail.comwrote: From what you've said, it sounds like you can already write: serverSide :: IO a - Form a This seems elegant enough to me for your needs. Just encourage it as an idiom specific to Forms. myBlogForm = Blog $

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Michael Snoyman
On Tue, Oct 1, 2013 at 10:24 AM, Alexey Uimanov s9gf4...@gmail.com wrote: Maybe this is needed new typeclass ApplicativeTrans? There's actually no problem with defining a MonadTrans instance for non-monads. Obviously this can't follow the laws directly (since they're defined in terms of

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Alberto G. Corona
In MFow there is a Monad instance for formlets that make a lot of sense. Apart from using liftIO inside an applicative formlets it can do it that way also: myBlogForm = do t - liftIO getTime Blog $ titleForm * return t * contentsForm Which may look contrived, but instead of using

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Alexander Solla
On Mon, Sep 30, 2013 at 11:58 PM, Michael Snoyman mich...@snoyman.comwrote: I'm wondering if anyone's run into this problem before, and if there's a common solution. I ran into it, asked about it on SO, and followed your advice. :) ___ Haskell-Cafe

[Haskell-cafe] Haskell Logo Macbook Decal

2013-10-01 Thread Ryan Trinkle
Hi everyone, I put together a Haskell logo decal designed to fit over the Apple logo on a MacBook, and had a few made by macdecals.com. They came out great! They're available here: http://www.macdecals.com/macbook-haskell . My share of the proceeds will go to haskell.org, and macdecals.com has

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread John Wiegley
Yitzchak Gale g...@sefer.org writes: In fact, it even makes sense to define it as FunctorIO, with the only laws being that liftIO commutes with fmap and preserves id, i.e., that it is a natural transformation. (Those laws are also needed for ApplicativeIO and MonadIO.) Given that we are

Re: [Haskell-cafe] Lifting IO actions into Applicatives

2013-10-01 Thread Dan Burton
Interesting. It's similar in spirit to basically a safe Coerce typeclass, but for * - * types. class Coerce a b where coerce :: a - b class Coerce1 f g where coerce1 :: f a - g a -- Dan Burton On Tue, Oct 1, 2013 at 11:00 AM, John Wiegley jo...@fpcomplete.com wrote:

[Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-01 Thread Ryan Newton
Hello all, Normally, we don't worry *too* much about incorrect instances of standard classes (Num, Eq, Ord) etc. They make the user's program wrong, but they don't compromise the type system. Unfortunately, with the LVish parallel programming library we do have a situation where incorrect

Re: [Haskell-cafe] Any precedent or plan for guaranteed-safe Eq and Ord instances?

2013-10-01 Thread Ryan Newton
Here are some examples: - data Foo = Bar | Baz instance Eq Foo where _ == _ = True instance Ord Foo where compare Bar Bar = EQ compare Bar Baz = LT compare _ _ = error I'm partial! - These would

Re: [Haskell-cafe] Haskell Logo Macbook Decal

2013-10-01 Thread Kyle Hanson
I ordered mine! Does anyone know if there is any place where I could order pre-made Haskell t-shirt that benefits haskell.org too? -- Kyle On Tue, Oct 1, 2013 at 10:23 AM, Ryan Trinkle ryan.trin...@gmail.comwrote: Hi everyone, I put together a Haskell logo decal designed to fit over the

Re: [Haskell-cafe] Haskell Logo Macbook Decal

2013-10-01 Thread David Johnson
Bought the white one. On Tue, Oct 1, 2013 at 5:50 PM, Kyle Hanson hanoo...@gmail.com wrote: I ordered mine! Does anyone know if there is any place where I could order pre-made Haskell t-shirt that benefits haskell.org too? -- Kyle On Tue, Oct 1, 2013 at 10:23 AM, Ryan Trinkle

Re: [Haskell-cafe] Haskell Logo Macbook Decal

2013-10-01 Thread Jason Dagit
On Tue, Oct 1, 2013 at 3:50 PM, Kyle Hanson hanoo...@gmail.com wrote: I ordered mine! Does anyone know if there is any place where I could order pre-made Haskell t-shirt that benefits haskell.org too? I don't know where, but I just wanted to say thank you to both you and Ryan and everyone

[Haskell-cafe] [ANN] lvish 1.0 -- successor to monad-par

2013-10-01 Thread Ryan Newton
Hi all, I'm pleased to announce the release of our new parallel-programming library, LVish: hackage.haskell.org/package/lvish It provides a Par monad similar to the monad-par package, but generalizes the model to include data-structures other than single-assignment variables (IVars). For