Eric Mertens | 14 Oct 18:33 2013
Picon

Proposal: Add common instances for Control.Applicative.Const

Hello,

It would be handy for Control.Applicative.Const to have the various derivable instances (Eq, Ord, Read, Show).

In particular Read and Show would make debugging easier.

--
Eric Mertens
_______________________________________________
Libraries mailing list
Libraries <at> haskell.org
http://www.haskell.org/mailman/listinfo/libraries
David Luposchainsky | 14 Oct 19:55 2013

Re: Proposal: Add common instances for Control.Applicative.Const

On 2013-10-14 18:33, Eric Mertens wrote:
> It would be handy for Control.Applicative.Const to have the various
> derivable instances (Eq, Ord, Read, Show).

Let me ask the other way round: is there ever a reason to *not* add
these instances if they're possible and unambiguous?

David
Edward Kmett | 14 Oct 20:32 2013
Picon

Re: Proposal: Add common instances for Control.Applicative.Const

There is a somewhat weak prescriptive argument that one shouldn't use these things for long term usage, e.g. that you put, say a WrappedMonad shim on just for long enough to pass something and get a different dictionary, but really the result is it just makes code harder to test, debug and work with at a REPL and raises the question of what components should people be using when they DO need to embed such a thing in a place where it winds up visible or stored in a container.

I'm generally positive on adding these kinds of instances, especially where they don't require us to go out and lean on UndecidableInstances and the like.

-Edward


On Mon, Oct 14, 2013 at 1:55 PM, David Luposchainsky <dluposchainsky <at> googlemail.com> wrote:
On 2013-10-14 18:33, Eric Mertens wrote:
> It would be handy for Control.Applicative.Const to have the various
> derivable instances (Eq, Ord, Read, Show).

Let me ask the other way round: is there ever a reason to *not* add
these instances if they're possible and unambiguous?

David
_______________________________________________
Libraries mailing list
Libraries <at> haskell.org
http://www.haskell.org/mailman/listinfo/libraries

_______________________________________________
Libraries mailing list
Libraries <at> haskell.org
http://www.haskell.org/mailman/listinfo/libraries
Edward Kmett | 14 Oct 20:28 2013
Picon

Re: Proposal: Add common instances for Control.Applicative.Const

+1 for me


On Mon, Oct 14, 2013 at 12:33 PM, Eric Mertens <emertens <at> gmail.com> wrote:
Hello,

It would be handy for Control.Applicative.Const to have the various derivable instances (Eq, Ord, Read, Show).

In particular Read and Show would make debugging easier.

--
Eric Mertens

_______________________________________________
Libraries mailing list
Libraries <at> haskell.org
http://www.haskell.org/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
Libraries <at> haskell.org
http://www.haskell.org/mailman/listinfo/libraries
Ross Paterson | 14 Oct 23:03 2013
Picon

Re: Proposal: Add common instances for Control.Applicative.Const

On Mon, Oct 14, 2013 at 09:33:38AM -0700, Eric Mertens wrote:
> It would be handy for Control.Applicative.Const to have the various derivable
> instances (Eq, Ord, Read, Show).
> 
> In particular Read and Show would make debugging easier.

I'd suggest redefining getConst as a function rather than a field to
make the derived Read and Show instances simpler.  Ditto WrappedMonad.
Edward Kmett | 15 Oct 01:43 2013
Picon

Re: Proposal: Add common instances for Control.Applicative.Const

Alternately we could just hand-roll the instances so it doesn't change whether it gets imported if the user writes 

import Control.Applicative (Const(..))

but I agree with simplifying the presentation.



On Mon, Oct 14, 2013 at 5:03 PM, Ross Paterson <R.Paterson <at> city.ac.uk> wrote:
On Mon, Oct 14, 2013 at 09:33:38AM -0700, Eric Mertens wrote:
> It would be handy for Control.Applicative.Const to have the various derivable
> instances (Eq, Ord, Read, Show).
>
> In particular Read and Show would make debugging easier.

I'd suggest redefining getConst as a function rather than a field to
make the derived Read and Show instances simpler.  Ditto WrappedMonad.
_______________________________________________
Libraries mailing list
Libraries <at> haskell.org
http://www.haskell.org/mailman/listinfo/libraries

_______________________________________________
Libraries mailing list
Libraries <at> haskell.org
http://www.haskell.org/mailman/listinfo/libraries
Ross Paterson | 15 Oct 02:02 2013
Picon

Re: Proposal: Add common instances for Control.Applicative.Const

On Mon, Oct 14, 2013 at 07:43:31PM -0400, Edward Kmett wrote:
> Alternately we could just hand-roll the instances so it doesn't change whether
> it gets imported if the user writes 
> 
> import Control.Applicative (Const(..))
> 
> but I agree with simplifying the presentation.

Hand-rolling is possible, but it's more transparent to use the derived
instances.

Gmane