Proposal: give a field name to Data.Ord.Down

It's awkward to write a lambda to unwrap this kind of wrappers. I propose newtype Down a = Down { getDown :: a } with the Show/Read instances as if they didn't have named fields. The same goes for Control.Arrow.ArrowMonad, although I'm not sure about its usefulness...

I have needed this many times.
On Thu, May 2, 2019 at 10:56 PM Fumiaki Kinoshita
It's awkward to write a lambda to unwrap this kind of wrappers. I propose
newtype Down a = Down { getDown :: a }
with the Show/Read instances as if they didn't have named fields.
The same goes for Control.Arrow.ArrowMonad, although I'm not sure about its usefulness... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

I just added `Down` to the RIO prelude, and the absence of a deconstructor
was my #1 concern about doing so. It invites another package to provide an
alternative, and we avoid including things with actively competing
implementations. I'd much rather see this handled in `base`.
(I'd rather have it named `unDown`, so as not to steal the name `getDown`
from the heroes who will pair it with `getFunky`. But that's a lesser
concern.)
On Thu, May 2, 2019 at 8:13 PM davean
I have needed this many times.
On Thu, May 2, 2019 at 10:56 PM Fumiaki Kinoshita
wrote: It's awkward to write a lambda to unwrap this kind of wrappers. I propose
newtype Down a = Down { getDown :: a }
with the Show/Read instances as if they didn't have named fields.
The same goes for Control.Arrow.ArrowMonad, although I'm not sure about its usefulness... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

+1 from me, with no preference between getDown and runDown -Edward
On May 3, 2019, at 1:13 PM, davean
wrote: I have needed this many times.
On Thu, May 2, 2019 at 10:56 PM Fumiaki Kinoshita
wrote: It's awkward to write a lambda to unwrap this kind of wrappers. I propose newtype Down a = Down { getDown :: a }
with the Show/Read instances as if they didn't have named fields.
The same goes for Control.Arrow.ArrowMonad, although I'm not sure about its usefulness... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

+1 from me, but the field name should be "up".
On Sat, May 4, 2019, 02:29 Edward Kmett
+1 from me, with no preference between getDown and runDown
-Edward
On May 3, 2019, at 1:13 PM, davean
wrote: I have needed this many times.
On Thu, May 2, 2019 at 10:56 PM Fumiaki Kinoshita
wrote: It's awkward to write a lambda to unwrap this kind of wrappers. I propose
newtype Down a = Down { getDown :: a }
with the Show/Read instances as if they didn't have named fields.
The same goes for Control.Arrow.ArrowMonad, although I'm not sure about its usefulness... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

I can getDown with this. +1
On Sat, May 4, 2019, 4:17 AM Zemyla
+1 from me, but the field name should be "up".
On Sat, May 4, 2019, 02:29 Edward Kmett
wrote: +1 from me, with no preference between getDown and runDown
-Edward
On May 3, 2019, at 1:13 PM, davean
wrote: I have needed this many times.
On Thu, May 2, 2019 at 10:56 PM Fumiaki Kinoshita
wrote: It's awkward to write a lambda to unwrap this kind of wrappers. I propose
newtype Down a = Down { getDown :: a }
with the Show/Read instances as if they didn't have named fields.
The same goes for Control.Arrow.ArrowMonad, although I'm not sure about its usefulness... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

+1
On Sat, May 4, 2019 at 10:08 AM Elliot Cameron
I can getDown with this. +1
On Sat, May 4, 2019, 4:17 AM Zemyla
wrote: +1 from me, but the field name should be "up".
On Sat, May 4, 2019, 02:29 Edward Kmett
wrote: +1 from me, with no preference between getDown and runDown
-Edward
On May 3, 2019, at 1:13 PM, davean
wrote: I have needed this many times.
On Thu, May 2, 2019 at 10:56 PM Fumiaki Kinoshita
wrote: It's awkward to write a lambda to unwrap this kind of wrappers. I propose
newtype Down a = Down { getDown :: a }
with the Show/Read instances as if they didn't have named fields.
The same goes for Control.Arrow.ArrowMonad, although I'm not sure about its usefulness... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

+1
On Thu, May 2, 2019, 10:56 PM Fumiaki Kinoshita
It's awkward to write a lambda to unwrap this kind of wrappers. I propose
newtype Down a = Down { getDown :: a }
with the Show/Read instances as if they didn't have named fields.
The same goes for Control.Arrow.ArrowMonad, although I'm not sure about its usefulness... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

+1
On Sun., 5 May 2019, 06:21 chessai .,
+1
On Thu, May 2, 2019, 10:56 PM Fumiaki Kinoshita
wrote: It's awkward to write a lambda to unwrap this kind of wrappers. I propose
newtype Down a = Down { getDown :: a }
with the Show/Read instances as if they didn't have named fields.
The same goes for Control.Arrow.ArrowMonad, although I'm not sure about its usefulness... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

+1. I do prefer getDown as the field name, but anything is better than nothing. Sent from my iPhone
On May 4, 2019, at 9:49 PM, George Wilson
wrote: +1
On Sun., 5 May 2019, 06:21 chessai .,
wrote: +1 On Thu, May 2, 2019, 10:56 PM Fumiaki Kinoshita
wrote: It's awkward to write a lambda to unwrap this kind of wrappers. I propose newtype Down a = Down { getDown :: a }
with the Show/Read instances as if they didn't have named fields.
The same goes for Control.Arrow.ArrowMonad, although I'm not sure about its usefulness... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
participants (10)
-
Andrew Martin
-
Carter Schonwald
-
chessai .
-
davean
-
Edward Kmett
-
Elliot Cameron
-
Fumiaki Kinoshita
-
George Wilson
-
Theodore Lief Gannon
-
Zemyla