From carter.schonwald at gmail.com Tue Mar 3 20:28:20 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 3 Mar 2020 15:28:20 -0500 Subject: Improved interface to UArray In-Reply-To: References: Message-ID: Hey Zemyla! one fuzzy question i have, and perhaps you have a perspective on this, would/could the PrimMonad machinery in primitive help simplify / clean up stuff here too? On Mon, Feb 24, 2020 at 9:46 AM Zemyla wrote: > It's currently hard to describe that a type should be usable with UArray > or IOUArray, and almost impossible to describe without QualifiedConstraints > that it should be usable with STUArray. And it's actually impossible to use > GeneralizedNewtypeDeriving to derive new instances of IArray or MArray. It > also means that it's difficult to keep the three sets of instances in sync. > > Therefore, there should be (taking inspiration from primitive) a class > that describes types which can be used in unboxed arrays. It'd be something > along the lines of: > > class Unboxed e where > unsafeNewUArray :: Int# -> e -> State# s -> (# State# s, > MutableByteArray# s #) > unsafeNewUArray_ :: Const (Int# -> State# s -> (# State# s, > MutableByteArray# s #)) e > unsafeReadUArray :: MutableByteArray# s -> Int# -> State# s -> (# State# > s, e #) > unsafeWriteUArray :: MutableByteArray# s -> Int# -> e -> State# s -> > State# s > unsafeIndexUArray :: ByteArray# -> Int# -> e > > And then the instances for UArray, STUArray, and IOUArray would be: > > instance Unboxed e => IArray UArray e where ... > instance Unboxed e => MArray IOUArray e IO where ... > instance Unboxed e => MArray (STUArray s) e (ST s) where ... > > Incidentally, this also means it'd be less effort to add instances like > Unboxed CInt, Unboxed a => Unboxed (Complex a), and Unboxed Ordering. > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zemyla at gmail.com Tue Mar 3 20:30:42 2020 From: zemyla at gmail.com (Zemyla) Date: Tue, 3 Mar 2020 14:30:42 -0600 Subject: Improved interface to UArray In-Reply-To: References: Message-ID: We should probably use something similar, but I don't think a dependency on primitive is a good idea. On Tue, Mar 3, 2020, 14:28 Carter Schonwald wrote: > Hey Zemyla! > one fuzzy question i have, and perhaps you have a perspective on this, > would/could the PrimMonad machinery in primitive help simplify / clean up > stuff here too? > > On Mon, Feb 24, 2020 at 9:46 AM Zemyla wrote: > >> It's currently hard to describe that a type should be usable with UArray >> or IOUArray, and almost impossible to describe without QualifiedConstraints >> that it should be usable with STUArray. And it's actually impossible to use >> GeneralizedNewtypeDeriving to derive new instances of IArray or MArray. It >> also means that it's difficult to keep the three sets of instances in sync. >> >> Therefore, there should be (taking inspiration from primitive) a class >> that describes types which can be used in unboxed arrays. It'd be something >> along the lines of: >> >> class Unboxed e where >> unsafeNewUArray :: Int# -> e -> State# s -> (# State# s, >> MutableByteArray# s #) >> unsafeNewUArray_ :: Const (Int# -> State# s -> (# State# s, >> MutableByteArray# s #)) e >> unsafeReadUArray :: MutableByteArray# s -> Int# -> State# s -> (# >> State# s, e #) >> unsafeWriteUArray :: MutableByteArray# s -> Int# -> e -> State# s -> >> State# s >> unsafeIndexUArray :: ByteArray# -> Int# -> e >> >> And then the instances for UArray, STUArray, and IOUArray would be: >> >> instance Unboxed e => IArray UArray e where ... >> instance Unboxed e => MArray IOUArray e IO where ... >> instance Unboxed e => MArray (STUArray s) e (ST s) where ... >> >> Incidentally, this also means it'd be less effort to add instances like >> Unboxed CInt, Unboxed a => Unboxed (Complex a), and Unboxed Ordering. >> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chessai1996 at gmail.com Tue Mar 3 20:56:29 2020 From: chessai1996 at gmail.com (chessai .) Date: Tue, 3 Mar 2020 12:56:29 -0800 Subject: Improved interface to UArray In-Reply-To: References: Message-ID: Zemlya, could you expound on why you think a primitive dependency is a bad idea? I'm just not sure what reasons you have in mind. Thanks On Tue, Mar 3, 2020, 12:31 PM Zemyla wrote: > We should probably use something similar, but I don't think a dependency > on primitive is a good idea. > > On Tue, Mar 3, 2020, 14:28 Carter Schonwald > wrote: > >> Hey Zemyla! >> one fuzzy question i have, and perhaps you have a perspective on this, >> would/could the PrimMonad machinery in primitive help simplify / clean up >> stuff here too? >> >> On Mon, Feb 24, 2020 at 9:46 AM Zemyla wrote: >> >>> It's currently hard to describe that a type should be usable with UArray >>> or IOUArray, and almost impossible to describe without QualifiedConstraints >>> that it should be usable with STUArray. And it's actually impossible to use >>> GeneralizedNewtypeDeriving to derive new instances of IArray or MArray. It >>> also means that it's difficult to keep the three sets of instances in sync. >>> >>> Therefore, there should be (taking inspiration from primitive) a class >>> that describes types which can be used in unboxed arrays. It'd be something >>> along the lines of: >>> >>> class Unboxed e where >>> unsafeNewUArray :: Int# -> e -> State# s -> (# State# s, >>> MutableByteArray# s #) >>> unsafeNewUArray_ :: Const (Int# -> State# s -> (# State# s, >>> MutableByteArray# s #)) e >>> unsafeReadUArray :: MutableByteArray# s -> Int# -> State# s -> (# >>> State# s, e #) >>> unsafeWriteUArray :: MutableByteArray# s -> Int# -> e -> State# s -> >>> State# s >>> unsafeIndexUArray :: ByteArray# -> Int# -> e >>> >>> And then the instances for UArray, STUArray, and IOUArray would be: >>> >>> instance Unboxed e => IArray UArray e where ... >>> instance Unboxed e => MArray IOUArray e IO where ... >>> instance Unboxed e => MArray (STUArray s) e (ST s) where ... >>> >>> Incidentally, this also means it'd be less effort to add instances like >>> Unboxed CInt, Unboxed a => Unboxed (Complex a), and Unboxed Ordering. >>> _______________________________________________ >>> Libraries mailing list >>> Libraries at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>> >> _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zemyla at gmail.com Tue Mar 3 22:14:25 2020 From: zemyla at gmail.com (Zemyla) Date: Tue, 3 Mar 2020 16:14:25 -0600 Subject: Improved interface to UArray In-Reply-To: References: Message-ID: Because a lot of the stuff is defined in GHC.Arr, in base. Also, the Prim instance for Bool is different than the UArray instance for Bool. On Tue, Mar 3, 2020, 14:56 chessai . wrote: > Zemlya, could you expound on why you think a primitive dependency is a bad > idea? I'm just not sure what reasons you have in mind. > > Thanks > > On Tue, Mar 3, 2020, 12:31 PM Zemyla wrote: > >> We should probably use something similar, but I don't think a dependency >> on primitive is a good idea. >> >> On Tue, Mar 3, 2020, 14:28 Carter Schonwald >> wrote: >> >>> Hey Zemyla! >>> one fuzzy question i have, and perhaps you have a perspective on this, >>> would/could the PrimMonad machinery in primitive help simplify / clean up >>> stuff here too? >>> >>> On Mon, Feb 24, 2020 at 9:46 AM Zemyla wrote: >>> >>>> It's currently hard to describe that a type should be usable with >>>> UArray or IOUArray, and almost impossible to describe without >>>> QualifiedConstraints that it should be usable with STUArray. And it's >>>> actually impossible to use GeneralizedNewtypeDeriving to derive new >>>> instances of IArray or MArray. It also means that it's difficult to keep >>>> the three sets of instances in sync. >>>> >>>> Therefore, there should be (taking inspiration from primitive) a class >>>> that describes types which can be used in unboxed arrays. It'd be something >>>> along the lines of: >>>> >>>> class Unboxed e where >>>> unsafeNewUArray :: Int# -> e -> State# s -> (# State# s, >>>> MutableByteArray# s #) >>>> unsafeNewUArray_ :: Const (Int# -> State# s -> (# State# s, >>>> MutableByteArray# s #)) e >>>> unsafeReadUArray :: MutableByteArray# s -> Int# -> State# s -> (# >>>> State# s, e #) >>>> unsafeWriteUArray :: MutableByteArray# s -> Int# -> e -> State# s -> >>>> State# s >>>> unsafeIndexUArray :: ByteArray# -> Int# -> e >>>> >>>> And then the instances for UArray, STUArray, and IOUArray would be: >>>> >>>> instance Unboxed e => IArray UArray e where ... >>>> instance Unboxed e => MArray IOUArray e IO where ... >>>> instance Unboxed e => MArray (STUArray s) e (ST s) where ... >>>> >>>> Incidentally, this also means it'd be less effort to add instances like >>>> Unboxed CInt, Unboxed a => Unboxed (Complex a), and Unboxed Ordering. >>>> _______________________________________________ >>>> Libraries mailing list >>>> Libraries at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>>> >>> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Tue Mar 3 23:39:14 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 3 Mar 2020 18:39:14 -0500 Subject: Improved interface to UArray In-Reply-To: References: Message-ID: I meant specifically using PrimMonad, rather than the prim array facilities, to write the instances On Tue, Mar 3, 2020 at 5:14 PM Zemyla wrote: > Because a lot of the stuff is defined in GHC.Arr, in base. Also, the Prim > instance for Bool is different than the UArray instance for Bool. > > On Tue, Mar 3, 2020, 14:56 chessai . wrote: > >> Zemlya, could you expound on why you think a primitive dependency is a >> bad idea? I'm just not sure what reasons you have in mind. >> >> Thanks >> >> On Tue, Mar 3, 2020, 12:31 PM Zemyla wrote: >> >>> We should probably use something similar, but I don't think a dependency >>> on primitive is a good idea. >>> >>> On Tue, Mar 3, 2020, 14:28 Carter Schonwald >>> wrote: >>> >>>> Hey Zemyla! >>>> one fuzzy question i have, and perhaps you have a perspective on this, >>>> would/could the PrimMonad machinery in primitive help simplify / clean up >>>> stuff here too? >>>> >>>> On Mon, Feb 24, 2020 at 9:46 AM Zemyla wrote: >>>> >>>>> It's currently hard to describe that a type should be usable with >>>>> UArray or IOUArray, and almost impossible to describe without >>>>> QualifiedConstraints that it should be usable with STUArray. And it's >>>>> actually impossible to use GeneralizedNewtypeDeriving to derive new >>>>> instances of IArray or MArray. It also means that it's difficult to keep >>>>> the three sets of instances in sync. >>>>> >>>>> Therefore, there should be (taking inspiration from primitive) a class >>>>> that describes types which can be used in unboxed arrays. It'd be something >>>>> along the lines of: >>>>> >>>>> class Unboxed e where >>>>> unsafeNewUArray :: Int# -> e -> State# s -> (# State# s, >>>>> MutableByteArray# s #) >>>>> unsafeNewUArray_ :: Const (Int# -> State# s -> (# State# s, >>>>> MutableByteArray# s #)) e >>>>> unsafeReadUArray :: MutableByteArray# s -> Int# -> State# s -> (# >>>>> State# s, e #) >>>>> unsafeWriteUArray :: MutableByteArray# s -> Int# -> e -> State# s -> >>>>> State# s >>>>> unsafeIndexUArray :: ByteArray# -> Int# -> e >>>>> >>>>> And then the instances for UArray, STUArray, and IOUArray would be: >>>>> >>>>> instance Unboxed e => IArray UArray e where ... >>>>> instance Unboxed e => MArray IOUArray e IO where ... >>>>> instance Unboxed e => MArray (STUArray s) e (ST s) where ... >>>>> >>>>> Incidentally, this also means it'd be less effort to add instances >>>>> like Unboxed CInt, Unboxed a => Unboxed (Complex a), and Unboxed Ordering. >>>>> _______________________________________________ >>>>> Libraries mailing list >>>>> Libraries at haskell.org >>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>>>> >>>> _______________________________________________ >>> Libraries mailing list >>> Libraries at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Tue Mar 3 23:41:21 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 3 Mar 2020 18:41:21 -0500 Subject: Improved interface to UArray In-Reply-To: References: Message-ID: looking at current base, https://downloads.haskell.org/ghc/latest/docs/html/libraries/base-4.13.0.0/GHC-Arr.html it seems (naively to me) that nothing precludes the array package from using PrimMonad m => for the IO etc monad instances, with zero impact on the interface as defined in base. Or am I missing something? On Tue, Mar 3, 2020 at 6:39 PM Carter Schonwald wrote: > I meant specifically using PrimMonad, rather than the prim array > facilities, to write the instances > > On Tue, Mar 3, 2020 at 5:14 PM Zemyla wrote: > >> Because a lot of the stuff is defined in GHC.Arr, in base. Also, the Prim >> instance for Bool is different than the UArray instance for Bool. >> >> On Tue, Mar 3, 2020, 14:56 chessai . wrote: >> >>> Zemlya, could you expound on why you think a primitive dependency is a >>> bad idea? I'm just not sure what reasons you have in mind. >>> >>> Thanks >>> >>> On Tue, Mar 3, 2020, 12:31 PM Zemyla wrote: >>> >>>> We should probably use something similar, but I don't think a >>>> dependency on primitive is a good idea. >>>> >>>> On Tue, Mar 3, 2020, 14:28 Carter Schonwald >>>> wrote: >>>> >>>>> Hey Zemyla! >>>>> one fuzzy question i have, and perhaps you have a perspective on this, >>>>> would/could the PrimMonad machinery in primitive help simplify / clean up >>>>> stuff here too? >>>>> >>>>> On Mon, Feb 24, 2020 at 9:46 AM Zemyla wrote: >>>>> >>>>>> It's currently hard to describe that a type should be usable with >>>>>> UArray or IOUArray, and almost impossible to describe without >>>>>> QualifiedConstraints that it should be usable with STUArray. And it's >>>>>> actually impossible to use GeneralizedNewtypeDeriving to derive new >>>>>> instances of IArray or MArray. It also means that it's difficult to keep >>>>>> the three sets of instances in sync. >>>>>> >>>>>> Therefore, there should be (taking inspiration from primitive) a >>>>>> class that describes types which can be used in unboxed arrays. It'd be >>>>>> something along the lines of: >>>>>> >>>>>> class Unboxed e where >>>>>> unsafeNewUArray :: Int# -> e -> State# s -> (# State# s, >>>>>> MutableByteArray# s #) >>>>>> unsafeNewUArray_ :: Const (Int# -> State# s -> (# State# s, >>>>>> MutableByteArray# s #)) e >>>>>> unsafeReadUArray :: MutableByteArray# s -> Int# -> State# s -> (# >>>>>> State# s, e #) >>>>>> unsafeWriteUArray :: MutableByteArray# s -> Int# -> e -> State# s >>>>>> -> State# s >>>>>> unsafeIndexUArray :: ByteArray# -> Int# -> e >>>>>> >>>>>> And then the instances for UArray, STUArray, and IOUArray would be: >>>>>> >>>>>> instance Unboxed e => IArray UArray e where ... >>>>>> instance Unboxed e => MArray IOUArray e IO where ... >>>>>> instance Unboxed e => MArray (STUArray s) e (ST s) where ... >>>>>> >>>>>> Incidentally, this also means it'd be less effort to add instances >>>>>> like Unboxed CInt, Unboxed a => Unboxed (Complex a), and Unboxed Ordering. >>>>>> _______________________________________________ >>>>>> Libraries mailing list >>>>>> Libraries at haskell.org >>>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>>>>> >>>>> _______________________________________________ >>>> Libraries mailing list >>>> Libraries at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominic at steinitz.org Sat Mar 7 13:24:50 2020 From: dominic at steinitz.org (dominic at steinitz.org) Date: Sat, 7 Mar 2020 13:24:50 +0000 Subject: Fwd: [nushio3/cmaes] Make work under ghc 8.6.3 (#3) References: <62E7F210-BDAD-4968-B12F-8A8CB98D425A@steinitz.org> Message-ID: <64711675-6FA2-4E56-9D7B-0675C7B7099D@steinitz.org> The owner of https://hackage.haskell.org/package/cmaes has sadly passed away - see below. May I request ownership is transferred to me https://hackage.haskell.org/user/DominicSteinitz. Many thanks Dominic Steinitz dominic at steinitz.org http://idontgetoutmuch.org Twitter: @idontgetoutmuch PS > TakayukiMuranushi is part of the following groups: > > Maintainers for Paraiso > Maintainers for authoring > Maintainers for binary-search > Maintainers for citation-resolve > Maintainers for cmaes > Maintainers for doctest-prop > Maintainers for dynamic-object > Maintainers for embeddock-example > Maintainers for embeddock > Maintainers for formura > Maintainers for typelevel-tensor > Maintainers for unicode-show From dominic at steinitz.org Sat Mar 7 13:26:08 2020 From: dominic at steinitz.org (dominic at steinitz.org) Date: Sat, 7 Mar 2020 13:26:08 +0000 Subject: Fwd: [nushio3/cmaes] Make work under ghc 8.6.3 (#3) References: Message-ID: I should have attached this. Dominic Steinitz dominic at steinitz.org http://idontgetoutmuch.org Twitter: @idontgetoutmuch > Begin forwarded message: > > From: Masahiro Sakai > Subject: Re: [nushio3/cmaes] Make work under ghc 8.6.3 (#3) > Date: 1 March 2020 at 02:05:26 GMT > To: nushio3/cmaes > Cc: idontgetoutmuch , Author > Reply-To: nushio3/cmaes > > The author @nushio3 passed away in 2019 and cannot merge this pull request. > It might be better to work on your fork, and possibly to take over ownership of the package on Hackage if you want to continue maintaining. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub , or unsubscribe . > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chessai1996 at gmail.com Fri Mar 13 20:50:52 2020 From: chessai1996 at gmail.com (chessai .) Date: Fri, 13 Mar 2020 13:50:52 -0700 Subject: New CLC co-chairs, New maintainers of `base` Message-ID: As you know from previous announcements, Edward Kmett is stepping down as CLC Chair, and Ryan Scott is stepping down from the CLC altogether. They are both also stepping down as co-maintainers of base. Carter Schonwald and myself, chessai, will be the new CLC co-chair and co-maintainers of base. Thank you again to Edward and Ryan for all of their accomplishments and hard work. Carter and I look forward to serving this wonderful community. From chessai1996 at gmail.com Sat Mar 14 03:59:22 2020 From: chessai1996 at gmail.com (chessai .) Date: Fri, 13 Mar 2020 20:59:22 -0700 Subject: Improving the instances of Data.Functor.{Product,Sum} Message-ID: Consider the Eq instance for these types. Currently we rely on: (Eq1 f, Eq1 g, Eq a) But some potential improvements include changing to: (Eq (f (g a))) (FlexibleContexts) or (forall x. Eq x => Eq (f x), forall x. Eq x => Eq (g x), Eq a) (QuantifiedConstraints) There was a discussion sometime last year about the same thing regarding Semigroup/Monoid instances for `Compose` [1]. Additionally, the question has been raised again for Data.Functor.{Product,Sum} on Gitlab [2, 3]. There has been no consensus in either case, but that's not too worrying as both discussions have been brief. I'm currently not happy with the {Eq,Ord,Show}{1,2} family of classes, and would hope to work toward their removal, or at least the shrinking of their presence in base. Even though the linked proposals are about a single type, I think it's important that we come up with a decision and stick with it. Having different APIs for different types here would be pretty confusing, and some could even say sloppy. Please let me know your thoughts. [1]: https://mail.haskell.org/pipermail/libraries/2019-July/029771.html [2]: https://gitlab.haskell.org/ghc/ghc/issues/17015 [3]: https://gitlab.haskell.org/ghc/ghc/merge_requests/1704 From emertens at gmail.com Sat Mar 14 04:14:09 2020 From: emertens at gmail.com (Eric Mertens) Date: Fri, 13 Mar 2020 21:14:09 -0700 Subject: Improving the instances of Data.Functor.{Product,Sum} In-Reply-To: References: Message-ID: I prefer to avoid FlexibleInstances wherever I can. The last thing I'd heard about quantified constraints was that they were buggy and I've been avoiding relying on them. (I should probably review that assumptions at some point.) Having a class like Eq1 is the cleaner option. I'd rather fix up these classes than work to get rid of them. On Fri, Mar 13, 2020 at 8:59 PM chessai . wrote: > Consider the Eq instance for these types. Currently we rely on: > > (Eq1 f, Eq1 g, Eq a) > > But some potential improvements include changing to: > > (Eq (f (g a))) (FlexibleContexts) > > or > > (forall x. Eq x => Eq (f x), forall x. Eq x => Eq (g x), Eq a) > (QuantifiedConstraints) > > There was a discussion sometime last year about the same thing > regarding Semigroup/Monoid instances for `Compose` [1]. Additionally, > the question has been raised again for Data.Functor.{Product,Sum} on > Gitlab [2, 3]. There has been no consensus in either case, but that's > not too worrying as both discussions have been brief. I'm currently > not happy with the {Eq,Ord,Show}{1,2} family of classes, and would > hope to work toward their removal, or at least the shrinking of their > presence in base. Even though the linked proposals are about a single > type, I think it's important that we come up with a decision and stick > with it. Having different APIs for different types here would be > pretty confusing, and some could even say sloppy. > > Please let me know your thoughts. > > [1]: https://mail.haskell.org/pipermail/libraries/2019-July/029771.html > [2]: https://gitlab.haskell.org/ghc/ghc/issues/17015 > [3]: https://gitlab.haskell.org/ghc/ghc/merge_requests/1704 > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -- Eric Mertens -------------- next part -------------- An HTML attachment was scrubbed... URL: From zemyla at gmail.com Sat Mar 14 04:22:02 2020 From: zemyla at gmail.com (Zemyla) Date: Fri, 13 Mar 2020 23:22:02 -0500 Subject: Improving the instances of Data.Functor.{Product,Sum} In-Reply-To: References: Message-ID: Also, keeping it Haskell98 compliant makes it easier for newer users to grok. On Fri, Mar 13, 2020, 23:15 Eric Mertens wrote: > I prefer to avoid FlexibleInstances wherever I can. The last thing I'd > heard about quantified constraints was that they were buggy and I've been > avoiding relying on them. (I should probably review that assumptions at > some point.) Having a class like Eq1 is the cleaner option. I'd rather fix > up these classes than work to get rid of them. > > On Fri, Mar 13, 2020 at 8:59 PM chessai . wrote: > >> Consider the Eq instance for these types. Currently we rely on: >> >> (Eq1 f, Eq1 g, Eq a) >> >> But some potential improvements include changing to: >> >> (Eq (f (g a))) (FlexibleContexts) >> >> or >> >> (forall x. Eq x => Eq (f x), forall x. Eq x => Eq (g x), Eq a) >> (QuantifiedConstraints) >> >> There was a discussion sometime last year about the same thing >> regarding Semigroup/Monoid instances for `Compose` [1]. Additionally, >> the question has been raised again for Data.Functor.{Product,Sum} on >> Gitlab [2, 3]. There has been no consensus in either case, but that's >> not too worrying as both discussions have been brief. I'm currently >> not happy with the {Eq,Ord,Show}{1,2} family of classes, and would >> hope to work toward their removal, or at least the shrinking of their >> presence in base. Even though the linked proposals are about a single >> type, I think it's important that we come up with a decision and stick >> with it. Having different APIs for different types here would be >> pretty confusing, and some could even say sloppy. >> >> Please let me know your thoughts. >> >> [1]: https://mail.haskell.org/pipermail/libraries/2019-July/029771.html >> [2]: https://gitlab.haskell.org/ghc/ghc/issues/17015 >> [3]: https://gitlab.haskell.org/ghc/ghc/merge_requests/1704 >> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > > > -- > Eric Mertens > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chessai1996 at gmail.com Sat Mar 14 05:49:14 2020 From: chessai1996 at gmail.com (chessai .) Date: Fri, 13 Mar 2020 22:49:14 -0700 Subject: Improving the instances of Data.Functor.{Product,Sum} In-Reply-To: References: Message-ID: Eric, Could you expound on why you try to avoid Flexible{Contexts,Instances} in your own code? That might be useful to look at here. On Fri, Mar 13, 2020, 9:22 PM Zemyla wrote: > Also, keeping it Haskell98 compliant makes it easier for newer users to > grok. > > On Fri, Mar 13, 2020, 23:15 Eric Mertens wrote: > >> I prefer to avoid FlexibleInstances wherever I can. The last thing I'd >> heard about quantified constraints was that they were buggy and I've been >> avoiding relying on them. (I should probably review that assumptions at >> some point.) Having a class like Eq1 is the cleaner option. I'd rather fix >> up these classes than work to get rid of them. >> >> On Fri, Mar 13, 2020 at 8:59 PM chessai . wrote: >> >>> Consider the Eq instance for these types. Currently we rely on: >>> >>> (Eq1 f, Eq1 g, Eq a) >>> >>> But some potential improvements include changing to: >>> >>> (Eq (f (g a))) (FlexibleContexts) >>> >>> or >>> >>> (forall x. Eq x => Eq (f x), forall x. Eq x => Eq (g x), Eq a) >>> (QuantifiedConstraints) >>> >>> There was a discussion sometime last year about the same thing >>> regarding Semigroup/Monoid instances for `Compose` [1]. Additionally, >>> the question has been raised again for Data.Functor.{Product,Sum} on >>> Gitlab [2, 3]. There has been no consensus in either case, but that's >>> not too worrying as both discussions have been brief. I'm currently >>> not happy with the {Eq,Ord,Show}{1,2} family of classes, and would >>> hope to work toward their removal, or at least the shrinking of their >>> presence in base. Even though the linked proposals are about a single >>> type, I think it's important that we come up with a decision and stick >>> with it. Having different APIs for different types here would be >>> pretty confusing, and some could even say sloppy. >>> >>> Please let me know your thoughts. >>> >>> [1]: https://mail.haskell.org/pipermail/libraries/2019-July/029771.html >>> [2]: https://gitlab.haskell.org/ghc/ghc/issues/17015 >>> [3]: https://gitlab.haskell.org/ghc/ghc/merge_requests/1704 >>> _______________________________________________ >>> Libraries mailing list >>> Libraries at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>> >> >> >> -- >> Eric Mertens >> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lemming at henning-thielemann.de Sat Mar 14 07:29:32 2020 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Sat, 14 Mar 2020 08:29:32 +0100 (CET) Subject: Improving the instances of Data.Functor.{Product,Sum} In-Reply-To: References: Message-ID: On Fri, 13 Mar 2020, chessai . wrote: > Could you expound on why you try to avoid Flexible{Contexts,Instances} > in your own code? That might be useful to look at here. I also try to avoid FlexibleInstances. FlexibleInstances are sometimes a consequence of multi-parameter type classes with too many parameters. E.g. instance Convert Int a instance Convert Integer a which should be better a single-parameter type class on the first parameter. FlexibleInstances might indicate too lax instances. E.g. instance C (A a) (B a) where should be better isntance (a~b) => C (A a) (B b) where Sometimes they are a sign of non-composability. E.g. instance StringClass String where should be better instance CharClass a => StringClass [a] where or instance (a ~ Char) => StringClass [a] where depending, on what you need. From rae at richarde.dev Sat Mar 14 11:16:43 2020 From: rae at richarde.dev (Richard Eisenberg) Date: Sat, 14 Mar 2020 11:16:43 +0000 Subject: Improving the instances of Data.Functor.{Product,Sum} In-Reply-To: References: Message-ID: <1A13B63F-E4F7-4124-AEF0-C0CB42E7546D@richarde.dev> > On Mar 14, 2020, at 4:14 AM, Eric Mertens wrote: > > The last thing I'd heard about quantified constraints was that they were buggy and I've been avoiding relying on them. (I should probably review that assumptions at some point.) Without expressing an opinion about chessai's proposal (which I have not really thought about): quantified constraints are in good shape and ready for prime time. They have limitations (e.g. you can't mention a type family to the right of the =>), but when they are valid, they work well. I'll never swear that a feature is bug-free, but I think it's reasonable to consider using quantified constraints in `base`. Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: From chessai1996 at gmail.com Sat Mar 14 14:10:47 2020 From: chessai1996 at gmail.com (chessai .) Date: Sat, 14 Mar 2020 07:10:47 -0700 Subject: Improving the instances of Data.Functor.{Product,Sum} In-Reply-To: <1A13B63F-E4F7-4124-AEF0-C0CB42E7546D@richarde.dev> References: <1A13B63F-E4F7-4124-AEF0-C0CB42E7546D@richarde.dev> Message-ID: I can second Richard's estimation of QuantifiedConstraints, I have used them a lot in my own code since they were in HEAD. I consider it a sufficiently stable feature to include in base or any library. On Sat, Mar 14, 2020, 4:16 AM Richard Eisenberg wrote: > > > On Mar 14, 2020, at 4:14 AM, Eric Mertens wrote: > > The last thing I'd heard about quantified constraints was that they were > buggy and I've been avoiding relying on them. (I should probably review > that assumptions at some point.) > > > Without expressing an opinion about chessai's proposal (which I have not > really thought about): quantified constraints are in good shape and ready > for prime time. They have limitations (e.g. you can't mention a type family > to the right of the =>), but when they are valid, they work well. I'll > never swear that a feature is bug-free, but I think it's reasonable to > consider using quantified constraints in `base`. > > Richard > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Sat Mar 14 15:43:26 2020 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Sat, 14 Mar 2020 17:43:26 +0200 Subject: Improving the instances of Data.Functor.{Product,Sum} In-Reply-To: References: <1A13B63F-E4F7-4124-AEF0-C0CB42E7546D@richarde.dev> Message-ID: <3d206fe2-6ad3-0343-51ed-66fa9ccd95a5@iki.fi> QuantifiedConstraints are not buggy, but they are not _complete_ (I do mean that as "buggy" = not sound, properly expressive = complete). There are at least three issues: 1. Instance definition need UndecidableInstances (in my opinion this is big deal) 2. Instances are not elegant (easy to write, but not elegant). 3. QuantifiedConstraints resists to be abstracted over See https://gist.github.com/phadej/266d68cf5cc1229c3548b7965f4335f8 for the standalone code file. For the reasons below I wouldn't recommend using QuantifiedConstraints. I very like them, but I'm not convinced the feature is ready for "prime time". To put into perspective, I think code classes of `singletons` are more ready to be included in `base` than changing instances of Data.Functor.Sum and .Product. I do use singletons in my code more than QuantifiedConstraints. :) I'm very worried how this change will affect libraries like `free` and `recursion-schemes` and what builds on top of them. This is not only change to `base`, it strongly guides how downstream libraries should be written (or changed) as well. On the other hand, I don't feel strongly about     instance (Eq (f a), Eq (g a)) => Eq (Product f g a) Yet, in the light of `free` it is "a step backwards". See https://hackage.haskell.org/package/free-5/changelog --- Simple example with `newtype Fix f = Fix (f (Fix f))`     class Eq1 f where         liftEq :: (a -> b -> Bool) -> f a -> f b -> Bool     class Eq1 f => Ord1 f where         liftCompare :: (a -> b -> Ordering) -> f a -> f b -> Ordering     instance Eq1 f => Eq (Fix f) where         (==) = eq where eq (Fix x) (Fix y) = liftEq eq x y     instance Ord1 f => Ord (Fix f) where         compare = cmp where cmp (Fix x) (Fix y) = liftCompare cmp x y works. It's boilerplate, but it's already written. However, if we want to use QuantifiedConstraints, then we 1. need UndecidableInstances 2. and then the code turns out to be less elegant: instance (forall x. Eq x => Eq (f x)) => Eq (Fix f) where     (==) = eq where eq (Fix x) (Fix y) = x == y instance (forall x. Ord x => Ord (f x)) => Ord (Fix f) where     compare = cmp where cmp (Fix x) (Fix y) = compare x y fails to compile with     GHCi, version 8.8.3: https://www.haskell.org/ghc/  :? for help     [1 of 1] Compiling Main             ( Ord1.hs, interpreted )     Ord1.hs:28:10: error:         • Could not deduce (Ord x)             arising from the superclasses of an instance declaration we need to write Ord instance differently    instance (forall x. Ord x => Ord (f x), forall x. Eq x => Eq (f x)) => Ord (Fix f) where        compare = cmp where cmp (Fix x) (Fix y) = compare x y This _cannot_ be made to work:     forall x. Ord x => Ord (f x) doesn't entail     forall x. Eq x => Eq (f x) If you try to write defaultLiftEq using liftCompare     defaultLiftEq :: Ord1 f => (a -> b -> Bool) -> f a -> f b -> Bool     defaultLiftEq eq x y = EQ == liftCompare _problem_ x y then you will se a problem. --- Third issue is that We cannot abstract over QuantifiedConstraints. Take an example `Dict`. We can use `Dict` for various things.     data Dict :: (k -> Constraint) -> k -> * where         Dict :: c a => Dict c a It nicely uses PolyKinds extension so we can write:     eqInt :: Dict Eq Int     eqInt = Dict     eq1List :: Dict Eq1 []     eq1List = Dict And we can use Dict to *manually* thread information     entail :: Dict Ord1 f -> Dict Eq1 f     entail Dict = Dict The selling pitch of QuantifiedConstraints, that we could get this for free. Above Ord (Fix) example however makes me suspicious. Let's try:     eqQList :: Dict (forall x. Eq x => Eq (f x)) []     eqQList = undefined But it doesn't work!     Ord1.hs:53:28: error:         • Expected kind ‘(* -> *) -> Constraint’,             but ‘Eq (f x)’ has kind ‘*’         • In the first argument of ‘Dict’, namely             ‘(forall x. Eq x => Eq (f x))’           In the type signature:             eqQList :: Dict (forall x. Eq x => Eq (f x)) []        |     53 | eqQList :: Dict (forall x. Eq x => Eq (f x)) []        |     Ord1.hs:53:36: error:         • Expected a type, but ‘Eq (f x)’ has kind ‘Constraint’         • In the first argument of ‘Dict’, namely             ‘(forall x. Eq x => Eq (f x))’           In the type signature:             eqQList :: Dict (forall x. Eq x => Eq (f x)) []        |     53 | eqQList :: Dict (forall x. Eq x => Eq (f x)) []        |                                    ^^^^^^^^ Then we remember that we have seen that, we **cannot define** type synonyms for quantified constraints     type Eq1' f = forall x. Eq x => Eq (f x) errors with     Ord1.hs:56:33: error:         • Expected a type, but ‘Eq (f x)’ has kind ‘Constraint’ Luckily GHC-8.10.1 (which is not released at the moment of writing) will give us ability to say     type Eq1' :: (* -> *) -> Constraint     type Eq1' f = forall x. Eq x => Eq (f x) This is promising! Let's try to fix eqQList     eqQList2 :: Dict Eq1' []     eqQList2 = undefined But that doesn't work. Type-aliases have to be fully applied! How in Haskell we fix issues when type-aliases (of classes) need to be partially evaluated? We defined     class ... => Example a b c     instance ... => Example a b c Third try     eqQList3 :: Dict Eq1'' f     eqQList3 = Dict The type signature is accepted, but the implementation is not    Ord1.hs:67:12: error:        • Could not deduce (Eq (f x)) arising from a use of ‘Dict’ At this point I'm clueless. --- Best regards, Oleg P.S. If we would like to take QuantifiedConstraints somewhere into use, then IMO we should start with MonadTrans class. IIRC it's well motivated in the paper. But UndecidableInstances is very unfortunate. On 14.3.2020 16.10, chessai . wrote: > I can second Richard's estimation of QuantifiedConstraints, I have > used them a lot in my own code since they were in HEAD. I consider it > a sufficiently stable feature to include in base or any library. > > On Sat, Mar 14, 2020, 4:16 AM Richard Eisenberg > wrote: > > > >> On Mar 14, 2020, at 4:14 AM, Eric Mertens > > wrote: >> >> The last thing I'd heard about quantified constraints was that >> they were buggy and I've been avoiding relying on them. (I should >> probably review that assumptions at some point.) > > Without expressing an opinion about chessai's proposal (which I > have not really thought about): quantified constraints are in good > shape and ready for prime time. They have limitations (e.g. you > can't mention a type family to the right of the =>), but when they > are valid, they work well. I'll never swear that a feature is > bug-free, but I think it's reasonable to consider using quantified > constraints in `base`. > > Richard > > > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sun Mar 15 20:43:07 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sun, 15 Mar 2020 16:43:07 -0400 Subject: Improving the instances of Data.Functor.{Product,Sum} In-Reply-To: <3d206fe2-6ad3-0343-51ed-66fa9ccd95a5@iki.fi> References: <1A13B63F-E4F7-4124-AEF0-C0CB42E7546D@richarde.dev> <3d206fe2-6ad3-0343-51ed-66fa9ccd95a5@iki.fi> Message-ID: as an additional point of data, https://github.com/ekmett/bytes/pull/49#issuecomment-580924670 and the indirectly linked ticket https://gitlab.haskell.org/ghc/ghc/issues/17767#note_251123 is an example of how not trivial a pretty simple use of quantified constraints / related machinery can be! a good "guiding light" for core libraries in haskell perhaps should be "what choices jointly give the best type inference, composability, generality, performance, and usability" and when we hit a trade off for these parameters, make sure we understand those and have very well understood tradeoffs. @daniel for these sorts of instance renovation proposals, its probably best to show case "heres the type and instance and uses" in each of the K different flavors and what gets better/easier/harder simpler. I honestly dont do it as often as I should myself! In this case, putting together a tiny repo with different module doing the various flavors and how they work might be best for grounding this. bonus points if its cabalized so that folks on different lagging rates of ghc versions can poke around :) (one idea i've been thinking about is how to best make various phases of possibly nontrivial proposals easy to evaluate and compare for impact and benefit, but thats a discussion for another time) as ever, be well all on this bizarre spring we're all experiencing -Carter On Sat, Mar 14, 2020 at 11:44 AM Oleg Grenrus wrote: > QuantifiedConstraints are not buggy, but they are not _complete_ > (I do mean that as "buggy" = not sound, properly expressive = complete). > > There are at least three issues: > > 1. Instance definition need UndecidableInstances (in my opinion this is > big deal) > 2. Instances are not elegant (easy to write, but not elegant). > 3. QuantifiedConstraints resists to be abstracted over > > See https://gist.github.com/phadej/266d68cf5cc1229c3548b7965f4335f8 for > the standalone code file. > > For the reasons below I wouldn't recommend using QuantifiedConstraints. > I very like them, but I'm not convinced the feature is ready for "prime > time". > To put into perspective, I think code classes of `singletons` are more > ready to > be included in `base` than changing instances of Data.Functor.Sum and > .Product. > I do use singletons in my code more than QuantifiedConstraints. :) > > I'm very worried how this change will affect libraries like `free` and > `recursion-schemes` and what builds on top of them. > This is not only change to `base`, it strongly guides how downstream > libraries should be written (or changed) as well. > > On the other hand, I don't feel strongly about > > instance (Eq (f a), Eq (g a)) => Eq (Product f g a) > > Yet, in the light of `free` it is "a step backwards". > See https://hackage.haskell.org/package/free-5/changelog > > --- > > Simple example with `newtype Fix f = Fix (f (Fix f))` > > class Eq1 f where > liftEq :: (a -> b -> Bool) -> f a -> f b -> Bool > > class Eq1 f => Ord1 f where > liftCompare :: (a -> b -> Ordering) -> f a -> f b -> Ordering > > instance Eq1 f => Eq (Fix f) where > (==) = eq where eq (Fix x) (Fix y) = liftEq eq x y > > instance Ord1 f => Ord (Fix f) where > compare = cmp where cmp (Fix x) (Fix y) = liftCompare cmp x y > > works. It's boilerplate, but it's already written. > > However, if we want to use QuantifiedConstraints, > then we > > 1. need UndecidableInstances > 2. and then the code turns out to be less elegant: > > instance (forall x. Eq x => Eq (f x)) => Eq (Fix f) where > (==) = eq where eq (Fix x) (Fix y) = x == y > > instance (forall x. Ord x => Ord (f x)) => Ord (Fix f) where > compare = cmp where cmp (Fix x) (Fix y) = compare x y > > fails to compile with > > GHCi, version 8.8.3: https://www.haskell.org/ghc/ :? for help > [1 of 1] Compiling Main ( Ord1.hs, interpreted ) > > Ord1.hs:28:10: error: > • Could not deduce (Ord x) > arising from the superclasses of an instance declaration > > we need to write Ord instance differently > > instance (forall x. Ord x => Ord (f x), forall x. Eq x => Eq (f x)) => > Ord (Fix f) where > compare = cmp where cmp (Fix x) (Fix y) = compare x y > > > This _cannot_ be made to work: > > forall x. Ord x => Ord (f x) > > doesn't entail > > forall x. Eq x => Eq (f x) > > If you try to write defaultLiftEq using liftCompare > > defaultLiftEq :: Ord1 f => (a -> b -> Bool) -> f a -> f b -> Bool > defaultLiftEq eq x y = EQ == liftCompare _problem_ x y > > then you will se a problem. > > --- > > Third issue is that We cannot abstract over QuantifiedConstraints. > > Take an example `Dict`. We can use `Dict` for various things. > > data Dict :: (k -> Constraint) -> k -> * where > Dict :: c a => Dict c a > > It nicely uses PolyKinds extension so we can write: > > eqInt :: Dict Eq Int > eqInt = Dict > > eq1List :: Dict Eq1 [] > eq1List = Dict > > And we can use Dict to *manually* thread information > > entail :: Dict Ord1 f -> Dict Eq1 f > entail Dict = Dict > > The selling pitch of QuantifiedConstraints, that we could get this for > free. > Above Ord (Fix) example however makes me suspicious. Let's try: > > eqQList :: Dict (forall x. Eq x => Eq (f x)) [] > eqQList = undefined > > But it doesn't work! > > Ord1.hs:53:28: error: > • Expected kind ‘(* -> *) -> Constraint’, > but ‘Eq (f x)’ has kind ‘*’ > • In the first argument of ‘Dict’, namely > ‘(forall x. Eq x => Eq (f x))’ > In the type signature: > eqQList :: Dict (forall x. Eq x => Eq (f x)) [] > | > 53 | eqQList :: Dict (forall x. Eq x => Eq (f x)) [] > | > > Ord1.hs:53:36: error: > • Expected a type, but ‘Eq (f x)’ has kind ‘Constraint’ > • In the first argument of ‘Dict’, namely > ‘(forall x. Eq x => Eq (f x))’ > In the type signature: > eqQList :: Dict (forall x. Eq x => Eq (f x)) [] > | > 53 | eqQList :: Dict (forall x. Eq x => Eq (f x)) [] > | ^^^^^^^^ > > Then we remember that we have seen that, > we **cannot define** type synonyms for quantified constraints > > type Eq1' f = forall x. Eq x => Eq (f x) > > errors with > > Ord1.hs:56:33: error: > • Expected a type, but ‘Eq (f x)’ has kind ‘Constraint’ > > Luckily GHC-8.10.1 (which is not released at the moment of writing) > will give us ability to say > > type Eq1' :: (* -> *) -> Constraint > type Eq1' f = forall x. Eq x => Eq (f x) > > This is promising! Let's try to fix eqQList > > eqQList2 :: Dict Eq1' [] > eqQList2 = undefined > > But that doesn't work. Type-aliases have to be fully applied! > > How in Haskell we fix issues when type-aliases (of classes) need to be > partially > evaluated? We defined > > class ... => Example a b c > instance ... => Example a b c > > Third try > > eqQList3 :: Dict Eq1'' f > eqQList3 = Dict > > The type signature is accepted, but the implementation is not > > Ord1.hs:67:12: error: > • Could not deduce (Eq (f x)) arising from a use of ‘Dict’ > > At this point I'm clueless. > > --- > > Best regards, > Oleg > > P.S. If we would like to take QuantifiedConstraints somewhere into use, > then IMO we should start with MonadTrans class. IIRC it's well motivated in > the paper. But UndecidableInstances is very unfortunate. > On 14.3.2020 16.10, chessai . wrote: > > I can second Richard's estimation of QuantifiedConstraints, I have used > them a lot in my own code since they were in HEAD. I consider it a > sufficiently stable feature to include in base or any library. > > On Sat, Mar 14, 2020, 4:16 AM Richard Eisenberg wrote: > >> >> >> On Mar 14, 2020, at 4:14 AM, Eric Mertens wrote: >> >> The last thing I'd heard about quantified constraints was that they were >> buggy and I've been avoiding relying on them. (I should probably review >> that assumptions at some point.) >> >> >> Without expressing an opinion about chessai's proposal (which I have not >> really thought about): quantified constraints are in good shape and ready >> for prime time. They have limitations (e.g. you can't mention a type family >> to the right of the =>), but when they are valid, they work well. I'll >> never swear that a feature is bug-free, but I think it's reasonable to >> consider using quantified constraints in `base`. >> >> Richard >> > > _______________________________________________ > Libraries mailing listLibraries at haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Wed Mar 18 18:46:47 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 18 Mar 2020 14:46:47 -0400 Subject: intent to enable 2fa requirement for github.com/haskell org Message-ID: hey everyone, because so much important stuff for the community, it makes sense to add 2fa required for the org, are there any good reasons to either wait to do this, or not do it? Feedback welcome! (if theres no objections i'll do it friday or this weekend, so theres some lead time for anyone who's not setup for that yet) Best wishes and great health to all -carter -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Wed Mar 18 19:45:21 2020 From: david.feuer at gmail.com (David Feuer) Date: Wed, 18 Mar 2020 15:45:21 -0400 Subject: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: That's not a lot of lead time. On Wed, Mar 18, 2020, 2:47 PM Carter Schonwald wrote: > hey everyone, because so much important stuff for the community, it makes > sense to add 2fa required for the org, are there any good reasons to either > wait to do this, or not do it? Feedback welcome! > > (if theres no objections i'll do it friday or this weekend, so theres some > lead time for anyone who's not setup for that yet) > > Best wishes and great health to all > -carter > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Wed Mar 18 20:09:01 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 18 Mar 2020 16:09:01 -0400 Subject: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: true, otoh, 2fa in various usable forms has been widely available for years, and we can reonboard people pretty easily. Its critical haskell infra and to the best of my knowledge, current 2fa tooling is pretty accessible to everyone globally. If someone has specific issues we can address them as they arise! On Wed, Mar 18, 2020 at 3:45 PM David Feuer wrote: > That's not a lot of lead time. > > On Wed, Mar 18, 2020, 2:47 PM Carter Schonwald > wrote: > >> hey everyone, because so much important stuff for the community, it makes >> sense to add 2fa required for the org, are there any good reasons to either >> wait to do this, or not do it? Feedback welcome! >> >> (if theres no objections i'll do it friday or this weekend, so theres >> some lead time for anyone who's not setup for that yet) >> >> Best wishes and great health to all >> -carter >> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chessai1996 at gmail.com Wed Mar 18 21:28:51 2020 From: chessai1996 at gmail.com (chessai .) Date: Wed, 18 Mar 2020 14:28:51 -0700 Subject: [core libraries] Re: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: I agree with Carter here, 2FA is very accessible and if someone runs into a problem we can just tell them they need 2FA. It wouldn't be much more than a 10 minute disruption. Perhaps we could send out notice that it will take into effect at a certain point, maybe giving people a week or two. But we should really have this be mandatory. On Wed, Mar 18, 2020, 1:09 PM Carter Schonwald wrote: > true, otoh, 2fa in various usable forms has been widely available for > years, and we can reonboard people pretty easily. Its critical haskell > infra and to the best of my knowledge, current 2fa tooling is pretty > accessible to everyone globally. If someone has specific issues we can > address them as they arise! > > On Wed, Mar 18, 2020 at 3:45 PM David Feuer wrote: > >> That's not a lot of lead time. >> >> On Wed, Mar 18, 2020, 2:47 PM Carter Schonwald < >> carter.schonwald at gmail.com> wrote: >> >>> hey everyone, because so much important stuff for the community, it >>> makes sense to add 2fa required for the org, are there any good reasons to >>> either wait to do this, or not do it? Feedback welcome! >>> >>> (if theres no objections i'll do it friday or this weekend, so theres >>> some lead time for anyone who's not setup for that yet) >>> >>> Best wishes and great health to all >>> -carter >>> _______________________________________________ >>> Libraries mailing list >>> Libraries at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>> >> -- > You received this message because you are subscribed to the Google Groups > "haskell-core-libraries" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to haskell-core-libraries+unsubscribe at googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/haskell-core-libraries/CAHYVw0xA-Fzh1G-YUxWtV1HgOg%3D5o4jwYKNOipU-7dpYrYmA-g%40mail.gmail.com > > . > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexandreR_B at outlook.com Wed Mar 18 21:38:31 2020 From: alexandreR_B at outlook.com (=?iso-8859-1?Q?Alexandre_Rodrigues_Bald=E9?=) Date: Wed, 18 Mar 2020 21:38:31 +0000 Subject: [core libraries] Re: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: , Message-ID: This is a sensible measure, but I doubt people that contribute to GHC via GitHub (even if just for read access) are on this maling list. Perhaps an issue can be created to notify people of this, rather than let them run into errors and wonder what they did wrong. ________________________________ De: ghc-devs em nome de chessai . Enviado: Wednesday, March 18, 2020 9:28:51 PM Para: Carter Schonwald Cc: David Feuer ; Haskell Libraries ; ghc-devs ; core-libraries-committee at haskell.org Assunto: Re: [core libraries] Re: intent to enable 2fa requirement for github.com/haskell org I agree with Carter here, 2FA is very accessible and if someone runs into a problem we can just tell them they need 2FA. It wouldn't be much more than a 10 minute disruption. Perhaps we could send out notice that it will take into effect at a certain point, maybe giving people a week or two. But we should really have this be mandatory. On Wed, Mar 18, 2020, 1:09 PM Carter Schonwald > wrote: true, otoh, 2fa in various usable forms has been widely available for years, and we can reonboard people pretty easily. Its critical haskell infra and to the best of my knowledge, current 2fa tooling is pretty accessible to everyone globally. If someone has specific issues we can address them as they arise! On Wed, Mar 18, 2020 at 3:45 PM David Feuer > wrote: That's not a lot of lead time. On Wed, Mar 18, 2020, 2:47 PM Carter Schonwald > wrote: hey everyone, because so much important stuff for the community, it makes sense to add 2fa required for the org, are there any good reasons to either wait to do this, or not do it? Feedback welcome! (if theres no objections i'll do it friday or this weekend, so theres some lead time for anyone who's not setup for that yet) Best wishes and great health to all -carter _______________________________________________ Libraries mailing list Libraries at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries -- You received this message because you are subscribed to the Google Groups "haskell-core-libraries" group. To unsubscribe from this group and stop receiving emails from it, send an email to haskell-core-libraries+unsubscribe at googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-core-libraries/CAHYVw0xA-Fzh1G-YUxWtV1HgOg%3D5o4jwYKNOipU-7dpYrYmA-g%40mail.gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Wed Mar 18 22:07:25 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 18 Mar 2020 18:07:25 -0400 Subject: [core libraries] Re: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: theres a reason i emailed ghc-devs + libraries, to make sure its visible! we can remediate any perms that get busted that need to be reinstated, but its been sitting like it is for long enough :) On Wed, Mar 18, 2020 at 5:38 PM Alexandre Rodrigues Baldé < alexandreR_B at outlook.com> wrote: > This is a sensible measure, but I doubt people that contribute to GHC via > GitHub (even if just for read access) are on this maling list. > > > > Perhaps an issue can be created to notify people of this, rather than let > them run into errors and wonder what they did wrong. > > > ------------------------------ > *De:* ghc-devs em nome de chessai . < > chessai1996 at gmail.com> > *Enviado:* Wednesday, March 18, 2020 9:28:51 PM > *Para:* Carter Schonwald > *Cc:* David Feuer ; Haskell Libraries < > libraries at haskell.org>; ghc-devs ; > core-libraries-committee at haskell.org > > *Assunto:* Re: [core libraries] Re: intent to enable 2fa requirement for > github.com/haskell org > > I agree with Carter here, 2FA is very accessible and if someone runs into > a problem we can just tell them they need 2FA. It wouldn't be much more > than a 10 minute disruption. Perhaps we could send out notice that it will > take into effect at a certain point, maybe giving people a week or two. But > we should really have this be mandatory. > > On Wed, Mar 18, 2020, 1:09 PM Carter Schonwald > wrote: > > true, otoh, 2fa in various usable forms has been widely available for > years, and we can reonboard people pretty easily. Its critical haskell > infra and to the best of my knowledge, current 2fa tooling is pretty > accessible to everyone globally. If someone has specific issues we can > address them as they arise! > > On Wed, Mar 18, 2020 at 3:45 PM David Feuer wrote: > > That's not a lot of lead time. > > On Wed, Mar 18, 2020, 2:47 PM Carter Schonwald > wrote: > > hey everyone, because so much important stuff for the community, it makes > sense to add 2fa required for the org, are there any good reasons to either > wait to do this, or not do it? Feedback welcome! > > (if theres no objections i'll do it friday or this weekend, so theres some > lead time for anyone who's not setup for that yet) > > Best wishes and great health to all > -carter > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > -- > You received this message because you are subscribed to the Google Groups > "haskell-core-libraries" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to haskell-core-libraries+unsubscribe at googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/haskell-core-libraries/CAHYVw0xA-Fzh1G-YUxWtV1HgOg%3D5o4jwYKNOipU-7dpYrYmA-g%40mail.gmail.com > > . > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Wed Mar 18 22:47:47 2020 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Thu, 19 Mar 2020 00:47:47 +0200 Subject: [core libraries] Re: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: For read access you don't need 2FA (= be in the GitHub organization). Can you clarify what could go wrong? - Oleg On 18.3.2020 23.38, Alexandre Rodrigues Baldé wrote: > > This is a sensible measure, but I doubt people that contribute to GHC > via GitHub (even if just for read access) are on this maling list. > > Perhaps an issue can be created to notify people of this, rather than > let them run into errors and wonder what they did wrong. > > ------------------------------------------------------------------------ > *De:* ghc-devs em nome de chessai . > > *Enviado:* Wednesday, March 18, 2020 9:28:51 PM > *Para:* Carter Schonwald > *Cc:* David Feuer ; Haskell Libraries > ; ghc-devs ; > core-libraries-committee at haskell.org > > *Assunto:* Re: [core libraries] Re: intent to enable 2fa requirement > for github.com/haskell org > I agree with Carter here, 2FA is very accessible and if someone runs > into a problem we can just tell them they need 2FA. It wouldn't be > much more than a 10 minute disruption. Perhaps we could send out > notice that it will take into effect at a certain point, maybe giving > people a week or two. But we should really have this be mandatory. > > On Wed, Mar 18, 2020, 1:09 PM Carter Schonwald > > wrote: > > true, otoh, 2fa in various usable forms has been widely available > for years, and we can reonboard people pretty easily. Its critical > haskell infra and to the best of my knowledge, current 2fa tooling > is pretty accessible to everyone globally. If someone has specific > issues we can address them as they arise! > > On Wed, Mar 18, 2020 at 3:45 PM David Feuer > wrote: > > That's not a lot of lead time. > > On Wed, Mar 18, 2020, 2:47 PM Carter Schonwald > > wrote: > > hey everyone, because so much important stuff for the > community, it makes sense to add 2fa required for the org, > are there any good reasons to either wait to do this, or > not do it? Feedback welcome! > > (if theres no objections i'll do it friday or this > weekend, so theres some lead time for anyone who's not > setup for that yet) > > Best wishes and great health to all > -carter > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > -- > You received this message because you are subscribed to the Google > Groups "haskell-core-libraries" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to > haskell-core-libraries+unsubscribe at googlegroups.com > . > To view this discussion on the web visit > https://groups.google.com/d/msgid/haskell-core-libraries/CAHYVw0xA-Fzh1G-YUxWtV1HgOg%3D5o4jwYKNOipU-7dpYrYmA-g%40mail.gmail.com > . > > > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Wed Mar 18 23:05:16 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 18 Mar 2020 19:05:16 -0400 Subject: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: No. You don’t. You can use a yubi key and or a totp tool like google Authenticator or 1Password etc. no phones required On Wed, Mar 18, 2020 at 6:16 PM Duncan Coutts wrote: > On Wed, 2020-03-18 at 14:46 -0400, Carter Schonwald wrote: > > hey everyone, because so much important stuff for the community, it > > makes sense to add 2fa required for the org, are there any good > > reasons to either wait to do this, or not do it? Feedback welcome! > > I think I might get cut off. > > Is it not still the case that github's 2fa needs a program running on a > mobile phone, or an SMS-capable mobile phone? Is there any support for > normal tools running on a normal Linux machine? > > (I think last time I tried to use the SMS route, it refused to send SMS > messages to my landline, despite the fact that I can receive them) > > > Duncan > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Wed Mar 18 23:52:36 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 18 Mar 2020 19:52:36 -0400 Subject: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: Awesome! After talking with several folks, feedback has been that best practices are to make sure the notice is a week before hand. So what I’ll do is personally reach out to those who aren’t 2fa enabled in the Haskell gh org (and haven’t commented on this thread )and ask them to enable 2fa on their GitHub account. Perhaps I should attach a 2fa options explainer ! I’ll look at folks responses and if everyone active has made the switch over, I’ll look to do a transition next Monday or Tuesday. Be well! (Nyc and many other places are pretty strange right now :/ ) -Carter On Wed, Mar 18, 2020 at 7:42 PM Duncan Coutts wrote: > On Wed, 2020-03-18 at 19:05 -0400, Carter Schonwald wrote: > > No. You don’t. You can use a yubi key and or a totp tool like google > > Authenticator or 1Password etc. no phones required > > It took me a while, but I have successfully managed to turn 2FA back > into 1FA. > > In case it helps anyone else, generate your 2FA response with > > $ oathtool --totp -b $the-2fa-secret > > Where $the-2fa-secret is the code github gives you after the recovery > codes (initially shown as a barcode, but they'll give you the actual > code if you click the link). > > > On Wed, Mar 18, 2020 at 6:16 PM Duncan Coutts > wrote: > > > On Wed, 2020-03-18 at 14:46 -0400, Carter Schonwald wrote: > > > > hey everyone, because so much important stuff for the community, it > > > > makes sense to add 2fa required for the org, are there any good > > > > reasons to either wait to do this, or not do it? Feedback welcome! > > > > > > I think I might get cut off. > > > > > > Is it not still the case that github's 2fa needs a program running on a > > > mobile phone, or an SMS-capable mobile phone? Is there any support for > > > normal tools running on a normal Linux machine? > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at well-typed.com Wed Mar 18 19:05:39 2020 From: ben at well-typed.com (Ben Gamari) Date: Wed, 18 Mar 2020 15:05:39 -0400 Subject: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: <3F698C66-BFAE-46DA-B902-BE079C8DD69E@well-typed.com> I agree that this would be a good idea. Cheers, — Ben On March 18, 2020 2:46:47 PM EDT, Carter Schonwald wrote: >hey everyone, because so much important stuff for the community, it >makes >sense to add 2fa required for the org, are there any good reasons to >either >wait to do this, or not do it? Feedback welcome! > >(if theres no objections i'll do it friday or this weekend, so theres >some >lead time for anyone who's not setup for that yet) > >Best wishes and great health to all >-carter -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Thu Mar 19 08:57:26 2020 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Thu, 19 Mar 2020 08:57:26 +0000 Subject: [core libraries] Re: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: I have not been following this. What is the consequence for a regular GHC developer, or someone contributing to GHC? In any announcement please give a way to verify “am I affected?” Thanks Simon From: haskell-core-libraries at googlegroups.com On Behalf Of Carter Schonwald Sent: 18 March 2020 23:53 To: Duncan Coutts Cc: Haskell Libraries ; core-libraries-committee at haskell.org; ghc-devs Subject: [core libraries] Re: intent to enable 2fa requirement for github.com/haskell org Awesome! After talking with several folks, feedback has been that best practices are to make sure the notice is a week before hand. So what I’ll do is personally reach out to those who aren’t 2fa enabled in the Haskell gh org (and haven’t commented on this thread )and ask them to enable 2fa on their GitHub account. Perhaps I should attach a 2fa options explainer ! I’ll look at folks responses and if everyone active has made the switch over, I’ll look to do a transition next Monday or Tuesday. Be well! (Nyc and many other places are pretty strange right now :/ ) -Carter On Wed, Mar 18, 2020 at 7:42 PM Duncan Coutts > wrote: On Wed, 2020-03-18 at 19:05 -0400, Carter Schonwald wrote: > No. You don’t. You can use a yubi key and or a totp tool like google > Authenticator or 1Password etc. no phones required It took me a while, but I have successfully managed to turn 2FA back into 1FA. In case it helps anyone else, generate your 2FA response with $ oathtool --totp -b $the-2fa-secret Where $the-2fa-secret is the code github gives you after the recovery codes (initially shown as a barcode, but they'll give you the actual code if you click the link). > On Wed, Mar 18, 2020 at 6:16 PM Duncan Coutts > wrote: > > On Wed, 2020-03-18 at 14:46 -0400, Carter Schonwald wrote: > > > hey everyone, because so much important stuff for the community, it > > > makes sense to add 2fa required for the org, are there any good > > > reasons to either wait to do this, or not do it? Feedback welcome! > > > > I think I might get cut off. > > > > Is it not still the case that github's 2fa needs a program running on a > > mobile phone, or an SMS-capable mobile phone? Is there any support for > > normal tools running on a normal Linux machine? > > -- You received this message because you are subscribed to the Google Groups "haskell-core-libraries" group. To unsubscribe from this group and stop receiving emails from it, send an email to haskell-core-libraries+unsubscribe at googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-core-libraries/CAHYVw0x5CTOmQDLp3%2B89muQ%2BvXgmcmgo%3DgCHs8kjBHOMb%3D5Ksw%40mail.gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rae at richarde.dev Thu Mar 19 09:44:15 2020 From: rae at richarde.dev (Richard Eisenberg) Date: Thu, 19 Mar 2020 09:44:15 +0000 Subject: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: <2EC32AA7-BA58-4456-AAB0-0950A7D2DC8A@richarde.dev> > On Mar 18, 2020, at 11:52 PM, Carter Schonwald wrote: > > After talking with several folks, feedback has been that best practices are to make sure the notice is a week before hand. > > So what I’ll do is personally reach out to those who aren’t 2fa enabled in the Haskell gh org (and haven’t commented on this thread )and ask them to enable 2fa on their GitHub account. Perhaps I should attach a 2fa options explainer ! > > I’ll look at folks responses and if everyone active has made the switch over, I’ll look to do a transition next Monday or Tuesday. > If best practices are to wait a week... shouldn't we wait a week? There's no fire here. Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Thu Mar 19 14:55:29 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Thu, 19 Mar 2020 10:55:29 -0400 Subject: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: <2EC32AA7-BA58-4456-AAB0-0950A7D2DC8A@richarde.dev> References: <2EC32AA7-BA58-4456-AAB0-0950A7D2DC8A@richarde.dev> Message-ID: @ Simon: you already have 2fa enabled, youre not on the list of users who do *not* have 2fa enabled. Its just an extra login prompt the first time you login from a new device or do anything in the "are you sure you want to do that change". SO enabling 2fa is largely invisible to contributors aside from the 5 minutes to setup, and the message i sent out directly to every person who would be impacted that hasn't already replied to this email thread listed a number of options that could choose (though i should have also included a url, but if anyones confused i hope they ask and I can help) @richard indeed, this is why i also directly and individually emailed every member/contributor of the github haskell org individually (who doesnt have 2fa setup). Some of them dont have an easy to track down email address! Basically everyone who's been active in the past two years has responded already or indicated they'll set it up this coming weekend. (in 1-2 cases, it helped remind that they'd forgotten to setup 2fa even though they had planned to ) On Thu, Mar 19, 2020 at 5:44 AM Richard Eisenberg wrote: > > > On Mar 18, 2020, at 11:52 PM, Carter Schonwald > wrote: > > After talking with several folks, feedback has been that best practices > are to make sure the notice is a week before hand. > > So what I’ll do is personally reach out to those who aren’t 2fa enabled in > the Haskell gh org (and haven’t commented on this thread )and ask them to > enable 2fa on their GitHub account. Perhaps I should attach a 2fa options > explainer ! > > I’ll look at folks responses and if everyone active has made the switch > over, I’ll look to do a transition next Monday or Tuesday. > > > If best practices are to wait a week... shouldn't we wait a week? There's > no fire here. > > Richard > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chessai1996 at gmail.com Sat Mar 21 18:44:07 2020 From: chessai1996 at gmail.com (chessai .) Date: Sat, 21 Mar 2020 11:44:07 -0700 Subject: Alternative instance for Const Message-ID: We already have instance Monoid m => Applicative (Const m) we could easily add instance Monoid m => Alternative (Const m) where empty = coerce mempty (<|>) = coerce (<>) which trivially satisfies left/right identity and associativity. I propose we add this instance to base. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zemyla at gmail.com Sat Mar 21 20:22:39 2020 From: zemyla at gmail.com (Zemyla) Date: Sat, 21 Mar 2020 15:22:39 -0500 Subject: Alternative instance for Const In-Reply-To: References: Message-ID: No, the Alternative instance should be based on semirings instead. The one you propose isn't distributive. Lacking general semirings, the best we can do at the moment is newtypes for each semiring we have. For instance: newtype NumConst a b = NumConst { getNumConst :: a } deriving (Functor) instance Num a => Applicative (NumConst a) where pure = const (NumConst 1) (<*>) = (coerce :: (a -> a -> a) -> NumConst a (u -> v) -> NumConst a u -> NumConst a v) (*) instance Num a => Alternative (NumConst a) where empty = NumConst 0 (<|>) = (coerce :: (a -> a -> a) -> NumConst a b -> NumConst a b -> NumConst a b) (+) On Sat, Mar 21, 2020, 13:44 chessai . wrote: > We already have > > instance Monoid m => Applicative (Const m) > > we could easily add > > instance Monoid m => Alternative (Const m) where > empty = coerce mempty > (<|>) = coerce (<>) > > which trivially satisfies left/right identity and associativity. > > I propose we add this instance to base. > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.jakobi at googlemail.com Sat Mar 21 21:46:32 2020 From: simon.jakobi at googlemail.com (Simon Jakobi) Date: Sat, 21 Mar 2020 22:46:32 +0100 Subject: Alternative instance for Const In-Reply-To: References: Message-ID: Hi Zemyla, Could you clarify where the requirement for distributivity comes from? The haddocks for Alternative don't mention it: http://downloads.haskell.org/~ghc/8.10.1-rc1/docs/html/libraries/base-4.14.0.0/Control-Applicative.html#t:Alternative Thanks, Simon Am Sa., 21. März 2020 um 21:23 Uhr schrieb Zemyla : > > No, the Alternative instance should be based on semirings instead. The one you propose isn't distributive. > > Lacking general semirings, the best we can do at the moment is newtypes for each semiring we have. For instance: > > newtype NumConst a b = NumConst { getNumConst :: a } > deriving (Functor) > > instance Num a => Applicative (NumConst a) where > pure = const (NumConst 1) > (<*>) = (coerce :: (a -> a -> a) -> NumConst a (u -> v) -> NumConst a u -> NumConst a v) (*) > > instance Num a => Alternative (NumConst a) where > empty = NumConst 0 > (<|>) = (coerce :: (a -> a -> a) -> NumConst a b -> NumConst a b -> NumConst a b) (+) > > On Sat, Mar 21, 2020, 13:44 chessai . wrote: >> >> We already have >> >> instance Monoid m => Applicative (Const m) >> >> we could easily add >> >> instance Monoid m => Alternative (Const m) where >> empty = coerce mempty >> (<|>) = coerce (<>) >> >> which trivially satisfies left/right identity and associativity. >> >> I propose we add this instance to base. >> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries From oleg.grenrus at iki.fi Sat Mar 21 22:54:12 2020 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Sun, 22 Mar 2020 00:54:12 +0200 Subject: Alternative instance for Const In-Reply-To: References: Message-ID: <2db5f636-f1dd-fc9a-858c-ae1b6a42227a@iki.fi> https://wiki.haskell.org/Typeclassopedia#Laws_6 On 21.3.2020 23.46, Simon Jakobi via Libraries wrote: > Hi Zemyla, > > Could you clarify where the requirement for distributivity comes from? > > The haddocks for Alternative don't mention it: > http://downloads.haskell.org/~ghc/8.10.1-rc1/docs/html/libraries/base-4.14.0.0/Control-Applicative.html#t:Alternative > > Thanks, > Simon > > Am Sa., 21. März 2020 um 21:23 Uhr schrieb Zemyla : >> No, the Alternative instance should be based on semirings instead. The one you propose isn't distributive. >> >> Lacking general semirings, the best we can do at the moment is newtypes for each semiring we have. For instance: >> >> newtype NumConst a b = NumConst { getNumConst :: a } >> deriving (Functor) >> >> instance Num a => Applicative (NumConst a) where >> pure = const (NumConst 1) >> (<*>) = (coerce :: (a -> a -> a) -> NumConst a (u -> v) -> NumConst a u -> NumConst a v) (*) >> >> instance Num a => Alternative (NumConst a) where >> empty = NumConst 0 >> (<|>) = (coerce :: (a -> a -> a) -> NumConst a b -> NumConst a b -> NumConst a b) (+) >> >> On Sat, Mar 21, 2020, 13:44 chessai . wrote: >>> We already have >>> >>> instance Monoid m => Applicative (Const m) >>> >>> we could easily add >>> >>> instance Monoid m => Alternative (Const m) where >>> empty = coerce mempty >>> (<|>) = coerce (<>) >>> >>> which trivially satisfies left/right identity and associativity. >>> >>> I propose we add this instance to base. >>> _______________________________________________ >>> Libraries mailing list >>> Libraries at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries From chessai1996 at gmail.com Sat Mar 21 23:23:37 2020 From: chessai1996 at gmail.com (chessai .) Date: Sat, 21 Mar 2020 16:23:37 -0700 Subject: Alternative instance for Const In-Reply-To: <2db5f636-f1dd-fc9a-858c-ae1b6a42227a@iki.fi> References: <2db5f636-f1dd-fc9a-858c-ae1b6a42227a@iki.fi> Message-ID: As far as I'm aware, distributivity is neither required nor adhered to by many types in core libraries and beyond. Only left and right identity, and associativity. This instance would also play well with the existing Applicative instance. On Sat, Mar 21, 2020, 3:54 PM Oleg Grenrus wrote: > https://wiki.haskell.org/Typeclassopedia#Laws_6 > > On 21.3.2020 23.46, Simon Jakobi via Libraries wrote: > > Hi Zemyla, > > > > Could you clarify where the requirement for distributivity comes from? > > > > The haddocks for Alternative don't mention it: > > > http://downloads.haskell.org/~ghc/8.10.1-rc1/docs/html/libraries/base-4.14.0.0/Control-Applicative.html#t:Alternative > > > > Thanks, > > Simon > > > > Am Sa., 21. März 2020 um 21:23 Uhr schrieb Zemyla : > >> No, the Alternative instance should be based on semirings instead. The > one you propose isn't distributive. > >> > >> Lacking general semirings, the best we can do at the moment is newtypes > for each semiring we have. For instance: > >> > >> newtype NumConst a b = NumConst { getNumConst :: a } > >> deriving (Functor) > >> > >> instance Num a => Applicative (NumConst a) where > >> pure = const (NumConst 1) > >> (<*>) = (coerce :: (a -> a -> a) -> NumConst a (u -> v) -> NumConst > a u -> NumConst a v) (*) > >> > >> instance Num a => Alternative (NumConst a) where > >> empty = NumConst 0 > >> (<|>) = (coerce :: (a -> a -> a) -> NumConst a b -> NumConst a b -> > NumConst a b) (+) > >> > >> On Sat, Mar 21, 2020, 13:44 chessai . wrote: > >>> We already have > >>> > >>> instance Monoid m => Applicative (Const m) > >>> > >>> we could easily add > >>> > >>> instance Monoid m => Alternative (Const m) where > >>> empty = coerce mempty > >>> (<|>) = coerce (<>) > >>> > >>> which trivially satisfies left/right identity and associativity. > >>> > >>> I propose we add this instance to base. > >>> _______________________________________________ > >>> Libraries mailing list > >>> Libraries at haskell.org > >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > >> _______________________________________________ > >> Libraries mailing list > >> Libraries at haskell.org > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > _______________________________________________ > > Libraries mailing list > > Libraries at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.abel at ifi.lmu.de Sun Mar 22 09:27:07 2020 From: andreas.abel at ifi.lmu.de (Andreas Abel) Date: Sun, 22 Mar 2020 10:27:07 +0100 Subject: Alternative instance for Const In-Reply-To: References: Message-ID: > No, the Alternative instance should be based on semirings instead. The > one you propose isn't distributive. +1. -1 on non-distributive default instances. On 2020-03-21 21:22, Zemyla wrote: > No, the Alternative instance should be based on semirings instead. The > one you propose isn't distributive. > > Lacking general semirings, the best we can do at the moment is newtypes > for each semiring we have. For instance: > > newtype NumConst a b = NumConst { getNumConst :: a } >   deriving (Functor) > > instance Num a => Applicative (NumConst a) where >   pure = const (NumConst 1) >   (<*>) = (coerce :: (a -> a -> a) -> NumConst a (u -> v) -> NumConst a > u -> NumConst a v) (*) > > instance Num a => Alternative (NumConst a) where >   empty = NumConst 0 >   (<|>) = (coerce :: (a -> a -> a) -> NumConst a b -> NumConst a b -> > NumConst a b) (+) > > On Sat, Mar 21, 2020, 13:44 chessai . > wrote: > > We already have > > instance Monoid m => Applicative (Const m) > > we could easily add > > instance Monoid m => Alternative (Const m) where >   empty = coerce mempty >   (<|>) = coerce (<>) > > which trivially satisfies left/right identity and associativity. > > I propose we add this instance to base. > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > From zemyla at gmail.com Sun Mar 22 18:40:07 2020 From: zemyla at gmail.com (Zemyla) Date: Sun, 22 Mar 2020 13:40:07 -0500 Subject: Export functions on Natural in Numeric.Natural Message-ID: Functions in GHC.Natural like naturalToWordMaybe and minusNaturalMaybe are extremely useful, especially when trying to write provably total functions, and I wish they were available in a Safe module like Numeric.Natural. I also want a total function that does the following: -- This function turns an Integer n into a pair of -- (fromInteger (abs n), fromInteger (signum n)). integerToNaturalSign :: Integer -> (Natural, Int) #if 0 -- This is the reference version, except for the fact that numeric literals don't exist yet -- when GHC.Natural is being defined, and fromInteger isn't actually total. integerToNaturalSign n = case compare n 0 of LT -> (fromInteger (negate n), -1) EQ -> (0, 0) GT -> (fromInteger n, 1) #elif !defined(MIN_VERSION_integer_gmp) -- This is like the reference version, except using the newtype wrapper and MagicHash. integerToNaturalSign n = case compare n (intToInteger# 0#) of LT -> (Natural (negateInteger n), I# (-1#)) EQ -> (Natural n, I# 0#) GT -> (Natural n, I# 1#) #else -- We take advantage of the GMP functions and constructors. integerToNaturalSign (Jn# bn) = (bigNatToNatural bn, I# (-1#)) integerToNaturalSign (S# i#) = case isTrue# (i# <# 0#) of True -> (NatS# (int2Word# (negateInt# i#)), I# (-1#)) _ -> (NatS# (int2Word# i#), I# (i# ># 0#)) integerToNaturalSign (Jp# bn) = (bigNatToNatural bn, I# 1#) #endif -------------- next part -------------- An HTML attachment was scrubbed... URL: From chessai1996 at gmail.com Sun Mar 22 22:55:22 2020 From: chessai1996 at gmail.com (chessai .) Date: Sun, 22 Mar 2020 15:55:22 -0700 Subject: Export functions on Natural in Numeric.Natural In-Reply-To: References: Message-ID: Sure, I don't see why not. I think powModNatural is also safe. Are your criteria for a function worth re-exporting from Numeric.Natural that 1. The function does not have an overloaded variant defined in base (e.g. all the monorphic version of `fromIntegral` in GHC.Natural would be excluded) and 2. The function is total? Thanks On Sun, Mar 22, 2020 at 11:40 AM Zemyla wrote: > > Functions in GHC.Natural like naturalToWordMaybe and minusNaturalMaybe are extremely useful, especially when trying to write provably total functions, and I wish they were available in a Safe module like Numeric.Natural. I also want a total function that does the following: > > -- This function turns an Integer n into a pair of > -- (fromInteger (abs n), fromInteger (signum n)). > integerToNaturalSign :: Integer -> (Natural, Int) > #if 0 > -- This is the reference version, except for the fact that numeric literals don't exist yet > -- when GHC.Natural is being defined, and fromInteger isn't actually total. > integerToNaturalSign n = case compare n 0 of > LT -> (fromInteger (negate n), -1) > EQ -> (0, 0) > GT -> (fromInteger n, 1) > #elif !defined(MIN_VERSION_integer_gmp) > -- This is like the reference version, except using the newtype wrapper and MagicHash. > integerToNaturalSign n = case compare n (intToInteger# 0#) of > LT -> (Natural (negateInteger n), I# (-1#)) > EQ -> (Natural n, I# 0#) > GT -> (Natural n, I# 1#) > #else > -- We take advantage of the GMP functions and constructors. > integerToNaturalSign (Jn# bn) = (bigNatToNatural bn, I# (-1#)) > integerToNaturalSign (S# i#) = case isTrue# (i# <# 0#) of > True -> (NatS# (int2Word# (negateInt# i#)), I# (-1#)) > _ -> (NatS# (int2Word# i#), I# (i# ># 0#)) > integerToNaturalSign (Jp# bn) = (bigNatToNatural bn, I# 1#) > #endif > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries From zemyla at gmail.com Mon Mar 23 01:11:26 2020 From: zemyla at gmail.com (Zemyla) Date: Sun, 22 Mar 2020 20:11:26 -0500 Subject: Export functions on Natural in Numeric.Natural In-Reply-To: References: Message-ID: That pretty much sums it up. On Sun, Mar 22, 2020, 17:55 chessai . wrote: > Sure, I don't see why not. I think powModNatural is also safe. > > Are your criteria for a function worth re-exporting from Numeric.Natural > that > > 1. The function does not have an overloaded variant defined in base > (e.g. all the monorphic version of `fromIntegral` in GHC.Natural would > be excluded) and > 2. The function is total? > > Thanks > > On Sun, Mar 22, 2020 at 11:40 AM Zemyla wrote: > > > > Functions in GHC.Natural like naturalToWordMaybe and minusNaturalMaybe > are extremely useful, especially when trying to write provably total > functions, and I wish they were available in a Safe module like > Numeric.Natural. I also want a total function that does the following: > > > > -- This function turns an Integer n into a pair of > > -- (fromInteger (abs n), fromInteger (signum n)). > > integerToNaturalSign :: Integer -> (Natural, Int) > > #if 0 > > -- This is the reference version, except for the fact that numeric > literals don't exist yet > > -- when GHC.Natural is being defined, and fromInteger isn't actually > total. > > integerToNaturalSign n = case compare n 0 of > > LT -> (fromInteger (negate n), -1) > > EQ -> (0, 0) > > GT -> (fromInteger n, 1) > > #elif !defined(MIN_VERSION_integer_gmp) > > -- This is like the reference version, except using the newtype wrapper > and MagicHash. > > integerToNaturalSign n = case compare n (intToInteger# 0#) of > > LT -> (Natural (negateInteger n), I# (-1#)) > > EQ -> (Natural n, I# 0#) > > GT -> (Natural n, I# 1#) > > #else > > -- We take advantage of the GMP functions and constructors. > > integerToNaturalSign (Jn# bn) = (bigNatToNatural bn, I# (-1#)) > > integerToNaturalSign (S# i#) = case isTrue# (i# <# 0#) of > > True -> (NatS# (int2Word# (negateInt# i#)), I# (-1#)) > > _ -> (NatS# (int2Word# i#), I# (i# ># 0#)) > > integerToNaturalSign (Jp# bn) = (bigNatToNatural bn, I# 1#) > > #endif > > _______________________________________________ > > Libraries mailing list > > Libraries at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chessai1996 at gmail.com Mon Mar 23 01:16:26 2020 From: chessai1996 at gmail.com (chessai .) Date: Sun, 22 Mar 2020 18:16:26 -0700 Subject: Export functions on Natural in Numeric.Natural In-Reply-To: References: Message-ID: Sounds reasonable to me. Perhaps others can weigh in. Thanks On Sun, Mar 22, 2020, 6:11 PM Zemyla wrote: > That pretty much sums it up. > > On Sun, Mar 22, 2020, 17:55 chessai . wrote: > >> Sure, I don't see why not. I think powModNatural is also safe. >> >> Are your criteria for a function worth re-exporting from Numeric.Natural >> that >> >> 1. The function does not have an overloaded variant defined in base >> (e.g. all the monorphic version of `fromIntegral` in GHC.Natural would >> be excluded) and >> 2. The function is total? >> >> Thanks >> >> On Sun, Mar 22, 2020 at 11:40 AM Zemyla wrote: >> > >> > Functions in GHC.Natural like naturalToWordMaybe and minusNaturalMaybe >> are extremely useful, especially when trying to write provably total >> functions, and I wish they were available in a Safe module like >> Numeric.Natural. I also want a total function that does the following: >> > >> > -- This function turns an Integer n into a pair of >> > -- (fromInteger (abs n), fromInteger (signum n)). >> > integerToNaturalSign :: Integer -> (Natural, Int) >> > #if 0 >> > -- This is the reference version, except for the fact that numeric >> literals don't exist yet >> > -- when GHC.Natural is being defined, and fromInteger isn't actually >> total. >> > integerToNaturalSign n = case compare n 0 of >> > LT -> (fromInteger (negate n), -1) >> > EQ -> (0, 0) >> > GT -> (fromInteger n, 1) >> > #elif !defined(MIN_VERSION_integer_gmp) >> > -- This is like the reference version, except using the newtype wrapper >> and MagicHash. >> > integerToNaturalSign n = case compare n (intToInteger# 0#) of >> > LT -> (Natural (negateInteger n), I# (-1#)) >> > EQ -> (Natural n, I# 0#) >> > GT -> (Natural n, I# 1#) >> > #else >> > -- We take advantage of the GMP functions and constructors. >> > integerToNaturalSign (Jn# bn) = (bigNatToNatural bn, I# (-1#)) >> > integerToNaturalSign (S# i#) = case isTrue# (i# <# 0#) of >> > True -> (NatS# (int2Word# (negateInt# i#)), I# (-1#)) >> > _ -> (NatS# (int2Word# i#), I# (i# ># 0#)) >> > integerToNaturalSign (Jp# bn) = (bigNatToNatural bn, I# 1#) >> > #endif >> > _______________________________________________ >> > Libraries mailing list >> > Libraries at haskell.org >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Wed Mar 25 16:47:55 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 25 Mar 2020 12:47:55 -0400 Subject: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: Duncan, David, please figure out 2fa tools that work for you and enable them, https://github.com/tadfisher/pass-otp https://github.com/solokeys/solo https://github.com/herrjemand/awesome-webauthn#hardware-authenticators https://1password.com/ https://keepass.info/download.html if you are having trouble figuring out tools you're comfortable using, please share with us those constraints we can help you! im here to help (and i'm delaying enabling another day or two to provide help to some active contributors who are having their own difficulties setitng up this stuff) On Wed, Mar 18, 2020 at 6:16 PM Duncan Coutts wrote: > On Wed, 2020-03-18 at 14:46 -0400, Carter Schonwald wrote: > > hey everyone, because so much important stuff for the community, it > > makes sense to add 2fa required for the org, are there any good > > reasons to either wait to do this, or not do it? Feedback welcome! > > I think I might get cut off. > > Is it not still the case that github's 2fa needs a program running on a > mobile phone, or an SMS-capable mobile phone? Is there any support for > normal tools running on a normal Linux machine? > > (I think last time I tried to use the SMS route, it refused to send SMS > messages to my landline, despite the fact that I can receive them) > > > Duncan > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Wed Mar 25 19:46:49 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 25 Mar 2020 15:46:49 -0400 Subject: intent to enable 2fa requirement for github.com/haskell org In-Reply-To: References: Message-ID: Yeah, there’s def an incredible diversity of tools that are great in this space. And there’s at this point decent tools for almost every platform constraint imaginable. On Wed, Mar 25, 2020 at 1:30 PM Giorgio Marinelli wrote: > I use the following 2fa tools. They offer also import/export > functionalities. > > - andOTP (Android) https://github.com/andOTP/andOTP > - OTPClient (Linux) https://github.com/paolostivanin/OTPClient > > Regards, > > > Giorgio > > On Wed, 25 Mar 2020 at 17:48, Carter Schonwald > wrote: > > > > Duncan, David, please figure out 2fa tools that work for you and enable > them, > > > > > > https://github.com/tadfisher/pass-otp > > > > https://github.com/solokeys/solo > > > > https://github.com/herrjemand/awesome-webauthn#hardware-authenticators > > > > https://1password.com/ > > > > https://keepass.info/download.html > > > > > > if you are having trouble figuring out tools you're comfortable using, > please share with us those constraints we can help you! > > > > im here to help (and i'm delaying enabling another day or two to provide > help to some active contributors who are having their own difficulties > setitng up this stuff) > > > > On Wed, Mar 18, 2020 at 6:16 PM Duncan Coutts > wrote: > >> > >> On Wed, 2020-03-18 at 14:46 -0400, Carter Schonwald wrote: > >> > hey everyone, because so much important stuff for the community, it > >> > makes sense to add 2fa required for the org, are there any good > >> > reasons to either wait to do this, or not do it? Feedback welcome! > >> > >> I think I might get cut off. > >> > >> Is it not still the case that github's 2fa needs a program running on a > >> mobile phone, or an SMS-capable mobile phone? Is there any support for > >> normal tools running on a normal Linux machine? > >> > >> (I think last time I tried to use the SMS route, it refused to send SMS > >> messages to my landline, despite the fact that I can receive them) > >> > >> > >> Duncan > >> > > _______________________________________________ > > ghc-devs mailing list > > ghc-devs at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > -------------- next part -------------- An HTML attachment was scrubbed... URL: From grey at quietmisdreavus.net Mon Mar 30 16:21:26 2020 From: grey at quietmisdreavus.net (Grey Mitchell) Date: Mon, 30 Mar 2020 10:21:26 -0600 Subject: =?UTF-8?Q?Adding_new_contructors_to_IOMode_to_support_"don't_overwrite_i?= =?UTF-8?Q?f_already_exists"_behavior?= In-Reply-To: <038a1a94-74e2-44fe-aff6-3722c98f1295@www.fastmail.com> References: <038a1a94-74e2-44fe-aff6-3722c98f1295@www.fastmail.com> Message-ID: <25b5eeed-22c5-4746-a284-0c492a5c1e1f@www.fastmail.com> The current behavior for System.IO.openFile will either truncate an existing file (with WriteMode) or append new content to the end (with AppendMode). However, there's another behavior that's available from the underlying API: signal an error when the file already exists. I poked around at the code and i think that with a couple extra variants of IOMode, this behavior could be added with a relatively small patch. I have a branch pushed where i added this behavior: https://gitlab.haskell.org/QuietMisdreavus/ghc/-/commit/1ff18d4d3fc63f42c371f4046ab07405299c6755 I'm a relative newcomer to contributing to GHC or the base library, so if i'm missing something in my patch please let me know. Specifically, i would like to know is there's a place i can add a test for this behavior. I'm also open to changing the names of the new IOModes - this was just something i wrote in to get something working. Looking forward to working with maintainers to get this added! Thanks, Grey Mitchell (@QuietMisdreavus) From carter.schonwald at gmail.com Tue Mar 31 21:51:34 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 31 Mar 2020 17:51:34 -0400 Subject: Adding new contructors to IOMode to support "don't overwrite if already exists" behavior In-Reply-To: <25b5eeed-22c5-4746-a284-0c492a5c1e1f@www.fastmail.com> References: <038a1a94-74e2-44fe-aff6-3722c98f1295@www.fastmail.com> <25b5eeed-22c5-4746-a284-0c492a5c1e1f@www.fastmail.com> Message-ID: At least naively, this seems like a really good idea. 1) do folks who have more experience across the range of supported platforms have any opinions about these additional semantics ? 2) are these names suitably descriptive / unambiguous and or otherwise widely used / discoverable ? On Mon, Mar 30, 2020 at 12:22 PM Grey Mitchell wrote: > The current behavior for System.IO.openFile will either truncate an > existing > file (with WriteMode) or append new content to the end (with AppendMode). > However, there's another behavior that's available from the underlying API: > signal an error when the file already exists. I poked around at the code > and i > think that with a couple extra variants of IOMode, this behavior could be > added > with a relatively small patch. > > I have a branch pushed where i added this behavior: > > https://gitlab.haskell.org/QuietMisdreavus/ghc/-/commit/1ff18d4d3fc63f42c371f4046ab07405299c6755 > > I'm a relative newcomer to contributing to GHC or the base library, so if > i'm > missing something in my patch please let me know. Specifically, i would > like to > know is there's a place i can add a test for this behavior. I'm also open > to > changing the names of the new IOModes - this was just something i wrote in > to > get something working. > > Looking forward to working with maintainers to get this added! > > Thanks, > Grey Mitchell (@QuietMisdreavus) > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Tue Mar 31 22:15:24 2020 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 31 Mar 2020 18:15:24 -0400 Subject: Adding new contructors to IOMode to support "don't overwrite if already exists" behavior In-Reply-To: References: <038a1a94-74e2-44fe-aff6-3722c98f1295@www.fastmail.com> <25b5eeed-22c5-4746-a284-0c492a5c1e1f@www.fastmail.com> Message-ID: One really important question is what modes are actually promised by actual file systems on every posix or otherwise supported platforms . Table stakes is code should work well on every tier 1 platform and tier 2 as well And it’s been pointed out to me that this is part of the Haskell report so whatever final design is done needs to be excellent Meta aside : on and off I sometimes wonder what the world would be like if file systems weren’t stuck in posix minima tar pits (heck an Mvcc with transactions file system would rock). But that’s unrelated to improving the world we have. Do either way this at least starts a discussion about what we can do better today ! Pardon the slow reply, I think everyone everywhere is having a very strange start to spring. Be well and look forward to improving bits and pieces of how we deal with files on computers ;) -Carter On Tue, Mar 31, 2020 at 5:51 PM Carter Schonwald wrote: > At least naively, this seems like a really good idea. > > 1) do folks who have more experience across the range of supported > platforms have any opinions about these additional semantics ? > > 2) are these names suitably descriptive / unambiguous and or otherwise > widely used / discoverable ? > > On Mon, Mar 30, 2020 at 12:22 PM Grey Mitchell > wrote: > >> The current behavior for System.IO.openFile will either truncate an >> existing >> file (with WriteMode) or append new content to the end (with AppendMode). >> However, there's another behavior that's available from the underlying >> API: >> signal an error when the file already exists. I poked around at the code >> and i >> think that with a couple extra variants of IOMode, this behavior could be >> added >> with a relatively small patch. >> >> I have a branch pushed where i added this behavior: >> >> https://gitlab.haskell.org/QuietMisdreavus/ghc/-/commit/1ff18d4d3fc63f42c371f4046ab07405299c6755 >> >> I'm a relative newcomer to contributing to GHC or the base library, so if >> i'm >> missing something in my patch please let me know. Specifically, i would >> like to >> know is there's a place i can add a test for this behavior. I'm also open >> to >> changing the names of the new IOModes - this was just something i wrote >> in to >> get something working. >> >> Looking forward to working with maintainers to get this added! >> >> Thanks, >> Grey Mitchell (@QuietMisdreavus) >> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From grey at quietmisdreavus.net Tue Mar 31 23:28:43 2020 From: grey at quietmisdreavus.net (Grey Mitchell) Date: Tue, 31 Mar 2020 17:28:43 -0600 Subject: =?UTF-8?Q?Re:_Adding_new_contructors_to_IOMode_to_support_"don't_overwri?= =?UTF-8?Q?te_if_already_exists"_behavior?= In-Reply-To: References: <038a1a94-74e2-44fe-aff6-3722c98f1295@www.fastmail.com> <25b5eeed-22c5-4746-a284-0c492a5c1e1f@www.fastmail.com> Message-ID: <3b770034-b0bb-4ee3-a5b4-bd1c66af6099@www.fastmail.com> Re: Platform support: I have access to Windows, Linux, and Mac machines, so i can run a quick test if need be. (My current development environment is on a Mac, so i'd need to set up a fresh environment on my Windows and Linux machines.) My assumption is the the EXCL flag being enabled by these modes is part of the basic support for the POSIX open() call - even the MSVC C standard library includes it as part of its emulated open(). It would of course be important to verify this by running the code. Re: Names: I want to reiterate that the names in my branch were sketches. I did a quick survey of a handful of programming languages just now to see is there was any existing consensus. Rust and .NET call the behavior "create new" in their enumerations. The docs for Python and Ruby call the flag "exclusive create" or "exclusive access", reflecting the name of the underlying C flag. This seems to tell me that my initial suggestion of "no overwrite" doesn't really match up; i'd like to offer another suggestion of WriteCreateNewMode and ReadWriteCreateNewMode. No worries about the slow reply! I've been there, so it's totally understandable. -grey On Tue, Mar 31, 2020, at 4:15 PM, Carter Schonwald wrote: > One really important question is what modes are actually promised by actual file systems on every posix or otherwise supported platforms . Table stakes is code should work well on every tier 1 platform and tier 2 as well > > And it’s been pointed out to me that this is part of the Haskell report so whatever final design is done needs to be excellent > > Meta aside : on and off I sometimes wonder what the world would be like if file systems weren’t stuck in posix minima tar pits (heck an Mvcc with transactions file system would rock). But that’s unrelated to improving the world we have. Do either way this at least starts a discussion about what we can do better today ! > > Pardon the slow reply, I think everyone everywhere is having a very strange start to spring. > > Be well and look forward to improving bits and pieces of how we deal with files on computers ;) > > -Carter > > On Tue, Mar 31, 2020 at 5:51 PM Carter Schonwald wrote: >> At least naively, this seems like a really good idea. >> >> 1) do folks who have more experience across the range of supported platforms have any opinions about these additional semantics ? >> >> 2) are these names suitably descriptive / unambiguous and or otherwise widely used / discoverable ? >> >> On Mon, Mar 30, 2020 at 12:22 PM Grey Mitchell wrote: >>> The current behavior for System.IO.openFile will either truncate an existing >>> file (with WriteMode) or append new content to the end (with AppendMode). >>> However, there's another behavior that's available from the underlying API: >>> signal an error when the file already exists. I poked around at the code and i >>> think that with a couple extra variants of IOMode, this behavior could be added >>> with a relatively small patch. >>> >>> I have a branch pushed where i added this behavior: >>> https://gitlab.haskell.org/QuietMisdreavus/ghc/-/commit/1ff18d4d3fc63f42c371f4046ab07405299c6755 >>> >>> I'm a relative newcomer to contributing to GHC or the base library, so if i'm >>> missing something in my patch please let me know. Specifically, i would like to >>> know is there's a place i can add a test for this behavior. I'm also open to >>> changing the names of the new IOModes - this was just something i wrote in to >>> get something working. >>> >>> Looking forward to working with maintainers to get this added! >>> >>> Thanks, >>> Grey Mitchell (@QuietMisdreavus) >>> _______________________________________________ >>> Libraries mailing list >>> Libraries at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries Thanks, Grey -------------- next part -------------- An HTML attachment was scrubbed... URL: