From lemming at henning-thielemann.de Thu Nov 3 16:12:01 2022 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Thu, 3 Nov 2022 17:12:01 +0100 (CET) Subject: [Haskell-cafe] Haskell survey 2022 Message-ID: <35b3aa4-f519-f750-2fb0-f1996131d66@henning-thielemann.de> It seems there is a survey on Haskell Weekly but I have not seen an announcement on the mailing lists: https://haskellweekly.news/survey/2022.html From ben at well-typed.com Thu Nov 3 20:58:14 2022 From: ben at well-typed.com (Ben Gamari) Date: Thu, 03 Nov 2022 16:58:14 -0400 Subject: [Haskell-cafe] [ANNOUNCE] GHC 9.4.3 is now available Message-ID: <87mt97ep1h.fsf@smart-cactus.org> The GHC developers are happy to announce the availability of GHC 9.4.3. Binary distributions, source distributions, and documentation are available at downloads.haskell.org: https://downloads.haskell.org/ghc/9.4.3 This release is primarily a bugfix release addressing a few issues found in 9.4.2. These include: * An issue where recursively calls could be speculatively evaluated, resulting in non-termination (#20836) * A code generation issue in the AArch64 native code generator backend resulting in incorrect runtime results in some circumstances (#22282) * A crash on Darwin when running executables compiled with IPE support (#22080) * A long-standing interface-file determinism issue where full paths would leak into the interface file (#22162) * A bug in the `process` library where file handles specified as `NoStream` would still be usable in the child (process#251) Note that, as GHC 9.4 is the first release series where the release artifacts are all generated by our new Hadrian build system, it is possible that there will be packaging issues. If you enounter trouble while using a binary distribution, please open a [ticket]. Likewise, if you are a downstream packager, do consider migrating to [Hadrian] to run your build; the Hadrian build system can be built using `cabal-install`, `stack`, or the in-tree [bootstrap script]. See the accompanying [blog post] for details on migrating packaging to Hadrian. We would also like to emphasize that GHC 9.4 must be used in conjunction with Cabal-3.8 or later. This is particularly important for Windows users due to changes in GHC's Windows toolchain. We would like to thank Microsoft Azure, GitHub, IOG, the Zw3rk stake pool, Well-Typed, Tweag I/O, Serokell, Equinix, SimSpace, Haskell Foundation, and other anonymous contributors whose on-going financial and in-kind support has facilitated GHC maintenance and release management over the years. Finally, this release would not have been possible without the hundreds of open-source contributors whose work comprise this release. As always, do give this release a try and open a ticket if you see anything amiss. Happy Haskelling, - Ben [ticket]: https://gitlab.haskell.org/ghc/ghc/-/issues/new [bootstrap script]: https://gitlab.haskell.org/ghc/ghc/-/blob/e2520df3fffa0cf22fb19c5fb872832d11c07d35/hadrian/bootstrap/README.md [Hadrian]: https://gitlab.haskell.org/ghc/ghc/-/blob/e2520df3fffa0cf22fb19c5fb872832d11c07d35/hadrian [blog post]: https://www.haskell.org/ghc/blog/20220805-make-to-hadrian.html -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From mgsloan at gmail.com Fri Nov 4 02:09:49 2022 From: mgsloan at gmail.com (Michael Sloan) Date: Thu, 3 Nov 2022 20:09:49 -0600 Subject: [Haskell-cafe] Help with TH trick In-Reply-To: References: Message-ID: Hmm, the documentation does list 5 bullets of why this is a nice way of doing things. But yes, considering this didn't catch on no doubt either the docs are poor quality or the thing isn't really something people want. FWIW I wrote this many years ago, before deriving via. I just figured you might be interested as it is very similar to your query. The examples could be better. One thing to note is that you can list a bunch of instances: $($(derive [d| instance Deriving (Storable X) instance Deriving (Eq X) instance Deriving (Show X) |])) (purely an example, afaik it wouldn't make sense to use TH to generate some canonical Eq and Show instances) Whereas with typical `$(mkStorable [t| Storable X|] $)` style you need multiple splices and you need to know the names of these TH functions. In retrospect this would probably be better without the `Deriving` wrapper, I think I needed that to disambiguate from the instantiators, which indeed aren't properly documented at all (I don't recall how they work, and don't feel like digging into it much further) On Tue, Oct 25, 2022 at 11:21 PM David Feuer wrote: > I must admit that looks rather mysterious to me. The documentation I saw > doesn't make the benefit of the nested splice terribly obvious. > > On Tue, Oct 25, 2022, 10:53 PM Michael Sloan wrote: > >> You might also be interested in >> https://hackage.haskell.org/package/th-utilities-0.2.5.0/docs/TH-Derive.html - >> though afaik it didn't catch on. >> >> The cleverness there is to use nesting splicing, where the inner one >> generates code involving something like "runDeriver (Proxy @ Storable X) >> ...", where runDeriver is a method of a typeclass. The instances of this >> class implement the code generation that is ultimately used for the output. >> >> $($(derive [d| >> instance Deriving (Storable X) >> |])) >> >> >> On Sat, Oct 22, 2022, 13:48 David Feuer wrote: >> >>> Okay, I found it: recursion-schemes. >>> >>> On Sat, Oct 22, 2022, 3:05 PM David Feuer wrote: >>> >>>> That doesn't work out so well when the class has a bunch of methods. I >>>> definitely saw the nice way on Hackage ... somewhere. >>>> >>>> On Sat, Oct 22, 2022, 2:49 PM Brandon Allbery >>>> wrote: >>>> >>>>> I'm not aware of anything specifically like that, but the `make…` >>>>> functions in >>>>> https://hackage.haskell.org/package/deriving-compat-0.6.1/docs/Data-Deriving.html >>>>> may allow you to do something similar? >>>>> >>>>> On Sat, Oct 22, 2022 at 2:32 PM David Feuer >>>>> wrote: >>>>> > >>>>> > I remember seeing a package that offered a function used something >>>>> like this: >>>>> > >>>>> > $(deriveThingy [d| instance Foo a => Thingy a |]) >>>>> > >>>>> > to allow the user to specify the constraint(s) for a generated >>>>> instance. I'd love to borrow the code for that, but I can't remember what >>>>> package it was in, what class it derived, etc. Can anyone help? >>>>> > _______________________________________________ >>>>> > Haskell-Cafe mailing list >>>>> > To (un)subscribe, modify options or view archives go to: >>>>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>> > Only members subscribed via the mailman list are allowed to post. >>>>> >>>>> >>>>> >>>>> -- >>>>> brandon s allbery kf8nh >>>>> allbery.b at gmail.com >>>>> >>>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view archives go to: >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> Only members subscribed via the mailman list are allowed to post. >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Fri Nov 4 02:23:03 2022 From: david.feuer at gmail.com (David Feuer) Date: Thu, 3 Nov 2022 22:23:03 -0400 Subject: [Haskell-cafe] Help with TH trick In-Reply-To: References: Message-ID: Why the double splice? What about this makes you generate code that when run will generate code? On Thu, Nov 3, 2022, 10:10 PM Michael Sloan wrote: > Hmm, the documentation does list 5 bullets of why this is a nice way of > doing things. But yes, considering this didn't catch on no doubt either > the docs are poor quality or the thing isn't really something people want. > FWIW I wrote this many years ago, before deriving via. I just figured you > might be interested as it is very similar to your query. > > The examples could be better. One thing to note is that you can list a > bunch of instances: > > $($(derive [d| > instance Deriving (Storable X) > instance Deriving (Eq X) > instance Deriving (Show X) > |])) > > > (purely an example, afaik it wouldn't make sense to use TH to generate > some canonical Eq and Show instances) > > Whereas with typical `$(mkStorable [t| Storable X|] $)` style you need > multiple splices and you need to know the names of these TH functions. > > In retrospect this would probably be better without the `Deriving` > wrapper, I think I needed that to disambiguate from the instantiators, > which indeed aren't properly documented at all (I don't recall how they > work, and don't feel like digging into it much further) > > On Tue, Oct 25, 2022 at 11:21 PM David Feuer > wrote: > >> I must admit that looks rather mysterious to me. The documentation I saw >> doesn't make the benefit of the nested splice terribly obvious. >> >> On Tue, Oct 25, 2022, 10:53 PM Michael Sloan wrote: >> >>> You might also be interested in >>> https://hackage.haskell.org/package/th-utilities-0.2.5.0/docs/TH-Derive.html - >>> though afaik it didn't catch on. >>> >>> The cleverness there is to use nesting splicing, where the inner one >>> generates code involving something like "runDeriver (Proxy @ Storable X) >>> ...", where runDeriver is a method of a typeclass. The instances of this >>> class implement the code generation that is ultimately used for the output. >>> >>> $($(derive [d| >>> instance Deriving (Storable X) >>> |])) >>> >>> >>> On Sat, Oct 22, 2022, 13:48 David Feuer wrote: >>> >>>> Okay, I found it: recursion-schemes. >>>> >>>> On Sat, Oct 22, 2022, 3:05 PM David Feuer >>>> wrote: >>>> >>>>> That doesn't work out so well when the class has a bunch of methods. I >>>>> definitely saw the nice way on Hackage ... somewhere. >>>>> >>>>> On Sat, Oct 22, 2022, 2:49 PM Brandon Allbery >>>>> wrote: >>>>> >>>>>> I'm not aware of anything specifically like that, but the `make…` >>>>>> functions in >>>>>> https://hackage.haskell.org/package/deriving-compat-0.6.1/docs/Data-Deriving.html >>>>>> may allow you to do something similar? >>>>>> >>>>>> On Sat, Oct 22, 2022 at 2:32 PM David Feuer >>>>>> wrote: >>>>>> > >>>>>> > I remember seeing a package that offered a function used something >>>>>> like this: >>>>>> > >>>>>> > $(deriveThingy [d| instance Foo a => Thingy a |]) >>>>>> > >>>>>> > to allow the user to specify the constraint(s) for a generated >>>>>> instance. I'd love to borrow the code for that, but I can't remember what >>>>>> package it was in, what class it derived, etc. Can anyone help? >>>>>> > _______________________________________________ >>>>>> > Haskell-Cafe mailing list >>>>>> > To (un)subscribe, modify options or view archives go to: >>>>>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>>> > Only members subscribed via the mailman list are allowed to post. >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> brandon s allbery kf8nh >>>>>> allbery.b at gmail.com >>>>>> >>>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> To (un)subscribe, modify options or view archives go to: >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> Only members subscribed via the mailman list are allowed to post. >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From mgsloan at gmail.com Fri Nov 4 02:37:41 2022 From: mgsloan at gmail.com (Michael Sloan) Date: Thu, 3 Nov 2022 20:37:41 -0600 Subject: [Haskell-cafe] Help with TH trick In-Reply-To: References: Message-ID: Ah, it allows the mechanism to be open, so if you create a new typeclass you can also declare how to use TH to derive instances. Roughly (if TH allowed splices in more spots in quotes): class Tangy a where -- ... instance Deriver (Tangy a) where runDeriver Proxy cxt ty = [d| instance $(cxt) => Tangy $(ty) where {- ... -} |] Now in some other module I can do: $($(derive [d| instance Deriving (Tangy X) |])) The first splice will generate the code that dispatches to the instance, and the next splice will generate the actual output. This approach can also allow you to use more complex dispatch to the deriver if you wish. For example, maybe you have a Serializable class that comes with some format type that is openly extensible. You could define `instance Deriver (Serializable Json a)` / `instance Deriver (Serializable Yaml a)` etc and `derive` will dispatch to them when interpreting the outer splice. On Thu, Nov 3, 2022 at 8:23 PM David Feuer wrote: > Why the double splice? What about this makes you generate code that when > run will generate code? > > On Thu, Nov 3, 2022, 10:10 PM Michael Sloan wrote: > >> Hmm, the documentation does list 5 bullets of why this is a nice way of >> doing things. But yes, considering this didn't catch on no doubt either >> the docs are poor quality or the thing isn't really something people want. >> FWIW I wrote this many years ago, before deriving via. I just figured you >> might be interested as it is very similar to your query. >> >> The examples could be better. One thing to note is that you can list a >> bunch of instances: >> >> $($(derive [d| >> instance Deriving (Storable X) >> instance Deriving (Eq X) >> instance Deriving (Show X) >> |])) >> >> >> (purely an example, afaik it wouldn't make sense to use TH to generate >> some canonical Eq and Show instances) >> >> Whereas with typical `$(mkStorable [t| Storable X|] $)` style you need >> multiple splices and you need to know the names of these TH functions. >> >> In retrospect this would probably be better without the `Deriving` >> wrapper, I think I needed that to disambiguate from the instantiators, >> which indeed aren't properly documented at all (I don't recall how they >> work, and don't feel like digging into it much further) >> >> On Tue, Oct 25, 2022 at 11:21 PM David Feuer >> wrote: >> >>> I must admit that looks rather mysterious to me. The documentation I saw >>> doesn't make the benefit of the nested splice terribly obvious. >>> >>> On Tue, Oct 25, 2022, 10:53 PM Michael Sloan wrote: >>> >>>> You might also be interested in >>>> https://hackage.haskell.org/package/th-utilities-0.2.5.0/docs/TH-Derive.html - >>>> though afaik it didn't catch on. >>>> >>>> The cleverness there is to use nesting splicing, where the inner one >>>> generates code involving something like "runDeriver (Proxy @ Storable X) >>>> ...", where runDeriver is a method of a typeclass. The instances of this >>>> class implement the code generation that is ultimately used for the output. >>>> >>>> $($(derive [d| >>>> instance Deriving (Storable X) >>>> |])) >>>> >>>> >>>> On Sat, Oct 22, 2022, 13:48 David Feuer wrote: >>>> >>>>> Okay, I found it: recursion-schemes. >>>>> >>>>> On Sat, Oct 22, 2022, 3:05 PM David Feuer >>>>> wrote: >>>>> >>>>>> That doesn't work out so well when the class has a bunch of methods. >>>>>> I definitely saw the nice way on Hackage ... somewhere. >>>>>> >>>>>> On Sat, Oct 22, 2022, 2:49 PM Brandon Allbery >>>>>> wrote: >>>>>> >>>>>>> I'm not aware of anything specifically like that, but the `make…` >>>>>>> functions in >>>>>>> https://hackage.haskell.org/package/deriving-compat-0.6.1/docs/Data-Deriving.html >>>>>>> may allow you to do something similar? >>>>>>> >>>>>>> On Sat, Oct 22, 2022 at 2:32 PM David Feuer >>>>>>> wrote: >>>>>>> > >>>>>>> > I remember seeing a package that offered a function used something >>>>>>> like this: >>>>>>> > >>>>>>> > $(deriveThingy [d| instance Foo a => Thingy a |]) >>>>>>> > >>>>>>> > to allow the user to specify the constraint(s) for a generated >>>>>>> instance. I'd love to borrow the code for that, but I can't remember what >>>>>>> package it was in, what class it derived, etc. Can anyone help? >>>>>>> > _______________________________________________ >>>>>>> > Haskell-Cafe mailing list >>>>>>> > To (un)subscribe, modify options or view archives go to: >>>>>>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>>>> > Only members subscribed via the mailman list are allowed to post. >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> brandon s allbery kf8nh >>>>>>> allbery.b at gmail.com >>>>>>> >>>>>> _______________________________________________ >>>>> Haskell-Cafe mailing list >>>>> To (un)subscribe, modify options or view archives go to: >>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>> Only members subscribed via the mailman list are allowed to post. >>>> >>>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From mgsloan at gmail.com Fri Nov 4 02:45:36 2022 From: mgsloan at gmail.com (Michael Sloan) Date: Thu, 3 Nov 2022 20:45:36 -0600 Subject: [Haskell-cafe] Help with TH trick In-Reply-To: References: Message-ID: And the point of the "instantiators" is to support generating instances where you also require some value-level definition. This can now be done via deriving via, except that deriving via will reveal implementation details to users which may be undesirable. Very roughly (I did not look at how instantiators actually work in the package): data BoolLike = Trueish | Falseish $($(derive [d| instance EqViaBijection Bool BoolLike where to True = Trueish to False = Falseish from Trueish = True from Falseish = False ]|)) and the generated code would be an `Eq` instance, and the bijection used would not be visible to outside users (whereas it is if you use deriving via for this) On Thu, Nov 3, 2022 at 8:37 PM Michael Sloan wrote: > Ah, it allows the mechanism to be open, so if you create a new typeclass > you can also declare how to use TH to derive instances. Roughly (if TH > allowed splices in more spots in quotes): > > class Tangy a where > -- ... > > instance Deriver (Tangy a) where > runDeriver Proxy cxt ty = [d| instance $(cxt) => Tangy $(ty) where {- > ... -} |] > > Now in some other module I can do: > > $($(derive [d| instance Deriving (Tangy X) |])) > > The first splice will generate the code that dispatches to the instance, > and the next splice will generate the actual output. This approach can > also allow you to use more complex dispatch to the deriver if you wish. > For example, maybe you have a Serializable class that comes with some > format type that is openly extensible. You could define `instance > Deriver (Serializable Json a)` / `instance Deriver (Serializable Yaml a)` > etc and `derive` will dispatch to them when interpreting the outer splice. > > On Thu, Nov 3, 2022 at 8:23 PM David Feuer wrote: > >> Why the double splice? What about this makes you generate code that when >> run will generate code? >> >> On Thu, Nov 3, 2022, 10:10 PM Michael Sloan wrote: >> >>> Hmm, the documentation does list 5 bullets of why this is a nice way of >>> doing things. But yes, considering this didn't catch on no doubt either >>> the docs are poor quality or the thing isn't really something people want. >>> FWIW I wrote this many years ago, before deriving via. I just figured you >>> might be interested as it is very similar to your query. >>> >>> The examples could be better. One thing to note is that you can list a >>> bunch of instances: >>> >>> $($(derive [d| >>> instance Deriving (Storable X) >>> instance Deriving (Eq X) >>> instance Deriving (Show X) >>> |])) >>> >>> >>> (purely an example, afaik it wouldn't make sense to use TH to generate >>> some canonical Eq and Show instances) >>> >>> Whereas with typical `$(mkStorable [t| Storable X|] $)` style you need >>> multiple splices and you need to know the names of these TH functions. >>> >>> In retrospect this would probably be better without the `Deriving` >>> wrapper, I think I needed that to disambiguate from the instantiators, >>> which indeed aren't properly documented at all (I don't recall how they >>> work, and don't feel like digging into it much further) >>> >>> On Tue, Oct 25, 2022 at 11:21 PM David Feuer >>> wrote: >>> >>>> I must admit that looks rather mysterious to me. The documentation I >>>> saw doesn't make the benefit of the nested splice terribly obvious. >>>> >>>> On Tue, Oct 25, 2022, 10:53 PM Michael Sloan wrote: >>>> >>>>> You might also be interested in >>>>> https://hackage.haskell.org/package/th-utilities-0.2.5.0/docs/TH-Derive.html - >>>>> though afaik it didn't catch on. >>>>> >>>>> The cleverness there is to use nesting splicing, where the inner one >>>>> generates code involving something like "runDeriver (Proxy @ Storable X) >>>>> ...", where runDeriver is a method of a typeclass. The instances of this >>>>> class implement the code generation that is ultimately used for the output. >>>>> >>>>> $($(derive [d| >>>>> instance Deriving (Storable X) >>>>> |])) >>>>> >>>>> >>>>> On Sat, Oct 22, 2022, 13:48 David Feuer wrote: >>>>> >>>>>> Okay, I found it: recursion-schemes. >>>>>> >>>>>> On Sat, Oct 22, 2022, 3:05 PM David Feuer >>>>>> wrote: >>>>>> >>>>>>> That doesn't work out so well when the class has a bunch of methods. >>>>>>> I definitely saw the nice way on Hackage ... somewhere. >>>>>>> >>>>>>> On Sat, Oct 22, 2022, 2:49 PM Brandon Allbery >>>>>>> wrote: >>>>>>> >>>>>>>> I'm not aware of anything specifically like that, but the `make…` >>>>>>>> functions in >>>>>>>> https://hackage.haskell.org/package/deriving-compat-0.6.1/docs/Data-Deriving.html >>>>>>>> may allow you to do something similar? >>>>>>>> >>>>>>>> On Sat, Oct 22, 2022 at 2:32 PM David Feuer >>>>>>>> wrote: >>>>>>>> > >>>>>>>> > I remember seeing a package that offered a function used >>>>>>>> something like this: >>>>>>>> > >>>>>>>> > $(deriveThingy [d| instance Foo a => Thingy a |]) >>>>>>>> > >>>>>>>> > to allow the user to specify the constraint(s) for a generated >>>>>>>> instance. I'd love to borrow the code for that, but I can't remember what >>>>>>>> package it was in, what class it derived, etc. Can anyone help? >>>>>>>> > _______________________________________________ >>>>>>>> > Haskell-Cafe mailing list >>>>>>>> > To (un)subscribe, modify options or view archives go to: >>>>>>>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>>>>> > Only members subscribed via the mailman list are allowed to post. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> brandon s allbery kf8nh >>>>>>>> allbery.b at gmail.com >>>>>>>> >>>>>>> _______________________________________________ >>>>>> Haskell-Cafe mailing list >>>>>> To (un)subscribe, modify options or view archives go to: >>>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>>> Only members subscribed via the mailman list are allowed to post. >>>>> >>>>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From boryskopec00 at gmail.com Sun Nov 6 17:36:55 2022 From: boryskopec00 at gmail.com (=?UTF-8?B?Qm9yeXMgS29wZcSH?=) Date: Sun, 6 Nov 2022 18:36:55 +0100 Subject: [Haskell-cafe] CIS 194 not compiling under new GHC Message-ID: Hi all, I've been working through the CIS 194 course recently and unfortunately from lecture 7 onwards the code is not compliant with current compiler. I can still follow the lectures but I'd like to do every homework exercise. Unfortunately most homework exercises provide you with a code framework to work with and this code does not compile. Do any of you know about updated versions or corrections to this course? I believe there could be a repo where someone is keeping the course's homework up to date because this course is still quite popular. Regards Borys -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Sun Nov 6 17:41:40 2022 From: david.feuer at gmail.com (David Feuer) Date: Sun, 6 Nov 2022 12:41:40 -0500 Subject: [Haskell-cafe] CIS 194 not compiling under new GHC In-Reply-To: References: Message-ID: The changes needed to make it work should be minor. Since you call out the chapter on monoids, any Monoid instance now needs a Semigroup instance. Before: instance Monoid X where mappend a b = ... mempty = ... Now: instance Semigroup X where a <> b = ... instance Monoid X where -- mappend no longer needs to be defined mempty = ... On Sun, Nov 6, 2022, 12:37 PM Borys Kopeć wrote: > Hi all, > > I've been working through the CIS 194 > course > recently and unfortunately from lecture 7 onwards the code is not compliant > with current compiler. > > I can still follow the lectures but I'd like to do every homework > exercise. Unfortunately most homework exercises provide you with a code > framework to work with and this code does not compile. > > Do any of you know about updated versions or corrections to this course? I > believe there could be a repo where someone is keeping the course's > homework up to date because this course is still quite popular. > > Regards > Borys > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sun Nov 6 17:44:35 2022 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 6 Nov 2022 12:44:35 -0500 Subject: [Haskell-cafe] CIS 194 not compiling under new GHC In-Reply-To: References: Message-ID: This being a beginners course, it would still be better if it were kept up to date with such changes instead of requiring newcomers to know about them. Byorgey? On Sun, Nov 6, 2022 at 12:42 PM David Feuer wrote: > > The changes needed to make it work should be minor. Since you call out the chapter on monoids, any Monoid instance now needs a Semigroup instance. > > Before: > > instance Monoid X where > mappend a b = ... > mempty = ... > > Now: > > instance Semigroup X where > a <> b = ... > instance Monoid X where > -- mappend no longer needs to be defined > mempty = ... > > On Sun, Nov 6, 2022, 12:37 PM Borys Kopeć wrote: >> >> Hi all, >> >> I've been working through the CIS 194 course recently and unfortunately from lecture 7 onwards the code is not compliant with current compiler. >> >> I can still follow the lectures but I'd like to do every homework exercise. Unfortunately most homework exercises provide you with a code framework to work with and this code does not compile. >> >> Do any of you know about updated versions or corrections to this course? I believe there could be a repo where someone is keeping the course's homework up to date because this course is still quite popular. >> >> Regards >> Borys >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- brandon s allbery kf8nh allbery.b at gmail.com From boryskopec00 at gmail.com Sun Nov 6 17:47:58 2022 From: boryskopec00 at gmail.com (=?UTF-8?B?Qm9yeXMgS29wZcSH?=) Date: Sun, 6 Nov 2022 18:47:58 +0100 Subject: [Haskell-cafe] CIS 194 not compiling under new GHC In-Reply-To: References: Message-ID: Yes, I agree. Unfortunately in the framework provided in this chapter there are more problems than the one you mentioned David. I know I could google each one, make the compiler happy and then get on with exercises but I think that this is not an optimal learning experience. Also I don't know whether all exercises are even sensical with new features being added. On Sun, 6 Nov 2022 at 18:44, Brandon Allbery wrote: > This being a beginners course, it would still be better if it were > kept up to date with such changes instead of requiring newcomers to > know about them. Byorgey? > > On Sun, Nov 6, 2022 at 12:42 PM David Feuer wrote: > > > > The changes needed to make it work should be minor. Since you call out > the chapter on monoids, any Monoid instance now needs a Semigroup instance. > > > > Before: > > > > instance Monoid X where > > mappend a b = ... > > mempty = ... > > > > Now: > > > > instance Semigroup X where > > a <> b = ... > > instance Monoid X where > > -- mappend no longer needs to be defined > > mempty = ... > > > > On Sun, Nov 6, 2022, 12:37 PM Borys Kopeć > wrote: > >> > >> Hi all, > >> > >> I've been working through the CIS 194 course recently and unfortunately > from lecture 7 onwards the code is not compliant with current compiler. > >> > >> I can still follow the lectures but I'd like to do every homework > exercise. Unfortunately most homework exercises provide you with a code > framework to work with and this code does not compile. > >> > >> Do any of you know about updated versions or corrections to this > course? I believe there could be a repo where someone is keeping the > course's homework up to date because this course is still quite popular. > >> > >> Regards > >> Borys > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> To (un)subscribe, modify options or view archives go to: > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> Only members subscribed via the mailman list are allowed to post. > > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > > > -- > brandon s allbery kf8nh > allbery.b at gmail.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jclites at mac.com Sun Nov 6 18:47:47 2022 From: jclites at mac.com (Jeff Clites) Date: Sun, 6 Nov 2022 10:47:47 -0800 Subject: [Haskell-cafe] CIS 194 not compiling under new GHC In-Reply-To: References: Message-ID: > On Nov 6, 2022, at 9:47 AM, Borys Kopeć wrote: > > I know I could google each one, make the compiler happy and then get on with exercises but I think that this is not an optimal learning experience. Not ideal, but it would be worth giving it a try and seeing if you can push through, because deciphering compiler errors are something you will have to deal with when writing your solutions, so it's educational in its own way. It might turn out to be just a few things that need fixing up. > Also I don't know whether all exercises are even sensical with new features being added. I would think they probably are still relevant; the language concepts haven't changed. (I did some quick Googling to see if anyone had put an updated version on GitHub, but I didn't turn anything up. There are a bunch of repos with exercise solutions, so some of them might contain updates to the provided sources but I didn't dig into it.) Jeff > On Sun, 6 Nov 2022 at 18:44, Brandon Allbery wrote: > This being a beginners course, it would still be better if it were > kept up to date with such changes instead of requiring newcomers to > know about them. Byorgey? > > On Sun, Nov 6, 2022 at 12:42 PM David Feuer wrote: > > > > The changes needed to make it work should be minor. Since you call out the chapter on monoids, any Monoid instance now needs a Semigroup instance. > > > > Before: > > > > instance Monoid X where > > mappend a b = ... > > mempty = ... > > > > Now: > > > > instance Semigroup X where > > a <> b = ... > > instance Monoid X where > > -- mappend no longer needs to be defined > > mempty = ... > > > > On Sun, Nov 6, 2022, 12:37 PM Borys Kopeć wrote: > >> > >> Hi all, > >> > >> I've been working through the CIS 194 course recently and unfortunately from lecture 7 onwards the code is not compliant with current compiler. > >> > >> I can still follow the lectures but I'd like to do every homework exercise. Unfortunately most homework exercises provide you with a code framework to work with and this code does not compile. > >> > >> Do any of you know about updated versions or corrections to this course? I believe there could be a repo where someone is keeping the course's homework up to date because this course is still quite popular. > >> > >> Regards > >> Borys > > -- > brandon s allbery kf8nh > allbery.b at gmail.com From byorgey at gmail.com Sun Nov 6 20:26:03 2022 From: byorgey at gmail.com (Brent Yorgey) Date: Sun, 6 Nov 2022 14:26:03 -0600 Subject: [Haskell-cafe] CIS 194 not compiling under new GHC In-Reply-To: References: Message-ID: https://github.com/byorgey/haskell-course is the canonical github repo with the materials (though unfortunately I think most people get the material from the upenn-hosted site, which I no longer have access to). I'm very happy to take PRs with updates. -Brent On Sun, Nov 6, 2022 at 12:48 PM Jeff Clites via Haskell-Cafe < haskell-cafe at haskell.org> wrote: > > On Nov 6, 2022, at 9:47 AM, Borys Kopeć wrote: > > > > I know I could google each one, make the compiler happy and then get on > with exercises but I think that this is not an optimal learning experience. > > Not ideal, but it would be worth giving it a try and seeing if you can > push through, because deciphering compiler errors are something you will > have to deal with when writing your solutions, so it's educational in its > own way. It might turn out to be just a few things that need fixing up. > > > Also I don't know whether all exercises are even sensical with new > features being added. > > I would think they probably are still relevant; the language concepts > haven't changed. > > > (I did some quick Googling to see if anyone had put an updated version on > GitHub, but I didn't turn anything up. There are a bunch of repos with > exercise solutions, so some of them might contain updates to the provided > sources but I didn't dig into it.) > > Jeff > > > On Sun, 6 Nov 2022 at 18:44, Brandon Allbery > wrote: > > This being a beginners course, it would still be better if it were > > kept up to date with such changes instead of requiring newcomers to > > know about them. Byorgey? > > > > On Sun, Nov 6, 2022 at 12:42 PM David Feuer > wrote: > > > > > > The changes needed to make it work should be minor. Since you call out > the chapter on monoids, any Monoid instance now needs a Semigroup instance. > > > > > > Before: > > > > > > instance Monoid X where > > > mappend a b = ... > > > mempty = ... > > > > > > Now: > > > > > > instance Semigroup X where > > > a <> b = ... > > > instance Monoid X where > > > -- mappend no longer needs to be defined > > > mempty = ... > > > > > > On Sun, Nov 6, 2022, 12:37 PM Borys Kopeć > wrote: > > >> > > >> Hi all, > > >> > > >> I've been working through the CIS 194 course recently and > unfortunately from lecture 7 onwards the code is not compliant with current > compiler. > > >> > > >> I can still follow the lectures but I'd like to do every homework > exercise. Unfortunately most homework exercises provide you with a code > framework to work with and this code does not compile. > > >> > > >> Do any of you know about updated versions or corrections to this > course? I believe there could be a repo where someone is keeping the > course's homework up to date because this course is still quite popular. > > >> > > >> Regards > > >> Borys > > > > -- > > brandon s allbery kf8nh > > allbery.b at gmail.com > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sun Nov 6 20:47:36 2022 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 6 Nov 2022 15:47:36 -0500 Subject: [Haskell-cafe] CIS 194 not compiling under new GHC In-Reply-To: References: Message-ID: I just updated the entry in lambdabot for it; that should help some. sm may have some other references to update. On Sun, Nov 6, 2022 at 3:26 PM Brent Yorgey wrote: > > https://github.com/byorgey/haskell-course is the canonical github repo with the materials (though unfortunately I think most people get the material from the upenn-hosted site, which I no longer have access to). I'm very happy to take PRs with updates. > > -Brent > > On Sun, Nov 6, 2022 at 12:48 PM Jeff Clites via Haskell-Cafe wrote: >> >> > On Nov 6, 2022, at 9:47 AM, Borys Kopeć wrote: >> > >> > I know I could google each one, make the compiler happy and then get on with exercises but I think that this is not an optimal learning experience. >> >> Not ideal, but it would be worth giving it a try and seeing if you can push through, because deciphering compiler errors are something you will have to deal with when writing your solutions, so it's educational in its own way. It might turn out to be just a few things that need fixing up. >> >> > Also I don't know whether all exercises are even sensical with new features being added. >> >> I would think they probably are still relevant; the language concepts haven't changed. >> >> >> (I did some quick Googling to see if anyone had put an updated version on GitHub, but I didn't turn anything up. There are a bunch of repos with exercise solutions, so some of them might contain updates to the provided sources but I didn't dig into it.) >> >> Jeff >> >> > On Sun, 6 Nov 2022 at 18:44, Brandon Allbery wrote: >> > This being a beginners course, it would still be better if it were >> > kept up to date with such changes instead of requiring newcomers to >> > know about them. Byorgey? >> > >> > On Sun, Nov 6, 2022 at 12:42 PM David Feuer wrote: >> > > >> > > The changes needed to make it work should be minor. Since you call out the chapter on monoids, any Monoid instance now needs a Semigroup instance. >> > > >> > > Before: >> > > >> > > instance Monoid X where >> > > mappend a b = ... >> > > mempty = ... >> > > >> > > Now: >> > > >> > > instance Semigroup X where >> > > a <> b = ... >> > > instance Monoid X where >> > > -- mappend no longer needs to be defined >> > > mempty = ... >> > > >> > > On Sun, Nov 6, 2022, 12:37 PM Borys Kopeć wrote: >> > >> >> > >> Hi all, >> > >> >> > >> I've been working through the CIS 194 course recently and unfortunately from lecture 7 onwards the code is not compliant with current compiler. >> > >> >> > >> I can still follow the lectures but I'd like to do every homework exercise. Unfortunately most homework exercises provide you with a code framework to work with and this code does not compile. >> > >> >> > >> Do any of you know about updated versions or corrections to this course? I believe there could be a repo where someone is keeping the course's homework up to date because this course is still quite popular. >> > >> >> > >> Regards >> > >> Borys >> > >> > -- >> > brandon s allbery kf8nh >> > allbery.b at gmail.com >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- brandon s allbery kf8nh allbery.b at gmail.com From david.feuer at gmail.com Sun Nov 6 21:50:11 2022 From: david.feuer at gmail.com (David Feuer) Date: Sun, 6 Nov 2022 16:50:11 -0500 Subject: [Haskell-cafe] Help with TH trick In-Reply-To: References: Message-ID: FYI, you can also hide the bijection with DerivingVia if you choose. {-# language MultiParamTypeClasses, StandaloneDeriving, DerivingVia, ScopedTypeVariables #-} class Isomorphic plain fancy where to :: plain -> fancy from :: fancy -> plain newtype Isomorphically plain fancy = Isomorphically fancy instance (Eq plain, Isomorphic plain fancy) => Eq (Isomorphically plain fancy) where Isomorphically x == Isomorphically y = from x == (from y :: plain) data BoolLike = Trueish | Falseish -- BL is not exported, so the bijection is hidden newtype BL = BL BoolLike instance Isomorphic Bool BL where to True = BL Trueish to False = BL Falseish from (BL Trueish) = True from (BL Falseish) = False deriving via Isomorphically Bool BL instance Eq BoolLike On Thu, Nov 3, 2022, 10:46 PM Michael Sloan wrote: > And the point of the "instantiators" is to support generating instances > where you also require some value-level definition. This can now be done > via deriving via, except that deriving via will reveal implementation > details to users which may be undesirable. Very roughly (I did not look at > how instantiators actually work in the package): > > data BoolLike = Trueish | Falseish > > $($(derive [d| > instance EqViaBijection Bool BoolLike where > to True = Trueish > to False = Falseish > from Trueish = True > from Falseish = False > ]|)) > > and the generated code would be an `Eq` instance, and the bijection used > would not be visible to outside users (whereas it is if you use deriving > via for this) > > On Thu, Nov 3, 2022 at 8:37 PM Michael Sloan wrote: > >> Ah, it allows the mechanism to be open, so if you create a new typeclass >> you can also declare how to use TH to derive instances. Roughly (if TH >> allowed splices in more spots in quotes): >> >> class Tangy a where >> -- ... >> >> instance Deriver (Tangy a) where >> runDeriver Proxy cxt ty = [d| instance $(cxt) => Tangy $(ty) where {- >> ... -} |] >> >> Now in some other module I can do: >> >> $($(derive [d| instance Deriving (Tangy X) |])) >> >> The first splice will generate the code that dispatches to the instance, >> and the next splice will generate the actual output. This approach can >> also allow you to use more complex dispatch to the deriver if you wish. >> For example, maybe you have a Serializable class that comes with some >> format type that is openly extensible. You could define `instance >> Deriver (Serializable Json a)` / `instance Deriver (Serializable Yaml a)` >> etc and `derive` will dispatch to them when interpreting the outer splice. >> >> On Thu, Nov 3, 2022 at 8:23 PM David Feuer wrote: >> >>> Why the double splice? What about this makes you generate code that when >>> run will generate code? >>> >>> On Thu, Nov 3, 2022, 10:10 PM Michael Sloan wrote: >>> >>>> Hmm, the documentation does list 5 bullets of why this is a nice way of >>>> doing things. But yes, considering this didn't catch on no doubt either >>>> the docs are poor quality or the thing isn't really something people want. >>>> FWIW I wrote this many years ago, before deriving via. I just figured you >>>> might be interested as it is very similar to your query. >>>> >>>> The examples could be better. One thing to note is that you can list a >>>> bunch of instances: >>>> >>>> $($(derive [d| >>>> instance Deriving (Storable X) >>>> instance Deriving (Eq X) >>>> instance Deriving (Show X) >>>> |])) >>>> >>>> >>>> (purely an example, afaik it wouldn't make sense to use TH to generate >>>> some canonical Eq and Show instances) >>>> >>>> Whereas with typical `$(mkStorable [t| Storable X|] $)` style you need >>>> multiple splices and you need to know the names of these TH functions. >>>> >>>> In retrospect this would probably be better without the `Deriving` >>>> wrapper, I think I needed that to disambiguate from the instantiators, >>>> which indeed aren't properly documented at all (I don't recall how they >>>> work, and don't feel like digging into it much further) >>>> >>>> On Tue, Oct 25, 2022 at 11:21 PM David Feuer >>>> wrote: >>>> >>>>> I must admit that looks rather mysterious to me. The documentation I >>>>> saw doesn't make the benefit of the nested splice terribly obvious. >>>>> >>>>> On Tue, Oct 25, 2022, 10:53 PM Michael Sloan >>>>> wrote: >>>>> >>>>>> You might also be interested in >>>>>> https://hackage.haskell.org/package/th-utilities-0.2.5.0/docs/TH-Derive.html - >>>>>> though afaik it didn't catch on. >>>>>> >>>>>> The cleverness there is to use nesting splicing, where the inner one >>>>>> generates code involving something like "runDeriver (Proxy @ Storable X) >>>>>> ...", where runDeriver is a method of a typeclass. The instances of this >>>>>> class implement the code generation that is ultimately used for the output. >>>>>> >>>>>> $($(derive [d| >>>>>> instance Deriving (Storable X) >>>>>> |])) >>>>>> >>>>>> >>>>>> On Sat, Oct 22, 2022, 13:48 David Feuer >>>>>> wrote: >>>>>> >>>>>>> Okay, I found it: recursion-schemes. >>>>>>> >>>>>>> On Sat, Oct 22, 2022, 3:05 PM David Feuer >>>>>>> wrote: >>>>>>> >>>>>>>> That doesn't work out so well when the class has a bunch of >>>>>>>> methods. I definitely saw the nice way on Hackage ... somewhere. >>>>>>>> >>>>>>>> On Sat, Oct 22, 2022, 2:49 PM Brandon Allbery >>>>>>>> wrote: >>>>>>>> >>>>>>>>> I'm not aware of anything specifically like that, but the `make…` >>>>>>>>> functions in >>>>>>>>> https://hackage.haskell.org/package/deriving-compat-0.6.1/docs/Data-Deriving.html >>>>>>>>> may allow you to do something similar? >>>>>>>>> >>>>>>>>> On Sat, Oct 22, 2022 at 2:32 PM David Feuer >>>>>>>>> wrote: >>>>>>>>> > >>>>>>>>> > I remember seeing a package that offered a function used >>>>>>>>> something like this: >>>>>>>>> > >>>>>>>>> > $(deriveThingy [d| instance Foo a => Thingy a |]) >>>>>>>>> > >>>>>>>>> > to allow the user to specify the constraint(s) for a generated >>>>>>>>> instance. I'd love to borrow the code for that, but I can't remember what >>>>>>>>> package it was in, what class it derived, etc. Can anyone help? >>>>>>>>> > _______________________________________________ >>>>>>>>> > Haskell-Cafe mailing list >>>>>>>>> > To (un)subscribe, modify options or view archives go to: >>>>>>>>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>>>>>> > Only members subscribed via the mailman list are allowed to post. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> brandon s allbery kf8nh >>>>>>>>> allbery.b at gmail.com >>>>>>>>> >>>>>>>> _______________________________________________ >>>>>>> Haskell-Cafe mailing list >>>>>>> To (un)subscribe, modify options or view archives go to: >>>>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>>>> Only members subscribed via the mailman list are allowed to post. >>>>>> >>>>>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From zubin at well-typed.com Mon Nov 7 07:50:04 2022 From: zubin at well-typed.com (Zubin Duggal) Date: Mon, 7 Nov 2022 13:20:04 +0530 Subject: [Haskell-cafe] [Haskell] [ANNOUNCE] GHC 9.2.5 released Message-ID: <20221107075004.pyhwecu65kl2xjmn@zubin-msi> The GHC developers are very happy to at announce the availability of GHC 9.2.5. Binary distributions, source distributions, and documentation are available at [`downloads.haskell.org`](https://downloads.haskell.org/ghc/9.2.5). Download Page: https://www.haskell.org/ghc/download_ghc_9_2_5.html Blog Post: https://www.haskell.org/ghc/blog/20221107-ghc-9.2.5-released.html This release is primarily a bugfix release addressing a few issues found in 9.2.4. These include: * Code generation issues in the AArch64 native code generator backend resulting in incorrect runtime results in some circumstances (#22282, #21964) * Fixes for a number of issues with the simplifier leading to core lint errors and suboptimal performance (#21694, #21755, #22114) * A long-standing interface-file determinism issue where full paths would leak into the interface file (#22162) * A runtime system bug where creating empty mutable arrays resulted in a crash (#21962) - ... and a few more. See the [release notes] for a full accounting. As some of the fixed issues do affect correctness users are encouraged to upgrade promptly. We would like to thank Microsoft Azure, GitHub, IOG, the Zw3rk stake pool, Well-Typed, Tweag I/O, Serokell, Equinix, SimSpace, Haskell Foundation, and other anonymous contributors whose on-going financial and in-kind support has facilitated GHC maintenance and release management over the years. Finally, this release would not have been possible without the hundreds of open-source contributors whose work comprise this release. As always, do give this release a try and open a [ticket][] if you see anything amiss. Happy compiling, - Zubin [ticket]: https://gitlab.haskell.org/ghc/ghc/-/issues/new [release notes]: https://downloads.haskell.org/~ghc/9.2.5/docs/html/users_guide/9.2.5-notes.html -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: not available URL: From boryskopec00 at gmail.com Mon Nov 7 12:46:42 2022 From: boryskopec00 at gmail.com (=?UTF-8?B?Qm9yeXMgS29wZcSH?=) Date: Mon, 7 Nov 2022 13:46:42 +0100 Subject: [Haskell-cafe] CIS 194 not compiling under new GHC In-Reply-To: References: Message-ID: Thank you Brent for answering. I'll continue with the course and try to update the code framework as necessary. If there happens to be a problem that I cannot solve (since it goes outside of my beginner's knowledge scope) is it okay for me to write to you? On Sun, 6 Nov 2022 at 21:26, Brent Yorgey wrote: > https://github.com/byorgey/haskell-course is the canonical github repo > with the materials (though unfortunately I think most people get the > material from the upenn-hosted site, which I no longer have access to). > I'm very happy to take PRs with updates. > > -Brent > > On Sun, Nov 6, 2022 at 12:48 PM Jeff Clites via Haskell-Cafe < > haskell-cafe at haskell.org> wrote: > >> > On Nov 6, 2022, at 9:47 AM, Borys Kopeć wrote: >> > >> > I know I could google each one, make the compiler happy and then get on >> with exercises but I think that this is not an optimal learning experience. >> >> Not ideal, but it would be worth giving it a try and seeing if you can >> push through, because deciphering compiler errors are something you will >> have to deal with when writing your solutions, so it's educational in its >> own way. It might turn out to be just a few things that need fixing up. >> >> > Also I don't know whether all exercises are even sensical with new >> features being added. >> >> I would think they probably are still relevant; the language concepts >> haven't changed. >> >> >> (I did some quick Googling to see if anyone had put an updated version on >> GitHub, but I didn't turn anything up. There are a bunch of repos with >> exercise solutions, so some of them might contain updates to the provided >> sources but I didn't dig into it.) >> >> Jeff >> >> > On Sun, 6 Nov 2022 at 18:44, Brandon Allbery >> wrote: >> > This being a beginners course, it would still be better if it were >> > kept up to date with such changes instead of requiring newcomers to >> > know about them. Byorgey? >> > >> > On Sun, Nov 6, 2022 at 12:42 PM David Feuer >> wrote: >> > > >> > > The changes needed to make it work should be minor. Since you call >> out the chapter on monoids, any Monoid instance now needs a Semigroup >> instance. >> > > >> > > Before: >> > > >> > > instance Monoid X where >> > > mappend a b = ... >> > > mempty = ... >> > > >> > > Now: >> > > >> > > instance Semigroup X where >> > > a <> b = ... >> > > instance Monoid X where >> > > -- mappend no longer needs to be defined >> > > mempty = ... >> > > >> > > On Sun, Nov 6, 2022, 12:37 PM Borys Kopeć >> wrote: >> > >> >> > >> Hi all, >> > >> >> > >> I've been working through the CIS 194 course recently and >> unfortunately from lecture 7 onwards the code is not compliant with current >> compiler. >> > >> >> > >> I can still follow the lectures but I'd like to do every homework >> exercise. Unfortunately most homework exercises provide you with a code >> framework to work with and this code does not compile. >> > >> >> > >> Do any of you know about updated versions or corrections to this >> course? I believe there could be a repo where someone is keeping the >> course's homework up to date because this course is still quite popular. >> > >> >> > >> Regards >> > >> Borys >> > >> > -- >> > brandon s allbery kf8nh >> > allbery.b at gmail.com >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Tue Nov 8 20:31:47 2022 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Tue, 08 Nov 2022 21:31:47 +0100 Subject: [Haskell-cafe] [ANN] faster-megaparsec Message-ID: <62539146404b542f05811d1983c83ae688a28764.camel@aatal-apotheke.de> Dear Haskellers, megaparsec [1] is a parsing library with excellent error reporting. Being able to emit decent parse error messages is traded off against speed, however. Wouldn't it be nice to have a faster parser for your daily parsing needs, but obtain megaparsec's informative error messages for the rare cases when things go wrong? Thanks to megaparsec's parser type class, MonadParsec, you can have both: I wrote a MonadParsec instance for StateT s Maybe (s being the input stream type such as Text or ByteString) which does not do all the bookkeeping ParsecT needs to do. If you manage to write your parser only using the type class primitives, then you can specialize your parser to StateT s Maybe. Only if that returns Nothing specialize again to ParsecT Void s and parse the input again, thus obtaining a decent error message. The package faster-megaparsec [1,2] provides a convenient function to do just that. Of course StateT s Maybe can not provide all the features ParsecT has: * StateT s Maybe is always backtracking. * It does not know the offset in the stream. * It must hold the entire input stream in memory for a second pass, so no garbage collecting the consumed input while parsing. So if your parsing relies on non-backtracking choice, stream offset or garbage-collecting input while parsing, you can not use faster- megaparsec as a drop-in replacement. Happy parsing! Olaf [1] https://hackage.haskell.org/package/megaparsec [2] https://hackage.haskell.org/package/faster-megaparsec [3] https://hub.darcs.net/olf/faster-megaparsec From juhpetersen at gmail.com Wed Nov 9 04:37:05 2022 From: juhpetersen at gmail.com (Jens Petersen) Date: Wed, 9 Nov 2022 12:37:05 +0800 Subject: [Haskell-cafe] [ANNOUNCE] GHC 9.4.3 is now available In-Reply-To: <87mt97ep1h.fsf@smart-cactus.org> References: <87mt97ep1h.fsf@smart-cactus.org> Message-ID: On Fri, 4 Nov 2022 at 05:00, Ben Gamari wrote: > The GHC developers are happy to announce the availability of GHC 9.4.3. > Thank you - I updated the Fedora ghc9.4 package to 9.4.3. Fedora users can install it from updates-testing repos already (available for several days now) . The EPEL9 build was just completed today (due to some build issue on s390x). Jens -------------- next part -------------- An HTML attachment was scrubbed... URL: From emilypi at cohomolo.gy Thu Nov 10 15:09:30 2022 From: emilypi at cohomolo.gy (Emily Pillmore) Date: Thu, 10 Nov 2022 15:09:30 +0000 Subject: [Haskell-cafe] [ANN] faster-megaparsec In-Reply-To: <62539146404b542f05811d1983c83ae688a28764.camel@aatal-apotheke.de> References: <62539146404b542f05811d1983c83ae688a28764.camel@aatal-apotheke.de> Message-ID: Do you provide reproducible benchmarks for these claims? I'd love to see the outcome for various types of projects to make the choice for myself. Unsubstantiated claims of "This is Faster™️" are the path to shame and treachery. On Tue, Nov 08, 2022 at 1:31 PM, Olaf Klinke < olf at aatal-apotheke.de > wrote: > > > > Dear Haskellers, > > > > megaparsec [1] is a parsing library with excellent error reporting. Being > able to emit decent parse error messages is traded off against speed, > however. Wouldn't it be nice to have a faster parser for your daily > parsing needs, but obtain megaparsec's informative error messages for the > rare cases when things go wrong? > > > > Thanks to megaparsec's parser type class, MonadParsec, you can have both: > I wrote a MonadParsec instance for StateT s Maybe (s being the input > stream type such as Text or ByteString) which does not do all the > bookkeeping ParsecT needs to do. If you manage to write your parser only > using the type class primitives, then you can specialize your parser to > StateT s Maybe. Only if that returns Nothing specialize again to ParsecT > Void s and parse the input again, thus obtaining a decent error message. > The package faster-megaparsec [1,2] provides a convenient function to do > just that. > > > > Of course StateT s Maybe can not provide all the features ParsecT has: > * StateT s Maybe is always backtracking. > * It does not know the offset in the stream. > * It must hold the entire input stream in memory for a second pass, so no > garbage collecting the consumed input while parsing. So if your parsing > relies on non-backtracking choice, stream offset or garbage-collecting > input while parsing, you can not use faster- megaparsec as a drop-in > replacement. > > > > Happy parsing! > Olaf > > > > [1] https:/ / hackage. haskell. org/ package/ megaparsec ( > https://hackage.haskell.org/package/megaparsec ) > [2] https:/ / hackage. haskell. org/ package/ faster-megaparsec ( > https://hackage.haskell.org/package/faster-megaparsec ) > [3] https://hub.darcs.net/olf/faster-megaparsec > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: http:/ / mail. haskell. > org/ cgi-bin/ mailman/ listinfo/ haskell-cafe ( > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe ) Only > members subscribed via the mailman list are allowed to post. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Fri Nov 11 08:39:06 2022 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Fri, 11 Nov 2022 09:39:06 +0100 Subject: [Haskell-cafe] [ANN] faster-megaparsec Message-ID: <2693c6b87a7627ad5d44ffed7359c8b53a9ce093.camel@aatal-apotheke.de> > Do you provide reproducible benchmarks for these claims? I'd love to > see the outcome for various types of projects to make the choice for > myself. > > Unsubstantiated claims of "This is Faster™️" are the path to shame > and treachery. > Dear Emily, version 0.1.1 [1] now contains a benchmark suite, where words of randomly generated languages are parsed with both parsers (ParsecT and StateT Text Maybe). For tiny to moderately sized languages, the speed- up is not huge but noticeable. (I need to work on improving test case generation.) I've been using this trick for a long time but only now decided to spin off a dedicated package. My experience with parsing large amounts of tabular data files shows there is a more substantial difference, although that might be due to my lack of understanding how to write optimized megaparsec parsers. Still your point is valid that this is merely anecdotal evidence. If time permits, I shall add a more realistic benchmark with randomly generated CSV data or Finn Bender's haskell-parsing-benchmarks [2]. Cheers, Olaf [1] https://hackage.haskell.org/package/faster-megaparsec-0.1.1.0 [2] https://gitlab.com/FinnBender/haskell-parsing-benchmarks > On Tue, Nov 08, 2022 at 1:31 PM, Olaf Klinke < olf at aatal- > apotheke.de > wrote: > > > > > > > > > Dear Haskellers, > > > > > > > > megaparsec [1] is a parsing library with excellent error reporting. > Being > > able to emit decent parse error messages is traded off against > speed, > > however. Wouldn't it be nice to have a faster parser for your daily > > parsing needs, but obtain megaparsec's informative error messages > for the > > rare cases when things go wrong? > > > > > > > > Thanks to megaparsec's parser type class, MonadParsec, you can have > both: > > I wrote a MonadParsec instance for StateT s Maybe (s being the > input > > stream type such as Text or ByteString) which does not do all the > > bookkeeping ParsecT needs to do. If you manage to write your parser > only > > using the type class primitives, then you can specialize your > parser to > > StateT s Maybe. Only if that returns Nothing specialize again to > ParsecT > > Void s and parse the input again, thus obtaining a decent error > message. > > The package faster-megaparsec [1,2] provides a convenient function > to do > > just that. > > > > > > > > Of course StateT s Maybe can not provide all the features ParsecT > has: > > * StateT s Maybe is always backtracking. > > * It does not know the offset in the stream. > > * It must hold the entire input stream in memory for a second pass, > so no > > garbage collecting the consumed input while parsing. So if your > parsing > > relies on non-backtracking choice, stream offset or garbage- > collecting > > input while parsing, you can not use faster- megaparsec as a drop- > in > > replacement. > > > > > > > > Happy parsing! > > Olaf > > > > > > > > [1] https:/ / hackage. haskell. org/ package/ megaparsec ( > > https://hackage.haskell.org/package/megaparsec ) > > [2] https:/ / hackage. haskell. org/ package/ faster-megaparsec ( > > https://hackage.haskell.org/package/faster-megaparsec ) > > [3] https://hub.darcs.net/olf/faster-megaparsec > From olf at aatal-apotheke.de Fri Nov 11 15:50:56 2022 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Fri, 11 Nov 2022 16:50:56 +0100 Subject: [Haskell-cafe] [ANN] faster-megaparsec Message-ID: <7340249c9f3261dfda61128aab322ccc7db2904a.camel@aatal-apotheke.de> Emily wrote: > Do you provide reproducible benchmarks for these claims? I'd love to > see the outcome for various types of projects to make the choice for > myself. > > Unsubstantiated claims of "This is Faster™️" are the path to shame > and treachery. Version 0.1.2 now includes a CSV Benchmark. The benchmark generates random table layouts of up to 50 columns and decodes two named columns in 100000 lines. Speed-up on my machine is roughly 0.7x over ParsecT and 0.6x over Cassava when decoding only few columns of a broad table. In particular, a Text-based ParsecT is faster than (ByteString-based) Cassava in this scenario. This was also the initial reason why I got interested in improving performance of megaparsec parsers in the first place. Cheers, Olaf From frase at frase.id.au Sat Nov 12 12:31:15 2022 From: frase at frase.id.au (Fraser Tweedale) Date: Sat, 12 Nov 2022 22:31:15 +1000 Subject: [Haskell-cafe] [CFP] FOSDEM Haskell Devroom, Sun 2023-02-05, Brussels Message-ID: I am thrilled to announce that Europe's largest free software conference, FOSDEM, will in 2023 and for the first time feature a Haskell devroom (specialist track). The Call for Participation is open now, until 2022-11-28. Read on for more info! FOSDEM 2023 will be held on 4 & 5 February 2023, in Brussels. For more information see the official site: https://fosdem.org/2023/. The Haskell devroom will take place on Sunday 5 February, from 13:10 to 17:00 UTC+1. Presentations will be also be streamed live and published afterwards. ## Key Dates 2022-11-28: Submission Deadline 2022-12-12: Announcement of selected talks 2023-02-04..2023-02-05: FOSDEM conference 2023-02-05: Haskell Devroom ## About the Haskell devroom Haskell is a statically typed functional programming language. Its vibrant community spans industry, academia and the hobbyist realm. The Haskell devroom welcomes people new to Haskell or functional programming, as well as intermediate or experienced Haskellers. The Haskell devroom will: - Advocate the Haskell programming language, and its community, to a wide audience of free software developers and users. - Promote and support participation in free software projects that use Haskell. - Teach Haskell (more broadly, functional) programming techniques, and introduce important libraries, frameworks or developer tools. ## Call for Participation We invite proposals for talks, tutorials and demos on topics including: - Introductory talks teaching functional programming concepts and Haskell programming - Practical advice for Haskell programming: developer tools, package ecosystem, Haskell in production. - "Show and tell" session for people to introduce Haskell projects they are involved with, and invite contributions. - Experience reports: share about problems you tackled using Haskell, and the outcomes. - What is going on in the Haskell community? Where and how you can get involved? Sessions will have a maximum duration of 30 minutes, including questions. You are welcome to propose shorter sessions (for example a demo, short talk or Q&A). This is an in-person event. Presenters must be able to attend to deliver their presentation. ## Code of conduct Speakers and attendees must abide by the FOSDEM Code of Conduct[1]. Also, because this is a Haskell community event we expect participants to follow the Haskell Foundation Guidelines for Respectful Communication[2]. [1] https://fosdem.org/2023/practical/conduct/ [2] https://haskell.foundation/guidelines-for-respectful-communication/ If you submit a proposal and it is accepted, you will be required to confirm that you accept the FOSDEM Code of Conduct. If you have any questions about the Code of Conduct or wish to have one of the devroom organizers review your presentation slides or any other content for compliance, please email us and we will do our best to assist you. ## How to submit Submit proposals through the FOSDEM Pentabarf submission tool[3]. If you do not already have an account, you need to create one. [3] https://penta.fosdem.org/submission/FOSDEM23 Go to "Create Event" and select the "Haskell devroom" track. Ensure you fill the following fields: - Event title - Track ("Haskell devroom") - Duration (including questions; <= 30 minutes) - Event type - Short abstract - Full abstract - Submission notes (if any) You can use the Submission notes to mention: - Any special requirements - Anything else you want the organisers/reviewers to know In the "Person" profile section please provide your: - Name, nickname (optional), image - Short Biography - Email address - Phone number (in case we need to contact you during the conference) Presentations will be live-streamed and recordings published under the CC-BY licence. By submitting you consent to having your presentation recorded and broadcast/published under the CC-BY licence. ## People and contacts The Haskell devroom organisers are: - Fraser Tweedale - Troels Henriksen Thanks to David Christiansen and the Haskell Foundation for supporting this event. If you need to reach the Haskell devroom organisers or program committee, email . From jondrews at fastmail.com Sat Nov 12 18:13:30 2022 From: jondrews at fastmail.com (Jonathan Drews) Date: Sat, 12 Nov 2022 11:13:30 -0700 Subject: [Haskell-cafe] Numerical Recipes in Haskell? Message-ID: Hi: New member here. I am looking for a book similar to "Numerical Recioes in C" but for Haskell. https://www.amazon.com/Numerical-Recipes-Scientific-Computing-Second/dp/0521431085 Does such a book exist? I've looked and can't seem to find one. I am new to Haskell and don't have much programming experience. I am using the No Starch press book "Learn Physics with Functional Programming: A Hands-on Guide to Exploring Physics with Haskell". It's very well written. -- Kind regards, Jonathan From coot at coot.me Sun Nov 13 13:21:58 2022 From: coot at coot.me (coot at coot.me) Date: Sun, 13 Nov 2022 13:21:58 +0000 Subject: [Haskell-cafe] [ANN] updated vim's cabal syntax file Message-ID: <4jDG79ZNkbshOLhNCUqkh8MrMhScl2IOiWIhyNRV-FL7AnZrPbbXusL-O3SBE3H-ArKMT5cN47PPphJfZ_xL2MI9uKFAVyEy9LE5Y-4WC0A=@coot.me> vim-9.0.0849 comes with an updated cabal syntax file which supports a few more fields. If you want to see the changes, check out the few recent commits: https://github.com/coot/haskell-vim-scripts/commits/master/syntax/cabal.vim?since=2022-09-01T00%3A00%3A00Z Cheers, Marcin -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 509 bytes Desc: OpenPGP digital signature URL: From andrei.h.popescu at gmail.com Mon Nov 14 12:54:02 2022 From: andrei.h.popescu at gmail.com (Andrei Popescu) Date: Mon, 14 Nov 2022 12:54:02 +0000 Subject: [Haskell-cafe] Sam Staton giving this year's LMS/BCS-FACS Evening Seminar (online) -- registration open until this Wednesday at 5PM, UTC Message-ID: EVENT: Annual LMS/BCS-FACS Evening Seminar SPEAKER: Sam Staton, University of Oxford TITLE: Programming-based foundations for statistics DATE: Thursday, 17 November 2022, Starting time: 18:00 UTC VENUE: Online via Zoom EVENT PAGE: https://www.lms.ac.uk/events/lectures/lms-bcs-facs-evening-seminars REGISTRATION LINK: https://www.lms.ac.uk/civicrm/event/register?id=88&reset=1 Prior registration is required for attendance -- the registration site will close on Wednesday, 16 November, at 17:00 SYNOPSIS Probabilistic programming is a popular tool for statistics and machine learning. The idea is to describe a statistical model as a program with random choices. The program might be a simulation of a system, such as a physics model, a model of viral spread, or a model of electoral behaviour. We can now carry out statistical inference over the system, for example, by running a Monte Carlo simulation – running the simulation 100,000’s of times. As I will discuss in this talk, the idea of treating statistical models as computer programs also has a foundational appeal. If we can understand statistical models as programs, then the foundations of probability and statistics can be discussed in terms of program semantics. There is a chance of new foundational perspectives on statistics, in terms of programming languages and their formal methods. As I will explain, this programming-based foundation for statistics is attractive because there are some intuitively simple scenarios, such as inference over function spaces, which have an easy programming implementation, but for which the traditional mathematical interpretation is complicated. SPEAKER BIOGRAPHY Sam Staton is a Professor of Computer Science and Royal Society University Research Fellow at the University of Oxford. There he currently runs an ERC grant "Better Languages for Statistics". Before arriving in Oxford in 2015, Sam spent time in Nijmegen, Paris, and Cambridge. His PhD was in Cambridge with Marcelo Fiore (2007). Sam's main research is in programming language theory, but he is also interested in logic and category theory. He has recent contributions in probabilistic programming languages, and quantum computing and programming languages. Webpage: https://www.cs.ox.ac.uk/people/samuel.staton/main.html From ivanperezdominguez at gmail.com Mon Nov 14 19:02:36 2022 From: ivanperezdominguez at gmail.com (Ivan Perez) Date: Mon, 14 Nov 2022 11:02:36 -0800 Subject: [Haskell-cafe] [ANN] Copilot 3.12 Message-ID: Dear all, I'm very excited to announce Copilot 3.12. Copilot is a stream-based DSL for writing and monitoring embedded C programs, with an emphasis on correctness and hard realtime requirements. Copilot is typically used as a high-level runtime verification framework, and supports temporal logic (LTL, PTLTL and MTL), clocks and voting algorithms. Among others, Copilot has been used at the Safety Critical Avionics Systems Branch of NASA Langley Research Center for monitoring test flights of drones. It also serves as a runtime monitoring backend for the requirements elicitation tool FRET (https://github.com/NASA-SW-VnV/fret/), via Ogma ( https://github.com/nasa/ogma). The main changes in this release are as follows: - A new library copilot-prettyprinter exposes functions related to the Copilot Core pretty-printing backend. Pre-existing functions included as part of copilot-core are now deprecated. - The C99 backend now produces an additional header file with struct declarations. This file is used by the C implementation file generated by Copilot to define structs before the declarations of the handlers, avoiding potential forward declarations that the C compiler cannot resolve. Users of Copilot can choose to import the same new type declaration header file before the standard Copilot header file in their hand-written code, or use external definitions that declare compatible structs. Note that, in the former case, the header file that declares the structs must be included before the header file that declares the externs, handlers and step function. - The custom type equality module in copilot-core is now deprecated in favour of the definition of type equality in base. - copilot-theorem now includes support for proofs by bisimulation necessary for future extensions to Copilot. - copilot-core now complies with the coding rules established as part of the process of compliance with higher NASA's requirements for software with higher assurance classifications. Current emphasis is on improving the codebase in terms of stability and test coverage, removing unnecessary dependencies, hiding internal definitions, and formatting the code to meet our new coding standards. Users are encouraged to participate by opening issues and asking questions via our github repo (https://github.com/copilot-language/copilot). I'd also like to take this opportunity to announce that Copilot is now available on Debian. As a consequence of this effort, Copilot will also be available to Ubuntu users in the near future. We would like to publicly thank the Debian Haskell Group and, most especially, Scott Talbert, for continued effort making Copilot available on Debian-based distros. This will be extremely useful to a great portion of our users, who need to use Copilot as a runtime verification system targeting C, but do not need to become proficient in Haskell. We hope to continue this effort by making Copilot easily available on other distributions and OSs. Happy Haskelling, The Copilot team -------------- next part -------------- An HTML attachment was scrubbed... URL: From dyaitskov at gmail.com Tue Nov 15 03:34:15 2022 From: dyaitskov at gmail.com (Daneel Yaitskov) Date: Mon, 14 Nov 2022 22:34:15 -0500 Subject: [Haskell-cafe] [ANN] faster-megaparsec In-Reply-To: <62539146404b542f05811d1983c83ae688a28764.camel@aatal-apotheke.de> References: <62539146404b542f05811d1983c83ae688a28764.camel@aatal-apotheke.de> Message-ID: Hi, Recently I was improving performance of simple-sql-parser library which sits on top of megaparsec. Main issue was memory consumption, not speed. Machine generated SQL query might weigh megabytes. I got success with a deduplicating cache for lexer tokens. A complex parser produces very chunky lazy text. To avoid traversing these linked lists (cache locality) and copying to strict one - offsets in the input Text are analyzed before and after success return from parser => shallow substring which is deduplicated with high probability and no extra memcpy. Another interesting idea, I would like to try, is to use ByteString for text input and mmap input byte string. SQL query is 99% ASCII only and all keywords are ASCII bytes. So knowing that constraint parser doesn't spend time on reconstructing characters out of impossible multibyte input, when it expects keywords. Megaparsec doesn't have digital search tree, which help a lot with avoiding back tracking. Thanks On Tue, Nov 8, 2022 at 3:32 PM Olaf Klinke wrote: > Dear Haskellers, > > megaparsec [1] is a parsing library with excellent error > reporting. Being able to emit decent parse error messages is traded off > against speed, however. Wouldn't it be nice to have a faster parser for > your daily parsing needs, but obtain megaparsec's informative error > messages for the rare cases when things go wrong? > > Thanks to megaparsec's parser type class, MonadParsec, you can have > both: I wrote a MonadParsec instance for StateT s Maybe (s being the > input stream type such as Text or ByteString) which does not do all the > bookkeeping ParsecT needs to do. If you manage to write your parser > only using the type class primitives, then you can specialize your > parser to StateT s Maybe. Only if that returns Nothing specialize again > to ParsecT Void s and parse the input again, thus obtaining a decent > error message. The package faster-megaparsec [1,2] provides a > convenient function to do just that. > > Of course StateT s Maybe can not provide all the features ParsecT has: > * StateT s Maybe is always backtracking. > * It does not know the offset in the stream. > * It must hold the entire input stream in memory for a second pass, > so no garbage collecting the consumed input while parsing. > So if your parsing relies on non-backtracking choice, stream offset or > garbage-collecting input while parsing, you can not use faster- > megaparsec as a drop-in replacement. > > Happy parsing! > Olaf > > [1] https://hackage.haskell.org/package/megaparsec > [2] https://hackage.haskell.org/package/faster-megaparsec > [3] https://hub.darcs.net/olf/faster-megaparsec > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Best regards, Daniil Iaitskov -------------- next part -------------- An HTML attachment was scrubbed... URL: From P.Achten at cs.ru.nl Tue Nov 15 09:31:41 2022 From: P.Achten at cs.ru.nl (Peter Achten) Date: Tue, 15 Nov 2022 10:31:41 +0100 Subject: [Haskell-cafe] [TFP 2023 2nd Call for Papers] 24th International Symposium on Trends in Functional Programming Message-ID: <80a2053c-9039-34f6-4314-68fcdbc1b45f@cs.ru.nl> # TFP 2023 -- Call for Papers (trendsfp.github.io) ## Important Dates Submission deadline: pre-symposium, full papers,  Wednesday 23rd November, 2022 Submission deadline: pre-symposium, draft papers, Friday 16th December, 2022 Notification:        pre-symposium submissions,   Friday 23rd December, 2022 Registration:                                     Friday 6th January, 2023 TFPIE Workshop:                                   Thursday 12th January, 2023 TFP Symposium:                                    Friday 13th - Sunday 15th January, 2023 Submission deadline: post-symposium review,       Friday 17th February, 2023 Notification:        post-symposium submissions,  Friday 31st March, 2023 The Symposium on Trends in Functional Programming (TFP) is an international forum for researchers with interests in all aspects of functional programming, taking a broad view of current and future trends in the area. It aspires to be a lively environment for presenting the latest research results, and other contributions. This year, TFP will take place in-person at UMass Boston, Massachusetts in the United States.  It is co-located with the Trends in Functional Programming in Education (TFPIE) workshop, which will take on the day before the main symposium. Please be aware that TFP has several submission deadlines. The first, November 23, is for authors that wish to have their full paper reviewed prior to the symposium. Papers that are accepted in this way must also be presented at the symposium. The second, December 16, is for authors that wish to present their work or work-in progress at the symposium first without submitting to the full review process for publication. These authors can then take into account feedback received at the symposium and submit a full article for review by the third deadline, February 17. ## Scope The symposium recognizes that new trends may arise through various routes. As part of the Symposium's focus on trends we therefore identify the following five article categories. High-quality articles are solicited in any of these categories: * Research Articles:   Leading-edge, previously unpublished research work * Position Articles:   On what new trends should or should not be * Project Articles:   Descriptions of recently started new projects * Evaluation Articles:   What lessons can be drawn from a finished project * Overview Articles:   Summarizing work with respect to a trendy subject Articles must be original and not simultaneously submitted for publication to any other forum. They may consider any aspect of functional programming: theoretical, implementation-oriented, or experience-oriented. Applications of functional programming techniques to other languages are also within the scope of the symposium. Topics suitable for the symposium include, but are not limited to: * Functional programming and multicore/manycore computing * Functional programming in the cloud * High performance functional computing * Extra-functional (behavioural) properties of functional programs * Dependently typed functional programming * Validation and verification of functional programs * Debugging and profiling for functional languages * Functional programming in different application areas:   security, mobility, telecommunications applications, embedded   systems, global computing, grids, etc. * Interoperability with imperative programming languages * Novel memory management techniques * Program analysis and transformation techniques * Empirical performance studies * Abstract/virtual machines and compilers for functional languages * (Embedded) domain specific languages * New implementation strategies * Any new emerging trend in the functional programming area If you are in doubt on whether your article is within the scope of TFP, please contact the TFP 2023 program chair, Stephen Chang. ## Best Paper Awards TFP awards two prizes for the best papers each year. First, to reward excellent contributions, TFP awards a prize for the best overall paper accepted for the post-conference formal proceedings. Second, a prize for the best student paper is awarded each year. TFP traditionally pays special attention to research students, acknowledging that students are almost by definition part of new subject trends. A student paper is one for which the authors state that the paper is mainly the work of students, the students are listed as first authors, and a student would present the paper. In both cases, it is the PC of TFP that awards the prize. In case the best paper happens to be a student paper, then that paper will receive both prizes. ## Instructions to Authors Papers must be submitted at:   Authors of papers have the choice of having their contributions formally reviewed either before or after the Symposium. Further, pre-symposium submissions may either be full (earlier deadline) or draft papers (later deadline). ## Pre-symposium formal review Papers to be formally reviewed before the symposium should be submitted before the early deadline and will receive their reviews and notification of acceptance for both presentation and publication before the symposium. A paper that has been rejected for publication but accepted for presentation may be resubmitted for the post-symposium formal review. ## Post-symposium formal review Draft papers will receive minimal reviews and notification of acceptance for presentation at the symposium. Authors of draft papers will be invited to submit revised papers based on the feedback receive at the symposium. A post-symposium refereeing process will then select a subset of these articles for formal publication. ## Paper categories Draft papers and papers submitted for formal review are submitted as extended abstracts (4 to 10 pages in length) or full papers (20 pages). The submission must clearly indicate which category it belongs to: research, position, project, evaluation, or overview paper. It should also indicate which authors are research students, and whether the main author(s) are students. A draft paper for which all authors are students will receive additional feedback by one of the PC members shortly after the symposium has taken place. ## Format Papers must be written in English, and written using the LNCS style. For more information about formatting please consult the Springer LNCS web site. ## Program Committee Peter Achten,              Radboud University Nijmegen, Netherlands Nada Amin,                 Harvard University, USA Ambrose Bonnaire-Sergeant, Untypable LLC, USA Laura M. Castro,           University of A Coruña, Spain Stephen Chang (Chair),     University of Massachusetts Boston, US John Clements,             Cal Poly, USA Youyou Cong,               Tokyo Institute of Technology, Japan Paul Downen,               University of Massachusetts Lowell, USA Kathy Gray,                Meta Platforms, Inc., UK Ben Greenman,              University of Utah, USA Jason Hemann,              Seton Hall University, USA Patricia Johann,           Appalachian State University, USA Alexis King,               Tweag, USA Julia Lawall,              Inria-Paris, France Barak Pearlmutter,         Maynooth University, Ireland Norman Ramsey,             Tufts University, USA Ilya Sergey,               National University of Singapore, Singapore Melinda Tóth,              Eötvös Loránd University, Hungary Ningning Xie,              University of Toronto, Canada From olf at aatal-apotheke.de Tue Nov 15 22:16:29 2022 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Tue, 15 Nov 2022 23:16:29 +0100 Subject: [Haskell-cafe] [ANN] faster-megaparsec In-Reply-To: References: <62539146404b542f05811d1983c83ae688a28764.camel@aatal-apotheke.de> Message-ID: <1989145dd95b4564b403b50b26f2b8e50cc9ce6f.camel@aatal-apotheke.de> On Mon, 2022-11-14 at 22:34 -0500, Daneel Yaitskov wrote: > Hi, > > Recently I was improving performance of simple-sql-parser library which > sits on top of megaparsec. > Main issue was memory consumption, not speed. Machine generated SQL query > might weigh megabytes. Parsing megabytes of input should be no problem. The Haskell representation of the highly structured syntax is likely much larger. > I got success with a deduplicating cache for lexer tokens. Aha, so the input stream to parse is a stream of pointers, where identical tokens point to the same memory reference? It's not in your fork [1] yet, is it?  The same trick might be possible with a Lempel-Ziv parse as well (so you run your parser on compressed input). The primitive stream operations like uncons become more expensive than usual, though. [1] https://github.com/yaitskov/simple-sql-parser/blob/master/Language/SQL/SimpleSQL/Lex.lhs > > A complex parser produces very chunky lazy text. > To avoid traversing these linked lists (cache locality) and copying to > strict one > - offsets in the input Text are analyzed before and after success return > from parser => shallow substring which is deduplicated with high > probability and no extra memcpy. > > Another interesting idea, I would like to try, is to use ByteString for > text input and mmap input byte string. > SQL query is 99% ASCII only and all keywords are ASCII bytes. > So knowing that constraint parser doesn't spend time on reconstructing > characters out of impossible multibyte input, > when it expects keywords. I never dug into the internals of parsers enough to provide any meaningful comments on this. faster-megaparsec was a low-hanging fruit. The next thing I might try is to Church-encode the StateT since attoparsec and megaparsec are doing that, too. What annoys me more [2] about SQL is that its interface is purely text- based in most flavors, and the syntax is not optimized for parsing. E.g. even if the SQL server holds binary numbers, and our client program represents numbers in binary, in the SQL interface numbers have to be serialized/deserialized as (Byte)Strings. Others have commented that this might not be the most severe bottleneck, though. [2] https://mail.haskell.org/pipermail/haskell-cafe/2022-August/135444.html > > Megaparsec doesn't have digital search tree, which help a lot with avoiding > back tracking. > > Thanks > > On Tue, Nov 8, 2022 at 3:32 PM Olaf Klinke wrote: > > > Dear Haskellers, > > > > megaparsec [1] is a parsing library with excellent error > > reporting. Being able to emit decent parse error messages is traded off > > against speed, however. Wouldn't it be nice to have a faster parser for > > your daily parsing needs, but obtain megaparsec's informative error > > messages for the rare cases when things go wrong? > > > > Thanks to megaparsec's parser type class, MonadParsec, you can have > > both: I wrote a MonadParsec instance for StateT s Maybe (s being the > > input stream type such as Text or ByteString) which does not do all the > > bookkeeping ParsecT needs to do. If you manage to write your parser > > only using the type class primitives, then you can specialize your > > parser to StateT s Maybe. Only if that returns Nothing specialize again > > to ParsecT Void s and parse the input again, thus obtaining a decent > > error message. The package faster-megaparsec [1,2] provides a > > convenient function to do just that. > > > > Of course StateT s Maybe can not provide all the features ParsecT has: > > * StateT s Maybe is always backtracking. > > * It does not know the offset in the stream. > > * It must hold the entire input stream in memory for a second pass, > >   so no garbage collecting the consumed input while parsing. > > So if your parsing relies on non-backtracking choice, stream offset or > > garbage-collecting input while parsing, you can not use faster- > > megaparsec as a drop-in replacement. > > > > Happy parsing! > > Olaf > > > > [1] https://hackage.haskell.org/package/megaparsec > > [2] https://hackage.haskell.org/package/faster-megaparsec > > [3] https://hub.darcs.net/olf/faster-megaparsec > > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > > From emilypi at cohomolo.gy Wed Nov 16 21:59:09 2022 From: emilypi at cohomolo.gy (Emily Pillmore) Date: Wed, 16 Nov 2022 21:59:09 +0000 Subject: [Haskell-cafe] [ANN] base16-3.2.1 Message-ID: Hi All, I'm announcing `base16-3.2.1`, available on hackage now, which features a QOL contribution from Shea Levy, as well as support for up to GHC 9.4.x. This will be the last in the 3.x series before the next major update, which will feature newtyped Base16 bytestrings and optimized Base16 encoding and decoding loops. The same will happen across the all the BaseN encoding libraries from me. Cheers, Emily -------------- next part -------------- An HTML attachment was scrubbed... URL: From emilypi at cohomolo.gy Wed Nov 16 22:00:05 2022 From: emilypi at cohomolo.gy (Emily Pillmore) Date: Wed, 16 Nov 2022 22:00:05 +0000 Subject: [Haskell-cafe] [ANN] base16-3.2.1 In-Reply-To: References: Message-ID: Er, `base16-0.3.2.1`. On Wed, Nov 16, 2022 at 2:59 PM, Emily Pillmore < emilypi at cohomolo.gy > wrote: > > Hi All, > > > > I'm announcing `base16-3.2.1`, available on hackage now, which features a > QOL contribution from Shea Levy, as well as support for up to GHC 9.4.x. > This will be the last in the 3.x series before the next major update, > which will feature newtyped Base16 bytestrings and optimized Base16 > encoding and decoding loops. The same will happen across the all the BaseN > encoding libraries from me. > > > > > > Cheers, > > Emily > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikolaj at well-typed.com Thu Nov 17 14:47:02 2022 From: mikolaj at well-typed.com (Mikolaj Konarski) Date: Thu, 17 Nov 2022 15:47:02 +0100 Subject: [Haskell-cafe] Cabal 3.10 last call for contributions Message-ID: Hi! Would you like cabal 3.10 to have your favourite bugfix, feature or overall spiffiness? If so, please let us help you help yourself. We are going to soft-freeze cabal 3.10 in a month or two and ship a little later, around the GHC 9.6 release date. There is still time to fix your favourite regression https://github.com/haskell/cabal/issues?q=is%3Aopen+label%3A%22regression+in+3.8%22%2C%22type%3A+regression%22 or add your high priority feature (or argue for bumping the priority of an existing ticket) https://github.com/haskell/cabal/labels/priority%3A%20high%20%3Afire%3A The friendly team of cabal maintainers is at your disposal whether you need a PR review, a design discussion in a ticket, or you just get stuck or urgently need somebody to chat to (the #hackage IRC/matrix room is open). Cabal 3.10 is going to be mostly a bugfix release, so there may or may not be a release candidate for you to try to break. However, brave people are continuously dogfooding the master branch from github artifacts (at the bottom of 'validate' CI jobs) or gitlab pipelines (more flavours, including statically linked Alpine Linux) https://gitlab.haskell.org/haskell/cabal/-/pipelines/59103 Another way you can contribute is by picking up a newcomer-labelled ticket. Yet another is triaging new tickets, e.g., via https://www.codetriage.com/haskell/cabal Don't worry if you feel you'd need to learn a lot --- cabal is a large and constantly changing system, so most of us are forgetting faster than learning. However, purity, types and tests often permit to focus, code-dive and fix or improve a hot subsystem in relative isolation. See you there, Mikolaj From Graham.Hutton at nottingham.ac.uk Mon Nov 21 12:20:23 2022 From: Graham.Hutton at nottingham.ac.uk (Graham Hutton) Date: Mon, 21 Nov 2022 12:20:23 +0000 Subject: [Haskell-cafe] 10 PhD studentships in Nottingham Message-ID: Dear all, The School of Computer Science at the University of Nottingham in the UK is seeking applications for 10 fully-funded PhD studentships: https://tinyurl.com/ten-phd-2022 Applicants in the area of the Functional Programming Lab (tinyurl.com/fp-notts) are strongly encouraged! If you are interested in applying, please contact a potential supervisor as soon as possible; the application deadline is 12th Feb 2023: Thorsten Altenkirch - constructive logic, proof assistants, homotopy type theory, category theory, lambda calculus. Ulrik Buchholtz - homotopy type theory, synthetic homotopy theory, proof assistants, constructive mathematics, and related topics. Graham Hutton - functional programming, haskell, category theory, program verification, program calculation. Nicolai Kraus - homotopy type theory, higher category theory, constructive mathematics, and related topics. Dan Marsden - category theory, logic, finite model theory, diagrammatic reasoning, foundations of computer science. These positions are open to students of any nationality. Best wishes, The FP Lab +-----------------------------------------------------------+ 10 Fully-Funded PhD Studentships School of Computer Science University of Nottingham, UK https://tinyurl.com/ten-phd-2022 Applications are invited from international and home students for 10 fully-funded PhD studentships offered by the School of Computer Science, starting on 1st October 2023. The topics for the studentships are open, but should relate to the interests of one the School's research groups: Computational Optimisation and Learning; Computer Vision; Cyber Security; Functional Programming; Intelligent Modelling and Analysis; Mixed Reality; Uncertainty in Data and Decision Making; Visualisation and Computer Graphics; Cyber-Physical Health and Assistive Robotics Technologies. The studentships are fully funded for 3.5 years and include a stipend of £17,668 per year and tuition fees. Applicants are normally expected to have a first-class class bachelors or masters in Computer Science or another relevant area, and must obtain the support of a potential supervisor in the School prior to submitting their application. If you are interested in applying, please contact a potential supervisor as soon as possible, and at least two weeks prior to the closing date. If the supervisor wishes to support your application, they will direct you to make an official application through the MyNottingham system. Closing date for applications: Sunday 12th February 2023. +-----------------------------------------------------------+ This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please contact the sender and delete the email and attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. Email communications with the University of Nottingham may be monitored where permitted by law. From bryan at haskell.foundation Tue Nov 22 11:13:41 2022 From: bryan at haskell.foundation (Bryan Richter) Date: Tue, 22 Nov 2022 13:13:41 +0200 Subject: [Haskell-cafe] Upcoming maintenance on Haskell services Message-ID: Hello folks, On Thursday 24 November at 6 AM UTC, I will start a 4-hour maintenance window for the following Haskell services: 1. downloads.haskell.org 2. gitlab.haskell.org In particular, I expect the following outages: 1. downloads.haskell.org will be read-only for the duration of the window. * No uploads 2. gitlab.haskell.org will be read-only for the duration of the window. * No CI pipelines(!) * No git pushes * No commenting on issues or merge requests 3. gitlab.haskell.org will furthermore be entirely inaccessible very briefly. * There will be 1-2 outages. * Each outage will last a few seconds. The reason for the maintenance is that our hosting sponsor, Equinix Metal, is performing a facilities migration. One of our servers, gitlab-storage, is slated for retirement. All data and services that run on that server must be moved to a new server. I'm sending this first notification to a wide audience as an extra precaution in case something goes wrong. :) In reality, I expect this maintenance to only affect GHC developers and a small group of ecosystem maintainers. In particular, web access of https://downloads.haskell.org should *not* be affected by this maintenance. I will send further updates to a smaller audience. Note: The actual migration will be quick. Most of the maintenance window will be spent waiting for DNS propagation. -Bryan Haskell Foundation DevOps From kari.pahula at ksfmedia.fi Wed Nov 23 14:35:14 2022 From: kari.pahula at ksfmedia.fi (Kari Pahula) Date: Wed, 23 Nov 2022 16:35:14 +0200 Subject: [Haskell-cafe] KSF Media Ab hiring Senior Developer in Helsinki, Finland Message-ID: KSF Media is Finland's largest Swedish language news media group. Our products include Hufvudstadsbladet, Västra Nyland, Östnyland and HBL Junior. KSF Media's digital products are growing fast and our focus is in digital subscription sales and product development. We are now looking for a new member to join our digital development team to create outstanding news media products for our readers. We are a small but capable team with a lean way of working and passion to learn new things every day. Our way of working Kanban Pair Programming, Code Reviews Git, CI/CD (multiple deployments a day), Trunk Based Development Working in the open. Our whole frontend is open source: https://github.com/KSF-Media/affresco and https://github.com/KSF-Media/mosaico Our stack Most new developments happen in Haskell, PureScript and Javascript Cloud Infrastructure as Code (Google Cloud, Kubernetes, Terraform) Microservices environment with REST APIs What we expect from you some relevant work experience and English language. Swedish or Finnish knowledge is a plus Knowledge of the principles behind the modern Web stack: things like MVC, Relational Databases and Testing High motivation, self-steering, willingness to learn and dive into things, good social skills and good sense of humour Interest in functional programming, news media and making the world a better place Awareness of some UX principles, API design (and optionally UI design) and empathy for the users of your code What we can offer Flexible terms, with possibility to remote working Competitive salary and benefits The best co-workers Office in the most central location in Helsinki Interested? Please apply via LinkedIn, https://www.linkedin.com/jobs/view/3373101222 or drop a line at antti.haarala at ksfmedia.fi no later than on the 5th of December. Reddit discussion at https://www.reddit.com/r/haskell/comments/z2pupj/ksf_media_ab_hiring_senior_developer_in_helsinki/ From jondrews at fastmail.com Thu Nov 24 00:25:37 2022 From: jondrews at fastmail.com (Jonathan Drews) Date: Wed, 23 Nov 2022 17:25:37 -0700 Subject: [Haskell-cafe] Learn Physics with Funtional Programming Message-ID: I got the No starch Press *.pdf book "Learn Physics with Functional Programming" by Scott Walck. It's an easy introduction to coding physics problems in Haskell. It is very well written. I mention it because right now, the week of Thanksgiving, NoStarch Press is having a 35% off sale on all books. -- Kind regards, Jonathan From leah at vuxu.org Fri Nov 25 16:07:42 2022 From: leah at vuxu.org (Leah Neukirchen) Date: Fri, 25 Nov 2022 17:07:42 +0100 Subject: [Haskell-cafe] Munich Haskell Meeting, 2022-11-30 @ 19:30 Message-ID: <87fse7hvap.fsf@vuxu.org> Dear all, Next week, our last* monthly Munich Haskell Meeting of the year 2022 will take place again on Wednesday, November 30 at Cafe Puck at 19h30. For details see here: http://muenchen.haskell.bayern/dates.html If you plan to join, please add yourself to this nuudel so we can reserve enough seats! It is OK to add yourself to the nuudel anonymously or pseudonymously. https://nuudel.digitalcourage.de/haskell-munich-nov-2022 Everybody is welcome! *) There will be no meeting in late December due to festivities, but perhaps again in the first week of January, as is tradition. cu, -- Leah Neukirchen https://leahneukirchen.org/ From erdweg at uni-mainz.de Fri Nov 25 16:45:27 2022 From: erdweg at uni-mainz.de (Erdweg, Sebastian) Date: Fri, 25 Nov 2022 16:45:27 +0000 Subject: [Haskell-cafe] PhD and post-doc positions in Mainz, Germany Message-ID: <5CB278E4-16A4-4159-A00E-3CD94F0EAB25@uni-mainz.de> We have multiple open positions for PhD students and post-docs in the PL Group of the University of Mainz in Germany. The available positions include a gross monthly salary of ~4000 Euro. Our team meets and socializes in Mainz; remote work is an option. The PL Group at the University of Mainz was founded in 2019. Our goal is to support developers in creating and maintaining software systems that are easier to write, more secure, run faster, and consume less energy. Our current research topics include: -- Incremental computing: How can a computation react to a change of its input efficiently? We have observed up to 10,000x speedups in prior work, can incrementality help us save as much energy? Can we build a new foundation for incremental computing to support a wider range of computations? -- WebAssembly: How can we discover and prevent security vulnerabilities in WebAssembly? We have built a data-flow analysis platform for WebAssembly to identify properties of WebAssembly programs at compile time. Can this platform be used to protect WebAssembly users while also optimizing the code for performance? -- Datalog: How can the power of Datalog best be exploited in modern software development? How can we abstract over and hide the technicalities of Datalog, for example, by compiling DSLs to Datalog. And how can we optimize Datalog code to provide truly declarative performance, without exposing users to details of the underlying database technology? -- Language engineering: How can we build programming-language tools with modest effort and without duplicating the language's semantics? For example, can we derive type checkers, debuggers, and other editor services from the language’s semantics? And does this require a language workbench or can we support rich services for embedded languages as well? Mainz is part of the Frankfurt Metropolitan Area and only a short train ride away from Frankfurt's international community and culture. Mainz itself lies at the confluence of the Rhine and Main rivers, surrounded by plenty of nature. https://mainz.de/en/worth-seeing/reasons-to-love-mainz.php I'm excited to hear from interested candidates via email. If you know potential candidates, please forward this message to them. Sebastian Erdweg https://www.pl.informatik.uni-mainz.de/erdweg From hecate at glitchbra.in Mon Nov 28 16:04:32 2022 From: hecate at glitchbra.in (=?UTF-8?Q?H=c3=a9cate?=) Date: Mon, 28 Nov 2022 17:04:32 +0100 Subject: [Haskell-cafe] Writing and testing a Storable instance for a record wrapping ForeignPtrs Message-ID: Hi everyone, In a fit of madness I have found myself writing Haskell code where I need to implement a Storable instance. However, by virtue of not being a C programmer, I'm fairly lost on some of the details, especially the value of the sizeOf and alignment methods. My Haskell-level record is the following: data SignedMessage = SignedMessage   { messageLength :: CSize   , messageForeignPtr :: ForeignPtr CUChar   , signatureForeignPtr :: ForeignPtr CUChar   } Here is the code of the Storable instance: https://gist.github.com/Kleidukos/31346d067f309f2a86cbd97a85c0f1e8#file-signing-hs And so I used `hedgehog-classes` to test the Storable instance. However, all the tests fail with the same reason: Prelude.undefined: https://gist.github.com/Kleidukos/31346d067f309f2a86cbd97a85c0f1e8#file-undefined_error-txt The main problem (and that's certainly a red herring for me) is that the `undefined` call comes frombase:Foreign.Marshal.Array. Which shouldn't be a problem, as it is not supposed to be evaluated! Yet apparently it is. If you're interested to see the full code, it's located here: https://github.com/haskell-cryptography/libsodium-bindings/blob/add-sel-package/sel/src/Sel/Signing.hs I'm not sure how to proceed from here. What would be a good angle to approach this? Cheers, Hécate -- Hécate ✨ 🐦: @TechnoEmpress IRC: Hecate WWW: https://glitchbra.in RUN: BSD From sylvain at haskus.fr Mon Nov 28 16:14:24 2022 From: sylvain at haskus.fr (Sylvain Henry) Date: Mon, 28 Nov 2022 17:14:24 +0100 Subject: [Haskell-cafe] Writing and testing a Storable instance for a record wrapping ForeignPtrs In-Reply-To: References: Message-ID: <02ac95d3-c547-3b29-4109-e0bd7512f4c0@haskus.fr> Hi, > instance Storable SignedMessage where >   sizeOf (SignedMessage{messageLength}) = >     sizeOf (undefined :: CSize) + fromIntegral messageLength + sizeOf cryptoSignBytes Your sizeOf function mustn't evaluate its argument, yet it does. The size of the storable data must only be defined by its type so you can't use messageLength here. sizeOf would better be defined as sizeOf :: Proxy a -> Word. For now it's just a convention to ignore the first argument. Sylvain On 28/11/2022 17:04, Hécate wrote: > Hi everyone, > > In a fit of madness I have found myself writing Haskell code where I > need to implement a Storable instance. However, by virtue of not being > a C programmer, I'm fairly lost on some of the details, especially the > value of the sizeOf and alignment methods. > > My Haskell-level record is the following: > > data SignedMessage = SignedMessage >   { messageLength :: CSize >   , messageForeignPtr :: ForeignPtr CUChar >   , signatureForeignPtr :: ForeignPtr CUChar >   } > > > Here is the code of the Storable instance: > https://gist.github.com/Kleidukos/31346d067f309f2a86cbd97a85c0f1e8#file-signing-hs > > And so I used `hedgehog-classes` to test the Storable instance. > However, all the tests fail with the same reason: Prelude.undefined: > > https://gist.github.com/Kleidukos/31346d067f309f2a86cbd97a85c0f1e8#file-undefined_error-txt > > > The main problem (and that's certainly a red herring for me) is that > the `undefined` call comes frombase:Foreign.Marshal.Array. > Which shouldn't be a problem, as it is not supposed to be evaluated! > Yet apparently it is. > > If you're interested to see the full code, it's located here: > https://github.com/haskell-cryptography/libsodium-bindings/blob/add-sel-package/sel/src/Sel/Signing.hs > > I'm not sure how to proceed from here. What would be a good angle to > approach this? > > Cheers, > Hécate > From ollie at ocharles.org.uk Mon Nov 28 16:14:51 2022 From: ollie at ocharles.org.uk (Oliver Charles) Date: Mon, 28 Nov 2022 16:14:51 +0000 Subject: [Haskell-cafe] Writing and testing a Storable instance for a record wrapping ForeignPtrs In-Reply-To: References: Message-ID: <807cfb26-e848-4f3b-8243-67ad0cded13f@app.fastmail.com> You are strict in your definition of `sizeOf`. You probably want: sizeOf ~SignedMessage{messageLength} = ... On Mon, 28 Nov 2022, at 4:04 PM, Hécate wrote: > Hi everyone, > > In a fit of madness I have found myself writing Haskell code where I > need to implement a Storable instance. However, by virtue of not being a > C programmer, I'm fairly lost on some of the details, especially the > value of the sizeOf and alignment methods. > > My Haskell-level record is the following: > > data SignedMessage = SignedMessage > { messageLength :: CSize > , messageForeignPtr :: ForeignPtr CUChar > , signatureForeignPtr :: ForeignPtr CUChar > } > > > Here is the code of the Storable instance: > https://gist.github.com/Kleidukos/31346d067f309f2a86cbd97a85c0f1e8#file-signing-hs > > And so I used `hedgehog-classes` to test the Storable instance. However, > all the tests fail with the same reason: Prelude.undefined: > > https://gist.github.com/Kleidukos/31346d067f309f2a86cbd97a85c0f1e8#file-undefined_error-txt > > The main problem (and that's certainly a red herring for me) is that the > `undefined` call comes frombase:Foreign.Marshal.Array. > Which shouldn't be a problem, as it is not supposed to be evaluated! > Yet apparently it is. > > If you're interested to see the full code, it's located here: > https://github.com/haskell-cryptography/libsodium-bindings/blob/add-sel-package/sel/src/Sel/Signing.hs > > I'm not sure how to proceed from here. What would be a good angle to > approach this? > > Cheers, > Hécate > > -- > Hécate ✨ > 🐦: @TechnoEmpress > IRC: Hecate > WWW: https://glitchbra.in > RUN: BSD > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ikke at nicolast.be Mon Nov 28 16:30:15 2022 From: ikke at nicolast.be (Nicolas Trangez) Date: Mon, 28 Nov 2022 17:30:15 +0100 Subject: [Haskell-cafe] Writing and testing a Storable instance for a record wrapping ForeignPtrs In-Reply-To: References: Message-ID: On Mon, 2022-11-28 at 17:04 +0100, Hécate wrote: > In a fit of madness I have found myself writing Haskell code where I > need to implement a Storable instance. However, by virtue of not > being a > C programmer, I'm fairly lost on some of the details, especially the > value of the sizeOf and alignment methods. Next to the other replies, did you consider using `hsc2hs` to create these bindings? Using the tool, you can use its `#{size ...}`, `#{alignment ...}` and `#{peek ...}`/`#{poke ...}` helpers to implement `Storable` for some C struct, without running a C compiler in your head (e.g., taking padding into account to implement `sizeOf`). See the docs at https://ghc.gitlab.haskell.org/ghc/doc/users_guide/utils.html#writing-haskell-interfaces-to-c-code-hsc2hs. Note `hsc2hs` is fully integrated in Cabal (use `Foo.hsc` as module filename), no need to reach out to its CLI. You can find a simple example of a Storable instance using it at https://github.com/NicolasT/landlock-hs/blob/b5638684869ad4f85bea53f10a3f0b921f000202/landlock/internal/System/Landlock/Rules.hsc#L44. Nicolas > > My Haskell-level record is the following: > > data SignedMessage = SignedMessage >    { messageLength :: CSize >    , messageForeignPtr :: ForeignPtr CUChar >    , signatureForeignPtr :: ForeignPtr CUChar >    } > > > Here is the code of the Storable instance: > https://gist.github.com/Kleidukos/31346d067f309f2a86cbd97a85c0f1e8#file-signing-hs > > And so I used `hedgehog-classes` to test the Storable instance. > However, > all the tests fail with the same reason: Prelude.undefined: > > https://gist.github.com/Kleidukos/31346d067f309f2a86cbd97a85c0f1e8#file-undefined_error-txt > > The main problem (and that's certainly a red herring for me) is that > the > `undefined` call comes frombase:Foreign.Marshal.Array. > Which shouldn't be a problem, as it is not supposed to be evaluated! > Yet apparently it is. > > If you're interested to see the full code, it's located here: > https://github.com/haskell-cryptography/libsodium-bindings/blob/add-sel-package/sel/src/Sel/Signing.hs > > I'm not sure how to proceed from here. What would be a good angle to > approach this? > > Cheers, > Hécate > From ietf-dane at dukhovni.org Mon Nov 28 16:42:34 2022 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Mon, 28 Nov 2022 11:42:34 -0500 Subject: [Haskell-cafe] Writing and testing a Storable instance for a record wrapping ForeignPtrs In-Reply-To: References: Message-ID: On Mon, Nov 28, 2022 at 05:04:32PM +0100, Hécate wrote: > In a fit of madness I have found myself writing Haskell code where I > need to implement a Storable instance. However, by virtue of not being a > C programmer, I'm fairly lost on some of the details, especially the > value of the sizeOf and alignment methods. > > My Haskell-level record is the following: > > data SignedMessage = SignedMessage >   { messageLength :: CSize >   , messageForeignPtr :: ForeignPtr CUChar >   , signatureForeignPtr :: ForeignPtr CUChar >   } This is not the sort of object for which `Storable` makes sense. It holds ephemeral pointers to variable sized external data, and so cannot be serialised in a modest fixed-size memory block. The `Storable` class is for primitive data (Ints, Words, ...) and simple fixed layout structures consisting of same (e.g. various structures passed to, or returned by C system calls). When structures contain pointers to data, nested `peek` or `poke` calls (with associated memory allocations) may be needed to read or write the structure. To serialise your "SignedMessage" object you may need a higher-level serialisation format. ASN.1, protobufs, ... or (for a Haskell-only format) an instance of `Data.Binary.Binary` (rather than Storable). https://hackage.haskell.org/package/binary-0.10.0.0/docs/Data-Binary.html What's the use case here? -- Viktor. From hecate at glitchbra.in Mon Nov 28 17:54:39 2022 From: hecate at glitchbra.in (=?UTF-8?Q?H=c3=a9cate?=) Date: Mon, 28 Nov 2022 18:54:39 +0100 Subject: [Haskell-cafe] [SOLVED] Writing and testing a Storable instance for a record wrapping ForeignPtrs In-Reply-To: References: Message-ID: <54f2d02a-ea3a-8dbd-3fe3-960be0ad8af9@glitchbra.in> Hi Viktor, hi everyone, Thanks again for the many useful answers. I'll try to answers the questions asked in one email: 1. did you consider using `hsc2hs` to create these bindings? I have to admit I stopped at c2hs when I found out it could not produce correct alignments for libsodium: https://github.com/haskell/c2hs/issues/272 I am now being told that hsc2hs asks the compiler directly so it's not problem, but that's eleven months after the fact :) 2. What's the use case here? The use case is certainly my own partial worldview of how it all works. That being said one interesting thing is that peek & poke allow you to do IO, whereas Binary's Put and Get do not seem to allow me to do it (without cheating at least). And I couldn't find any instruction that said that it was okay to use unsafeDupablePerformIO (or similar) in Binary. Have a nice rest of your day! Cheers, Hécate Le 28/11/2022 à 17:42, Viktor Dukhovni a écrit : > On Mon, Nov 28, 2022 at 05:04:32PM +0100, Hécate wrote: > >> In a fit of madness I have found myself writing Haskell code where I >> need to implement a Storable instance. However, by virtue of not being a >> C programmer, I'm fairly lost on some of the details, especially the >> value of the sizeOf and alignment methods. >> >> My Haskell-level record is the following: >> >> data SignedMessage = SignedMessage >>   { messageLength :: CSize >>   , messageForeignPtr :: ForeignPtr CUChar >>   , signatureForeignPtr :: ForeignPtr CUChar >>   } > This is not the sort of object for which `Storable` makes sense. It > holds ephemeral pointers to variable sized external data, and so cannot > be serialised in a modest fixed-size memory block. The `Storable` class > is for primitive data (Ints, Words, ...) and simple fixed layout > structures consisting of same (e.g. various structures passed to, or returned > by C system calls). When structures contain pointers to data, nested > `peek` or `poke` calls (with associated memory allocations) may be needed > to read or write the structure. > > To serialise your "SignedMessage" object you may need a higher-level > serialisation format. ASN.1, protobufs, ... or (for a Haskell-only > format) an instance of `Data.Binary.Binary` (rather than Storable). > > https://hackage.haskell.org/package/binary-0.10.0.0/docs/Data-Binary.html > > What's the use case here? > -- Hécate ✨ 🐦: @TechnoEmpress IRC: Hecate WWW: https://glitchbra.in RUN: BSD From ietf-dane at dukhovni.org Mon Nov 28 19:06:34 2022 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Mon, 28 Nov 2022 14:06:34 -0500 Subject: [Haskell-cafe] [SOLVED] Writing and testing a Storable instance for a record wrapping ForeignPtrs In-Reply-To: <54f2d02a-ea3a-8dbd-3fe3-960be0ad8af9@glitchbra.in> References: <54f2d02a-ea3a-8dbd-3fe3-960be0ad8af9@glitchbra.in> Message-ID: On Mon, Nov 28, 2022 at 06:54:39PM +0100, Hécate wrote: > 2. What's the use case here? > > The use case is certainly my own partial worldview of how it all works. > That being said one interesting thing is that peek & poke allow you to > do IO, whereas Binary's Put and Get do not seem to allow me to do it > (without cheating at least). And I couldn't find any instruction that > said that it was okay to use unsafeDupablePerformIO (or similar) in Binary. The use-case for Data.Binary is for converting to and from ByteStrings (possibly lazy construction via Builders). If you want to include reading the data from a stream, there's at least: https://hackage.haskell.org/package/ghc-9.4.2/docs/GHC-Utils-Binary.html and equivalent options. But your answer is still at much too low a level. What kinds of messages are these? What sort of communication pattern is this serialisation in aid of? - Haskell to FFI helper functions? - Haskell process to Haskell process on the same machine? - Haskell Process to cache for later retrieval? - Interprocess, possily across languages and systems? - ... What are the interoperability requirements? ... -- Viktor. From hecate at glitchbra.in Mon Nov 28 19:14:15 2022 From: hecate at glitchbra.in (=?UTF-8?Q?H=c3=a9cate?=) Date: Mon, 28 Nov 2022 20:14:15 +0100 Subject: [Haskell-cafe] [SOLVED] Writing and testing a Storable instance for a record wrapping ForeignPtrs In-Reply-To: References: <54f2d02a-ea3a-8dbd-3fe3-960be0ad8af9@glitchbra.in> Message-ID: <2e4f694b-9d29-2a07-4904-50863d4f5959@glitchbra.in> Ah sorry, I misunderstood your question. I am writing a high-level interface to my libsodium bindings, and I'm trying to provide implementations of helpful typeclasses. I actually don't need Storable to do the FFI stuff, thankfully, but the main case of using this library would involve sending the result of the signing operation to the network (as ByteStrings), with authorization tokens like Biscuit¹ in mind. ¹ https://www.biscuitsec.org Le 28/11/2022 à 20:06, Viktor Dukhovni a écrit : > On Mon, Nov 28, 2022 at 06:54:39PM +0100, Hécate wrote: > >> 2. What's the use case here? >> >> The use case is certainly my own partial worldview of how it all works. >> That being said one interesting thing is that peek & poke allow you to >> do IO, whereas Binary's Put and Get do not seem to allow me to do it >> (without cheating at least). And I couldn't find any instruction that >> said that it was okay to use unsafeDupablePerformIO (or similar) in Binary. > The use-case for Data.Binary is for converting to and from ByteStrings > (possibly lazy construction via Builders). If you want to include > reading the data from a stream, there's at least: > > https://hackage.haskell.org/package/ghc-9.4.2/docs/GHC-Utils-Binary.html > > and equivalent options. But your answer is still at much too low a > level. What kinds of messages are these? What sort of communication > pattern is this serialisation in aid of? > > - Haskell to FFI helper functions? > - Haskell process to Haskell process on the same machine? > - Haskell Process to cache for later retrieval? > - Interprocess, possily across languages and systems? > - ... > > What are the interoperability requirements? ... > -- Hécate ✨ 🐦: @TechnoEmpress IRC: Hecate WWW: https://glitchbra.in RUN: BSD From ietf-dane at dukhovni.org Mon Nov 28 19:34:50 2022 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Mon, 28 Nov 2022 14:34:50 -0500 Subject: [Haskell-cafe] [SOLVED] Writing and testing a Storable instance for a record wrapping ForeignPtrs In-Reply-To: <2e4f694b-9d29-2a07-4904-50863d4f5959@glitchbra.in> References: <54f2d02a-ea3a-8dbd-3fe3-960be0ad8af9@glitchbra.in> <2e4f694b-9d29-2a07-4904-50863d4f5959@glitchbra.in> Message-ID: On Mon, Nov 28, 2022 at 08:14:15PM +0100, Hécate wrote: > Ah sorry, I misunderstood your question. > > I am writing a high-level interface to my libsodium bindings, and I'm > trying to provide implementations of helpful typeclasses. > > I actually don't need Storable to do the FFI stuff, thankfully, but the > main case of using this library would involve sending the result of the > signing operation to the network (as ByteStrings), with authorization > tokens like Biscuit¹ in mind. > > ¹ https://www.biscuitsec.org For serialisation to external standard formats, like JSON, or binary JSON, ... you're definitely not looking for `Storable`. Simply returning the message as two octet-strings (ByteStrings), one for the raw data and another for the signature is all you need. From there, various higher-level formats are possible. The main thing to be mindful of is that ByteStrings are limited to 2^31 bytes on 32-bit machines, so very large messages don't fit in a ByteString on some (increasingly less common) architectures. Or am I missing some reason why you'd want to create a single binary blob ,>? -- Viktor. From hecate at glitchbra.in Mon Nov 28 19:42:40 2022 From: hecate at glitchbra.in (=?UTF-8?Q?H=c3=a9cate?=) Date: Mon, 28 Nov 2022 20:42:40 +0100 Subject: [Haskell-cafe] [SOLVED] Writing and testing a Storable instance for a record wrapping ForeignPtrs In-Reply-To: References: <54f2d02a-ea3a-8dbd-3fe3-960be0ad8af9@glitchbra.in> <2e4f694b-9d29-2a07-4904-50863d4f5959@glitchbra.in> Message-ID: Thanks for the knowledge regarding the size of the ByteString! Eventually the outside serialisation isn't up to me, but rather the consumers. I have one potential user who told me they need the signature and the message to be separate for the protocol they are implementing. I guess if I defer to ByteString early on it'll be easier for the library to be adapted to whatever use case comes after. Thanks a lot Viktor, I believe I'll go to bed less ignorant tonight. :) Le 28/11/2022 à 20:34, Viktor Dukhovni a écrit : > On Mon, Nov 28, 2022 at 08:14:15PM +0100, Hécate wrote: >> Ah sorry, I misunderstood your question. >> >> I am writing a high-level interface to my libsodium bindings, and I'm >> trying to provide implementations of helpful typeclasses. >> >> I actually don't need Storable to do the FFI stuff, thankfully, but the >> main case of using this library would involve sending the result of the >> signing operation to the network (as ByteStrings), with authorization >> tokens like Biscuit¹ in mind. >> >> ¹ https://www.biscuitsec.org > For serialisation to external standard formats, like JSON, or binary > JSON, ... you're definitely not looking for `Storable`. Simply > returning the message as two octet-strings (ByteStrings), one for the > raw data and another for the signature is all you need. From there, > various higher-level formats are possible. > > The main thing to be mindful of is that ByteStrings are limited to 2^31 > bytes on 32-bit machines, so very large messages don't fit in a > ByteString on some (increasingly less common) architectures. > > Or am I missing some reason why you'd want to create a single binary > blob ,>? > -- Hécate ✨ 🐦: @TechnoEmpress IRC: Hecate WWW: https://glitchbra.in RUN: BSD From ietf-dane at dukhovni.org Tue Nov 29 07:47:47 2022 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Tue, 29 Nov 2022 02:47:47 -0500 Subject: [Haskell-cafe] [SOLVED] Writing and testing a Storable instance for a record wrapping ForeignPtrs In-Reply-To: References: <54f2d02a-ea3a-8dbd-3fe3-960be0ad8af9@glitchbra.in> <2e4f694b-9d29-2a07-4904-50863d4f5959@glitchbra.in> Message-ID: On Mon, Nov 28, 2022 at 08:42:40PM +0100, Hécate wrote: > Thanks for the knowledge regarding the size of the ByteString! > > Eventually the outside serialisation isn't up to me, but rather the > consumers. I have one potential user who told me they need the signature > and the message to be separate for the protocol they are implementing. > > I guess if I defer to ByteString early on it'll be easier for the > library to be adapted to whatever use case comes after. Note that "Lazy" Bytestrings are allocated as a chain of component ByteString chunks, and their total length is an Int64 on all platforms. The chunks might still be in memory, and in some cases could be truly incrementally loaded from the underlying source. However true streaming support is perhaps best via ByteStream from e.g. https://hackage.haskell.org/package/streaming-bytestring-0.2.4/docs/Streaming-ByteString-Char8.html which supports monadic incremental consumption (the underlying Monad need not be IO, so pure sources are also supported). The design space is wide. If signatures are "detached" (available independently of the message), and messages could be too large to fit in memory, then streaming the message may be attractive. But then the protocol to the consumer needs to support streaming input (e.g. HTTP PUT or POST with chunked transfer encoding). With large messages one might even want chunk-level signatures that authenticate all the chunks transmitted so far in order, with a final empty chunk authenticating the entire message. There should be a standard format for this, but I am not aware of one. CMS sadly does not suffice. For example, messages that are just signed, but not cryptographically tied to a particular transaction (and recipient) are potentially subject to replays. This may or may not be OK. A message with a clear transaction context (that makes out of context replays detectable), encrypted to a given set of recipients, and then signed has stronger security properties than just a signed blob that is not tied to a clear context or recipient. It is sadly common to use cryptography pixie dust to add security theatre to application data flows without a careful analysis of the security properties required and attained. Security is difficult and brittle. :-( -- Viktor. From ida.bzowska at gmail.com Tue Nov 29 19:22:16 2022 From: ida.bzowska at gmail.com (Ida Bzowska) Date: Tue, 29 Nov 2022 20:22:16 +0100 Subject: [Haskell-cafe] Call for Haskell.org Committee Nominations Message-ID: Dear Haskellers, The Haskell.org Committee is happy to announce that we are opening the call for nominations for new members. Details can be found [here ]. You can nominate yourself or your friend! If you have any questions, don't hesitate to ask. λCheers Ida Bzowska -------------- next part -------------- An HTML attachment was scrubbed... URL: From frase at frase.id.au Wed Nov 30 11:45:29 2022 From: frase at frase.id.au (Fraser Tweedale) Date: Wed, 30 Nov 2022 21:45:29 +1000 Subject: [Haskell-cafe] FOSDEM Haskell devroom: we need proposals! Message-ID: Previously: https://mail.haskell.org/pipermail/haskell-cafe/2022-November/135674.html **We need more proposals! We need your help!** FOSDEM 2023 will be held on 4 & 5 February 2023, in Brussels. For more information see the [official site](https://fosdem.org/2023/). The Haskell devroom (specialist track) will take place on Sunday 5 February, from 13:10 to 17:00 UTC+1. This is an amazing opportunity to promote Haskell, and functional programming generally, to a legion of free software developers and enthusiasts. But right now, we are not even close to filling our schedule. If we don't fill our ~4 hour schedule, the Haskell devroom will not happen. Therefore we are extending our Call for Proposals until Saturday 2022-12-10. We are also now welcoming proposals for tutorials/workshops and longer presentations (up to 45 minutes). Shorter presentations are still welcome, of course. So if you want to propose an introductory workshop, install fest, hack session, or something similar, have at it. You can also help by sharing our CFP far and wide, and encourage specific people you think might have something interesting to present, to submit a proposal. Thanks, Fraser Tweedale From frederic-emmanuel.picca at synchrotron-soleil.fr Wed Nov 30 15:18:56 2022 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Wed, 30 Nov 2022 16:18:56 +0100 (CET) Subject: [Haskell-cafe] How to create a list of each constructor value Message-ID: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> Hello, I have a type like this data InputType = CristalK6C | MarsFlyscan | MarsSbs | SixsFlyMedH | SixsFlyMedV | SixsFlyMedVEiger | SixsFlyMedVS70 | SixsFlyScanUhv | SixsFlyScanUhv2 | SixsFlyScanUhvTest | SixsFlyScanUhvUfxc | SixsSbsFixedDetector | SixsSbsMedH | SixsSbsMedV | SixsSbsMedVFixDetector deriving (Eq, Show) I want to create a list of each values in order to create meaningfull error message for the user and simplify my Arbitrary instances. I do not want to type two time the values. instance Arbitrary InputType where arbitrary = oneof (map pure [ CristalK6C , MarsFlyscan , MarsSbs , SixsFlyMedH , SixsFlyMedV , SixsFlyMedVEiger , SixsFlyMedVS70 , SixsFlyScanUhv , SixsFlyScanUhv2 , SixsFlyScanUhvTest , SixsFlyScanUhvUfxc , SixsSbsFixedDetector , SixsSbsMedH , SixsSbsMedV , SixsSbsMedVFixDetector ] ) Thanks for your help Frederic From lemming at henning-thielemann.de Wed Nov 30 15:21:53 2022 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Wed, 30 Nov 2022 16:21:53 +0100 (CET) Subject: [Haskell-cafe] How to create a list of each constructor value In-Reply-To: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> References: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> Message-ID: <6d3546bb-13fd-ddf8-9fe8-ccfcdb423b2@henning-thielemann.de> On Wed, 30 Nov 2022, PICCA Frederic-Emmanuel wrote: > Hello, I have a type like this > > data InputType = CristalK6C > | MarsFlyscan > | MarsSbs > | SixsFlyMedH > | SixsFlyMedV > | SixsFlyMedVEiger > | SixsFlyMedVS70 > | SixsFlyScanUhv > | SixsFlyScanUhv2 > | SixsFlyScanUhvTest > | SixsFlyScanUhvUfxc > | SixsSbsFixedDetector > | SixsSbsMedH > | SixsSbsMedV > | SixsSbsMedVFixDetector > deriving (Eq, Show) > > I want to create a list of each values in order to create meaningfull > error message for the user and simplify my Arbitrary instances. deriving (Enum, Bounded) then use [minBound .. maxBound] From allbery.b at gmail.com Wed Nov 30 15:22:49 2022 From: allbery.b at gmail.com (Brandon Allbery) Date: Wed, 30 Nov 2022 10:22:49 -0500 Subject: [Haskell-cafe] How to create a list of each constructor value In-Reply-To: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> References: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> Message-ID: Derive Enum and Bounded and use [minBound .. maxBound] :: [InputType] On Wed, Nov 30, 2022 at 10:19 AM PICCA Frederic-Emmanuel wrote: > > Hello, I have a type like this > > data InputType = CristalK6C > | MarsFlyscan > | MarsSbs > | SixsFlyMedH > | SixsFlyMedV > | SixsFlyMedVEiger > | SixsFlyMedVS70 > | SixsFlyScanUhv > | SixsFlyScanUhv2 > | SixsFlyScanUhvTest > | SixsFlyScanUhvUfxc > | SixsSbsFixedDetector > | SixsSbsMedH > | SixsSbsMedV > | SixsSbsMedVFixDetector > deriving (Eq, Show) > > I want to create a list of each values in order to create meaningfull error message for the user and simplify my Arbitrary instances. > I do not want to type two time the values. > > instance Arbitrary InputType where > arbitrary = oneof (map pure > [ CristalK6C > , MarsFlyscan > , MarsSbs > , SixsFlyMedH > , SixsFlyMedV > , SixsFlyMedVEiger > , SixsFlyMedVS70 > , SixsFlyScanUhv > , SixsFlyScanUhv2 > , SixsFlyScanUhvTest > , SixsFlyScanUhvUfxc > , SixsSbsFixedDetector > , SixsSbsMedH > , SixsSbsMedV > , SixsSbsMedVFixDetector > ] > ) > > > Thanks for your help > > Frederic > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- brandon s allbery kf8nh allbery.b at gmail.com From bryan at haskell.foundation Wed Nov 30 15:25:35 2022 From: bryan at haskell.foundation (Bryan Richter) Date: Wed, 30 Nov 2022 17:25:35 +0200 Subject: [Haskell-cafe] How to create a list of each constructor value In-Reply-To: References: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> Message-ID: Also, you can simplify the "map pure (...)" by using `elements` :) https://hackage.haskell.org/package/QuickCheck-2.14.2/docs/Test-QuickCheck.html#v:elements On Wed, Nov 30, 2022 at 5:23 PM Brandon Allbery wrote: > > Derive Enum and Bounded and use [minBound .. maxBound] :: [InputType] > > On Wed, Nov 30, 2022 at 10:19 AM PICCA Frederic-Emmanuel > wrote: > > > > Hello, I have a type like this > > > > data InputType = CristalK6C > > | MarsFlyscan > > | MarsSbs > > | SixsFlyMedH > > | SixsFlyMedV > > | SixsFlyMedVEiger > > | SixsFlyMedVS70 > > | SixsFlyScanUhv > > | SixsFlyScanUhv2 > > | SixsFlyScanUhvTest > > | SixsFlyScanUhvUfxc > > | SixsSbsFixedDetector > > | SixsSbsMedH > > | SixsSbsMedV > > | SixsSbsMedVFixDetector > > deriving (Eq, Show) > > > > I want to create a list of each values in order to create meaningfull error message for the user and simplify my Arbitrary instances. > > I do not want to type two time the values. > > > > instance Arbitrary InputType where > > arbitrary = oneof (map pure > > [ CristalK6C > > , MarsFlyscan > > , MarsSbs > > , SixsFlyMedH > > , SixsFlyMedV > > , SixsFlyMedVEiger > > , SixsFlyMedVS70 > > , SixsFlyScanUhv > > , SixsFlyScanUhv2 > > , SixsFlyScanUhvTest > > , SixsFlyScanUhvUfxc > > , SixsSbsFixedDetector > > , SixsSbsMedH > > , SixsSbsMedV > > , SixsSbsMedVFixDetector > > ] > > ) > > > > > > Thanks for your help > > > > Frederic > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > > > -- > brandon s allbery kf8nh > allbery.b at gmail.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From haskellcafe at dandart.co.uk Wed Nov 30 15:28:17 2022 From: haskellcafe at dandart.co.uk (Dan Dart) Date: Wed, 30 Nov 2022 15:28:17 +0000 Subject: [Haskell-cafe] How to create a list of each constructor value In-Reply-To: References: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> Message-ID: Also, `enumerate` is a common function for `[minBound .. maxBound]`, found in many libraries, e.g. `extra`: https://hackage.haskell.org/package/extra-1.7.12/docs/Data-List-Extra.html#v:enumerate From frederic-emmanuel.picca at synchrotron-soleil.fr Wed Nov 30 15:36:25 2022 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Wed, 30 Nov 2022 16:36:25 +0100 (CET) Subject: [Haskell-cafe] How to create a list of each constructor value In-Reply-To: References: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> Message-ID: <1796030110.46309965.1669822585550.JavaMail.zimbra@synchrotron-soleil.fr> > Also, you can simplify the "map pure (...)" by using `elements` :) thanks another question I have plenty of instance build like this instance Arbitrary TypeA where arbitrary = TypeA <$> arbitrary <*> arbitrary ... <*> arbitrary is there a convenient way to avoid typing this it seems purely mechanical thanks Fred From frederic-emmanuel.picca at synchrotron-soleil.fr Wed Nov 30 15:37:09 2022 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Wed, 30 Nov 2022 16:37:09 +0100 (CET) Subject: [Haskell-cafe] How to create a list of each constructor value In-Reply-To: <6d3546bb-13fd-ddf8-9fe8-ccfcdb423b2@henning-thielemann.de> References: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> <6d3546bb-13fd-ddf8-9fe8-ccfcdb423b2@henning-thielemann.de> Message-ID: <941513603.46311788.1669822629421.JavaMail.zimbra@synchrotron-soleil.fr> Thanks you all for these rapid answers ----- Le 30 Nov 22, à 16:21, Henning Thielemann lemming at henning-thielemann.de a écrit : > On Wed, 30 Nov 2022, PICCA Frederic-Emmanuel wrote: > >> Hello, I have a type like this >> >> data InputType = CristalK6C >> | MarsFlyscan >> | MarsSbs >> | SixsFlyMedH >> | SixsFlyMedV >> | SixsFlyMedVEiger >> | SixsFlyMedVS70 >> | SixsFlyScanUhv >> | SixsFlyScanUhv2 >> | SixsFlyScanUhvTest >> | SixsFlyScanUhvUfxc >> | SixsSbsFixedDetector >> | SixsSbsMedH >> | SixsSbsMedV >> | SixsSbsMedVFixDetector >> deriving (Eq, Show) >> >> I want to create a list of each values in order to create meaningfull >> error message for the user and simplify my Arbitrary instances. > > deriving (Enum, Bounded) > > > then use [minBound .. maxBound] From lemming at henning-thielemann.de Wed Nov 30 15:39:42 2022 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Wed, 30 Nov 2022 16:39:42 +0100 (CET) Subject: [Haskell-cafe] How to create a list of each constructor value In-Reply-To: <1796030110.46309965.1669822585550.JavaMail.zimbra@synchrotron-soleil.fr> References: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> <1796030110.46309965.1669822585550.JavaMail.zimbra@synchrotron-soleil.fr> Message-ID: On Wed, 30 Nov 2022, PICCA Frederic-Emmanuel wrote: >> Also, you can simplify the "map pure (...)" by using `elements` :) > > thanks > > another question I have plenty of instance build like this > > instance Arbitrary TypeA where > arbitrary = TypeA <$> arbitrary <*> arbitrary ... <*> arbitrary uncurry TypeA <$> arbitrary uncurry3 TypeA <$> arbitrary would be a bit shorter if this is important. From frederic-emmanuel.picca at synchrotron-soleil.fr Wed Nov 30 15:42:20 2022 From: frederic-emmanuel.picca at synchrotron-soleil.fr (PICCA Frederic-Emmanuel) Date: Wed, 30 Nov 2022 16:42:20 +0100 (CET) Subject: [Haskell-cafe] How to create a list of each constructor value In-Reply-To: References: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> <1796030110.46309965.1669822585550.JavaMail.zimbra@synchrotron-soleil.fr> Message-ID: <1808435087.46317842.1669822940702.JavaMail.zimbra@synchrotron-soleil.fr> > uncurry TypeA <$> arbitrary > uncurry3 TypeA <$> arbitrary > > > would be a bit shorter if this is important. I think that writing less line is better and less error prone. thanks again Frederic From s9gf4ult at gmail.com Wed Nov 30 17:43:58 2022 From: s9gf4ult at gmail.com (s9gf4ult) Date: Wed, 30 Nov 2022 23:43:58 +0600 Subject: [Haskell-cafe] How to create a list of each constructor value In-Reply-To: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> References: <1434982562.46277715.1669821536049.JavaMail.zimbra@synchrotron-soleil.fr> Message-ID: <2f251f36-17a9-a5b0-c45b-9449998eb4df@gmail.com> You can use `generic-arbitrary` like this ```haskell import Test.QuickCheck.Arbitrary.Generic data CristalK6C ... deriving Generic deriving (Arbitrary) via GenericArbitrary CristalK6C ``` On 30.11.2022 21:18, PICCA Frederic-Emmanuel wrote: > Hello, I have a type like this > > data InputType = CristalK6C > | MarsFlyscan > | MarsSbs > | SixsFlyMedH > | SixsFlyMedV > | SixsFlyMedVEiger > | SixsFlyMedVS70 > | SixsFlyScanUhv > | SixsFlyScanUhv2 > | SixsFlyScanUhvTest > | SixsFlyScanUhvUfxc > | SixsSbsFixedDetector > | SixsSbsMedH > | SixsSbsMedV > | SixsSbsMedVFixDetector > deriving (Eq, Show) > > I want to create a list of each values in order to create meaningfull error message for the user and simplify my Arbitrary instances. > I do not want to type two time the values. > > instance Arbitrary InputType where > arbitrary = oneof (map pure > [ CristalK6C > , MarsFlyscan > , MarsSbs > , SixsFlyMedH > , SixsFlyMedV > , SixsFlyMedVEiger > , SixsFlyMedVS70 > , SixsFlyScanUhv > , SixsFlyScanUhv2 > , SixsFlyScanUhvTest > , SixsFlyScanUhvUfxc > , SixsSbsFixedDetector > , SixsSbsMedH > , SixsSbsMedV > , SixsSbsMedVFixDetector > ] > ) > > > Thanks for your help > > Frederic > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Wed Nov 30 22:33:02 2022 From: david.feuer at gmail.com (David Feuer) Date: Wed, 30 Nov 2022 17:33:02 -0500 Subject: [Haskell-cafe] Debugging a test suite freeze Message-ID: The logict-sequence test suite consistently freezes up on the last test when compiled with GHC 9.4.3. logict-sequence and its test suite don't do anything special with that GHC/base version as far as I can see, or anything particularly strange in general, so I'm pretty confident the problem lies elsewhere. My best guesses are hedgehog, tasty, and tasty-hedgehog. Has anyone else run into weird issues with any/all of these on GHC 9.4.3? David From david.feuer at gmail.com Wed Nov 30 22:46:16 2022 From: david.feuer at gmail.com (David Feuer) Date: Wed, 30 Nov 2022 17:46:16 -0500 Subject: [Haskell-cafe] Debugging a test suite freeze In-Reply-To: References: Message-ID: In particular, I think tasty does some tricky concurrency. Have there been changes in that recently, either in GHC itself or in async, that might be responsible? On Wed, Nov 30, 2022, 5:33 PM David Feuer wrote: > The logict-sequence test suite consistently freezes up on the last > test when compiled with GHC 9.4.3. logict-sequence and its test suite > don't do anything special with that GHC/base version as far as I can > see, or anything particularly strange in general, so I'm pretty > confident the problem lies elsewhere. My best guesses are hedgehog, > tasty, and tasty-hedgehog. Has anyone else run into weird issues with > any/all of these on GHC 9.4.3? > > David > -------------- next part -------------- An HTML attachment was scrubbed... URL: