From ben at well-typed.com Mon Apr 10 03:50:04 2017 From: ben at well-typed.com (Ben Gamari) Date: Sun, 09 Apr 2017 23:50:04 -0400 Subject: [ANNOUNCE] GHC 8.2.1 release candidate 1 Message-ID: <87lgr8zztf.fsf@ben-laptop.smart-cactus.org> Hello everyone, The GHC team is very pleased to announce the first candidate of the 8.2.1 release of the Glasgow Haskell Compiler. Source and binary distributions are available at https://downloads.haskell.org/~ghc/8.2.1-rc1/ This is the first of a few release candidates leading up the final 8.2.1 release. This release will feature, * A new type-indexed Typeable implementation * The long awaited Backpack * Deriving strategies for disambiguating DeriveAnyClass, GeneralizedNewtypeDeriving, and stock mechanisms * Overloaded record fields * Improved compiler performance * Better code generation through more robust tracking of join points * Compact regions for more efficient garbage collection and serialization * Better support for machines with non-uniform memory architectures * More robust support for levity (e.g. RuntimeRep) polymorphism * A simple interface for streaming eventlog data from live processes * Further refinement of DWARF support Unfortunately there are still a few known issues in this release, including a few compiler panics (#13233, #13509) and a memory leak in the simplifier (#13426) which may adversely affect heap sizes and compilation time for some modules. This memory leak unfortunately made it impossible to provide a 32-bit Windows distribution for this candidate; this will be resolved in -rc2. As always, please let us know if you have difficulty. Thanks to everyone who has contributed to this release! Happy testing, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From anthony_clayden at clear.net.nz Sun Apr 16 07:13:04 2017 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Sun, 16 Apr 2017 19:13:04 +1200 Subject: Why isn't this Overlapping? Message-ID: <58f31980.230.a7.10823@clear.net.nz> --ghc 7.10 or 8.0.1 {-# LANGUAGE DataKinds, KindSignatures, GADTs, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, UndecidableInstances, NoOverlappingInstances #-} class TypeEq a a' (b :: Bool) | a a' -> b instance (b ~ True) => TypeEq a a b instance (b ~ False) => TypeEq a a' b Those two instance heads are nearly identical, surely they overlap? And for a type-level type equality test, they must be unifiable. But GHC doesn't complain. If I take off the FunDep, then GHC complains. AFAICT none of those extensions imply Overlaps, but to be sure I've put NoOverlapping. AntC From iavor.diatchki at gmail.com Tue Apr 18 00:50:20 2017 From: iavor.diatchki at gmail.com (Iavor Diatchki) Date: Mon, 17 Apr 2017 17:50:20 -0700 Subject: Why isn't this Overlapping? In-Reply-To: <58f31980.230.a7.10823@clear.net.nz> References: <58f31980.230.a7.10823@clear.net.nz> Message-ID: Hello, these two instances really should be rejected as they violate the FD of the class: we can derive `TypeEq a a True` using the first instance and `TypeEq a a False` using the second one. Unfortunately, the check that we are using to validate FDs when `UndecidableInstances` is on, is not quite correct (relevant tickets are #9210 and #10675 where there are similar examples). -Iavor On Sun, Apr 16, 2017 at 12:13 AM, Anthony Clayden < anthony_clayden at clear.net.nz> wrote: > --ghc 7.10 or 8.0.1 > > {-# LANGUAGE DataKinds, KindSignatures, GADTs, > MultiParamTypeClasses, > FunctionalDependencies, FlexibleInstances, > UndecidableInstances, > NoOverlappingInstances #-} > > class TypeEq a a' (b :: Bool) | a a' -> b > > instance (b ~ True) => TypeEq a a b > instance (b ~ False) => TypeEq a a' b > > Those two instance heads are nearly identical, surely they > overlap? > And for a type-level type equality test, they must be > unifiable. > But GHC doesn't complain. > > If I take off the FunDep, then GHC complains. > > AFAICT none of those extensions imply Overlaps, > but to be sure I've put NoOverlapping. > > > AntC > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthony_clayden at clear.net.nz Tue Apr 18 01:24:25 2017 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Tue, 18 Apr 2017 13:24:25 +1200 Subject: Why isn't this Overlapping? Message-ID: <58f56ac9.2b5.2070.18301@clear.net.nz> > On Tue Apr 18 00:50:20 UTC 2017, Iavor Diatchki wrote: > > these two instances really should be rejected as they > violate the FD of the class: we can derive `TypeEq a a > True` using the first instance and `TypeEq a a False` > using the second one. Unfortunately, the check that we > are using to validate FDs when `UndecidableInstances` is > on, is not quite correct (relevant tickets are #9210 and > #10675 where there are similar examples). > Thanks Iavor, it was a propos those tickets I'm asking. See my comments on #10675 -- we'll have to agree to disagree on "not quite correct". (If you want to ban instance selecting on type equality, you'll make a lot of people grumpy.) My surprise here is why GHC doesn't complain about overlaps. (Separately from whether it's doing the right thing.) Here's another example [GHC 7.10] and here I agree the FunDep consistency is well broken, again needs UndecidableInstances: {-# LANGUAGE MultiParamTypeClasses, GADTs, FunctionalDependencies, FlexibleInstances, UndecidableInstances #-} class C a b | a -> b where foo :: a -> b -> String instance C Int Bool where foo _ _ = "Bool called" {- So far so good: no bare typevars in instance head; don't need UndecidableInstances for that -} instance (b ~ Char) => C Int b where foo _ _ = "b ~ Char called" I can't write that instance head `C Int Char`. GHC complains inconsistent with FunDep [quite correct]. But I can call `foo (5 :: Int) 'c'` ==> "b ~ Char called". If I call `foo (5 :: Int) undefined` ==> GHC complains of overlaps. [I would say fair enough too, except ...] If I change the instance to instance {-# OVERLAPPABLE #-} (b ~ Char) => C Int b where .. Then `foo (5 :: Int) undefined` ==> "Bool called" So GHC both uses the FunDep to improve the type, and uses the improvement to select an instance; and yet seems blind to FunDep inconsistencies in the instance decls. AntC > > > On Sun, Apr 16, 2017 at 12:13 AM, Anthony Clayden wrote: > > > > --ghc 7.10 or 8.0.1 > > > > {-# LANGUAGE DataKinds, KindSignatures, GADTs, > > MultiParamTypeClasses, > > FunctionalDependencies, FlexibleInstances, > > UndecidableInstances, > > NoOverlappingInstances #-} > > > > class TypeEq a a' (b :: Bool) | a a' -> b > > > > instance (b ~ True) => TypeEq a a b > > instance (b ~ False) => TypeEq a a' b > > > > Those two instance heads are nearly identical, surely > > they overlap? > > And for a type-level type equality test, they must be > > unifiable. > > But GHC doesn't complain. > > > > If I take off the FunDep, then GHC complains. > > > > AFAICT none of those extensions imply Overlaps, > > but to be sure I've put NoOverlapping. > > > > > > AntC > > _______________________________________________ > > Glasgow-haskell-users mailing list > > Glasgow-haskell-users at haskell.org > > > http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users > > > From simonpj at microsoft.com Tue Apr 18 10:31:30 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Tue, 18 Apr 2017 10:31:30 +0000 Subject: Why isn't this Overlapping? In-Reply-To: References: <58f31980.230.a7.10823@clear.net.nz> Message-ID: Moreover, as discussed in the user manual section, GHC doesn’t complain about overlapping instances at the instance decl, but rather where the instances are used. That’s why there is no overlap complaint here Simon From: Glasgow-haskell-users [mailto:glasgow-haskell-users-bounces at haskell.org] On Behalf Of Iavor Diatchki Sent: 18 April 2017 01:50 To: anthony_clayden at clear.net.nz Cc: GHC Users Mailing List Subject: Re: Why isn't this Overlapping? Hello, these two instances really should be rejected as they violate the FD of the class: we can derive `TypeEq a a True` using the first instance and `TypeEq a a False` using the second one. Unfortunately, the check that we are using to validate FDs when `UndecidableInstances` is on, is not quite correct (relevant tickets are #9210 and #10675 where there are similar examples). -Iavor On Sun, Apr 16, 2017 at 12:13 AM, Anthony Clayden > wrote: --ghc 7.10 or 8.0.1 {-# LANGUAGE DataKinds, KindSignatures, GADTs, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, UndecidableInstances, NoOverlappingInstances #-} class TypeEq a a' (b :: Bool) | a a' -> b instance (b ~ True) => TypeEq a a b instance (b ~ False) => TypeEq a a' b Those two instance heads are nearly identical, surely they overlap? And for a type-level type equality test, they must be unifiable. But GHC doesn't complain. If I take off the FunDep, then GHC complains. AFAICT none of those extensions imply Overlaps, but to be sure I've put NoOverlapping. AntC _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthony_clayden at clear.net.nz Tue Apr 18 11:24:53 2017 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Tue, 18 Apr 2017 23:24:53 +1200 Subject: Why isn't this Overlapping? Message-ID: <58f5f785.254.115d.2051@clear.net.nz> > On Tue Apr 18 10:31:30 UTC 2017, Simon Peyton Jones wrote: > > Moreover, as discussed in the user manual section, > GHC doesn’t complain about overlapping instances at the instance decl, > but rather where the instances are used. Thank you Simon, yes I knew that, so I'd written a usage (just didn't bother putting it in the message ): foo :: (TypeEq a a' b) => a -> a' -> String foo _ _ = "blah" x = foo 'c' "String" > That’s why there is no overlap complaint here I didn't get a complaint about `x`, contrary to what I expected. On trying again just now: y = foo 'c' 'd' GHC _does_ complain of overlap. I apologise for the distraction. AntC >> On 18 April 2017 01:50, Iavor Diatchki wrote >> these two instances really should be rejected as they violate the FD of the class: >> we can derive `TypeEq a a True` using the first instance and `TypeEq a a False` >> using the second one. Unfortunately, the check that we are using >> to validate FDs when `UndecidableInstances` is on, >> is not quite correct (relevant tickets are #9210 and #10675 >> where there are similar examples). >>> On Sun, Apr 16, 2017 at 12:13 AM, Anthony Clayden wrote: >>> --ghc 7.10 or 8.0.1 >>> >>> {-# LANGUAGE DataKinds, KindSignatures, GADTs, >>> MultiParamTypeClasses, >>> FunctionalDependencies, FlexibleInstances, >>> UndecidableInstances, NoOverlappingInstances #-} >>> class TypeEq a a' (b :: Bool) | a a' -> b >>> >>> instance (b ~ True) => TypeEq a a b >>> instance (b ~ False) => TypeEq a a' b >>> Those two instance heads are nearly identical, >>> surely they overlap? >> And for a type-level type equality test, >>> they must be unifiable. >>> But GHC doesn't complain. >>> >>> If I take off the FunDep, then GHC complains. >>> >>> AFAICT none of those extensions imply Overlaps, >>> but to be sure I've put NoOverlapping. From freelyn1980 at yahoo.com Fri Apr 21 02:54:18 2017 From: freelyn1980 at yahoo.com (Mark Robert Nixon) Date: Thu, 20 Apr 2017 19:54:18 -0700 Subject: Option for Combinator Graphs in GHC? Message-ID: <58F9745A.4080607@yahoo.com> Does the GHC compiler generate combinator terms/graphs of Haskell programs? Combinator terms are often derived during compilation for purposes of optimization by way of normal order graph reduction. But does GHC output, e.g., as an option, a given Haskell program's entire combinator term/graph? Very respectfully, Mark R. Nixon From choener at bioinf.uni-leipzig.de Thu Apr 27 21:30:33 2017 From: choener at bioinf.uni-leipzig.de (Christian =?iso-8859-1?Q?H=F6ner?= zu Siederdissen) Date: Thu, 27 Apr 2017 23:30:33 +0200 Subject: join points and stream fusion? Message-ID: <20170427213033.GA20374@workstation.Speedport_W_724V_Typ_A_05011603_05_020> Dear all, have some of you experienced bad code generation in ghc-8.2-rc1 in combination with stream fusion from the vector package? Unfortunately, the problem occurs with ADPfusion code which means no simple example, but I'm asking because of the following core below. In ghc-8.0 I have nice core, here however constructor specialization has not happened, neither with the Left/Right nor with the SPEC. The running time in ghc-8.0 is 2.6 seconds, in rc-1 10.9 seconds. Best, Christian joinrec { $wfoldlM'_loop2_s1uf4 $wfoldlM'_loop2_s1uf4 w_s1ueX ww1_s1uf2 w1_s1ueZ = case w_s1ueX of { __DEFAULT -> case w1_s1ueZ of { Left sa_au90 -> case sa_au90 of { Left sa1_XuNq -> case sa1_XuNq of { Left sa2_XuNe -> case sa2_XuNe of { SL s2_alTo k_alTp -> case k_alTp of { __DEFAULT -> jump $wfoldlM'_loop2_s1uf4 SPEC ww1_s1uf2 lvl211_s1IDG; 1# -> jump $wfoldlM'_loop2_s1uf4 SPEC ww1_s1uf2 (Left (Left (Left (SR s2_alTo)))) From choener at bioinf.uni-leipzig.de Thu Apr 27 22:09:33 2017 From: choener at bioinf.uni-leipzig.de (Christian =?iso-8859-1?Q?H=F6ner?= zu Siederdissen) Date: Fri, 28 Apr 2017 00:09:33 +0200 Subject: join points and stream fusion? In-Reply-To: <20170427213033.GA20374@workstation.Speedport_W_724V_Typ_A_05011603_05_020> References: <20170427213033.GA20374@workstation.Speedport_W_724V_Typ_A_05011603_05_020> Message-ID: <20170427220933.GA28734@workstation.Speedport_W_724V_Typ_A_05011603_05_020> As an addendum, I think what causes this is the following. I have a function (|||) xs ys = \lu ij -> xs lu ij Stream.++ ys lu ij xs and ys are two stream-generating functions and (Stream.++) concatenates streams. In the example I have four streams: xs_1 ||| xs_2 ||| xs_3 ||| xs_4 However, here I end up with a join point on (++). Further evidenced (?) by the curious occurance of s1uf4 ... (Left (Left (Left ...))). Additional calls then are (Left (Left (Right ))) and so on. It would be really good if (|||) is *not* turned into a join point. Best, Christian * Christian Höner zu Siederdissen [27.04.2017 23:30]: > Dear all, > > have some of you experienced bad code generation in ghc-8.2-rc1 in > combination with stream fusion from the vector package? > > Unfortunately, the problem occurs with ADPfusion code which means no > simple example, but I'm asking because of the following core below. > > In ghc-8.0 I have nice core, here however constructor specialization has > not happened, neither with the Left/Right nor with the SPEC. > > The running time in ghc-8.0 is 2.6 seconds, in rc-1 10.9 seconds. > > Best, > Christian > > joinrec { > $wfoldlM'_loop2_s1uf4 > $wfoldlM'_loop2_s1uf4 w_s1ueX ww1_s1uf2 w1_s1ueZ > = case w_s1ueX of { __DEFAULT -> > case w1_s1ueZ of { > Left sa_au90 -> > case sa_au90 of { > Left sa1_XuNq -> > case sa1_XuNq of { > Left sa2_XuNe -> > case sa2_XuNe of { > SL s2_alTo k_alTp -> > case k_alTp of { > __DEFAULT -> > jump $wfoldlM'_loop2_s1uf4 > SPEC ww1_s1uf2 lvl211_s1IDG; > 1# -> > jump $wfoldlM'_loop2_s1uf4 > SPEC ww1_s1uf2 (Left (Left (Left (SR s2_alTo)))) > > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users From simonpj at microsoft.com Thu Apr 27 22:35:34 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Thu, 27 Apr 2017 22:35:34 +0000 Subject: join points and stream fusion? In-Reply-To: <20170427220933.GA28734@workstation.Speedport_W_724V_Typ_A_05011603_05_020> References: <20170427213033.GA20374@workstation.Speedport_W_724V_Typ_A_05011603_05_020> <20170427220933.GA28734@workstation.Speedport_W_724V_Typ_A_05011603_05_020> Message-ID: I'm afraid I don't have enough context to understand this thread. Could you offer a concrete example (as small as possible), and explain how to reproduce the problem you are seeing. Don't forget to give the compiler version you are using, and any libraries you depend on (as few as poss). Is this a regression? I.e. did some earlier version of GHC do better on the exact same code? Maybe open a Trac ticket. Thanks Simon | -----Original Message----- | From: Glasgow-haskell-users [mailto:glasgow-haskell-users- | bounces at haskell.org] On Behalf Of Christian Höner zu Siederdissen | Sent: 27 April 2017 23:10 | To: glasgow-haskell-users at haskell.org | Subject: Re: join points and stream fusion? | | As an addendum, | | I think what causes this is the following. I have a function | (|||) xs ys = \lu ij -> xs lu ij Stream.++ ys lu ij xs and ys are two | stream-generating functions and (Stream.++) concatenates streams. In the | example I have four streams: | xs_1 ||| xs_2 ||| xs_3 ||| xs_4 | | However, here I end up with a join point on (++). Further evidenced (?) | by the curious occurance of s1uf4 ... (Left (Left (Left ...))). | Additional calls then are (Left (Left (Right ))) and so on. | | It would be really good if (|||) is *not* turned into a join point. | | Best, | Christian | | * Christian Höner zu Siederdissen | [27.04.2017 23:30]: | > Dear all, | > | > have some of you experienced bad code generation in ghc-8.2-rc1 in | > combination with stream fusion from the vector package? | > | > Unfortunately, the problem occurs with ADPfusion code which means no | > simple example, but I'm asking because of the following core below. | > | > In ghc-8.0 I have nice core, here however constructor specialization | > has not happened, neither with the Left/Right nor with the SPEC. | > | > The running time in ghc-8.0 is 2.6 seconds, in rc-1 10.9 seconds. | > | > Best, | > Christian | > | > joinrec { | > $wfoldlM'_loop2_s1uf4 | > $wfoldlM'_loop2_s1uf4 w_s1ueX ww1_s1uf2 w1_s1ueZ | > = case w_s1ueX of { __DEFAULT -> | > case w1_s1ueZ of { | > Left sa_au90 -> | > case sa_au90 of { | > Left sa1_XuNq -> | > case sa1_XuNq of { | > Left sa2_XuNe -> | > case sa2_XuNe of { | > SL s2_alTo k_alTp -> | > case k_alTp of { | > __DEFAULT -> | > jump $wfoldlM'_loop2_s1uf4 | > SPEC ww1_s1uf2 lvl211_s1IDG; | > 1# -> | > jump $wfoldlM'_loop2_s1uf4 | > SPEC ww1_s1uf2 (Left (Left (Left (SR | > s2_alTo)))) | > | > _______________________________________________ | > Glasgow-haskell-users mailing list | > Glasgow-haskell-users at haskell.org | > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.h | > askell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell-users&data | > =02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a08d48dba157d% | > 7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636289277756070800&sdata= | > DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0 | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users at haskell.org | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.hask | ell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell- | users&data=02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a08d48d | ba157d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636289277756070800&sd | ata=DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0 From choener at bioinf.uni-leipzig.de Thu Apr 27 23:13:50 2017 From: choener at bioinf.uni-leipzig.de (Christian =?iso-8859-1?Q?H=F6ner?= zu Siederdissen) Date: Fri, 28 Apr 2017 01:13:50 +0200 Subject: join points and stream fusion? In-Reply-To: References: <20170427213033.GA20374@workstation.Speedport_W_724V_Typ_A_05011603_05_020> <20170427220933.GA28734@workstation.Speedport_W_724V_Typ_A_05011603_05_020> Message-ID: <20170427231350.GA5061@workstation.Speedport_W_724V_Typ_A_05011603_05_020> Sorry, with the addendum, I have constructed a very small example: https://ghc.haskell.org/trac/ghc/ticket/13623 This is new with ghc 8.2-rc1 and does not show up earlier. Viele Gruesse, Christian * Simon Peyton Jones [28.04.2017 00:35]: > I'm afraid I don't have enough context to understand this thread. > > Could you offer a concrete example (as small as possible), and explain how to reproduce the problem you are seeing. Don't forget to give the compiler version you are using, and any libraries you depend on (as few as poss). > > Is this a regression? I.e. did some earlier version of GHC do better on the exact same code? > > Maybe open a Trac ticket. > > Thanks > > Simon > > | -----Original Message----- > | From: Glasgow-haskell-users [mailto:glasgow-haskell-users- > | bounces at haskell.org] On Behalf Of Christian Höner zu Siederdissen > | Sent: 27 April 2017 23:10 > | To: glasgow-haskell-users at haskell.org > | Subject: Re: join points and stream fusion? > | > | As an addendum, > | > | I think what causes this is the following. I have a function > | (|||) xs ys = \lu ij -> xs lu ij Stream.++ ys lu ij xs and ys are two > | stream-generating functions and (Stream.++) concatenates streams. In the > | example I have four streams: > | xs_1 ||| xs_2 ||| xs_3 ||| xs_4 > | > | However, here I end up with a join point on (++). Further evidenced (?) > | by the curious occurance of s1uf4 ... (Left (Left (Left ...))). > | Additional calls then are (Left (Left (Right ))) and so on. > | > | It would be really good if (|||) is *not* turned into a join point. > | > | Best, > | Christian > | > | * Christian Höner zu Siederdissen > | [27.04.2017 23:30]: > | > Dear all, > | > > | > have some of you experienced bad code generation in ghc-8.2-rc1 in > | > combination with stream fusion from the vector package? > | > > | > Unfortunately, the problem occurs with ADPfusion code which means no > | > simple example, but I'm asking because of the following core below. > | > > | > In ghc-8.0 I have nice core, here however constructor specialization > | > has not happened, neither with the Left/Right nor with the SPEC. > | > > | > The running time in ghc-8.0 is 2.6 seconds, in rc-1 10.9 seconds. > | > > | > Best, > | > Christian > | > > | > joinrec { > | > $wfoldlM'_loop2_s1uf4 > | > $wfoldlM'_loop2_s1uf4 w_s1ueX ww1_s1uf2 w1_s1ueZ > | > = case w_s1ueX of { __DEFAULT -> > | > case w1_s1ueZ of { > | > Left sa_au90 -> > | > case sa_au90 of { > | > Left sa1_XuNq -> > | > case sa1_XuNq of { > | > Left sa2_XuNe -> > | > case sa2_XuNe of { > | > SL s2_alTo k_alTp -> > | > case k_alTp of { > | > __DEFAULT -> > | > jump $wfoldlM'_loop2_s1uf4 > | > SPEC ww1_s1uf2 lvl211_s1IDG; > | > 1# -> > | > jump $wfoldlM'_loop2_s1uf4 > | > SPEC ww1_s1uf2 (Left (Left (Left (SR > | > s2_alTo)))) > | > > | > _______________________________________________ > | > Glasgow-haskell-users mailing list > | > Glasgow-haskell-users at haskell.org > | > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.h > | > askell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell-users&data > | > =02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a08d48dba157d% > | > 7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636289277756070800&sdata= > | > DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0 > | _______________________________________________ > | Glasgow-haskell-users mailing list > | Glasgow-haskell-users at haskell.org > | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.hask > | ell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell- > | users&data=02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a08d48d > | ba157d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636289277756070800&sd > | ata=DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0 From anthony_clayden at clear.net.nz Fri Apr 28 00:14:49 2017 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Fri, 28 Apr 2017 12:14:49 +1200 Subject: Superclass Equality constraints cp FunDeps Message-ID: <59028979.1b9.22e7.14477@clear.net.nz> The docos say [User Guide 10.14.1. on Equality Constraints] > Equality constraints can also appear in class and instance contexts. > The former enable a simple translation of programs using > functional dependencies into programs using family synonyms instead. http://downloads.haskell.org/~ghc/8.0.2/docs/html/users_guide/glasgow_exts.html#equality-constraints And the forms of constraint seem quite sophisticated. I was surprised (pleased) I could do this: {-# LANGUAGE MultiParamTypeClasses, TypeFamilies, FlexibleInstances #-} type family F a class (F a ~ (b, c) ) => C a b c where -- (b c) !! f1 :: a -> b f2 :: a -> c Uses of `f1` happily improve the type for `b`. Uses of `f2` happily improve the type for `c`. But I didn't declare a Functional Dependency. (It seems to do no harm if I add `| a -> b c`.) GHC's behaviour seems stronger than a "simple translation". It seems entirely equivalent to a FunDep. Or is there something I'm missing? (I could have overlapping instances, but only providing the equations for type family `F` are confluent.) Are there restrictions on the form of Equality Constraints to get them to behave as FunDeps? (It's not merely a bare typevar on one side.) AntC From simonpj at microsoft.com Fri Apr 28 07:29:44 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 28 Apr 2017 07:29:44 +0000 Subject: join points and stream fusion? In-Reply-To: <20170427231350.GA5061@workstation.Speedport_W_724V_Typ_A_05011603_05_020> References: <20170427213033.GA20374@workstation.Speedport_W_724V_Typ_A_05011603_05_020> <20170427220933.GA28734@workstation.Speedport_W_724V_Typ_A_05011603_05_020> <20170427231350.GA5061@workstation.Speedport_W_724V_Typ_A_05011603_05_020> Message-ID: Thank you! | -----Original Message----- | From: Christian Höner zu Siederdissen [mailto:choener at bioinf.uni- | leipzig.de] | Sent: 28 April 2017 00:14 | To: Simon Peyton Jones | Cc: glasgow-haskell-users at haskell.org | Subject: Re: join points and stream fusion? | | Sorry, | | with the addendum, I have constructed a very small example: | https://ghc.haskell.org/trac/ghc/ticket/13623 | | This is new with ghc 8.2-rc1 and does not show up earlier. | | Viele Gruesse, | Christian | | * Simon Peyton Jones [28.04.2017 00:35]: | > I'm afraid I don't have enough context to understand this thread. | > | > Could you offer a concrete example (as small as possible), and | explain how to reproduce the problem you are seeing. Don't forget to | give the compiler version you are using, and any libraries you depend | on (as few as poss). | > | > Is this a regression? I.e. did some earlier version of GHC do better | on the exact same code? | > | > Maybe open a Trac ticket. | > | > Thanks | > | > Simon | > | > | -----Original Message----- | > | From: Glasgow-haskell-users [mailto:glasgow-haskell-users- | > | bounces at haskell.org] On Behalf Of Christian Höner zu Siederdissen | > | Sent: 27 April 2017 23:10 | > | To: glasgow-haskell-users at haskell.org | > | Subject: Re: join points and stream fusion? | > | | > | As an addendum, | > | | > | I think what causes this is the following. I have a function | > | (|||) xs ys = \lu ij -> xs lu ij Stream.++ ys lu ij xs and ys are | > | two stream-generating functions and (Stream.++) concatenates | > | streams. In the example I have four streams: | > | xs_1 ||| xs_2 ||| xs_3 ||| xs_4 | > | | > | However, here I end up with a join point on (++). Further | evidenced | > | (?) by the curious occurance of s1uf4 ... (Left (Left (Left | ...))). | > | Additional calls then are (Left (Left (Right ))) and so on. | > | | > | It would be really good if (|||) is *not* turned into a join | point. | > | | > | Best, | > | Christian | > | | > | * Christian Höner zu Siederdissen | > | [27.04.2017 23:30]: | > | > Dear all, | > | > | > | > have some of you experienced bad code generation in ghc-8.2-rc1 | in | > | > combination with stream fusion from the vector package? | > | > | > | > Unfortunately, the problem occurs with ADPfusion code which | means | > | > no simple example, but I'm asking because of the following core | below. | > | > | > | > In ghc-8.0 I have nice core, here however constructor | > | > specialization has not happened, neither with the Left/Right nor | with the SPEC. | > | > | > | > The running time in ghc-8.0 is 2.6 seconds, in rc-1 10.9 | seconds. | > | > | > | > Best, | > | > Christian | > | > | > | > joinrec { | > | > $wfoldlM'_loop2_s1uf4 | > | > $wfoldlM'_loop2_s1uf4 w_s1ueX ww1_s1uf2 w1_s1ueZ | > | > = case w_s1ueX of { __DEFAULT -> | > | > case w1_s1ueZ of { | > | > Left sa_au90 -> | > | > case sa_au90 of { | > | > Left sa1_XuNq -> | > | > case sa1_XuNq of { | > | > Left sa2_XuNe -> | > | > case sa2_XuNe of { | > | > SL s2_alTo k_alTp -> | > | > case k_alTp of { | > | > __DEFAULT -> | > | > jump $wfoldlM'_loop2_s1uf4 | > | > SPEC ww1_s1uf2 lvl211_s1IDG; | > | > 1# -> | > | > jump $wfoldlM'_loop2_s1uf4 | > | > SPEC ww1_s1uf2 (Left (Left (Left (SR | > | > s2_alTo)))) | > | > | > | > _______________________________________________ | > | > Glasgow-haskell-users mailing list | > | > Glasgow-haskell-users at haskell.org | > | > | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fma | > | > il.h | > | > askell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell- | users& | > | > data | > | > | =02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a08d48dba1 | > | > 57d% | > | > | 7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636289277756070800&sd | > | > ata= | > | > DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0 | > | _______________________________________________ | > | Glasgow-haskell-users mailing list | > | Glasgow-haskell-users at haskell.org | > | | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail | > | .hask | > | ell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell- | > | | users&data=02%7C01%7Csimonpj%40microsoft.com%7Cd36333a2218f4c513f5a0 | > | 8d48d | > | | ba157d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6362892777560708 | > | 00&sd | > | ata=DGsBNjZPuDbpEONyJBOy7BDimCELGHNM1trxjCP5luk%3D&reserved=0 From rae at cs.brynmawr.edu Sat Apr 29 02:23:10 2017 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Fri, 28 Apr 2017 22:23:10 -0400 Subject: Superclass Equality constraints cp FunDeps In-Reply-To: <59028979.1b9.22e7.14477@clear.net.nz> References: <59028979.1b9.22e7.14477@clear.net.nz> Message-ID: I'm not quite sure what a restriction on (~) might be, but (~) is effectively declared as > class a ~ b | a -> b, b -> a So I agree with your observations. Richard > On Apr 27, 2017, at 8:14 PM, Anthony Clayden wrote: > > The docos say [User Guide 10.14.1. on Equality Constraints] > >> Equality constraints can also appear in class and instance > contexts. >> The former enable a simple translation of programs using >> functional dependencies into programs using family > synonyms instead. > http://downloads.haskell.org/~ghc/8.0.2/docs/html/users_guide/glasgow_exts.html#equality-constraints > > And the forms of constraint seem quite sophisticated. > I was surprised (pleased) I could do this: > > {-# LANGUAGE MultiParamTypeClasses, TypeFamilies, > FlexibleInstances #-} > > type family F a > > class (F a ~ (b, c) ) => C a b c where -- (b c) !! > f1 :: a -> b > f2 :: a -> c > > Uses of `f1` happily improve the type for `b`. > Uses of `f2` happily improve the type for `c`. > > But I didn't declare a Functional Dependency. > (It seems to do no harm if I add `| a -> b c`.) > > GHC's behaviour seems stronger than a "simple translation". > It seems entirely equivalent to a FunDep. > > Or is there something I'm missing? > (I could have overlapping instances, > but only providing the equations for > type family `F` are confluent.) > > Are there restrictions on the form of Equality Constraints > to get them to behave as FunDeps? > (It's not merely a bare typevar on one side.) > > AntC > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users From anthony_clayden at clear.net.nz Sat Apr 29 05:55:14 2017 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Sat, 29 Apr 2017 17:55:14 +1200 Subject: Superclass Equality constraints cp FunDeps Message-ID: <59042ac2.1c4.39a5.32729@clear.net.nz> > On Sat Apr 29 02:23:10 UTC 2017, Richard Eisenberg wrote: > > I'm not quite sure what a restriction on (~) might be, Thanks Richard, I was thinking that FunDeps are restricted to bare type vars. I can't write either of these: > class C a b c | a -> (b, c) -- per my O.P. (~) > class C a b c | a -> (b c) So it's the one place where type vars `b c` like this: > class C a b c | a -> b c doesn't mean applying `b` to `c`. > but (~) is effectively declared as > > > class a ~ b | a -> b, b -> a > > So I agree with your observations. Aha! So I could equivalently go: > class EqC a b | a -> b, b -> a > > class (EqC a (b, c)) => C a b c where ... > -- needs FlexibleInstances And that does indeed work equivalently to the (~). Again, I haven't put FunDeps on class `C`. So should I reasonably have known that a superclass constraint with FunDeps on the superclass induces FunDeps on the sub-class without explicitly needing to declare so? (I'm not complaining, more surprised/impressed.) AntC > > On Apr 27, 2017, at 8:14 PM, Anthony Clayden > > wrote: > > The docos say [User Guide 10.14.1. on Equality > > Constraints] > >> Equality constraints can also appear in class and > > instance contexts. > >> The former enable a simple translation of programs > >> using functional dependencies into programs using > > family synonyms instead. > > > http://downloads.haskell.org/~ghc/8.0.2/docs/html/users_guide/glasgow_exts.html#equality-constraints > > > > And the forms of constraint seem quite sophisticated. > > I was surprised (pleased) I could do this: > > > > {-# LANGUAGE MultiParamTypeClasses, TypeFamilies, > > FlexibleInstances #-} > > > > type family F a > > > > class (F a ~ (b, c) ) => C a b c where -- (b c) > > !! f1 :: a -> b > > f2 :: a -> c > > > > Uses of `f1` happily improve the type for `b`. > > Uses of `f2` happily improve the type for `c`. > > > > But I didn't declare a Functional Dependency. > > (It seems to do no harm if I add `| a -> b c`.) > > > > GHC's behaviour seems stronger than a "simple > > translation". It seems entirely equivalent to a FunDep. > > > > Or is there something I'm missing? > > (I could have overlapping instances, > > but only providing the equations for > > type family `F` are confluent.) > > > > Are there restrictions on the form of Equality > > Constraints to get them to behave as FunDeps? > > (It's not merely a bare typevar on one side.) > > > > AntC > > _______________________________________________ > > Glasgow-haskell-users mailing list > > Glasgow-haskell-users at haskell.org > > > http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users > From anthony_clayden at clear.net.nz Sun Apr 30 10:37:43 2017 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Sun, 30 Apr 2017 22:37:43 +1200 Subject: Superclass Equality constraints cp FunDeps Message-ID: <5905be77.3e0.5241.11908@clear.net.nz> > On at Apr 29 05:55:14 UTC 2017, Anthony Clayden wrote: > ... > So should I reasonably have known that > a superclass constraint > with FunDeps on the superclass > induces FunDeps on the sub-class > without explicitly needing to declare so? > > (I'm not complaining, more surprised/impressed.) > >From experimenting, FunDeps seem to come through from a superclass of a superclass of a superclass of the class. This from David Feuer says http://stackoverflow.com/questions/35252562/find-an-element-in-an-hlist/35260970#35260970 "superclass context is critical .... GHC always commits to an instance before checking the instance constraints, but it doesn't even try to find an instance until after solving the superclass constraints. So we need to use the superclass constraint to fix ..." Presumably that's the mechanism that induces FunDeps from supeclass constraints. Is that behaviour officially documented somewhere? (I remember when Type Families and (~) Constraints were first released, they weren't available superclass. Then there were a couple of releases you could put superclass constraints, but they weren't effective.) AntC From rae at cs.brynmawr.edu Sun Apr 30 19:31:22 2017 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Sun, 30 Apr 2017 15:31:22 -0400 Subject: Superclass Equality constraints cp FunDeps In-Reply-To: <5905be77.3e0.5241.11908@clear.net.nz> References: <5905be77.3e0.5241.11908@clear.net.nz> Message-ID: > On Apr 30, 2017, at 6:37 AM, Anthony Clayden wrote: > > Is that behaviour officially documented somewhere? Not that I can find. Documentation on functional dependencies is somewhat lacking. This may be because fundeps has received little love of late. Otherwise, I agree with your notes. Documentation patches are warmly accepted! Richard From allbery.b at gmail.com Sun Apr 30 19:35:17 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 30 Apr 2017 15:35:17 -0400 Subject: Superclass Equality constraints cp FunDeps In-Reply-To: References: <5905be77.3e0.5241.11908@clear.net.nz> Message-ID: On Sun, Apr 30, 2017 at 3:31 PM, Richard Eisenberg wrote: > > > On Apr 30, 2017, at 6:37 AM, Anthony Clayden < > anthony_clayden at clear.net.nz> wrote: > > Is that behaviour officially documented somewhere? > > Not that I can find. Documentation on functional dependencies is somewhat > lacking. This may be because fundeps has received little love of late. > Not just fundeps; the originally cited behavior of equality constraints could also stand to be documented. In fact, I'd noticed a few shortcomings in equality constraint documentation --- including the question of, are they always enabled, or are there particular extensions that enable them? And if so, should they also have their own extension that becomes implied by those other extensions? So it's not even just documentation. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From rae at cs.brynmawr.edu Sun Apr 30 19:45:34 2017 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Sun, 30 Apr 2017 15:45:34 -0400 Subject: Superclass Equality constraints cp FunDeps In-Reply-To: References: <5905be77.3e0.5241.11908@clear.net.nz> Message-ID: <3F3B7A4A-CEAF-4F91-ADFE-B8938B53B6F6@cs.brynmawr.edu> Documentation is just about always suboptimal -- but the best people to suggest concrete improvements are those who were confused to begin with. So, by all means, submit patches! Some relevant discussion on this point is on https://ghc.haskell.org/trac/ghc/ticket/10431 Currently, there is no extension for ~. It's enabled either by GADTs or TypeFamilies. I agree that this is not the best design, and the ticket above is a plan to fix it. Probably wouldn't take much more than someone with the will to make the changes! Richard > On Apr 30, 2017, at 3:35 PM, Brandon Allbery wrote: > > On Sun, Apr 30, 2017 at 3:31 PM, Richard Eisenberg > wrote: > > On Apr 30, 2017, at 6:37 AM, Anthony Clayden > wrote: > > Is that behaviour officially documented somewhere? > > Not that I can find. Documentation on functional dependencies is somewhat lacking. This may be because fundeps has received little love of late. > > Not just fundeps; the originally cited behavior of equality constraints could also stand to be documented. In fact, I'd noticed a few shortcomings in equality constraint documentation --- including the question of, are they always enabled, or are there particular extensions that enable them? And if so, should they also have their own extension that becomes implied by those other extensions? So it's not even just documentation. > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: