From ben at smart-cactus.org Wed Feb 1 00:09:50 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Tue, 31 Jan 2017 19:09:50 -0500 Subject: Join points revised In-Reply-To: <2ce83529-5c80-ffe8-9b6f-76fad0070ef9@cs.uoregon.edu> References: <2ce83529-5c80-ffe8-9b6f-76fad0070ef9@cs.uoregon.edu> Message-ID: <87tw8ekbzl.fsf@ben-laptop.smart-cactus.org> Luke Maurer writes: > Revised version of the join points patch is up: > > https://phabricator.haskell.org/D2853 > > Hoping to commit ASAP. Thanks all! > I have a few further review comments that I'm about to submit. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From rae at cs.brynmawr.edu Wed Feb 1 01:19:08 2017 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Tue, 31 Jan 2017 20:19:08 -0500 Subject: D2038: [WIP] TysPrim: Generalize kind of (->) In-Reply-To: <50EB9209-1A0F-4DA8-BA06-586DFD3C68DE@cs.brynmawr.edu> References: <20170131125046.126142.13535.3FCE5C50@phabricator.haskell.org> <50EB9209-1A0F-4DA8-BA06-586DFD3C68DE@cs.brynmawr.edu> Message-ID: <9CF741E7-5985-4267-8ECA-5E5E7E870F57@cs.brynmawr.edu> I had another thought on my drive home: why do we need to sort out Constraint v Type for 8.2? I have the patch, and it's essentially all set. But it weakens equality in a way that's troublesome for D2038 and introduces heterogeneous axioms, which are strange, ill-understood beasts. And I don't think we need it. On the other hand, D2038 is essential for the new Typeable, because it's the only way we can give (->) a proper kind. So, I propose: 1. Hold off on Constraint v Type until after the branch is cut. 2. Do what we can to mitigate Constraint v Type confusion vis-a-vis Typeable. (For example, make sure that there aren't Typeable instances for both, and have TcTypeable provide the Type instance whenever the Constraint instance is requested.) 3. Advertise that GHC will be a little confused on this point, and that, as far as Typeable is concerned, Constraint and Type are synonymous. 4. On the Constraint v Type patch, restore the full power of KindCo. This makes the type system broken, but I don't think the sky will come crashing down. 5. Merge Constraint v Type after the branch is cut. This will make GHC HEAD unsound in a new way, but no one will notice unless they try. 6. File a priority-highest bug to eliminate newtype-classes (which beget heterogeneous axioms in the Constraint/=Type world). 7. Finish the first-class reification design and implement before 8.4. 8. Remove newtype-classes, thus eliminating heterogeneous axioms and the unsoundness mentioned in (5). This route seems, to me, far preferable to monkeying around with roles and such in ways that we have no assurances are sound. (Remember, roles are there to keep the type system safe and sound. They were not added simply to annoy everyone, though they accomplish that goal quite nicely.) What do we think? It's not ideal, but I think it's the best of suboptimal alternatives. And it's no worse than 8.0 w.r.t. Constraint v Type. Richard > On Jan 31, 2017, at 5:56 PM, Richard Eisenberg wrote: > >> >> On Jan 31, 2017, at 5:41 PM, Simon Peyton Jones > wrote: >> >> But that can only happen if `(->)` has suitable roles. >> What if it doesn’t? > > The “correct” roles for (->) of the kind you gave is `nominal nominal nominal nominal representational representational`. That is, the dependent arguments are nominal, and the others are representational. This is because all kind-level coercions are nominal. You seem to be suggesting giving (->) different roles. I honestly don’t know what that would mean -- normally, GHC prevents you from specifying a weaker role than it would infer. It smells pretty foul to me, but I can’t quite put my finger on what would go wrong at the moment. > >> >> What if we just had an axiom >> >> axArrow v :: (->) Vanilla v >> ~R (->) Constraint v > > I think we’d also need one for results... but maybe not. > >> >> or something like that. Then we get >> >> [W] g : (->) Vanilla Vanilla Ptr Ptr (C a) Int >> ~R (->) Constraint Vanilla Ptr Ptr a Int >> >> We decompose partly and solve thus >> >> g = (axArrow Vanilla) axC > > And this works only if we weaken (->)’s roles. > > This whole road just feels like the wrong way, as soon as we started contemplating a heterogeneous axiom, which are ruled out in the literature, even when we have kind equalities. > > I think the Right Answer is to get rid of newtype-classes & fix reify, and I’m worried that anything short of that will fail catastrophically at some point. Otherwise, it’s patches on top of patches. > > I don’t think there is disagreement here, but there is the question about what to do for 8.2.... and unless we’re ready to roll out the new reify, I think the best course of action is to delay the new Typeable and all this Constraint v Type stuff until 8.4. (The new levity polymorphism stuff already committed is hunky-dory.) > > Richard > >> >> >> Simon >>   <> >> From: noreply at phabricator.haskell.org [mailto:noreply at phabricator.haskell.org ] >> Sent: 31 January 2017 12:51 >> To: Simon Peyton Jones > >> Subject: [Differential] [Commented On] D2038: [WIP] TysPrim: Generalize kind of (->) >> >> goldfire added a comment. >> >> View Revision >> >> >> In D2038#89360 , @simonpj wrote: >> >> To avoid being able to extract ContraintRep ~R LiftedPtrRep we decided to weaken one of the coercion constructors, the one that gets a kind coercion from a type coercion. We don't need it, and it's awkward here. >> >> The problem is that we need it with this patch. I was able to weaken this coercion constructor (KindCo) in my patchD3023 , but this patch uses it in a fundamental way that we can't get around. To wit: >> >> class C a where >> meth :: a >> >> axC :: (C a :: Constraint) ~R (a :: Type) >> Now, we wish to cast C a -> a to a -> a.. This cast will look like (->) ?? axC . What goes in the??? It's got to be something involving KindCo axC, which is disallowed as per our earlier decision. Therein lies the problem. >> >> As for reify: Yes, I'm agreed with that email. But is that implemented yet? Is a design settled on? I don't see a ghc-proposal. Are we wiling to take a dependency on that work in order to get this done? >> >> To be clear, my chief worry isn't that these problems cannot be solved by any means -- I'm just worried about the timing of this all and our desire to get 8.2 out the door. >> >> >> REPOSITORY >> rGHC Glasgow Haskell Compiler >> >> REVISION DETAIL >> https://phabricator.haskell.org/D2038 >> >> EMAIL PREFERENCES >> https://phabricator.haskell.org/settings/panel/emailpreferences/ >> >> To: bgamari, goldfire, austin >> Cc: simonpj, RyanGlScott, thomie > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at smart-cactus.org Wed Feb 1 01:56:10 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Tue, 31 Jan 2017 20:56:10 -0500 Subject: D2038: [WIP] TysPrim: Generalize kind of (->) In-Reply-To: <9CF741E7-5985-4267-8ECA-5E5E7E870F57@cs.brynmawr.edu> References: <20170131125046.126142.13535.3FCE5C50@phabricator.haskell.org> <50EB9209-1A0F-4DA8-BA06-586DFD3C68DE@cs.brynmawr.edu> <9CF741E7-5985-4267-8ECA-5E5E7E870F57@cs.brynmawr.edu> Message-ID: <87o9ymk72d.fsf@ben-laptop.smart-cactus.org> Richard Eisenberg writes: > I had another thought on my drive home: why do we need to sort out > Constraint v Type for 8.2? I have the patch, and it's essentially all > set. But it weakens equality in a way that's troublesome for D2038 and > introduces heterogeneous axioms, which are strange, ill-understood > beasts. And I don't think we need it. > > On the other hand, D2038 is essential for the new Typeable, because > it's the only way we can give (->) a proper kind. > Snipped well-considered plan for proceeding. > This route seems, to me, far preferable to monkeying around with roles > and such in ways that we have no assurances are sound. (Remember, > roles are there to keep the type system safe and sound. They were not > added simply to annoy everyone, though they accomplish that goal quite > nicely.) > :) > What do we think? It's not ideal, but I think it's the best of > suboptimal alternatives. And it's no worse than 8.0 w.r.t. Constraint > v Type. > This sounds quite reasonable to me. I will need to fix up the remaining issues in D2038 surrounding Constraint, but I think this shouldn't be so difficult. The only reason I haven't tried already was my belief that Constraint/Type would be resolved soon. I'll try to push another version of D2038 tonight. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From simonpj at microsoft.com Wed Feb 1 08:31:06 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Wed, 1 Feb 2017 08:31:06 +0000 Subject: Join points revised In-Reply-To: <2ce83529-5c80-ffe8-9b6f-76fad0070ef9@cs.uoregon.edu> References: <2ce83529-5c80-ffe8-9b6f-76fad0070ef9@cs.uoregon.edu> Message-ID: GHC devs: this join-point patch has been long in gestation, and I've reviewed it several times with Luke. I think it's ready to go, but if you have time to take a look, please do. The Wiki page https://ghc.haskell.org/trac/ghc/wiki/SequentCore Simon | -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Luke | Maurer | Sent: 31 January 2017 23:48 | To: ghc-devs | Subject: Join points revised | | Revised version of the join points patch is up: | | https://phabricator.haskell.org/D2853 | | Hoping to commit ASAP. Thanks all! | | - Luke Maurer | University of Oregon | maurerl at cs.uoregon.edu | | _______________________________________________ | ghc-devs mailing list | ghc-devs at haskell.org | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haskell | .org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | devs&data=02%7C01%7Csimonpj%40microsoft.com%7C7917aef78e504851e95808d44a33f5 | e7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636215034407397385&sdata=3sy | y8B9rlJ0WDAuQXnzy83mBRRU%2BdmpczYezCmNrO%2B8%3D&reserved=0 From simonpj at microsoft.com Wed Feb 1 08:34:48 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Wed, 1 Feb 2017 08:34:48 +0000 Subject: D2038: [WIP] TysPrim: Generalize kind of (->) In-Reply-To: <9CF741E7-5985-4267-8ECA-5E5E7E870F57@cs.brynmawr.edu> References: <20170131125046.126142.13535.3FCE5C50@phabricator.haskell.org> <50EB9209-1A0F-4DA8-BA06-586DFD3C68DE@cs.brynmawr.edu> <9CF741E7-5985-4267-8ECA-5E5E7E870F57@cs.brynmawr.edu> Message-ID: 1. Hold off on Constraint v Type until after the branch is cut. Good idea. I think that’d be OK. It’s no worse than the status quo. I’m MUCH more keen to get the TypeRep stuff in, because it has been in the works for nearly two years!! So let’s do 1-3 pronto. Who is acting there. Just Ben? Or are there bits Richard needs to help with? As to 4 onwards I still want to talk to you about roles. Simon From: Richard Eisenberg [mailto:rae at cs.brynmawr.edu] Sent: 01 February 2017 01:19 To: Simon Peyton Jones Cc: ghc-devs at haskell.org Subject: Re: D2038: [WIP] TysPrim: Generalize kind of (->) I had another thought on my drive home: why do we need to sort out Constraint v Type for 8.2? I have the patch, and it's essentially all set. But it weakens equality in a way that's troublesome for D2038 and introduces heterogeneous axioms, which are strange, ill-understood beasts. And I don't think we need it. On the other hand, D2038 is essential for the new Typeable, because it's the only way we can give (->) a proper kind. So, I propose: 1. Hold off on Constraint v Type until after the branch is cut. 2. Do what we can to mitigate Constraint v Type confusion vis-a-vis Typeable. (For example, make sure that there aren't Typeable instances for both, and have TcTypeable provide the Type instance whenever the Constraint instance is requested.) 3. Advertise that GHC will be a little confused on this point, and that, as far as Typeable is concerned, Constraint and Type are synonymous. 4. On the Constraint v Type patch, restore the full power of KindCo. This makes the type system broken, but I don't think the sky will come crashing down. 5. Merge Constraint v Type after the branch is cut. This will make GHC HEAD unsound in a new way, but no one will notice unless they try. 6. File a priority-highest bug to eliminate newtype-classes (which beget heterogeneous axioms in the Constraint/=Type world). 7. Finish the first-class reification design and implement before 8.4. 8. Remove newtype-classes, thus eliminating heterogeneous axioms and the unsoundness mentioned in (5). This route seems, to me, far preferable to monkeying around with roles and such in ways that we have no assurances are sound. (Remember, roles are there to keep the type system safe and sound. They were not added simply to annoy everyone, though they accomplish that goal quite nicely.) What do we think? It's not ideal, but I think it's the best of suboptimal alternatives. And it's no worse than 8.0 w.r.t. Constraint v Type. Richard On Jan 31, 2017, at 5:56 PM, Richard Eisenberg > wrote: On Jan 31, 2017, at 5:41 PM, Simon Peyton Jones > wrote: But that can only happen if `(->)` has suitable roles. What if it doesn’t? The “correct” roles for (->) of the kind you gave is `nominal nominal nominal nominal representational representational`. That is, the dependent arguments are nominal, and the others are representational. This is because all kind-level coercions are nominal. You seem to be suggesting giving (->) different roles. I honestly don’t know what that would mean -- normally, GHC prevents you from specifying a weaker role than it would infer. It smells pretty foul to me, but I can’t quite put my finger on what would go wrong at the moment. What if we just had an axiom axArrow v :: (->) Vanilla v ~R (->) Constraint v I think we’d also need one for results... but maybe not. or something like that. Then we get [W] g : (->) Vanilla Vanilla Ptr Ptr (C a) Int ~R (->) Constraint Vanilla Ptr Ptr a Int We decompose partly and solve thus g = (axArrow Vanilla) axC And this works only if we weaken (->)’s roles. This whole road just feels like the wrong way, as soon as we started contemplating a heterogeneous axiom, which are ruled out in the literature, even when we have kind equalities. I think the Right Answer is to get rid of newtype-classes & fix reify, and I’m worried that anything short of that will fail catastrophically at some point. Otherwise, it’s patches on top of patches. I don’t think there is disagreement here, but there is the question about what to do for 8.2.... and unless we’re ready to roll out the new reify, I think the best course of action is to delay the new Typeable and all this Constraint v Type stuff until 8.4. (The new levity polymorphism stuff already committed is hunky-dory.) Richard Simon From: noreply at phabricator.haskell.org [mailto:noreply at phabricator.haskell.org] Sent: 31 January 2017 12:51 To: Simon Peyton Jones > Subject: [Differential] [Commented On] D2038: [WIP] TysPrim: Generalize kind of (->) goldfire added a comment. View Revision In D2038#89360, @simonpj wrote: To avoid being able to extract ContraintRep ~R LiftedPtrRep we decided to weaken one of the coercion constructors, the one that gets a kind coercion from a type coercion. We don't need it, and it's awkward here. The problem is that we need it with this patch. I was able to weaken this coercion constructor (KindCo) in my patchD3023, but this patch uses it in a fundamental way that we can't get around. To wit: class C a where meth :: a axC :: (C a :: Constraint) ~R (a :: Type) Now, we wish to cast C a -> a to a -> a.. This cast will look like (->) ?? axC . What goes in the??? It's got to be something involving KindCo axC, which is disallowed as per our earlier decision. Therein lies the problem. As for reify: Yes, I'm agreed with that email. But is that implemented yet? Is a design settled on? I don't see a ghc-proposal. Are we wiling to take a dependency on that work in order to get this done? To be clear, my chief worry isn't that these problems cannot be solved by any means -- I'm just worried about the timing of this all and our desire to get 8.2 out the door. REPOSITORY rGHC Glasgow Haskell Compiler REVISION DETAIL https://phabricator.haskell.org/D2038 EMAIL PREFERENCES https://phabricator.haskell.org/settings/panel/emailpreferences/ To: bgamari, goldfire, austin Cc: simonpj, RyanGlScott, thomie _______________________________________________ ghc-devs mailing list ghc-devs at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs -------------- next part -------------- An HTML attachment was scrubbed... URL: From marlowsd at gmail.com Wed Feb 1 09:01:44 2017 From: marlowsd at gmail.com (Simon Marlow) Date: Wed, 1 Feb 2017 09:01:44 +0000 Subject: Lazy ST vs concurrency In-Reply-To: References: <1721492.EdgZeEtm4b@squirrel> Message-ID: On 31 January 2017 at 10:02, Simon Peyton Jones wrote: > Huh. You are right. That’s horrible. > Horrible indeed! > > > OK, here’s another idea. Provide, > > applyOnce# :: (a->b) -> a -> b > > > > which behaves like > > applyOnce f x = f x > > > > but guarantees that any thunk (applyOnce# f x) will be evaluated with > atomic eager black-holing. > > > > \(s :: State# s) -> > > let unsafePerformIO = \g -> g s > > thunk = applyOnce# unsafePerformIO (\s -> ... ) > > in > > ... > > But what if GHC decided to add another thunk, e.g. let thunk = let x = applyOnce# unsafePerformIO (\s -> ...) in x now we need atomicity on both thunks, but there's no way to tell. (of course GHC probably wouldn't do this particularly transformation, but there are a whole range of other things that it might correctly do that would subvert the programmer's intention to make a single atomic thunk). noDuplicate# avoids this problem because it walks the whole stack, claiming the whole chain of thunks currently under evaluation. But this is a messy solution, I don't like it either. Cheers Simon > Of course this does not guarantee safety. But I think it’d give a > per-thunk way to specify it. > > > > Simon > > > > *From:* Simon Marlow [mailto:marlowsd at gmail.com] > *Sent:* 31 January 2017 09:25 > > *To:* Simon Peyton Jones > *Cc:* David Feuer ; ghc-devs at haskell.org > *Subject:* Re: Lazy ST vs concurrency > > > > On 31 January 2017 at 09:11, Simon Peyton Jones > wrote: > > If we could identify exactly the thunks we wanted to be atomic, then yes, > that would be better than a whole-module solution. However I'm not sure > how to do that - doing it on the basis of a free variable with State# type > doesn't work if the State# is buried in a data structure or a function > closure, for instance. > > > > I disagree. Having a free State# variable is precisely necessary and > sufficient, I claim. Can you provide a counter-example? > > > > Sure, what I had in mind is something like this, defining a local > unsafePerformIO: > > > > \(s :: State# s) -> > > let unsafePerformIO = \g -> g s > > thunk = unsafePerformIO (\s -> ... ) > > in > > ... > > > > and "thunk" doesn't have a free variable of type State#. > > > > Cheers > > Simon > > > > > > Informal proof: > > · The model is that a value of type (State# t) is a linear value > that we mutate in-place. We must not consume it twice. > > · Evaluating a thunk that has a free (State# t) variable is > precisely “consuming” it. So we should only do that once > > > > > > I think -fatomic-eager-blackholing might "fix" it with less overhead, > though > > > > But precisely where would you have to use that flag? Inlining could meant > that the code appears anywhere! Once we have the ability to > atomically-blackhole a thunk, we can just use my criterion above, I claim. > > > > Stopgap story for 8.2. I am far from convinced that putting > unsafePerformIO in the impl of (>>=) for the ST monad will be correct; but > if you tell me it is, and if it is surrounded with huge banners saying that > this is the wrong solution, and pointing to a new ticket to fix it, then OK. > > > > Arguably this isn't all that urgent, given that it's been broken for 8 > years or so. > > > > > > Simon > > > > *From:* Simon Marlow [mailto:marlowsd at gmail.com] > *Sent:* 31 January 2017 08:59 > *To:* Simon Peyton Jones > *Cc:* David Feuer ; ghc-devs at haskell.org > > > *Subject:* Re: Lazy ST vs concurrency > > > > On 30 January 2017 at 22:56, Simon Peyton Jones > wrote: > > We don’t want to do this on a per-module basis do we, as > -fatomic-eager-blackholing would suggest. Rather, on per-thunk basis, no? > Which thunks, precisely? I think perhaps *precisely thunks one of whose > free variables has type (Sttate# s) for some s.* These are thunks that > consume a state token, and must do so no more than once. > > > > If we could identify exactly the thunks we wanted to be atomic, then yes, > that would be better than a whole-module solution. However I'm not sure > how to do that - doing it on the basis of a free variable with State# type > doesn't work if the State# is buried in a data structure or a function > closure, for instance. > > > > If entering such thunks was atomic, could we kill off noDuplicate#? > > > > I still don’t understand exactly what noDuplicate# does, what problem it > solves, and how the problem it solves relates to this LazyST problem. > > > > Back in our "Haskell on a Shared Memory Multiprocessor" paper ( > http://simonmar.github.io/bib/papers/multiproc.pdf > ) > we described a scheme to try to avoid duplication of work when multiple > cores evaluate the same thunk. This is normally applied lazily, because it > involves walking the stack and atomically black-holing thunks pointed to by > update frames. The noDuplicate# primop just invokes the stack walk > immediately; the idea is to try to prevent multiple threads from evaluating > a thunk containing unsafePerformIO. > > > > It's expensive. It's also not foolproof, because if you already happened > to create two copies of the unsafePerformIO thunk then noDuplicate# can't > help. I've never really liked it for these reasons, but I don't know a > better way. We have unsafeDupablePerformIO that doesn't call noDuplicate#, > and the programmer can use when the unsafePerformIO can safely be executed > multiple times. > > > > > > We need some kind of fix for 8.2. Simon what do you suggest? > > > > David's current fix would be OK (along with a clear notice in the release > notes etc. to note that the implementation got slower). I think > -fatomic-eager-blackholing might "fix" it with less overhead, though. > > > > Ben's suggestion: > > > > > eagerlyBlackhole :: a -> a > > > > is likely to be unreliable I think. We lack the control in the source > language to tie it to a particular thunk. > > > > Cheers > > Simon > > > > > > Simon > > > > *From:* Simon Marlow [mailto:marlowsd at gmail.com] > *Sent:* 30 January 2017 21:51 > *To:* David Feuer > *Cc:* Simon Peyton Jones ; ghc-devs at haskell.org > *Subject:* Re: Lazy ST vs concurrency > > > > On 30 January 2017 at 16:18, David Feuer wrote: > > I forgot to CC ghc-devs the first time, so here's another copy. > > > I was working on #11760 this weekend, which has to do with concurrency > breaking lazy ST. I came up with what I thought was a pretty decent > solution ( > https://phabricator.haskell.org/D3038 ). Simon Peyton Jones, however, is > quite > unhappy about the idea of sticking this weird unsafePerformIO-like code > (noDup, which I originally implemented as (unsafePerformIO . evaluate), but > which he finds ugly regardless of the details) into fmap and (>>=). He's > also > concerned that the noDuplicate# applications will kill performance in the > multi-threaded case, and suggests he would rather leave lazy ST broken, or > even remove it altogether, than use a fix that will make it slow sometimes, > particularly since there haven't been a lot of reports of problems in the > wild. > > > > In a nutshell, I think we have to fix this despite the cost - the > implementation is incorrect and unsafe. > > > > Unfortunately the mechanisms we have right now to fix it aren't ideal - > noDuplicate# is a bigger hammer than we need. All we really need is some > way to make a thunk atomic, it would require some special entry code to the > thunk which did atomic eager-blackholing. Hmm, now that I think about it, > perhaps we could just have a flag, -fatomic-eager-blackholing. We already > do this for CAFs, incidentally. The idea is to compare-and-swap the > blackhole info pointer into the thunk, and if we didn't win the race, just > re-enter the thunk (which is now a blackhole). We already have the cmpxchg > MachOp, so It shouldn't be more than a few lines in the code generator to > implement it. It would be too expensive to do by default, but doing it > just for Control.Monad.ST.Lazy should be ok and would fix the unsafety. > > > > (I haven't really thought this through, just an idea off the top of my > head, so there could well be something I'm overlooking here...) > > > > Cheers > > Simon > > > > > > My view is that leaving it broken, even if it only causes trouble > occasionally, is simply not an option. If users can't rely on it to always > give correct answers, then it's effectively useless. And for the sake of > backwards compatibility, I think it's a lot better to keep it around, even > if > it runs slowly multithreaded, than to remove it altogether. > > Note to Simon PJ: Yes, it's ugly to stick that noDup in there. But lazy ST > has > always been a bit of deep magic. You can't *really* carry a moment of time > around in your pocket and make its history happen only if necessary. We can > make it work in GHC because its execution model is entirely based around > graph > reduction, so evaluation is capable of driving execution. Whereas lazy IO > is > extremely tricky because it causes effects observable in the real world, > lazy > ST is only *moderately* tricky, causing effects that we have to make sure > don't lead to weird interactions between threads. I don't think it's > terribly > surprising that it needs to do a few more weird things to work properly. > > David > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Wed Feb 1 09:48:00 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Wed, 1 Feb 2017 09:48:00 +0000 Subject: Lazy ST vs concurrency In-Reply-To: References: <1721492.EdgZeEtm4b@squirrel> Message-ID: But what if GHC decided to add another thunk, e.g. Ugh. That is even more horrible. Clearly I’m not very good at thinking about this stuff. It smells wrong; we should find a simple, composable primitive that does the right thing. I’d like to leave some breadcrumbs of this thread, at very least pointing to it so we don’t repeat the thinking later. Meanwhile, for the present, what are we do to about LazyST? Simon From: Simon Marlow [mailto:marlowsd at gmail.com] Sent: 01 February 2017 09:02 To: Simon Peyton Jones Cc: David Feuer ; ghc-devs at haskell.org Subject: Re: Lazy ST vs concurrency On 31 January 2017 at 10:02, Simon Peyton Jones > wrote: Huh. You are right. That’s horrible. Horrible indeed! OK, here’s another idea. Provide, applyOnce# :: (a->b) -> a -> b which behaves like applyOnce f x = f x but guarantees that any thunk (applyOnce# f x) will be evaluated with atomic eager black-holing. \(s :: State# s) -> let unsafePerformIO = \g -> g s thunk = applyOnce# unsafePerformIO (\s -> ... ) in ... But what if GHC decided to add another thunk, e.g. let thunk = let x = applyOnce# unsafePerformIO (\s -> ...) in x now we need atomicity on both thunks, but there's no way to tell. (of course GHC probably wouldn't do this particularly transformation, but there are a whole range of other things that it might correctly do that would subvert the programmer's intention to make a single atomic thunk). noDuplicate# avoids this problem because it walks the whole stack, claiming the whole chain of thunks currently under evaluation. But this is a messy solution, I don't like it either. Cheers Simon Of course this does not guarantee safety. But I think it’d give a per-thunk way to specify it. Simon From: Simon Marlow [mailto:marlowsd at gmail.com] Sent: 31 January 2017 09:25 To: Simon Peyton Jones > Cc: David Feuer >; ghc-devs at haskell.org Subject: Re: Lazy ST vs concurrency On 31 January 2017 at 09:11, Simon Peyton Jones > wrote: If we could identify exactly the thunks we wanted to be atomic, then yes, that would be better than a whole-module solution. However I'm not sure how to do that - doing it on the basis of a free variable with State# type doesn't work if the State# is buried in a data structure or a function closure, for instance. I disagree. Having a free State# variable is precisely necessary and sufficient, I claim. Can you provide a counter-example? Sure, what I had in mind is something like this, defining a local unsafePerformIO: \(s :: State# s) -> let unsafePerformIO = \g -> g s thunk = unsafePerformIO (\s -> ... ) in ... and "thunk" doesn't have a free variable of type State#. Cheers Simon Informal proof: • The model is that a value of type (State# t) is a linear value that we mutate in-place. We must not consume it twice. • Evaluating a thunk that has a free (State# t) variable is precisely “consuming” it. So we should only do that once I think -fatomic-eager-blackholing might "fix" it with less overhead, though But precisely where would you have to use that flag? Inlining could meant that the code appears anywhere! Once we have the ability to atomically-blackhole a thunk, we can just use my criterion above, I claim. Stopgap story for 8.2. I am far from convinced that putting unsafePerformIO in the impl of (>>=) for the ST monad will be correct; but if you tell me it is, and if it is surrounded with huge banners saying that this is the wrong solution, and pointing to a new ticket to fix it, then OK. Arguably this isn't all that urgent, given that it's been broken for 8 years or so. Simon From: Simon Marlow [mailto:marlowsd at gmail.com] Sent: 31 January 2017 08:59 To: Simon Peyton Jones > Cc: David Feuer >; ghc-devs at haskell.org Subject: Re: Lazy ST vs concurrency On 30 January 2017 at 22:56, Simon Peyton Jones > wrote: We don’t want to do this on a per-module basis do we, as -fatomic-eager-blackholing would suggest. Rather, on per-thunk basis, no? Which thunks, precisely? I think perhaps precisely thunks one of whose free variables has type (Sttate# s) for some s. These are thunks that consume a state token, and must do so no more than once. If we could identify exactly the thunks we wanted to be atomic, then yes, that would be better than a whole-module solution. However I'm not sure how to do that - doing it on the basis of a free variable with State# type doesn't work if the State# is buried in a data structure or a function closure, for instance. If entering such thunks was atomic, could we kill off noDuplicate#? I still don’t understand exactly what noDuplicate# does, what problem it solves, and how the problem it solves relates to this LazyST problem. Back in our "Haskell on a Shared Memory Multiprocessor" paper (http://simonmar.github.io/bib/papers/multiproc.pdf) we described a scheme to try to avoid duplication of work when multiple cores evaluate the same thunk. This is normally applied lazily, because it involves walking the stack and atomically black-holing thunks pointed to by update frames. The noDuplicate# primop just invokes the stack walk immediately; the idea is to try to prevent multiple threads from evaluating a thunk containing unsafePerformIO. It's expensive. It's also not foolproof, because if you already happened to create two copies of the unsafePerformIO thunk then noDuplicate# can't help. I've never really liked it for these reasons, but I don't know a better way. We have unsafeDupablePerformIO that doesn't call noDuplicate#, and the programmer can use when the unsafePerformIO can safely be executed multiple times. We need some kind of fix for 8.2. Simon what do you suggest? David's current fix would be OK (along with a clear notice in the release notes etc. to note that the implementation got slower). I think -fatomic-eager-blackholing might "fix" it with less overhead, though. Ben's suggestion: > eagerlyBlackhole :: a -> a is likely to be unreliable I think. We lack the control in the source language to tie it to a particular thunk. Cheers Simon Simon From: Simon Marlow [mailto:marlowsd at gmail.com] Sent: 30 January 2017 21:51 To: David Feuer > Cc: Simon Peyton Jones >; ghc-devs at haskell.org Subject: Re: Lazy ST vs concurrency On 30 January 2017 at 16:18, David Feuer > wrote: I forgot to CC ghc-devs the first time, so here's another copy. I was working on #11760 this weekend, which has to do with concurrency breaking lazy ST. I came up with what I thought was a pretty decent solution ( https://phabricator.haskell.org/D3038 ). Simon Peyton Jones, however, is quite unhappy about the idea of sticking this weird unsafePerformIO-like code (noDup, which I originally implemented as (unsafePerformIO . evaluate), but which he finds ugly regardless of the details) into fmap and (>>=). He's also concerned that the noDuplicate# applications will kill performance in the multi-threaded case, and suggests he would rather leave lazy ST broken, or even remove it altogether, than use a fix that will make it slow sometimes, particularly since there haven't been a lot of reports of problems in the wild. In a nutshell, I think we have to fix this despite the cost - the implementation is incorrect and unsafe. Unfortunately the mechanisms we have right now to fix it aren't ideal - noDuplicate# is a bigger hammer than we need. All we really need is some way to make a thunk atomic, it would require some special entry code to the thunk which did atomic eager-blackholing. Hmm, now that I think about it, perhaps we could just have a flag, -fatomic-eager-blackholing. We already do this for CAFs, incidentally. The idea is to compare-and-swap the blackhole info pointer into the thunk, and if we didn't win the race, just re-enter the thunk (which is now a blackhole). We already have the cmpxchg MachOp, so It shouldn't be more than a few lines in the code generator to implement it. It would be too expensive to do by default, but doing it just for Control.Monad.ST.Lazy should be ok and would fix the unsafety. (I haven't really thought this through, just an idea off the top of my head, so there could well be something I'm overlooking here...) Cheers Simon My view is that leaving it broken, even if it only causes trouble occasionally, is simply not an option. If users can't rely on it to always give correct answers, then it's effectively useless. And for the sake of backwards compatibility, I think it's a lot better to keep it around, even if it runs slowly multithreaded, than to remove it altogether. Note to Simon PJ: Yes, it's ugly to stick that noDup in there. But lazy ST has always been a bit of deep magic. You can't *really* carry a moment of time around in your pocket and make its history happen only if necessary. We can make it work in GHC because its execution model is entirely based around graph reduction, so evaluation is capable of driving execution. Whereas lazy IO is extremely tricky because it causes effects observable in the real world, lazy ST is only *moderately* tricky, causing effects that we have to make sure don't lead to weird interactions between threads. I don't think it's terribly surprising that it needs to do a few more weird things to work properly. David -------------- next part -------------- An HTML attachment was scrubbed... URL: From rae at cs.brynmawr.edu Wed Feb 1 13:53:53 2017 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Wed, 1 Feb 2017 08:53:53 -0500 Subject: D2038: [WIP] TysPrim: Generalize kind of (->) In-Reply-To: References: <20170131125046.126142.13535.3FCE5C50@phabricator.haskell.org> <50EB9209-1A0F-4DA8-BA06-586DFD3C68DE@cs.brynmawr.edu> <9CF741E7-5985-4267-8ECA-5E5E7E870F57@cs.brynmawr.edu> Message-ID: <8DD87CB3-926F-48CF-B71C-E71069E997A9@cs.brynmawr.edu> > On Feb 1, 2017, at 3:34 AM, Simon Peyton Jones wrote: > > Who is acting there. Just Ben? Or are there bits Richard needs to help with? Ben has done the real heavy lifting, with me opining on this bit or that. From what Ben says, it's very close. There is a small bit of new work to be done to prefer Type over Constraint when solving for Typeable (my step 2), but that can't be hard. If I'm released (for now) from #11715, what's the next priority for me? Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: From rwbarton at gmail.com Wed Feb 1 18:26:10 2017 From: rwbarton at gmail.com (Reid Barton) Date: Wed, 1 Feb 2017 13:26:10 -0500 Subject: More history in perf.haskell.org graphs Message-ID: Hi Joachim, The graphs like https://perf.haskell.org/ghc/#graph/buildtime/make are very helpful, but I haven't found a way to adjust the range of commits shown from the default of the last 50 commits. For example, suppose I wanted to see the history of build time over the past 12 months and then narrow in on commits that caused regressions. Is there a way to do that using the https://perf.haskell.org/ghc/ website? Failing that, is the data that goes into these graphs available for download in some form? Regards, Reid Barton From ben at smart-cactus.org Wed Feb 1 18:42:23 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Wed, 01 Feb 2017 13:42:23 -0500 Subject: More history in perf.haskell.org graphs In-Reply-To: References: Message-ID: <87fujxkb1s.fsf@ben-laptop.smart-cactus.org> Reid Barton writes: > Hi Joachim, > > The graphs like https://perf.haskell.org/ghc/#graph/buildtime/make are > very helpful, but I haven't found a way to adjust the range of commits > shown from the default of the last 50 commits. For example, suppose I > wanted to see the history of build time over the past 12 months and > then narrow in on commits that caused regressions. Is there a way to > do that using the https://perf.haskell.org/ghc/ website? > This is precisely the goal of my own ghc-perf tool [1], although it has sadly languished in the recent months. I really need to work out some Postgrest performance issues and find a more reliable hosting situation for it. > Failing that, is the data that goes into these graphs available for > download in some form? > Joachim can likely provide a more helpful answer, but at very least the logs are available here [2]. I use a set of scripts [3] to extract performance numbers from these logs into PostgreSQL. Cheers, - Ben [1] http://home.smart-cactus.org/~ben/ghc-perf/ [2] https://github.com/nomeata/ghc-speed-logs [3] https://github.com/bgamari/ghc-perf-import/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From mail at joachim-breitner.de Wed Feb 1 19:07:21 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Wed, 01 Feb 2017 14:07:21 -0500 Subject: More history in perf.haskell.org graphs In-Reply-To: References: Message-ID: <1485976041.14724.10.camel@joachim-breitner.de> Hi, Am Mittwoch, den 01.02.2017, 13:26 -0500 schrieb Reid Barton: > The graphs like https://perf.haskell.org/ghc/#graph/buildtime/make > are very helpful, but I haven't found a way to adjust the range of commits > shown from the default of the last 50 commits. For example, suppose I > wanted to see the history of build time over the past 12 months and > then narrow in on commits that caused regressions. Is there a way to > do that using the https://perf.haskell.org/ghc/ website? > this is simply a missing feature. When building gipeda I ran out of steam before implementing that. Patches welcome ;-) Or use Ben’s work, which is pretty rad. Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From simonpj at microsoft.com Wed Feb 1 22:55:25 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Wed, 1 Feb 2017 22:55:25 +0000 Subject: D2038: [WIP] TysPrim: Generalize kind of (->) In-Reply-To: <8DD87CB3-926F-48CF-B71C-E71069E997A9@cs.brynmawr.edu> References: <20170131125046.126142.13535.3FCE5C50@phabricator.haskell.org> <50EB9209-1A0F-4DA8-BA06-586DFD3C68DE@cs.brynmawr.edu> <9CF741E7-5985-4267-8ECA-5E5E7E870F57@cs.brynmawr.edu> <8DD87CB3-926F-48CF-B71C-E71069E997A9@cs.brynmawr.edu> Message-ID: Check out https://ghc.haskell.org/trac/ghc/wiki/Status/GHC-8.2.1 There are several tickets you own in highest or high prio. Notably #12919 (an outright bug). And #12670, #13160, #13202 BEN: yell for whatever help you need with (->) and Typable Simon From: Richard Eisenberg [mailto:rae at cs.brynmawr.edu] Sent: 01 February 2017 13:54 To: Simon Peyton Jones Cc: ghc-devs at haskell.org Subject: Re: D2038: [WIP] TysPrim: Generalize kind of (->) On Feb 1, 2017, at 3:34 AM, Simon Peyton Jones > wrote: Who is acting there. Just Ben? Or are there bits Richard needs to help with? Ben has done the real heavy lifting, with me opining on this bit or that. From what Ben says, it's very close. There is a small bit of new work to be done to prefer Type over Constraint when solving for Typeable (my step 2), but that can't be hard. If I'm released (for now) from #11715, what's the next priority for me? Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at smart-cactus.org Wed Feb 1 23:36:56 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Wed, 01 Feb 2017 18:36:56 -0500 Subject: D2038: [WIP] TysPrim: Generalize kind of (->) In-Reply-To: References: <20170131125046.126142.13535.3FCE5C50@phabricator.haskell.org> <50EB9209-1A0F-4DA8-BA06-586DFD3C68DE@cs.brynmawr.edu> <9CF741E7-5985-4267-8ECA-5E5E7E870F57@cs.brynmawr.edu> <8DD87CB3-926F-48CF-B71C-E71069E997A9@cs.brynmawr.edu> Message-ID: <87inotiiuf.fsf@ben-laptop.smart-cactus.org> Simon Peyton Jones via ghc-devs writes: > Check out > https://ghc.haskell.org/trac/ghc/wiki/Status/GHC-8.2.1 > > There are several tickets you own in highest or high prio. Notably #12919 (an outright bug). And #12670, #13160, #13202 > > BEN: yell for whatever help you need with (->) and Typable > Thanks Simon! I think I probably have it from here. Cheers, - Ben Richard says, > > If I'm released (for now) from #11715, what's the next priority for me? > I would say #12919 is the most important. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From simonpj at microsoft.com Thu Feb 2 12:36:33 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Thu, 2 Feb 2017 12:36:33 +0000 Subject: Master broken? Message-ID: My clean build of origin/master, on 64-bit Linux is showing these failures Unexpected failures: /tmp/ghctest-5_qx1p/test spaces/./pmcheck/should_compile/T11195.run T11195 [exit code non-0] (normal) Unexpected stat failures: /tmp/ghctest-5_qx1p/test spaces/./perf/compiler/T5837.run T5837 [stat too good] (normal) /tmp/ghctest-5_qx1p/test spaces/./perf/compiler/T12234.run T12234 [stat too good] (optasm) (I do wish the summary omitted those long paths; makes it hard to read.) I'm happy about the perf improvements, but why don't they happen for other people? T11195 is a very long-running pattern-match perf test that regularly fails on a heavily loaded machine, with a timeout. It's very tiresome, but I don't think it's a regression. Simon -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at smart-cactus.org Thu Feb 2 16:44:36 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Thu, 02 Feb 2017 11:44:36 -0500 Subject: Master broken? In-Reply-To: References: Message-ID: <87a8a4ilu3.fsf@ben-laptop.smart-cactus.org> Simon Peyton Jones via ghc-devs writes: > My clean build of origin/master, on 64-bit Linux is showing these failures > > Unexpected failures: > > /tmp/ghctest-5_qx1p/test spaces/./pmcheck/should_compile/T11195.run T11195 [exit code non-0] (normal) > > > > Unexpected stat failures: > > /tmp/ghctest-5_qx1p/test spaces/./perf/compiler/T5837.run T5837 [stat too good] (normal) > > /tmp/ghctest-5_qx1p/test spaces/./perf/compiler/T12234.run T12234 [stat too good] (optasm) > > (I do wish the summary omitted those long paths; makes it hard to read.) > I'm happy about the perf improvements, but why don't they happen for other people? I bumped the allocation numbers for T12234 yesterday as it was failing on Darwin. It currently passes for my on x86_64/Linux. I'm not sure what to make of this. It quite frustrating how much environmental sensitivity these tests have. I personally this this is good motivation to follow through on #12758. > T11195 is a very long-running pattern-match perf test that regularly > fails on a heavily loaded machine, with a timeout. It's very tiresome, > but I don't think it's a regression. Yes, I have seen this on a few occassions, but not recently. I'm not sure what we can do other than bumping the timeout a bit. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From david.feuer at gmail.com Thu Feb 2 21:16:58 2017 From: david.feuer at gmail.com (David Feuer) Date: Thu, 2 Feb 2017 16:16:58 -0500 Subject: eagerlyBlackhole# efficiency thought In-Reply-To: References: Message-ID: We discussed trying to come up with a primitive eagerlyBlackhole# :: a -> a -- meaning eagerlyBlackhole a = runRW# $ \s -> case noDuplicate# s of _ -> a that would guarantee that the thunk is entered by only one thread. There are important situations where that check is redundant. Consider this code: (m >>= \a -> strictToLazyST (f a)) >>= o The implementation of >>= needs to wrap up the execution of its first argument in eagerlyBlackhole#. In this case, however, there is no risk that two threads will execute m, because it's forced within the same outer eagerlyBlackhole in which it was created. Is there a cheap way to detect this situation at run-time, when executing m, to avoid the synchronization delay? This probably doesn't arise too much for unsafePerformIO, but in lazy ST there may be a lot of nested no-duplicate thunks. I looked into trying to fix things up with RULES for *> and such, but I ran into trouble with eta expansion and in any case there are limits to what they can do to help >>=, and the whole thing is rather complicated. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at well-typed.com Thu Feb 2 21:36:23 2017 From: ben at well-typed.com (Ben Gamari) Date: Thu, 02 Feb 2017 16:36:23 -0500 Subject: Talkative Join points warning Message-ID: <87y3xogtrc.fsf@ben-laptop.smart-cactus.org> Hi Luke, I've noticed that a new WARN in OccurAnal seems to be quite loud. Validations now produce thousands of lines of the form, WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 OccurAnal failed to rediscover join point(s): [$j_shTG] WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 OccurAnal failed to rediscover join point(s): [$w$j_sl22] WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 OccurAnal failed to rediscover join point(s): [$w$j_sl1W] WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 OccurAnal failed to rediscover join point(s): [$w$j_sl1Q] Do you think we could either quiet the warning down a bit or perhaps disable it by default? It makes it rather difficult to see through the noise. This is actually perhaps another case where Simon Marlow suggestion of introducing a family of -v* flags (e.g. -fvanishing-join-points) might be helpful. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From matthewtpickering at gmail.com Thu Feb 2 23:29:08 2017 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Thu, 2 Feb 2017 23:29:08 +0000 Subject: Talkative Join points warning In-Reply-To: <87y3xogtrc.fsf@ben-laptop.smart-cactus.org> References: <87y3xogtrc.fsf@ben-laptop.smart-cactus.org> Message-ID: #13221 is related On Thu, Feb 2, 2017 at 9:36 PM, Ben Gamari wrote: > > Hi Luke, > > I've noticed that a new WARN in OccurAnal seems to be quite loud. > Validations now produce thousands of lines of the form, > > WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 > OccurAnal failed to rediscover join point(s): [$j_shTG] > WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 > OccurAnal failed to rediscover join point(s): [$w$j_sl22] > WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 > OccurAnal failed to rediscover join point(s): [$w$j_sl1W] > WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 > OccurAnal failed to rediscover join point(s): [$w$j_sl1Q] > > Do you think we could either quiet the warning down a bit or perhaps > disable it by default? It makes it rather difficult to see through the > noise. > > This is actually perhaps another case where Simon Marlow suggestion of > introducing a family of -v* flags (e.g. -fvanishing-join-points) might > be helpful. > > Cheers, > > - Ben > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > From simonpj at microsoft.com Thu Feb 2 23:37:55 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Thu, 2 Feb 2017 23:37:55 +0000 Subject: Talkative Join points warning In-Reply-To: <87y3xogtrc.fsf@ben-laptop.smart-cactus.org> References: <87y3xogtrc.fsf@ben-laptop.smart-cactus.org> Message-ID: Better still, figure out why it's happening and stop it happening. It shouldn't! S | -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Ben | Gamari | Sent: 02 February 2017 21:36 | To: Luke Maurer | Cc: ghc-devs at haskell.org | Subject: Talkative Join points warning | | | Hi Luke, | | I've noticed that a new WARN in OccurAnal seems to be quite loud. | Validations now produce thousands of lines of the form, | | WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 | OccurAnal failed to rediscover join point(s): [$j_shTG] | WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 | OccurAnal failed to rediscover join point(s): [$w$j_sl22] | WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 | OccurAnal failed to rediscover join point(s): [$w$j_sl1W] | WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 | OccurAnal failed to rediscover join point(s): [$w$j_sl1Q] | | Do you think we could either quiet the warning down a bit or perhaps | disable it by default? It makes it rather difficult to see through the | noise. | | This is actually perhaps another case where Simon Marlow suggestion of | introducing a family of -v* flags (e.g. -fvanishing-join-points) might be | helpful. | | Cheers, | | - Ben From maurerl at cs.uoregon.edu Fri Feb 3 00:51:44 2017 From: maurerl at cs.uoregon.edu (Luke Maurer) Date: Thu, 2 Feb 2017 16:51:44 -0800 Subject: Talkative Join points warning In-Reply-To: References: <87y3xogtrc.fsf@ben-laptop.smart-cactus.org> Message-ID: Agreed! Filed this one as bug #13221 yesterday: https://ghc.haskell.org/trac/ghc/ticket/13221 I'll have a look right now, in case it's an easy fix. - Luke On 02/02/2017 03:37 PM, Simon Peyton Jones wrote: > Better still, figure out why it's happening and stop it happening. It shouldn't! > > S > > | -----Original Message----- > | From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Ben > | Gamari > | Sent: 02 February 2017 21:36 > | To: Luke Maurer > | Cc: ghc-devs at haskell.org > | Subject: Talkative Join points warning > | > | > | Hi Luke, > | > | I've noticed that a new WARN in OccurAnal seems to be quite loud. > | Validations now produce thousands of lines of the form, > | > | WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 > | OccurAnal failed to rediscover join point(s): [$j_shTG] > | WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 > | OccurAnal failed to rediscover join point(s): [$w$j_sl22] > | WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 > | OccurAnal failed to rediscover join point(s): [$w$j_sl1W] > | WARNING: file compiler/simplCore/OccurAnal.hs, line 2633 > | OccurAnal failed to rediscover join point(s): [$w$j_sl1Q] > | > | Do you think we could either quiet the warning down a bit or perhaps > | disable it by default? It makes it rather difficult to see through the > | noise. > | > | This is actually perhaps another case where Simon Marlow suggestion of > | introducing a family of -v* flags (e.g. -fvanishing-join-points) might be > | helpful. > | > | Cheers, > | > | - Ben > From chrisdone at gmail.com Fri Feb 3 12:21:38 2017 From: chrisdone at gmail.com (Christopher Done) Date: Fri, 3 Feb 2017 12:21:38 +0000 Subject: Disable messages with GHC API Message-ID: In Intero, after loading modules, for each one I run the following function: https://github.com/commercialhaskell/intero/blob/300ac5a/src/GhciInfo.hs#L75..L85 If there are warnings or any output, they get outputted. As they are already outputted by regular :load, I don’t need the same output twice. How do I disable non-severe output for any GhcMonad m => m a? I’m using GHC 8.0.1 presently. I tried the following before calling getModInfo, expecting there to be no output anymore: + GHC.setSessionDynFlags + df {log_action = \ref dflags severity srcSpan style msg -> return ()} And this had no effect. I tried some other things but ran out of patience to keep a record of them all. Ciao! From matthewtpickering at gmail.com Fri Feb 3 12:50:54 2017 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Fri, 3 Feb 2017 12:50:54 +0000 Subject: Disable messages with GHC API In-Reply-To: References: Message-ID: The errors are eventually caught and printed by "handleSourceError" which is used a few times in your code. You could either modify one of these to not print out any errors or try something more intelligent like is in `parUpsweep_one` which does use the `log_action` in order to print the errors out. On Fri, Feb 3, 2017 at 12:21 PM, Christopher Done wrote: > In Intero, after loading modules, for each one I run the following > function: https://github.com/commercialhaskell/intero/blob/300ac5a/src/GhciInfo.hs#L75..L85 > > If there are warnings or any output, they get outputted. As they are > already outputted by regular :load, I don’t need the same output > twice. > > How do I disable non-severe output for any GhcMonad m => m a? I’m > using GHC 8.0.1 presently. > > I tried the following before calling getModInfo, expecting there to be > no output anymore: > > + GHC.setSessionDynFlags > + df {log_action = \ref dflags severity srcSpan style msg -> return ()} > > And this had no effect. I tried some other things but ran out of > patience to keep a record of them all. > > Ciao! > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs From ben at smart-cactus.org Fri Feb 3 15:23:57 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Fri, 03 Feb 2017 10:23:57 -0500 Subject: Panic from rewritableTyVarsOfType In-Reply-To: References: <87vassgpkf.fsf@ben-laptop.smart-cactus.org> Message-ID: <87r33fguwi.fsf@ben-laptop.smart-cactus.org> Simon Peyton Jones writes: > Ben, Richard > > rewritableTyVarsOfType is used when deciding whether to split a [WD] > constraint into [W] and [D]. For example, if we are adding > [WD] C a > and there is an inert > [WD] a ~ Int > then we want to split the [WD] into > [W] C a > [D] C a > so that the [D] one can be rewritten and perhaps yield improvement etc. > > There is no point in rewriting coercions or cases in t, because they > won't help (C t) to reduce. That's why rewriteableTyVarsOfType differs > from tyVarsOfType. And indeed the arg of a class C should be a > monotype. > Ahh, I see. > So rewriteableTyVarsOfType doesn't expect foralls, hence the panic. > But it's seeing a forall in an /equality/ constraint. > > FIRST ISSUE: I'm a bit surprised about that (smacks of impredicative > polymorphism) so the first thing to check is that this is really > supposed to happen in this program. Richard should be able to help. > Indeed this test is meant to fail, just not with a panic. I suspect this means that my solver logic isn't catching requests for polytypes as early as it needs to. > SECOND ISSUE: But regardless, I now realise that shouldSplitWD only > needs to split a [WD] equality if the LHS matches. If we have > [WD] a ~ ty -- work item > [D] a ~ ty2 -- inert > then we want to split the [WD] so we can get [D] ty ~ ty2. But > otherwise there is no point. > > Richard do you agree? > > I'll try that out. > > Meanwhile to get you rolling, you can replace rewritableTyVars with > tyCoVarsOfType and it'll all work, just a bit less efficiently. > Thanks Simon! Indeed that allows things to proceed and in the process, confirms that there is a bug in my solver logic. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From chrisdone at gmail.com Fri Feb 3 15:30:21 2017 From: chrisdone at gmail.com (Christopher Done) Date: Fri, 3 Feb 2017 15:30:21 +0000 Subject: Disable messages with GHC API In-Reply-To: References: Message-ID: Adding `handleSourceError` around it makes no difference. Which makes sense, as I don't think warnings count as exceptions, otherwise my code would never have completed in the first place. On 3 February 2017 at 12:50, Matthew Pickering wrote: > The errors are eventually caught and printed by "handleSourceError" > which is used a few times in your code. You could either modify one of > these to not print out any errors or try something more intelligent > like is in `parUpsweep_one` which does use the `log_action` in order > to print the errors out. > > On Fri, Feb 3, 2017 at 12:21 PM, Christopher Done wrote: >> In Intero, after loading modules, for each one I run the following >> function: https://github.com/commercialhaskell/intero/blob/300ac5a/src/GhciInfo.hs#L75..L85 >> >> If there are warnings or any output, they get outputted. As they are >> already outputted by regular :load, I don’t need the same output >> twice. >> >> How do I disable non-severe output for any GhcMonad m => m a? I’m >> using GHC 8.0.1 presently. >> >> I tried the following before calling getModInfo, expecting there to be >> no output anymore: >> >> + GHC.setSessionDynFlags >> + df {log_action = \ref dflags severity srcSpan style msg -> return ()} >> >> And this had no effect. I tried some other things but ran out of >> patience to keep a record of them all. >> >> Ciao! >> _______________________________________________ >> ghc-devs mailing list >> ghc-devs at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs From dxld at darkboxed.org Fri Feb 3 15:57:07 2017 From: dxld at darkboxed.org (Daniel =?iso-8859-1?Q?Gr=F6ber?=) Date: Fri, 3 Feb 2017 16:57:07 +0100 Subject: Disable messages with GHC API In-Reply-To: References: Message-ID: <20170203155707.iglqzfpkuxa76pjk@Eli.lan> On Fri, Feb 03, 2017 at 12:21:38PM +0000, Christopher Done wrote: > I tried the following before calling getModInfo, expecting there to be > no output anymore: > > + GHC.setSessionDynFlags > + df {log_action = \ref dflags severity srcSpan style msg -> return ()} That is pretty much exactly what I do in ghc-mod to suppress all output (other than the SourceError exceptions) so it's strange that wouldn't work. Have you tried making a small self contained test case for your problem, maybe it's something intero specific? How far has it diverged from it's GHCi roots these days anyways? Here's[1] a small testcase I usually modify to test various GHC oddities when I'm not sure if my ghc-mod monad magic is doing something werid or not, might be helpful: [1]: https://github.com/DanielG/ghc-mod/blob/master/test/manual/not-interpreted-error/GhcTestcase.hs --Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From matthewtpickering at gmail.com Fri Feb 3 15:59:09 2017 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Fri, 3 Feb 2017 15:59:09 +0000 Subject: Disable messages with GHC API In-Reply-To: References: Message-ID: You are right. I looked more closely now and it looks like "parseModule" and so on overwrite the DynFlags with a cached version before running the relevant piece of the pipeline. 857 hsc_env <- getSession 858 let hsc_env_tmp = hsc_env { hsc_dflags = ms_hspp_opts ms } 859 hpm <- liftIO $ hscParse hsc_env_tmp ms I think this is symptom of the fact that DynFlags is not very well structured and a lot of different compiler options are lumped together. It makes sense that we need to use the right DynFlags to run the module but this shouldn't overwrite things which are irrelevant like log_action. Matt On Fri, Feb 3, 2017 at 3:30 PM, Christopher Done wrote: > Adding `handleSourceError` around it makes no difference. > > Which makes sense, as I don't think warnings count as exceptions, > otherwise my code would never have completed in the first place. > > On 3 February 2017 at 12:50, Matthew Pickering > wrote: >> The errors are eventually caught and printed by "handleSourceError" >> which is used a few times in your code. You could either modify one of >> these to not print out any errors or try something more intelligent >> like is in `parUpsweep_one` which does use the `log_action` in order >> to print the errors out. >> >> On Fri, Feb 3, 2017 at 12:21 PM, Christopher Done wrote: >>> In Intero, after loading modules, for each one I run the following >>> function: https://github.com/commercialhaskell/intero/blob/300ac5a/src/GhciInfo.hs#L75..L85 >>> >>> If there are warnings or any output, they get outputted. As they are >>> already outputted by regular :load, I don’t need the same output >>> twice. >>> >>> How do I disable non-severe output for any GhcMonad m => m a? I’m >>> using GHC 8.0.1 presently. >>> >>> I tried the following before calling getModInfo, expecting there to be >>> no output anymore: >>> >>> + GHC.setSessionDynFlags >>> + df {log_action = \ref dflags severity srcSpan style msg -> return ()} >>> >>> And this had no effect. I tried some other things but ran out of >>> patience to keep a record of them all. >>> >>> Ciao! >>> _______________________________________________ >>> ghc-devs mailing list >>> ghc-devs at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs From ben at smart-cactus.org Fri Feb 3 16:01:09 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Fri, 03 Feb 2017 11:01:09 -0500 Subject: Panic from rewritableTyVarsOfType In-Reply-To: <87r33fguwi.fsf@ben-laptop.smart-cactus.org> References: <87vassgpkf.fsf@ben-laptop.smart-cactus.org> <87r33fguwi.fsf@ben-laptop.smart-cactus.org> Message-ID: <87o9yjgt6i.fsf@ben-laptop.smart-cactus.org> Ben Gamari writes: > Simon Peyton Jones writes: > >> Meanwhile to get you rolling, you can replace rewritableTyVars with >> tyCoVarsOfType and it'll all work, just a bit less efficiently. >> > Thanks Simon! Indeed that allows things to proceed and in the process, > confirms that there is a bug in my solver logic. > I should clarify: the bug is in fact not in the Typeable solver. The problem is that we have a type with some kind polymorphism. For instance, data Proxy (a :: k) = Proxy Note that in order to be `Typeable` Proxy needs to have its `k` kind argument instantiated. Consequently this program is perfectly fine, ty :: TypeRep (Proxy Int) ty = typeRep We can even decompose this into a type application, case ty of TRApp a b -> ... where `a :: TypeRep Proxy` (with `k ~ Type`) and `b :: TypeRep Int`. However, if we attempt to decompose `a` again (which is what the Typeable1 testcase described in this thread tests), we run into trouble, case a of TRApp x y -> ... After changing rewritableTyVars with tyCoVarsOfType, the testcase Typeable1 fails with the following correct, albeit not terribly readable, error message, Typeable1.hs:22:5: error: • Couldn't match kind ‘* -> (* -> *) -> (* -> *) -> * -> *’ with ‘forall k. (* -> *) -> (k -> *) -> k -> *’ Inaccessible code in a pattern with pattern synonym: TRApp :: forall k2 (t :: k2). () => forall k1 (a :: k1 -> k2) (b :: k1). t ~ a b => TypeRep (k1 -> k2) a -> TypeRep k1 b -> TypeRep k2 t, in a pattern binding in 'do' block • In the pattern: TRApp x y In a stmt of a 'do' block: TRApp x y <- pure x In the expression: do let x :: ComposeK Maybe Maybe Int x = undefined TRApp x y <- pure $ typeOf x print (x, y) TRApp x y <- pure x .... • Relevant bindings include y :: TypeRep k3 b2 (bound at Typeable1.hs:19:13) x :: TypeRep (k3 -> k2 -> k1 -> *) a2 (bound at Typeable1.hs:19:11) This might be a place where GHC could hold the user's hand a bit more gently. Anyways, hopefully this will be resolved with the fix to Simon's second issue. Otherwise I just need to look at two performance regressions and I think I'm done. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From alan.zimm at gmail.com Fri Feb 3 16:20:44 2017 From: alan.zimm at gmail.com (Alan & Kim Zimmerman) Date: Fri, 3 Feb 2017 18:20:44 +0200 Subject: Disable messages with GHC API In-Reply-To: References: Message-ID: Here [1] is the tweak we do in HaRe to get the right dynflags Alan [1] https://github.com/alanz/HaRe/blob/master/src/Language/Haskell/Refact/Utils/Utils.hs#L224 On 3 Feb 2017 5:59 p.m., "Matthew Pickering" wrote: > You are right. I looked more closely now and it looks like > "parseModule" and so on overwrite the DynFlags with a cached version > before running the relevant piece of the pipeline. > > 857 hsc_env <- getSession > 858 let hsc_env_tmp = hsc_env { hsc_dflags = ms_hspp_opts ms } > 859 hpm <- liftIO $ hscParse hsc_env_tmp ms > > > I think this is symptom of the fact that DynFlags is not very well > structured and a lot of different compiler options are lumped > together. It makes sense that we need to use the right DynFlags to run > the module but this shouldn't overwrite things which are irrelevant > like log_action. > > Matt > > > On Fri, Feb 3, 2017 at 3:30 PM, Christopher Done > wrote: > > Adding `handleSourceError` around it makes no difference. > > > > Which makes sense, as I don't think warnings count as exceptions, > > otherwise my code would never have completed in the first place. > > > > On 3 February 2017 at 12:50, Matthew Pickering > > wrote: > >> The errors are eventually caught and printed by "handleSourceError" > >> which is used a few times in your code. You could either modify one of > >> these to not print out any errors or try something more intelligent > >> like is in `parUpsweep_one` which does use the `log_action` in order > >> to print the errors out. > >> > >> On Fri, Feb 3, 2017 at 12:21 PM, Christopher Done > wrote: > >>> In Intero, after loading modules, for each one I run the following > >>> function: https://github.com/commercialhaskell/intero/blob/ > 300ac5a/src/GhciInfo.hs#L75..L85 > >>> > >>> If there are warnings or any output, they get outputted. As they are > >>> already outputted by regular :load, I don’t need the same output > >>> twice. > >>> > >>> How do I disable non-severe output for any GhcMonad m => m a? I’m > >>> using GHC 8.0.1 presently. > >>> > >>> I tried the following before calling getModInfo, expecting there to be > >>> no output anymore: > >>> > >>> + GHC.setSessionDynFlags > >>> + df {log_action = \ref dflags severity srcSpan style msg -> > return ()} > >>> > >>> And this had no effect. I tried some other things but ran out of > >>> patience to keep a record of them all. > >>> > >>> Ciao! > >>> _______________________________________________ > >>> ghc-devs mailing list > >>> ghc-devs at haskell.org > >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Fri Feb 3 16:38:44 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 3 Feb 2017 16:38:44 +0000 Subject: Panic from rewritableTyVarsOfType In-Reply-To: <87o9yjgt6i.fsf@ben-laptop.smart-cactus.org> References: <87vassgpkf.fsf@ben-laptop.smart-cactus.org> <87r33fguwi.fsf@ben-laptop.smart-cactus.org> <87o9yjgt6i.fsf@ben-laptop.smart-cactus.org> Message-ID: | Typeable1.hs:22:5: error: | • Couldn't match kind ‘* -> (* -> *) -> (* -> *) -> * -> *’ | with ‘forall k. (* -> *) -> (k -> *) -> k -> *’ I still don't see why we end up equating a polykind with a kind. | Anyways, hopefully this will be resolved with the fix to Simon's second | issue. Otherwise I just need to look at two performance regressions and I | think I'm done. I'm validating a patch that uses tyCoVarsOfType, but a bit more selectively. So you'll get the same error. S | -----Original Message----- | From: Ben Gamari [mailto:ben at smart-cactus.org] | Sent: 03 February 2017 16:01 | To: Simon Peyton Jones ; Richard Eisenberg | | Cc: ghc-devs at haskell.org | Subject: RE: Panic from rewritableTyVarsOfType | | Ben Gamari writes: | | > Simon Peyton Jones writes: | > | >> Meanwhile to get you rolling, you can replace rewritableTyVars with | >> tyCoVarsOfType and it'll all work, just a bit less efficiently. | >> | > Thanks Simon! Indeed that allows things to proceed and in the process, | > confirms that there is a bug in my solver logic. | > | I should clarify: the bug is in fact not in the Typeable solver. The problem | is that we have a type with some kind polymorphism. For instance, | | data Proxy (a :: k) = Proxy | | Note that in order to be `Typeable` Proxy needs to have its `k` kind | argument instantiated. Consequently this program is perfectly fine, | | ty :: TypeRep (Proxy Int) | ty = typeRep | | We can even decompose this into a type application, | | case ty of | TRApp a b -> ... | | where `a :: TypeRep Proxy` (with `k ~ Type`) and `b :: TypeRep Int`. | However, if we attempt to decompose `a` again (which is what the | Typeable1 testcase described in this thread tests), we run into trouble, | | case a of | TRApp x y -> ... | | After changing rewritableTyVars with tyCoVarsOfType, the testcase | Typeable1 fails with the following correct, albeit not terribly readable, | error message, | | Typeable1.hs:22:5: error: | • Couldn't match kind ‘* -> (* -> *) -> (* -> *) -> * -> *’ | with ‘forall k. (* -> *) -> (k -> *) -> k -> *’ | Inaccessible code in | a pattern with pattern synonym: | TRApp :: forall k2 (t :: k2). | () => | forall k1 (a :: k1 -> k2) (b :: k1). | t ~ a b => | TypeRep (k1 -> k2) a -> TypeRep k1 b -> TypeRep k2 t, | in a pattern binding in | 'do' block | • In the pattern: TRApp x y | In a stmt of a 'do' block: TRApp x y <- pure x | In the expression: | do let x :: ComposeK Maybe Maybe Int | x = undefined | TRApp x y <- pure $ typeOf x | print (x, y) | TRApp x y <- pure x | .... | • Relevant bindings include | y :: TypeRep k3 b2 (bound at Typeable1.hs:19:13) | x :: TypeRep (k3 -> k2 -> k1 -> *) a2 (bound at | Typeable1.hs:19:11) | | This might be a place where GHC could hold the user's hand a bit more | gently. | | Anyways, hopefully this will be resolved with the fix to Simon's second | issue. Otherwise I just need to look at two performance regressions and I | think I'm done. | | Cheers, | | - Ben From takenobu.hs at gmail.com Sat Feb 4 01:37:21 2017 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Sat, 4 Feb 2017 10:37:21 +0900 Subject: Is there a way to avoid time limit when using travis? Message-ID: Dear devs, Is there a way to avoid time limit when using travis? I started using travis [1]. It is very convenient :) But timeout occurs [2]. The log messages are as follows: =====> InstEqContext2(normal) 1806 of 5700 [0, 0, 0] =====> InstEqContext3(normal) 1807 of 5700 [0, 0, 0] =====> InstContextNorm(normal) 1808 of 5700 [0, 0, 0] The job exceeded the maximum time limit for jobs, and has been terminated. How do you avoid this? Paid plan or something? [1]: https://ghc.haskell.org/trac/ghc/wiki/Travis [2]: https://travis-ci.org/takenobu-hs/ghc/builds/197987055 Regards, Takenobu -------------- next part -------------- An HTML attachment was scrubbed... URL: From ezyang at mit.edu Sat Feb 4 01:41:33 2017 From: ezyang at mit.edu (Edward Z. Yang) Date: Fri, 03 Feb 2017 17:41:33 -0800 Subject: Is there a way to avoid time limit when using travis? In-Reply-To: References: Message-ID: <1486172425-sup-3346@sabre> Even with a paid plan, you only have 120 min to run your build. That might be enough in your case but in Cabal's Travis project I've started playing tricks where I upload the build products somewhere, and then redownload them in a new job before running tests. Edward Excerpts from Takenobu Tani's message of 2017-02-04 10:37:21 +0900: > Dear devs, > > Is there a way to avoid time limit when using travis? > > I started using travis [1]. It is very convenient :) > But timeout occurs [2]. > The log messages are as follows: > > =====> InstEqContext2(normal) 1806 of 5700 [0, 0, 0] > =====> InstEqContext3(normal) 1807 of 5700 [0, 0, 0] > =====> InstContextNorm(normal) 1808 of 5700 [0, 0, 0] > The job exceeded the maximum time limit for jobs, and has been > terminated. > > How do you avoid this? > Paid plan or something? > > [1]: https://ghc.haskell.org/trac/ghc/wiki/Travis > [2]: https://travis-ci.org/takenobu-hs/ghc/builds/197987055 > > Regards, > Takenobu From takenobu.hs at gmail.com Sat Feb 4 02:07:25 2017 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Sat, 4 Feb 2017 11:07:25 +0900 Subject: Is there a way to avoid time limit when using travis? In-Reply-To: <1486172425-sup-3346@sabre> References: <1486172425-sup-3346@sabre> Message-ID: Hi Edward, devs, Thank you for kind explanation. I understood the situation. Is it common to use paid plans when building GHC [1]? [1]: https://travis-ci.org/ghc/ghc Regards, Takenobu 2017-02-04 10:41 GMT+09:00 Edward Z. Yang : > Even with a paid plan, you only have 120 min to run your build. > That might be enough in your case but in Cabal's Travis project > I've started playing tricks where I upload the build products > somewhere, and then redownload them in a new job before running tests. > > Edward > > Excerpts from Takenobu Tani's message of 2017-02-04 10:37:21 +0900: > > Dear devs, > > > > Is there a way to avoid time limit when using travis? > > > > I started using travis [1]. It is very convenient :) > > But timeout occurs [2]. > > The log messages are as follows: > > > > =====> InstEqContext2(normal) 1806 of 5700 [0, 0, 0] > > =====> InstEqContext3(normal) 1807 of 5700 [0, 0, 0] > > =====> InstContextNorm(normal) 1808 of 5700 [0, 0, 0] > > The job exceeded the maximum time limit for jobs, and has been > > terminated. > > > > How do you avoid this? > > Paid plan or something? > > > > [1]: https://ghc.haskell.org/trac/ghc/wiki/Travis > > [2]: https://travis-ci.org/takenobu-hs/ghc/builds/197987055 > > > > Regards, > > Takenobu > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Sat Feb 4 03:45:07 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Fri, 03 Feb 2017 22:45:07 -0500 Subject: Is there a way to avoid time limit when using travis? In-Reply-To: References: <1486172425-sup-3346@sabre> Message-ID: <1486179907.4227.6.camel@joachim-breitner.de> Hi, ghc has an exception in place from travis; I fear it does not carry over to forks. If you have commit rights to GHC, you can develop in a branch. Maybe a pull request works as well, not sure whether that uses the time limit of the official repo or yours. Worth a try! Just write tin the PR that you don not want this to be merged :-) Greetings, Joachim Am Samstag, den 04.02.2017, 11:07 +0900 schrieb Takenobu Tani: > > Hi Edward, devs, > > Thank you for kind explanation. > I understood the situation. > > Is it common to use paid plans when building GHC [1]? > > [1]: https://travis-ci.org/ghc/ghc > > Regards, > Takenobu > > > 2017-02-04 10:41 GMT+09:00 Edward Z. Yang : > > Even with a paid plan, you only have 120 min to run your build. > > That might be enough in your case but in Cabal's Travis project > > I've started playing tricks where I upload the build products > > somewhere, and then redownload them in a new job before running > > tests. > > > > Edward > > > > Excerpts from Takenobu Tani's message of 2017-02-04 10:37:21 +0900: > > > Dear devs, > > > > > > Is there a way to avoid time limit when using travis? > > > > > > I started using travis [1]. It is very convenient :) > > > But timeout occurs [2]. > > > The log messages are as follows: > > > > > >     =====> InstEqContext2(normal) 1806 of 5700 [0, 0, 0] > > >     =====> InstEqContext3(normal) 1807 of 5700 [0, 0, 0] > > >     =====> InstContextNorm(normal) 1808 of 5700 [0, 0, 0] > > >     The job exceeded the maximum time limit for jobs, and has > > been > > > terminated. > > > > > > How do you avoid this? > > > Paid plan or something? > > > > > > [1]: https://ghc.haskell.org/trac/ghc/wiki/Travis > > > [2]: https://travis-ci.org/takenobu-hs/ghc/builds/197987055 > > > > > > Regards, > > > Takenobu > > > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From takenobu.hs at gmail.com Sat Feb 4 04:45:05 2017 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Sat, 4 Feb 2017 13:45:05 +0900 Subject: Is there a way to avoid time limit when using travis? In-Reply-To: <1486179907.4227.6.camel@joachim-breitner.de> References: <1486172425-sup-3346@sabre> <1486179907.4227.6.camel@joachim-breitner.de> Message-ID: Hi Joachim, Thank you for the advice. I'll try to correspond as follows: * To use Travis for simple build check * To use Phab or (slow) local machine for validation * To use Phab for review * To use Github PR for getting advice and confirm I'll enjoy it carefully:) Regards, Takenobu 2017-02-04 12:45 GMT+09:00 Joachim Breitner : > Hi, > > ghc has an exception in place from travis; I fear it does not carry > over to forks. > > If you have commit rights to GHC, you can develop in a branch. > > Maybe a pull request works as well, not sure whether that uses the time > limit of the official repo or yours. Worth a try! Just write tin the PR > that you don not want this to be merged :-) > > Greetings, > Joachim > > > Am Samstag, den 04.02.2017, 11:07 +0900 schrieb Takenobu Tani: > > > > Hi Edward, devs, > > > > Thank you for kind explanation. > > I understood the situation. > > > > Is it common to use paid plans when building GHC [1]? > > > > [1]: https://travis-ci.org/ghc/ghc > > > > Regards, > > Takenobu > > > > > > 2017-02-04 10:41 GMT+09:00 Edward Z. Yang : > > > Even with a paid plan, you only have 120 min to run your build. > > > That might be enough in your case but in Cabal's Travis project > > > I've started playing tricks where I upload the build products > > > somewhere, and then redownload them in a new job before running > > > tests. > > > > > > Edward > > > > > > Excerpts from Takenobu Tani's message of 2017-02-04 10:37:21 +0900: > > > > Dear devs, > > > > > > > > Is there a way to avoid time limit when using travis? > > > > > > > > I started using travis [1]. It is very convenient :) > > > > But timeout occurs [2]. > > > > The log messages are as follows: > > > > > > > > =====> InstEqContext2(normal) 1806 of 5700 [0, 0, 0] > > > > =====> InstEqContext3(normal) 1807 of 5700 [0, 0, 0] > > > > =====> InstContextNorm(normal) 1808 of 5700 [0, 0, 0] > > > > The job exceeded the maximum time limit for jobs, and has > > > been > > > > terminated. > > > > > > > > How do you avoid this? > > > > Paid plan or something? > > > > > > > > [1]: https://ghc.haskell.org/trac/ghc/wiki/Travis > > > > [2]: https://travis-ci.org/takenobu-hs/ghc/builds/197987055 > > > > > > > > Regards, > > > > Takenobu > > > > > > > _______________________________________________ > > ghc-devs mailing list > > ghc-devs at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > -- > Joachim “nomeata” Breitner > mail at joachim-breitner.de • https://www.joachim-breitner.de/ > XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F > Debian Developer: nomeata at debian.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at well-typed.com Sat Feb 4 18:24:45 2017 From: ben at well-typed.com (Ben Gamari) Date: Sat, 04 Feb 2017 13:24:45 -0500 Subject: Phabricator upgrade tomorrow In-Reply-To: <87eg0en6iw.fsf@ben-laptop.smart-cactus.org> References: <87eg0en6iw.fsf@ben-laptop.smart-cactus.org> Message-ID: <87k295g6fm.fsf@ben-laptop.smart-cactus.org> Hello everyone! Tomorrow I'm going to perform another Phabricator update if no one objects. Let me know if this will cause you undue burden. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From mle+hs at mega-nerd.com Sun Feb 5 08:49:26 2017 From: mle+hs at mega-nerd.com (Erik de Castro Lopo) Date: Sun, 5 Feb 2017 19:49:26 +1100 Subject: Handling of unlifted types Message-ID: <20170205194926.f810c13e3c76813cb46c4148@mega-nerd.com> Hi all, I'm working on pulling the core parts of Joachim Breitner's ghc-heap-view library into GHC. The WIP Phab review is here: https://phabricator.haskell.org/D3055 Currently that library has a function: getClosureData :: a -> IO Closure which works fine for lifted types. However, some of the supported closure types in http://hackage.haskell.org/trac/ghc/browser/includes/rts/storage/InfoTables.h actually refer to unlifted types, like the `MUT_ARR_PTRS_*` and `SMALL_MUT_ARR_PTRS_*`. I've had a look at the levity polymorphism stuff implemented in ghc 8.0 and came up with a new type for `getClosureData`: getClosureData :: forall (r :: RuntimeRep) (a :: TYPE r). a -> IO Closure but that results in: A representation-polymorphic type is not allowed here: Type: a Kind: TYPE r In the type of binder ‘x’ Am I barking up the wrong tree here? Any one have a clue on how I might make progress on this? Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ From ben at smart-cactus.org Sun Feb 5 16:34:28 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Sun, 05 Feb 2017 11:34:28 -0500 Subject: Handling of unlifted types In-Reply-To: <20170205194926.f810c13e3c76813cb46c4148@mega-nerd.com> References: <20170205194926.f810c13e3c76813cb46c4148@mega-nerd.com> Message-ID: <87bmugfvfv.fsf@ben-laptop.smart-cactus.org> Erik de Castro Lopo writes: > Hi all, > > I'm working on pulling the core parts of Joachim Breitner's > ghc-heap-view library into GHC. The WIP Phab review is here: > > https://phabricator.haskell.org/D3055 > > Currently that library has a function: > > getClosureData :: a -> IO Closure > > which works fine for lifted types. However, some of the supported > closure types in > > http://hackage.haskell.org/trac/ghc/browser/includes/rts/storage/InfoTables.h > > actually refer to unlifted types, like the `MUT_ARR_PTRS_*` and > `SMALL_MUT_ARR_PTRS_*`. > > I've had a look at the levity polymorphism stuff implemented in ghc 8.0 > and came up with a new type for `getClosureData`: > > getClosureData :: forall (r :: RuntimeRep) (a :: TYPE r). a -> IO Closure > Unfortunately I'm not sure that the sort of polymorphism that you need is possible at the moment. To see why, consider a few of the kinds that this function as-written might take, 1. Double# :: TYPE 'DoubleRep 2. Int :: TYPE 'LiftedRep 3. Array# :: TYPE 'UnliftedRep What you want here, I believe, is to allow getClosureData to accept (2) and (3). This should in principle be fine; afterall they are both represented at runtime by a pointer. However, (1) has a much different representation (being passed in a floating point register) and currently we can't distinguish (1) from (2) and (3) in the kind system. Consequently, we aren't able to provide this sort of sort of polymorphism since there is no single calling convention that could be used with such a function. At the moment I think the best you could do would be to provide an implementation for each supported RuntimeRep (either multiple functions or typeclass overloaded). Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From matthewtpickering at gmail.com Sun Feb 5 23:45:38 2017 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Sun, 5 Feb 2017 23:45:38 +0000 Subject: Phabricator upgrade tomorrow In-Reply-To: <87k295g6fm.fsf@ben-laptop.smart-cactus.org> References: <87eg0en6iw.fsf@ben-laptop.smart-cactus.org> <87k295g6fm.fsf@ben-laptop.smart-cactus.org> Message-ID: Ben has completed the upgrade. Smooth sailing ahead! Highlights from this release: 1. A new homepage - https://blog.phacility.com/post/8/the_new_home_menu/ 2. The new favourites menu - https://blog.phacility.com/post/6/extending_the_menubar/ 3. Emoji Autocomplete - https://blog.phacility.com/post/7/autocomplete_now_with_emoji/ 4. The interface to differential has slightly changed due an internal refactor but should work much the same as before. As always, any problems ping me or Ben on IRC and we will try and sort them out. Matt On Sat, Feb 4, 2017 at 6:24 PM, Ben Gamari wrote: > > Hello everyone! > > Tomorrow I'm going to perform another Phabricator update if no one > objects. Let me know if this will cause you undue burden. > > Cheers, > > - Ben > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > From andrey.mokhov at newcastle.ac.uk Mon Feb 6 03:19:28 2017 From: andrey.mokhov at newcastle.ac.uk (Andrey Mokhov) Date: Mon, 6 Feb 2017 03:19:28 +0000 Subject: Hadrian update References: Message-ID: Hello everyone, This is a quick update on the current state of Hadrian, the new build system for GHC (https://github.com/snowleopard/hadrian). Current status ============ We've been slowly but steadily fixing issues, and are getting close to the stage where GHC-devs can start using Hadrian in their everyday development, perhaps at first alongside Make as a fallback option. Here are key remaining issues and what we plan to do about them: * Build rules for distribution and installation are not fully implemented. I don't understand very well the requirements for these build rules and plan to spend some time with Simon Marlow to complete the implementation in March. If anyone can do this earlier, feel free to volunteer, I'm happy to help. * Ability to build stage1 GHC only. This is a quick fix on Hadrian's side but is currently blocked by Shake refactoring. Neil Mitchell is working on this. * Hadrian can't build GHC in the dynamic way. Jose Calderon has bravely taken up the challenge to fix this oldest surviving ticket (#4). There are a lot of other minor issues and continuous refactoring, but I think the above three are most important. If I missed anything, please let me know. How to help ========== 1) One of the simplest way to help the project is to try Hadrian and report any issues you encounter. To try it, clone it into your GHC tree and run it using "hadrian/build.sh" or "hadrian/build.bat", adding "-j --flavour=quickest" to speed things up. See the README for more details: https://github.com/snowleopard/hadrian 2) Whenever you are doing any changes in the GHC that affect the build system, please CC me (@snowleopard) to the corresponding Phab differential. This can save me a lot of time when Hadrian breaks because of changes in GHC. 3) Email me if you have time to write some code or docs for Hadrian - I'll find a good place to start with. Cheers, Andrey -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Tue Feb 7 11:18:09 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Tue, 7 Feb 2017 11:18:09 +0000 Subject: Handling of unlifted types In-Reply-To: <20170205194926.f810c13e3c76813cb46c4148@mega-nerd.com> References: <20170205194926.f810c13e3c76813cb46c4148@mega-nerd.com> Message-ID: Suppose f1 :: forall (a :: TYPE LiftedPtrRep). a -> Closure f2 :: forall (a :: TYPE UnliftedPtrRep). a -> Closure f3 :: forall (a :: TYPE FloatRep). a -> Closure f3 takes its argument in a floating point register, whereas f1 and f2 take their arguments in a pointer register; so you can't have a function polymorphic in all three. See the paper (have you read it?) You might think that f1 and f2 are more compatible, since they both take a pointer, but consider the call f1 (g x) f2 (h x) For f1 we'll build a thunk for (g x) and pass it to f1. For f2 we'll evaluate (h x) and pass the result to f2. So the calls are different. In short, there is a good reason that we can't be polymorphic here. You'll have to use three different functions. Simon | -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Erik de | Castro Lopo | Sent: 05 February 2017 08:49 | To: ghc-devs at haskell.org | Subject: Handling of unlifted types | | Hi all, | | I'm working on pulling the core parts of Joachim Breitner's ghc-heap-view | library into GHC. The WIP Phab review is here: | | https://phabricator.haskell.org/D3055 | | Currently that library has a function: | | getClosureData :: a -> IO Closure | | which works fine for lifted types. However, some of the supported closure | types in | | | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fhackage.hask | ell.org%2Ftrac%2Fghc%2Fbrowser%2Fincludes%2Frts%2Fstorage%2FInfoTables.h&dat | a=02%7C01%7Csimonpj%40microsoft.com%7Ca5585e761d5149d4f3c608d44da3f3dc%7C72f | 988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636218813965987006&sdata=5ze3nbAjXYm | Ey7H6M4Imtyz7dVH1bjEtloUJWQ2ItWo%3D&reserved=0 | | actually refer to unlifted types, like the `MUT_ARR_PTRS_*` and | `SMALL_MUT_ARR_PTRS_*`. | | I've had a look at the levity polymorphism stuff implemented in ghc 8.0 and | came up with a new type for `getClosureData`: | | getClosureData :: forall (r :: RuntimeRep) (a :: TYPE r). a -> IO | Closure | | but that results in: | | A representation-polymorphic type is not allowed here: | Type: a | Kind: TYPE r | In the type of binder ‘x’ | | Am I barking up the wrong tree here? Any one have a clue on how I might make | progress on this? | | | Erik | -- | ---------------------------------------------------------------------- | Erik de Castro Lopo | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mega- | nerd.com%2F&data=02%7C01%7Csimonpj%40microsoft.com%7Ca5585e761d5149d4f3c608d | 44da3f3dc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636218813965987006&sd | ata=M8bvL%2BDEFYX7Sx%2FAipnRDBBtbFBMcAl7p3Rf86Hbe%2FA%3D&reserved=0 | _______________________________________________ | ghc-devs mailing list | ghc-devs at haskell.org | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haskell | .org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | devs&data=02%7C01%7Csimonpj%40microsoft.com%7Ca5585e761d5149d4f3c608d44da3f3 | dc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636218813965987006&sdata=9AQ | mgEerIRrUeT%2BBRrGriMiAm2oJ7F9mQrMrBAPCQq0%3D&reserved=0 From tjakway at nyu.edu Tue Feb 7 14:29:58 2017 From: tjakway at nyu.edu (Thomas Jakway) Date: Tue, 7 Feb 2017 09:29:58 -0500 Subject: D2903 Needs Review Message-ID: If anyone has a free moment I'd appreciate feedback on D2903: https://phabricator.haskell.org/D2903 -Thomas From ben at well-typed.com Tue Feb 7 14:45:06 2017 From: ben at well-typed.com (Ben Gamari) Date: Tue, 07 Feb 2017 09:45:06 -0500 Subject: D2903 Needs Review In-Reply-To: References: Message-ID: <87vasmdpql.fsf@ben-laptop.smart-cactus.org> Thomas Jakway writes: > If anyone has a free moment I'd appreciate feedback on D2903: > https://phabricator.haskell.org/D2903 > Thanks Thomas! Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at well-typed.com Tue Feb 7 17:25:21 2017 From: ben at well-typed.com (Ben Gamari) Date: Tue, 07 Feb 2017 12:25:21 -0500 Subject: 8.2.1 Status Message-ID: <87k291ewvy.fsf@ben-laptop.smart-cactus.org> Hello everyone, Over the last week I've been busily helping Richard finish up the last bits destined for 8.2.1. At this point things are looking okay, although there is still a bit of a push necessary before we can cut an 8.2 branch, * We have decided to punt the separation of * and Constraint (#11715) off to 8.4 due to design complications * The generalization of (->)'s kind (D2038) is done and passes the testsuite save a performance regression which I am currently investigating * The recent levity polymorphism work regressed the profiled build (#13223) which I am working on fixing. * The type-indexed Typeable patch works save one regression which I am working on with Simon * Merge the subset of OverloadedRecordFields wanted for 8.2 * Update boot library submodules It looks likely that these tasks will require a majority of the rest of this week to work out. Consequently, I'm currently aiming to cut the branch for 8.2 on Friday. I'll then spend a few days testing the tree against Hackage and, if nothing goes terribly awry, likely cut a source release mid-to-late next week. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From simonpj at microsoft.com Tue Feb 7 17:44:49 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Tue, 7 Feb 2017 17:44:49 +0000 Subject: [Diffusion] [Build Failed] rGHCb8f58d79ee3e: Another improvement to SetLevels In-Reply-To: <20170207164522.114349.64177.B19CD7E8@phabricator.haskell.org> References: <20170207164522.114349.64177.B19CD7E8@phabricator.haskell.org> Message-ID: https://phabricator.haskell.org/harbormaster/build/20383/ There's something very odd here. I got "stat too good" solidly, so I reduced the number. But Harbormaster consistently allocates more 6.6% more than my 64-bit machine. I have no idea why. I reported this some days ago. It only seems to happen on this test. Anyway, I have to go home, but I suppose that we can "solve" this by giving it a wider bound. Feel free to do that. Or center it on what Harbormaster says, and I'll get used to filtering out that failure from my own builds. sorry to leave this loose end. It's annoying Simon From: noreply at phabricator.haskell.org [mailto:noreply at phabricator.haskell.org] Sent: 07 February 2017 17:11 To: Simon Peyton Jones Subject: [Diffusion] [Build Failed] rGHCb8f58d79ee3e: Another improvement to SetLevels Harbormaster failed to build B13774: rGHCb8f58d79ee3e: Another improvement to SetLevels! BRANCHES master USERS simonpj (Author) COMMIT https://phabricator.haskell.org/rGHCb8f58d79ee3e EMAIL PREFERENCES https://phabricator.haskell.org/settings/panel/emailpreferences/ To: simonpj, Harbormaster -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Tue Feb 7 23:09:14 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Tue, 07 Feb 2017 18:09:14 -0500 Subject: Build time over travis time limit again Message-ID: <1486508954.28707.1.camel@joachim-breitner.de> Hi, in case you are getting failed build reports from Travis and are wondering what’s wrong: Since a few commits our gradually increasing build time seems to have hit the next Travis build time limit (which was already raised to 70 minutes for us). I tried a few obvious knobs, but none of them would help. I will ask for more time from them. But if you know a way to keep build times down, that’d be great. Does Hadrian speed up a build from scratch? Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From george.colpitts at gmail.com Wed Feb 8 01:34:05 2017 From: george.colpitts at gmail.com (George Colpitts) Date: Wed, 08 Feb 2017 01:34:05 +0000 Subject: 8.2.1 Status In-Reply-To: <87k291ewvy.fsf@ben-laptop.smart-cactus.org> References: <87k291ewvy.fsf@ben-laptop.smart-cactus.org> Message-ID: Hi Ben It would be good if the status page ( https://ghc.haskell.org/trac/ghc/wiki/Status/GHC-8.2.1) could be updated with what we will actually be getting. In particular, according to https://ghc.haskell.org/trac/ghc/ticket/10074 Implement the 'Improved LLVM Backend' proposal has been deferred to 8.4.1 Thanks George On Tue, Feb 7, 2017 at 1:25 PM Ben Gamari wrote: > Hello everyone, > > Over the last week I've been busily helping Richard finish up the last > bits destined for 8.2.1. At this point things are looking okay, although > there is still a bit of a push necessary before we can cut an 8.2 > branch, > > * We have decided to punt the separation of * and Constraint (#11715) > off to 8.4 due to design complications > > * The generalization of (->)'s kind (D2038) is done and passes the > testsuite save a performance regression which I am currently > investigating > > * The recent levity polymorphism work regressed the profiled build > (#13223) which I am working on fixing. > > * The type-indexed Typeable patch works save one regression which I am > working on with Simon > > * Merge the subset of OverloadedRecordFields wanted for 8.2 > > * Update boot library submodules > > It looks likely that these tasks will require a majority of the rest of > this week to work out. Consequently, I'm currently aiming to cut the > branch for 8.2 on Friday. I'll then spend a few days testing the tree > against Hackage and, if nothing goes terribly awry, likely cut a source > release mid-to-late next week. > > Cheers, > > - Ben > > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at well-typed.com Wed Feb 8 01:52:44 2017 From: ben at well-typed.com (Ben Gamari) Date: Tue, 07 Feb 2017 20:52:44 -0500 Subject: 8.2.1 Status In-Reply-To: References: <87k291ewvy.fsf@ben-laptop.smart-cactus.org> Message-ID: <87d1ete9eb.fsf@ben-laptop.smart-cactus.org> George Colpitts writes: > Hi Ben > > It would be good if the status page ( > https://ghc.haskell.org/trac/ghc/wiki/Status/GHC-8.2.1) could be updated > with what we will actually be getting. In particular, according to > https://ghc.haskell.org/trac/ghc/ticket/10074 Implement the 'Improved LLVM > Backend' proposal has been deferred to 8.4.1 > Thanks George. I've updated the list. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From demiobenour at gmail.com Wed Feb 8 03:52:30 2017 From: demiobenour at gmail.com (Demi Obenour) Date: Tue, 7 Feb 2017 22:52:30 -0500 Subject: ghc-devs Digest, Vol 162, Issue 13 In-Reply-To: References: Message-ID: What if the function is strict? If the function is strict, then no think is required. Indeed, I see unsafe casts from unlifted to lifted types in at least two places in GHC (the bytecode linker and code related to hs_put_mvar). The only absolute limitation is GC, which doesn't care either way. One caveat is that such a function CANNOT be called as if it wasn't levity-polymorphic, because of precisely the issue you mentioned — the caller, not the callee, is responsible for evaluating the arguments. So this would need extensions to the kind system, as well as special handling in the compiler. On Feb 7, 2017 7:20 AM, wrote: > Send ghc-devs mailing list submissions to > ghc-devs at haskell.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > or, via email, send a message with subject or body 'help' to > ghc-devs-request at haskell.org > > You can reach the person managing the list at > ghc-devs-owner at haskell.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of ghc-devs digest..." > > > Today's Topics: > > 1. RE: Handling of unlifted types (Simon Peyton Jones) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 7 Feb 2017 11:18:09 +0000 > From: Simon Peyton Jones > To: Erik de Castro Lopo , "ghc-devs at haskell.org" > > Subject: RE: Handling of unlifted types > Message-ID: > namprd21.prod.outlook.com> > > Content-Type: text/plain; charset="utf-8" > > Suppose > > f1 :: forall (a :: TYPE LiftedPtrRep). a -> Closure > f2 :: forall (a :: TYPE UnliftedPtrRep). a -> Closure > f3 :: forall (a :: TYPE FloatRep). a -> Closure > > f3 takes its argument in a floating point register, whereas f1 and f2 take > their arguments in a pointer register; so you can't have a function > polymorphic in all three. See the paper (have you read it?) > > You might think that f1 and f2 are more compatible, since they both take a > pointer, but consider the call > f1 (g x) > f2 (h x) > > For f1 we'll build a thunk for (g x) and pass it to f1. For f2 we'll > evaluate (h x) and pass the result to f2. So the calls are different. > > In short, there is a good reason that we can't be polymorphic here. You'll > have to use three different functions. > > Simon > > > | -----Original Message----- > | From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Erik > de > | Castro Lopo > | Sent: 05 February 2017 08:49 > | To: ghc-devs at haskell.org > | Subject: Handling of unlifted types > | > | Hi all, > | > | I'm working on pulling the core parts of Joachim Breitner's > ghc-heap-view > | library into GHC. The WIP Phab review is here: > | > | https://phabricator.haskell.org/D3055 > | > | Currently that library has a function: > | > | getClosureData :: a -> IO Closure > | > | which works fine for lifted types. However, some of the supported > closure > | types in > | > | > | https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fhackage.hask > | ell.org%2Ftrac%2Fghc%2Fbrowser%2Fincludes%2Frts% > 2Fstorage%2FInfoTables.h&dat > | a=02%7C01%7Csimonpj%40microsoft.com%7Ca5585e761d5149d4f3c608d44da3 > f3dc%7C72f > | 988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636218813965987006& > sdata=5ze3nbAjXYm > | Ey7H6M4Imtyz7dVH1bjEtloUJWQ2ItWo%3D&reserved=0 > | > | actually refer to unlifted types, like the `MUT_ARR_PTRS_*` and > | `SMALL_MUT_ARR_PTRS_*`. > | > | I've had a look at the levity polymorphism stuff implemented in ghc 8.0 > and > | came up with a new type for `getClosureData`: > | > | getClosureData :: forall (r :: RuntimeRep) (a :: TYPE r). a -> IO > | Closure > | > | but that results in: > | > | A representation-polymorphic type is not allowed here: > | Type: a > | Kind: TYPE r > | In the type of binder ‘x’ > | > | Am I barking up the wrong tree here? Any one have a clue on how I might > make > | progress on this? > | > | > | Erik > | -- > | ---------------------------------------------------------------------- > | Erik de Castro Lopo > | https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fwww.mega- > | nerd.com%2F&data=02%7C01%7Csimonpj%40microsoft.com% > 7Ca5585e761d5149d4f3c608d > | 44da3f3dc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0% > 7C636218813965987006&sd > | ata=M8bvL%2BDEFYX7Sx%2FAipnRDBBtbFBMcAl7p3Rf86Hbe%2FA%3D&reserved=0 > | _______________________________________________ > | ghc-devs mailing list > | ghc-devs at haskell.org > | https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fmail.haskell > | .org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- > | devs&data=02%7C01%7Csimonpj%40microsoft.com% > 7Ca5585e761d5149d4f3c608d44da3f3 > | dc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0% > 7C636218813965987006&sdata=9AQ > | mgEerIRrUeT%2BBRrGriMiAm2oJ7F9mQrMrBAPCQq0%3D&reserved=0 > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > > > ------------------------------ > > End of ghc-devs Digest, Vol 162, Issue 13 > ***************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrey.mokhov at newcastle.ac.uk Wed Feb 8 12:47:27 2017 From: andrey.mokhov at newcastle.ac.uk (Andrey Mokhov) Date: Wed, 8 Feb 2017 12:47:27 +0000 Subject: Build time over travis time limit again References: Message-ID: Hi Joachim, > Does Hadrian speed up a build from scratch? Hadrian can build GHC on Windows (AppVeyor) and Linux (Travis) CI instances in about 40 mins using the 'quickest' build flavour (no optimisation/docs). https://ci.appveyor.com/project/snowleopard/hadrian https://travis-ci.org/snowleopard/hadrian On Travis OSX we recently started to time out (jobs are terminated at 48 mins), even though I'm using another trick to save build time on OSX: building with the --integer-simple flag, which skips building the GMP library. Cheers, Andrey From mail at joachim-breitner.de Wed Feb 8 17:04:25 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Wed, 08 Feb 2017 12:04:25 -0500 Subject: Build time over travis time limit again In-Reply-To: References: Message-ID: <1486573465.19338.2.camel@joachim-breitner.de> Hi, Am Mittwoch, den 08.02.2017, 12:47 +0000 schrieb Andrey Mokhov: > Does Hadrian speed up a build from scratch? > > Hadrian can build GHC on Windows (AppVeyor) and Linux (Travis) CI > instances in about 40 mins using the 'quickest' build flavour (no > optimisation/docs).  > > https://ci.appveyor.com/project/snowleopard/hadrian > https://travis-ci.org/snowleopard/hadrian > > On Travis OSX we recently started to time out (jobs are terminated at > 48 mins), even though I'm using another trick to save build time on > OSX: building with the --integer-simple flag, which skips building > the GMP library. does the testsuite (excluding perf tests, I guess) work with the quickest flavor? Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From ben at well-typed.com Wed Feb 8 17:16:11 2017 From: ben at well-typed.com (Ben Gamari) Date: Wed, 08 Feb 2017 12:16:11 -0500 Subject: Build time over travis time limit again In-Reply-To: <1486573465.19338.2.camel@joachim-breitner.de> References: <1486573465.19338.2.camel@joachim-breitner.de> Message-ID: <874m04eh7o.fsf@ben-laptop.smart-cactus.org> Joachim Breitner writes: > Hi, > > Am Mittwoch, den 08.02.2017, 12:47 +0000 schrieb Andrey Mokhov: >> Does Hadrian speed up a build from scratch? >> >> Hadrian can build GHC on Windows (AppVeyor) and Linux (Travis) CI >> instances in about 40 mins using the 'quickest' build flavour (no >> optimisation/docs).  >> >> https://ci.appveyor.com/project/snowleopard/hadrian >> https://travis-ci.org/snowleopard/hadrian >> >> On Travis OSX we recently started to time out (jobs are terminated at >> 48 mins), even though I'm using another trick to save build time on >> OSX: building with the --integer-simple flag, which skips building >> the GMP library. > > does the testsuite (excluding perf tests, I guess) work with the > quickest flavor? > Some ways won't work I would imagine, but I don't see why not. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ryan.gl.scott at gmail.com Thu Feb 9 16:20:22 2017 From: ryan.gl.scott at gmail.com (Ryan Scott) Date: Thu, 9 Feb 2017 11:20:22 -0500 Subject: 8.2.1 Status Message-ID: Hi Ben, Sorry for not asking this sooner, but I'd like to merge some form of https://phabricator.haskell.org/D2961 in time for 8.2 if possible. Sadly, doing it "the right way" (according to Simon) is proving to be extremely challenging. A previous iteration of D2961 does work (albeit the code is not as pretty as it ought to be). Are you still planning to cut the 8.2 release tomorrow? If so, I think I'll revert back to the working version of D2961 and merge that, and leave doing it the right way as future work. Ryan S. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrey.mokhov at newcastle.ac.uk Thu Feb 9 17:32:23 2017 From: andrey.mokhov at newcastle.ac.uk (Andrey Mokhov) Date: Thu, 9 Feb 2017 17:32:23 +0000 Subject: Build time over travis time limit again References: Message-ID: Joachim, Ben, I gave it a try on my machine. First of all, we currently need "--flavour=quick" instead of "quickest" because the latter builds only vanilla RTS. If I do: ./build.bat -j --flavour=quick ./build.bat -j --flavour=quick validate Then the testsuite completes, but I get a lot of errors, particularly in "ghci/", "perf/" and "th/". Most of them can probably be fixed relatively easily in Hadrian, but this requires a good understanding of which GHC features these tests actually depend on. I'll create an issue in the Hadrian repo to track down these testsuite failures and will CC you. Cheers, Andrey From mail at joachim-breitner.de Thu Feb 9 18:13:10 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Thu, 09 Feb 2017 13:13:10 -0500 Subject: Build time over travis time limit again In-Reply-To: <1486508954.28707.1.camel@joachim-breitner.de> References: <1486508954.28707.1.camel@joachim-breitner.de> Message-ID: <1486663990.13286.2.camel@joachim-breitner.de> Hi, Am Dienstag, den 07.02.2017, 18:09 -0500 schrieb Joachim Breitner: > I will ask for more time from them. But if you know a way to keep > build times down, that’d be great. we got 90 minutes now… Due to the broken window effect, we now have two failures: TH_addCStub1(normal) 4122 of 5714 [0, 0, 0]--- /tmp/ghctest-u7xmp5/test   spaces/./th/TH_addCStub2.run/TH_addCStub2.stderr.normalised 2017-02-09 17:41:03.087318367 +0000 +++ /tmp/ghctest-u7xmp5/test   spaces/./th/TH_addCStub2.run/TH_addCStub2.comp.stderr.normalised 2017-02-09 17:41:03.087318367 +0000 @@ -1,6 +1,4 @@    TH_addCStub2.hs:13:13:       expected ‘;’, ‘,’ or ‘)’ before ‘{’ token -          [ "#include " -                 ^  `gcc' failed in phase `C Compiler'. (Exit code: 1) --- /tmp/ghctest-u7xmp5/test   spaces/./th/TH_addCStub2.run/TH_addCStub2.stderr.normalised 2017-02-09 17:41:03.747318367 +0000 +++ /tmp/ghctest-u7xmp5/test   spaces/./th/TH_addCStub2.run/TH_addCStub2.comp.stderr.normalised 2017-02-09 17:41:03.751318367 +0000 @@ -1,6 +1,4 @@    TH_addCStub2.hs:13:13:       expected ‘;’, ‘,’ or ‘)’ before ‘{’ token -          [ "#include " -                 ^  `gcc' failed in phase `C Compiler'. (Exit code: 1) =====> TH_addCStub2(normal) 4123 of 5714 [0, 0, 0] Any idea what these tests are about? Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From john_ericson at alumni.brown.edu Thu Feb 9 18:26:20 2017 From: john_ericson at alumni.brown.edu (John Ericson) Date: Thu, 9 Feb 2017 13:26:20 -0500 Subject: Installation failure building GHC targeting 64-bit Android Message-ID: Hello all, I am working on Nixpkgs support for cross-compiling Haskell. GHC finishes building but fails during installation. As far as I can tell, the error seems to be that `make install` fails after it thinks it has installed haddock, looking for the installed one and not finding it. I've attached a build log and the top-level config.log. In a moment I'll push all relevant Nix expressions in case anyone wants to reproduce exactly. Thanks, John (aka Ericson2314 on GitHub; aka Sonarpulse on Freenode) -------------- next part -------------- A non-text attachment was scrubbed... Name: 6hp1n5fl0w571njkv0flkb2jmzsafq-aarch64-unknown-linux-gnu-ghc-8.1.20170106.drv.bz2 Type: application/x-bzip2 Size: 144716 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: config.log Type: application/octet-stream Size: 671229 bytes Desc: not available URL: From ben at well-typed.com Thu Feb 9 19:12:26 2017 From: ben at well-typed.com (Ben Gamari) Date: Thu, 09 Feb 2017 14:12:26 -0500 Subject: 8.2.1 Status In-Reply-To: References: Message-ID: <87a89vch5x.fsf@ben-laptop.smart-cactus.org> Ryan Scott writes: > Hi Ben, > Hi Ryan, > Sorry for not asking this sooner, but I'd like to merge some form of > https://phabricator.haskell.org/D2961 in time for 8.2 if possible. Sadly, > doing it "the right way" (according to Simon) is proving to be extremely > challenging. A previous iteration of D2961 does work (albeit the code is > not as pretty as it ought to be). > > Are you still planning to cut the 8.2 release tomorrow? If so, I think I'll > revert back to the working version of D2961 and merge that, and leave doing > it the right way as future work. > Indeed I was hoping to and the way things are looking at the moment I believe this plan is still feasible. I would be fine with reverting back to the old version. Perhaps you would like to update the Diff appropriately? Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From john_ericson at alumni.brown.edu Thu Feb 9 20:09:43 2017 From: john_ericson at alumni.brown.edu (John Ericson) Date: Thu, 9 Feb 2017 15:09:43 -0500 Subject: Installation failure building GHC targeting 64-bit Android In-Reply-To: References: Message-ID: There error seems to be on the Nix side of things, after make install. I'll report back once I know for sure. On Thu, Feb 9, 2017 at 1:26 PM, John Ericson wrote: > Hello all, > > I am working on Nixpkgs support for cross-compiling Haskell. GHC > finishes building but fails during installation. As far as I can tell, > the error seems to be that `make install` fails after it thinks it has > installed haddock, looking for the installed one and not finding it. > > I've attached a build log and the top-level config.log. In a moment > I'll push all relevant Nix expressions in case anyone wants to > reproduce exactly. > > Thanks, > > John > > (aka Ericson2314 on GitHub; aka Sonarpulse on Freenode) From ben at well-typed.com Thu Feb 9 23:29:39 2017 From: ben at well-typed.com (Ben Gamari) Date: Thu, 09 Feb 2017 18:29:39 -0500 Subject: Build time over travis time limit again In-Reply-To: References: Message-ID: <87wpczaqos.fsf@ben-laptop.smart-cactus.org> Andrey Mokhov writes: > Joachim, Ben, > > I gave it a try on my machine. > > First of all, we currently need "--flavour=quick" instead of "quickest" because the latter builds only vanilla RTS. > > If I do: > > ./build.bat -j --flavour=quick > ./build.bat -j --flavour=quick validate > > Then the testsuite completes, but I get a lot of errors, particularly > in "ghci/", "perf/" and "th/". Most of them can probably be fixed > relatively easily in Hadrian, but this requires a good understanding > of which GHC features these tests actually depend on. I'll create an > issue in the Hadrian repo to track down these testsuite failures and > will CC you. > I'm actually not sure it will be so easy for fix some of these. I have seen breakage of the ghci tests in non-validate build configurations (see #13243); this can likely be fixed but it will require some digging as it's not apparent to me what is going wrong. The performance tests will be quite sensitive to optimization level. That being said, perhaps we could make performance testsuite failures non-fatal for the Travis tests. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From mail at joachim-breitner.de Thu Feb 9 23:43:17 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Thu, 09 Feb 2017 18:43:17 -0500 Subject: Build time over travis time limit again In-Reply-To: <87wpczaqos.fsf@ben-laptop.smart-cactus.org> References: <87wpczaqos.fsf@ben-laptop.smart-cactus.org> Message-ID: <1486683797.17036.0.camel@joachim-breitner.de> Hi, Am Donnerstag, den 09.02.2017, 18:29 -0500 schrieb Ben Gamari: > That being said, perhaps > we could make performance testsuite failures non-fatal for the Travis > tests. they are already disabled:  - THREADS=3 SKIP_PERF_TESTS=YES VERBOSE=2 ./validate --fast --quiet Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From ryan.gl.scott at gmail.com Fri Feb 10 15:35:50 2017 From: ryan.gl.scott at gmail.com (Ryan Scott) Date: Fri, 10 Feb 2017 10:35:50 -0500 Subject: 8.2.1 Status In-Reply-To: <87a89vch5x.fsf@ben-laptop.smart-cactus.org> References: <87a89vch5x.fsf@ben-laptop.smart-cactus.org> Message-ID: Actually, I was able to make "the right way" work after all, thanks to SPJ's help! I'll merge it today (after Harbormaster validates it). Ryan S. On Thu, Feb 9, 2017 at 2:12 PM, Ben Gamari wrote: > Ryan Scott writes: > > > Hi Ben, > > > Hi Ryan, > > > Sorry for not asking this sooner, but I'd like to merge some form of > > https://phabricator.haskell.org/D2961 in time for 8.2 if possible. > Sadly, > > doing it "the right way" (according to Simon) is proving to be extremely > > challenging. A previous iteration of D2961 does work (albeit the code is > > not as pretty as it ought to be). > > > > Are you still planning to cut the 8.2 release tomorrow? If so, I think > I'll > > revert back to the working version of D2961 and merge that, and leave > doing > > it the right way as future work. > > > Indeed I was hoping to and the way things are looking at the moment I > believe this plan is still feasible. I would be fine with reverting back > to the old version. Perhaps you would like to update the Diff > appropriately? > > Cheers, > > - Ben > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Fri Feb 10 21:01:43 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Fri, 10 Feb 2017 16:01:43 -0500 Subject: Non-wip/* branches Message-ID: <1486760503.14922.1.camel@joachim-breitner.de> Hi, > facundominguez added a comment. >  > @nomeata please, could you remove the branches fd/fix-travis and  > fd/fix-travis2? Some server hook is preventing me from doing so. turns out I cannot do that either (which I knew). From experience, I know that I can create, force-push and delete branches of the form wip/*, but can only create and fast-forward-push to branches that are not of this form. This is mostly sensible, but it means that I cannot undo an accidental branch creation outside the wip/* branch. Ben, can you delete the two mentioned branches? And more general, would it make sense to prevent common footfolk like me form creating branches outside the wip/* namespace? This ensures that I can always clean up a mess I make. I can still ask some of the super admins, like you, should I for some reason require a branch outside the wip/* namespace. Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From ben at well-typed.com Fri Feb 10 22:25:54 2017 From: ben at well-typed.com (Ben Gamari) Date: Fri, 10 Feb 2017 17:25:54 -0500 Subject: Non-wip/* branches In-Reply-To: <1486760503.14922.1.camel@joachim-breitner.de> References: <1486760503.14922.1.camel@joachim-breitner.de> Message-ID: <87o9y9bs3x.fsf@ben-laptop.smart-cactus.org> Joachim Breitner writes: > Hi, > >> facundominguez added a comment. >>  >> @nomeata please, could you remove the branches fd/fix-travis and  >> fd/fix-travis2? Some server hook is preventing me from doing so. > > turns out I cannot do that either (which I knew). From experience, I > know that I can create, force-push and delete branches of the form > wip/*, but can only create and fast-forward-push to branches that are > not of this form. > > This is mostly sensible, but it means that I cannot undo an accidental > branch creation outside the wip/* branch. > > Ben, can you delete the two mentioned branches? > Sure, but I need to run out at the moment so it will take a few hours. Cheers, - Ben > And more general, would it make sense to prevent common footfolk like > me form creating branches outside the wip/* namespace? This ensures > that I can always clean up a mess I make. I can still ask some of the > super admins, like you, should I for some reason require a branch > outside the wip/* namespace. > This sounds like a reasonable proposal to me. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From rwbarton at gmail.com Fri Feb 10 22:55:02 2017 From: rwbarton at gmail.com (Reid Barton) Date: Fri, 10 Feb 2017 17:55:02 -0500 Subject: ghc speed log build script In-Reply-To: References: Message-ID: Hi Joachim, Is the script used to do the builds for perf.haskell.org/ghc/ available somewhere? I couldn't find it poking around your GitHub repositories. I assume from the line "Try to match validate settings" that the build script creates a custom build.mk or similar. I'd like to know exactly what it does so that I can experiment with custom build settings without worrying about them being overridden by your build script. Regards, Reid Barton -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Sat Feb 11 01:59:54 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Fri, 10 Feb 2017 20:59:54 -0500 Subject: ghc speed log build script In-Reply-To: References: Message-ID: <1486778394.14922.3.camel@joachim-breitner.de> Hi, they are floating around in various places and once lived in the codespeed repository. I just put them here, slightly easier to find: https://github.com/nomeata/gipeda/tree/master/ghc Greetings, Joachim Am Freitag, den 10.02.2017, 17:55 -0500 schrieb Reid Barton: > Hi Joachim, > > Is the script used to do the builds for perf.haskell.org/ghc/ > available somewhere? I couldn't find it poking around your GitHub > repositories. > > I assume from the line "Try to match validate settings" that the > build script creates a custom build.mk or similar. I'd like to know > exactly what it does so that I can experiment with custom build > settings without worrying about them being overridden by your build > script. > > Regards, > Reid Barton -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From siddu.druid at gmail.com Sat Feb 11 10:34:11 2017 From: siddu.druid at gmail.com (Siddharth Bhat) Date: Sat, 11 Feb 2017 10:34:11 +0000 Subject: [GHC] #12636: ProfHeap's printf modifiers are incorrect In-Reply-To: <059.f71528e5ca29b823dd918424c3f53d35@haskell.org> References: <044.403f3f75ee70a8b1fc6666278b9b5226@haskell.org> <059.f71528e5ca29b823dd918424c3f53d35@haskell.org> Message-ID: I believe the guarantee at that chunk of code is that void_total of the era will be >= 0. I could add an asset at those sections of code if need be. If not, what is the correct type to be used here? I think size_t is reasonable as none of them are supposed to be negative in the first place. On Sat 11 Feb, 2017, 3:51 PM GHC, wrote: > #12636: ProfHeap's printf modifiers are incorrect > -------------------------------------+------------------------------------- > Reporter: Phyx- | Owner: bollu > Type: bug | Status: new > Priority: normal | Milestone: > Component: Runtime System | Version: 8.0.1 > Resolution: | Keywords: newcomer > Operating System: Windows | Architecture: > | Unknown/Multiple > Type of failure: None/Unknown | Test Case: > Blocked By: | Blocking: > Related Tickets: | Differential Rev(s): > Wiki Page: | > -------------------------------------+------------------------------------- > > Comment (by Phyx-): > > I actually question the use of `ssize_t` at all for these values. I think > the calculations violate the expected value ranges of `ssize_t` namely > with > > {{{ > censuses[t].void_total += size; > censuses[era].void_total -= size; > }}} > > So I think the types in `_counter` are wrong and have the potential to do > an unsigned underflow as `ssize_t` is only guaranteed to be able to store > values between `[-1, {SSIZE_MAX}]`[1] > > [1] > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html > > -- > Ticket URL: > GHC > The Glasgow Haskell Compiler > -- Sending this from my phone, please excuse any typos! -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at well-typed.com Sun Feb 12 02:37:25 2017 From: ben at well-typed.com (Ben Gamari) Date: Sat, 11 Feb 2017 21:37:25 -0500 Subject: Trac maintenance Message-ID: <878tpcb0d6.fsf@ben-laptop.smart-cactus.org> Hello everyone, I'll be doing some maintenance on the Trac installation in a few minutes. It may be a bit flaky while this happens. Sorry for the inconvenience! Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at well-typed.com Sun Feb 12 02:56:58 2017 From: ben at well-typed.com (Ben Gamari) Date: Sat, 11 Feb 2017 21:56:58 -0500 Subject: Trac maintenance In-Reply-To: <878tpcb0d6.fsf@ben-laptop.smart-cactus.org> References: <878tpcb0d6.fsf@ben-laptop.smart-cactus.org> Message-ID: <8760kgazgl.fsf@ben-laptop.smart-cactus.org> Ben Gamari writes: > Hello everyone, > > I'll be doing some maintenance on the Trac installation in a few > minutes. It may be a bit flaky while this happens. Sorry for the > inconvenience! > Alright, I believe that should do it. We are now running Trac 1.2. Let me know if you encounter any trouble! Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From mail at joachim-breitner.de Sun Feb 12 03:11:32 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Sat, 11 Feb 2017 22:11:32 -0500 Subject: Trac maintenance In-Reply-To: <8760kgazgl.fsf@ben-laptop.smart-cactus.org> References: <878tpcb0d6.fsf@ben-laptop.smart-cactus.org> <8760kgazgl.fsf@ben-laptop.smart-cactus.org> Message-ID: <1486869092.31859.0.camel@joachim-breitner.de> Hi, Am Samstag, den 11.02.2017, 21:56 -0500 schrieb Ben Gamari: > Ben Gamari writes: > > > Hello everyone, > > > > I'll be doing some maintenance on the Trac installation in a few > > minutes. It may be a bit flaky while this happens. Sorry for the > > inconvenience! > > > > Alright, I believe that should do it. We are now running Trac 1.2. Let > me know if you encounter any trouble! upon a quick try, I am missing the live preview of changes as I edit a ticket. Oh, and when I try to edit a ticket I get AttributeError: 'Environment' object has no attribute 'get_db_cnx' Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From matthewtpickering at gmail.com Sun Feb 12 12:01:14 2017 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Sun, 12 Feb 2017 12:01:14 +0000 Subject: Trac maintenance In-Reply-To: <8760kgazgl.fsf@ben-laptop.smart-cactus.org> References: <878tpcb0d6.fsf@ben-laptop.smart-cactus.org> <8760kgazgl.fsf@ben-laptop.smart-cactus.org> Message-ID: Were there any particular features that we should know about which motivated the upgrade? Displaying real names is slightly inconvenient now for the purposes of assigning and ccing tickets as you must still use the user names for those fields. Matt On Sun, Feb 12, 2017 at 2:56 AM, Ben Gamari wrote: > Ben Gamari writes: > >> Hello everyone, >> >> I'll be doing some maintenance on the Trac installation in a few >> minutes. It may be a bit flaky while this happens. Sorry for the >> inconvenience! >> > Alright, I believe that should do it. We are now running Trac 1.2. Let > me know if you encounter any trouble! > > Cheers, > > - Ben > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > From kgadek at gmail.com Sun Feb 12 14:34:24 2017 From: kgadek at gmail.com (=?utf-8?Q?Konrad_G=C4=85dek?=) Date: Sun, 12 Feb 2017 15:34:24 +0100 Subject: Trac maintenance Message-ID: > upon a quick try, I am missing the live preview of changes as I edit a ticket. > > Oh, and when I try to edit a ticket I get > > AttributeError: 'Environment' object has no attribute 'get_db_cnx' I get the same error when I try to create new ticket. -- Konrad Gądek From mail at joachim-breitner.de Sun Feb 12 15:31:40 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Sun, 12 Feb 2017 10:31:40 -0500 Subject: Nofib runtimes sensitivity to RTS changes Message-ID: <1486913500.4545.1.camel@joachim-breitner.de> Hi, this is mostly a rant, targeted at the very vague fact that runtime performance benchmarks are so damn hard. This commit just came in: https://git.haskell.org/ghc.git/commitdiff/56c9bb39246f9ffd8ed41a0656bfe8e60d23be57 Clearly, only parts of the profiling RTS have changed. This is what perf.haskell.org measures: https://perf.haskell.org/ghc/#revision/56c9bb39246f9ffd8ed41a0656bfe8e60d23be57 Highlights: nofib/time/cryptarithm1  0.502  + 9.36%  0.549  seconds nofib/time/fasta  0.406  + 4.43%  0.424  seconds These changes are permanent, i.e. the following commits consistently give the higher runtimes. But nofib does not even run the profiling RTS! *very audible sigh* (Conclusion: Ignore runtime changes in nofib when the RTS has changed, the results are simply unusable.) I also wonder if we can adjust the input and parameters to nofib (in a new “veryslow” setting) to get them all run in a few seconds on modern hardware, instead of subseconds. Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From ben at smart-cactus.org Sun Feb 12 15:33:44 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Sun, 12 Feb 2017 10:33:44 -0500 Subject: Trac maintenance In-Reply-To: References: Message-ID: <8737fjbezr.fsf@ben-laptop.smart-cactus.org> Konrad Gądek writes: >> upon a quick try, I am missing the live preview of changes as I edit a ticket. >> >> Oh, and when I try to edit a ticket I get >> >> AttributeError: 'Environment' object has no attribute 'get_db_cnx' > > I get the same error when I try to create new ticket. > Thanks for letting me know. I believe this is now fixed. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at well-typed.com Sun Feb 12 15:39:13 2017 From: ben at well-typed.com (Ben Gamari) Date: Sun, 12 Feb 2017 10:39:13 -0500 Subject: Trac maintenance In-Reply-To: References: <878tpcb0d6.fsf@ben-laptop.smart-cactus.org> <8760kgazgl.fsf@ben-laptop.smart-cactus.org> Message-ID: <87zihra066.fsf@ben-laptop.smart-cactus.org> Matthew Pickering writes: > Were there any particular features that we should know about which > motivated the upgrade? > The primary motivations were to get better spam filtering for user registration and to fix syntax highlighting. > Displaying real names is slightly inconvenient now for the purposes of > assigning and ccing tickets as you must still use the user names for > those fields. > That is true; I'll see what can be done about this. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at smart-cactus.org Sun Feb 12 15:56:44 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Sun, 12 Feb 2017 10:56:44 -0500 Subject: Nofib runtimes sensitivity to RTS changes In-Reply-To: <1486913500.4545.1.camel@joachim-breitner.de> References: <1486913500.4545.1.camel@joachim-breitner.de> Message-ID: <87wpcv9zcz.fsf@ben-laptop.smart-cactus.org> Joachim Breitner writes: > Hi, > > this is mostly a rant, targeted at the very vague fact that runtime > performance benchmarks are so damn hard. > > This commit just came in: > https://git.haskell.org/ghc.git/commitdiff/56c9bb39246f9ffd8ed41a0656bfe8e60d23be57 > Clearly, only parts of the profiling RTS have changed. > > This is what perf.haskell.org measures: > https://perf.haskell.org/ghc/#revision/56c9bb39246f9ffd8ed41a0656bfe8e60d23be57 > Highlights: > nofib/time/cryptarithm1  0.502  + 9.36%  0.549  seconds > nofib/time/fasta  0.406  + 4.43%  0.424  seconds > These changes are permanent, i.e. the following commits consistently > give the higher runtimes. > > But nofib does not even run the profiling RTS! > > *very audible sigh* > > (Conclusion: Ignore runtime changes in nofib when the RTS has changed, > the results are simply unusable.) > > I also wonder if we can adjust the input and parameters to nofib (in a > new “veryslow” setting) to get them all run in a few seconds on modern > hardware, instead of subseconds. I think this would be a very worthwhile effort. Sub-second runtimes really are just plain useless. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at smart-cactus.org Sun Feb 12 17:25:56 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Sun, 12 Feb 2017 12:25:56 -0500 Subject: Convincing GHC not to produce unfoldings during simplification Message-ID: <87tw7z9v8b.fsf@ben-laptop.smart-cactus.org> I'm currently trying to get the interface file bulk imposed by TTypeable down. The branch will currently produce two top-level bindings for each TyCon. For instance, given the type, data Proxy (a :: k) = Proxy the branch will produce (ignoring the promoted datacon for a moment), $tcProxy :: TyCon $tcProxy = GHC.Types.TyCon fpr1 fpr2 -- fingerprints $trModule (GHC.Types.TrNameS "Proxy"#) 1 krep_aebr krep_aebr :: KindRep krep_aebr [InlPrag=NOINLINE CONLIKE] = GHC.Types.KindRepFun (GHC.Types.KindRepVar 0) (GHC.Types.KindRepTYPE GHC.Types.LiftedRep) Note that the KindRep has been marked as NOINLINE; I do this intentionally as these things can grow quite large (consider, for instance, the kind of a promoted tuple constructor). This is especially true as the simplifier tends to float out the constituents of the KindRep. After the first simplifier phase we end up with, krep_sebQ :: GHC.Types.KindRep [LclId, Unf=Unf{Src=, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 0}] krep_sebQ = GHC.Types.$WKindRepVar (GHC.Types.I# 0#) krep_sebR :: GHC.Types.KindRep [LclId, Unf=Unf{Src=, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 20 0}] krep_sebR = GHC.Types.$WKindRepTYPE GHC.Types.LiftedRep krep_aebr [InlPrag=NOINLINE CONLIKE] :: GHC.Types.KindRep [LclId, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}] krep_aebr = GHC.Types.KindRepFun krep_sebQ krep_sebR This means that GHC will now include each of the bindings floated out from krep_aebr in the interface file, despite the NOINLINE pragma, as they are all depended upon by the exported $tcProxy through their unfoldings. This is Quite Bad. I have observed that the floated bindings are not included in the interface file with -O0. Moreover, the core2core output clearly shows the unfoldings being added after the first simplifier phase. I haven't yet determined where in the simplifier these unfoldings are being introduced, but if anyone has ideas I'd love to hear them. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at smart-cactus.org Sun Feb 12 17:48:21 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Sun, 12 Feb 2017 12:48:21 -0500 Subject: Convincing GHC not to produce unfoldings during simplification In-Reply-To: <87tw7z9v8b.fsf@ben-laptop.smart-cactus.org> References: <87tw7z9v8b.fsf@ben-laptop.smart-cactus.org> Message-ID: <87poin9u6y.fsf@ben-laptop.smart-cactus.org> Ben Gamari writes: > I have observed that the floated bindings are not included in the > interface file with -O0. Moreover, the core2core output clearly shows > the unfoldings being added after the first simplifier phase. I haven't > yet determined where in the simplifier these unfoldings are being > introduced, but if anyone has ideas I'd love to hear them. > Ahhh, the inline pragma I was applying was wrong; I wanted neverInlinePragma but instead rolled my own (incorrect) version of it. It's interesting that neverInlinePragma has a NeverActive activation with EmptyInlineSpec. My intuition had lead me to an AlwaysActive activation of a NoInline InlineSpec. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at well-typed.com Sun Feb 12 18:09:57 2017 From: ben at well-typed.com (Ben Gamari) Date: Sun, 12 Feb 2017 13:09:57 -0500 Subject: Trac maintenance In-Reply-To: <87zihra066.fsf@ben-laptop.smart-cactus.org> References: <878tpcb0d6.fsf@ben-laptop.smart-cactus.org> <8760kgazgl.fsf@ben-laptop.smart-cactus.org> <87zihra066.fsf@ben-laptop.smart-cactus.org> Message-ID: <87mvdr9t6y.fsf@ben-laptop.smart-cactus.org> Ben Gamari writes: > Matthew Pickering writes: > >> Were there any particular features that we should know about which >> motivated the upgrade? >> > The primary motivations were to get better spam filtering for user > registration and to fix syntax highlighting. > >> Displaying real names is slightly inconvenient now for the purposes of >> assigning and ccing tickets as you must still use the user names for >> those fields. >> > That is true; I'll see what can be done about this. > I have disabled display of full names. For future reference, the change is documented here[1]. Cheers, - Ben [1] https://trac.edgewall.org/ticket/7339 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at well-typed.com Sun Feb 12 22:57:18 2017 From: ben at well-typed.com (Ben Gamari) Date: Sun, 12 Feb 2017 17:57:18 -0500 Subject: Improving trac notifications In-Reply-To: References: <87twn297mm.fsf@smart-cactus.org> <874meq8s53.fsf@smart-cactus.org> Message-ID: <87h93z9fw1.fsf@ben-laptop.smart-cactus.org> Matthew Pickering writes: > I attach a patch which should improve the notifications. > I have applied this patch to our Trac 1.2 installation. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From matthewtpickering at gmail.com Sun Feb 12 23:04:16 2017 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Sun, 12 Feb 2017 23:04:16 +0000 Subject: Improving trac notifications In-Reply-To: <87h93z9fw1.fsf@ben-laptop.smart-cactus.org> References: <87twn297mm.fsf@smart-cactus.org> <874meq8s53.fsf@smart-cactus.org> <87h93z9fw1.fsf@ben-laptop.smart-cactus.org> Message-ID: Cheers Ben! Matt On Sun, Feb 12, 2017 at 10:57 PM, Ben Gamari wrote: > Matthew Pickering writes: > >> I attach a patch which should improve the notifications. >> > I have applied this patch to our Trac 1.2 installation. > > Cheers, > > - Ben From simonpj at microsoft.com Mon Feb 13 13:29:10 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Mon, 13 Feb 2017 13:29:10 +0000 Subject: Trac Message-ID: Trac tickets now open up with the "Modify ticket" boxes open. That makes them vulnerable to accidental edits. Could it be closed by default as it used to be? Simon -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at smart-cactus.org Mon Feb 13 14:03:12 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Mon, 13 Feb 2017 09:03:12 -0500 Subject: Trac In-Reply-To: References: Message-ID: <87efz29oin.fsf@ben-laptop.smart-cactus.org> Simon Peyton Jones via ghc-devs writes: > Trac tickets now open up with the "Modify ticket" boxes open. That > makes them vulnerable to accidental edits. Could it be closed by > default as it used to be? Hmm, I'm having trouble reproducing this behavior. I wonder whether this is due to some per-user preference. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From george.colpitts at gmail.com Mon Feb 13 16:25:15 2017 From: george.colpitts at gmail.com (George Colpitts) Date: Mon, 13 Feb 2017 16:25:15 +0000 Subject: Trac In-Reply-To: <87efz29oin.fsf@ben-laptop.smart-cactus.org> References: <87efz29oin.fsf@ben-laptop.smart-cactus.org> Message-ID: I'm seeing the same thing as Simon, when I open a ticket, e.g. https://ghc.haskell.org/trac/ghc/ticket/4012, at the bottom , after the comments I see a Modify Ticket and Action box as if I had clicked the Modify link at the top. I believe this is new behavior. On Mon, Feb 13, 2017 at 10:03 AM Ben Gamari wrote: > Simon Peyton Jones via ghc-devs writes: > > > Trac tickets now open up with the "Modify ticket" boxes open. That > > makes them vulnerable to accidental edits. Could it be closed by > > default as it used to be? > > Hmm, I'm having trouble reproducing this behavior. I wonder whether > this is due to some per-user preference. > > Cheers, > > - Ben > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rae at cs.brynmawr.edu Mon Feb 13 17:55:09 2017 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Mon, 13 Feb 2017 12:55:09 -0500 Subject: Trac In-Reply-To: References: <87efz29oin.fsf@ben-laptop.smart-cactus.org> Message-ID: <41AE78AF-E400-4AF5-A406-4DF5944F0C7D@cs.brynmawr.edu> As another data point, I am *not* seeing this change in behavior. My "Modify Ticket" tab is closed by default. Richard > On Feb 13, 2017, at 11:25 AM, George Colpitts wrote: > > I'm seeing the same thing as Simon, when I open a ticket, e.g. https://ghc.haskell.org/trac/ghc/ticket/4012 , at the bottom , after the comments I see a Modify Ticket and Action box as if I had clicked the Modify link at the top. I believe this is new behavior. > > On Mon, Feb 13, 2017 at 10:03 AM Ben Gamari > wrote: > Simon Peyton Jones via ghc-devs > writes: > > > Trac tickets now open up with the "Modify ticket" boxes open. That > > makes them vulnerable to accidental edits. Could it be closed by > > default as it used to be? > > Hmm, I'm having trouble reproducing this behavior. I wonder whether > this is due to some per-user preference. > > Cheers, > > - Ben > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at smart-cactus.org Mon Feb 13 18:06:30 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Mon, 13 Feb 2017 13:06:30 -0500 Subject: Trac In-Reply-To: <41AE78AF-E400-4AF5-A406-4DF5944F0C7D@cs.brynmawr.edu> References: <87efz29oin.fsf@ben-laptop.smart-cactus.org> <41AE78AF-E400-4AF5-A406-4DF5944F0C7D@cs.brynmawr.edu> Message-ID: <87bmu69d95.fsf@ben-laptop.smart-cactus.org> Richard Eisenberg writes: > As another data point, I am *not* seeing this change in behavior. My "Modify Ticket" tab is closed by default. > Hmm, this is interesting. I just tried this in Chromium and indeed I see the Modify Ticket pane open by default. By contrast, Firefox is closed. What browsers are you all using? Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From rae at cs.brynmawr.edu Mon Feb 13 18:07:46 2017 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Mon, 13 Feb 2017 13:07:46 -0500 Subject: Trac In-Reply-To: <87bmu69d95.fsf@ben-laptop.smart-cactus.org> References: <87efz29oin.fsf@ben-laptop.smart-cactus.org> <41AE78AF-E400-4AF5-A406-4DF5944F0C7D@cs.brynmawr.edu> <87bmu69d95.fsf@ben-laptop.smart-cactus.org> Message-ID: <67215039-307E-45A1-8E2A-21440C7F8D1A@cs.brynmawr.edu> > On Feb 13, 2017, at 1:06 PM, Ben Gamari wrote: > > What browsers are you all using? Firefox, in agreement with your experience. From matthewtpickering at gmail.com Mon Feb 13 18:12:13 2017 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Mon, 13 Feb 2017 18:12:13 +0000 Subject: Trac In-Reply-To: <67215039-307E-45A1-8E2A-21440C7F8D1A@cs.brynmawr.edu> References: <87efz29oin.fsf@ben-laptop.smart-cactus.org> <41AE78AF-E400-4AF5-A406-4DF5944F0C7D@cs.brynmawr.edu> <87bmu69d95.fsf@ben-laptop.smart-cactus.org> <67215039-307E-45A1-8E2A-21440C7F8D1A@cs.brynmawr.edu> Message-ID: I am using Chrome and it is closed by default On Monday, February 13, 2017, Richard Eisenberg wrote: > > > On Feb 13, 2017, at 1:06 PM, Ben Gamari > wrote: > > > > What browsers are you all using? > > Firefox, in agreement with your experience. > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at smart-cactus.org Mon Feb 13 18:17:54 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Mon, 13 Feb 2017 13:17:54 -0500 Subject: Trac In-Reply-To: <87bmu69d95.fsf@ben-laptop.smart-cactus.org> References: <87efz29oin.fsf@ben-laptop.smart-cactus.org> <41AE78AF-E400-4AF5-A406-4DF5944F0C7D@cs.brynmawr.edu> <87bmu69d95.fsf@ben-laptop.smart-cactus.org> Message-ID: <878tpa9cq5.fsf@ben-laptop.smart-cactus.org> Ben Gamari writes: > Richard Eisenberg writes: > >> As another data point, I am *not* seeing this change in behavior. My "Modify Ticket" tab is closed by default. >> > Hmm, this is interesting. I just tried this in Chromium and indeed I see > the Modify Ticket pane open by default. By contrast, Firefox is closed. > What browsers are you all using? > I think I see what is going it; it's the silly CDN again. Austin, can we just drop the CDN from ghc.haskell.org? It really seems like hurts more than it helps. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at smart-cactus.org Mon Feb 13 18:28:03 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Mon, 13 Feb 2017 13:28:03 -0500 Subject: Trac In-Reply-To: <878tpa9cq5.fsf@ben-laptop.smart-cactus.org> References: <87efz29oin.fsf@ben-laptop.smart-cactus.org> <41AE78AF-E400-4AF5-A406-4DF5944F0C7D@cs.brynmawr.edu> <87bmu69d95.fsf@ben-laptop.smart-cactus.org> <878tpa9cq5.fsf@ben-laptop.smart-cactus.org> Message-ID: <8760ke9c98.fsf@ben-laptop.smart-cactus.org> Ben Gamari writes: > Ben Gamari writes: > >> Richard Eisenberg writes: >> >>> As another data point, I am *not* seeing this change in behavior. My "Modify Ticket" tab is closed by default. >>> >> Hmm, this is interesting. I just tried this in Chromium and indeed I see >> the Modify Ticket pane open by default. By contrast, Firefox is closed. >> What browsers are you all using? >> > I think I see what is going it; it's the silly CDN again. > > Austin, can we just drop the CDN from ghc.haskell.org? It really seems > like hurts more than it helps. > Hmm, I might have been too hasty in blaming the CDN here (which appears not to cover ghc.haskell.org). It looks like it might just be client-side caching. I have updating the server configuration to ensure that browsers aren't tempted to use old cached artifacts. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at smart-cactus.org Mon Feb 13 18:28:38 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Mon, 13 Feb 2017 13:28:38 -0500 Subject: Trac In-Reply-To: References: Message-ID: <8737fi9c89.fsf@ben-laptop.smart-cactus.org> Simon Peyton Jones via ghc-devs writes: > Trac tickets now open up with the "Modify ticket" boxes open. That > makes them vulnerable to accidental edits. Could it be closed by > default as it used to be? Let me know if you are still seeing this; I believe it should be resolved if you refresh. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From simonpj at microsoft.com Mon Feb 13 21:07:59 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Mon, 13 Feb 2017 21:07:59 +0000 Subject: Trac In-Reply-To: <87bmu69d95.fsf@ben-laptop.smart-cactus.org> References: <87efz29oin.fsf@ben-laptop.smart-cactus.org> <41AE78AF-E400-4AF5-A406-4DF5944F0C7D@cs.brynmawr.edu> <87bmu69d95.fsf@ben-laptop.smart-cactus.org> Message-ID: Firefox! | -----Original Message----- | From: Ben Gamari [mailto:ben at smart-cactus.org] | Sent: 13 February 2017 18:07 | To: Richard Eisenberg ; George Colpitts | | Cc: Simon Peyton Jones ; ghc-devs at haskell.org | Subject: Re: Trac | | Richard Eisenberg writes: | | > As another data point, I am *not* seeing this change in behavior. My | "Modify Ticket" tab is closed by default. | > | Hmm, this is interesting. I just tried this in Chromium and indeed I see | the Modify Ticket pane open by default. By contrast, Firefox is closed. | What browsers are you all using? | | Cheers, | | - Ben From harendra.kumar at gmail.com Tue Feb 14 18:50:33 2017 From: harendra.kumar at gmail.com (Harendra Kumar) Date: Wed, 15 Feb 2017 00:20:33 +0530 Subject: Extensible records & mandatory/optional record fields Message-ID: In my application, I want some of the fields in a record to have default values while others must always be specified by the user. I can implement this using the rawr records library (http://hackage.haskell.org/package/rawr) like so: def :: ("b" := String) -> R ("a" := Int, "b" := String) def t = (R (#a := 0) :*: R t) -- merge with defaults let r = def (#b := "hello") Here field "a" has a default value (i.e. it is optional when "def" is used) but field "b" does not have a default value and has to be explicitly specified by the user. This is made possible by record merging feature of rawr, making the record extensible. I could not find an equivalent way of achieving this using overloaded records (http://hackage.haskell.org/package/overloaded-records). Is record merging possible or can be made possible using overloaded-records or with the ghc overloaded records poposal? If not, is there a plan to make something like this possible in future? Or will this never be possible with the in built record syntax? Note that, this is handy to simulate mandatory and optional keyword arguments to a function by passing them in the form of a record. Something which is available in other languages like python. -harendra -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at well-typed.com Wed Feb 15 02:40:29 2017 From: ben at well-typed.com (Ben Gamari) Date: Tue, 14 Feb 2017 21:40:29 -0500 Subject: Trac password reset temporarily disabled Message-ID: <877f4s89cy.fsf@ben-laptop.smart-cactus.org> Since the Trac upgrade user password reset and email verification messages have been incorrectly sent to ghc-tickets at haskell.org. This appears to be a bug in the AccountManagerPlugin; I have opened a ticket with upstream (https://trac-hacks.org/ticket/13074) and hope to hear back soon. Until this is resolved I have disabled password reset to ensure that no user passwords leak to a public mailing list. If you need your password reset in the meantime please email me privately. Sorry for the inconvenience. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From simonpj at microsoft.com Thu Feb 16 00:05:22 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Thu, 16 Feb 2017 00:05:22 +0000 Subject: Convincing GHC not to produce unfoldings during simplification In-Reply-To: <87tw7z9v8b.fsf@ben-laptop.smart-cactus.org> References: <87tw7z9v8b.fsf@ben-laptop.smart-cactus.org> Message-ID: Can you tell me how to repro this? I can't. I tried module Foo( foo ) where {-# NOINLINE foo #-} foo = ("fred" , True, ('c', 'e')) And just as expected, I see foo in the interface file, but none of its components. Simon | -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Ben | Gamari | Sent: 12 February 2017 17:26 | To: ghc-devs at haskell.org | Subject: Convincing GHC not to produce unfoldings during simplification | | I'm currently trying to get the interface file bulk imposed by TTypeable | down. The branch will currently produce two top-level bindings for each | TyCon. | For instance, given the type, | | data Proxy (a :: k) = Proxy | | the branch will produce (ignoring the promoted datacon for a moment), | | $tcProxy :: TyCon | $tcProxy | = GHC.Types.TyCon | fpr1 fpr2 -- fingerprints | $trModule | (GHC.Types.TrNameS "Proxy"#) | 1 | krep_aebr | | krep_aebr :: KindRep | krep_aebr [InlPrag=NOINLINE CONLIKE] | = GHC.Types.KindRepFun | (GHC.Types.KindRepVar 0) | (GHC.Types.KindRepTYPE GHC.Types.LiftedRep) | | Note that the KindRep has been marked as NOINLINE; I do this | intentionally as these things can grow quite large (consider, for | instance, the kind of a promoted tuple constructor). This is especially | true as the simplifier tends to float out the constituents of the | KindRep. After the first simplifier phase we end up with, | | | krep_sebQ :: GHC.Types.KindRep | [LclId, | Unf=Unf{Src=, TopLvl=True, Value=False, ConLike=False, | WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 0}] | krep_sebQ = GHC.Types.$WKindRepVar (GHC.Types.I# 0#) | | krep_sebR :: GHC.Types.KindRep | [LclId, | Unf=Unf{Src=, TopLvl=True, Value=False, ConLike=False, | WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 20 0}] | krep_sebR = GHC.Types.$WKindRepTYPE GHC.Types.LiftedRep | | krep_aebr [InlPrag=NOINLINE CONLIKE] :: GHC.Types.KindRep | [LclId, | Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, | WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}] | krep_aebr = GHC.Types.KindRepFun krep_sebQ krep_sebR | | This means that GHC will now include each of the bindings floated out | from krep_aebr in the interface file, despite the NOINLINE pragma, as | they are all depended upon by the exported $tcProxy through their | unfoldings. This is Quite Bad. | | I have observed that the floated bindings are not included in the | interface file with -O0. Moreover, the core2core output clearly shows the | unfoldings being added after the first simplifier phase. I haven't yet | determined where in the simplifier these unfoldings are being introduced, | but if anyone has ideas I'd love to hear them. | | Cheers, | | - Ben From simonpj at microsoft.com Thu Feb 16 00:17:21 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Thu, 16 Feb 2017 00:17:21 +0000 Subject: Convincing GHC not to produce unfoldings during simplification In-Reply-To: <87poin9u6y.fsf@ben-laptop.smart-cactus.org> References: <87tw7z9v8b.fsf@ben-laptop.smart-cactus.org> <87poin9u6y.fsf@ben-laptop.smart-cactus.org> Message-ID: Yes, inl_act :: Activation controls what inlining takes place inl_inline :: InlineSpec says what the user originally wrote Perhaps I should beef up the comments. Simon | -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Ben | Gamari | Sent: 12 February 2017 17:48 | To: ghc-devs at haskell.org | Subject: Re: Convincing GHC not to produce unfoldings during | simplification | | Ben Gamari writes: | | > I have observed that the floated bindings are not included in the | > interface file with -O0. Moreover, the core2core output clearly shows | > the unfoldings being added after the first simplifier phase. I haven't | > yet determined where in the simplifier these unfoldings are being | > introduced, but if anyone has ideas I'd love to hear them. | > | Ahhh, the inline pragma I was applying was wrong; I wanted | neverInlinePragma but instead rolled my own (incorrect) version of it. | | It's interesting that neverInlinePragma has a NeverActive activation with | EmptyInlineSpec. My intuition had lead me to an AlwaysActive activation | of a NoInline InlineSpec. | | Cheers, | | - Ben From simonpj at microsoft.com Thu Feb 16 17:10:51 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Thu, 16 Feb 2017 17:10:51 +0000 Subject: FW: [Diffusion] [Build Failed] rGHC6bab649bde65: Improve checking of joins in Core Lint In-Reply-To: <20170216160723.5455.93380.5255ADC0@phabricator.haskell.org> References: <20170216160723.5455.93380.5255ADC0@phabricator.haskell.org> Message-ID: perf/haddock.base and haddock.Cabal have improved, hence failure here.. am building with HADDOCK_DOCS on. If someone else gets there first, be my guest From: noreply at phabricator.haskell.org [mailto:noreply at phabricator.haskell.org] Sent: 16 February 2017 16:08 To: Simon Peyton Jones Subject: [Diffusion] [Build Failed] rGHC6bab649bde65: Improve checking of joins in Core Lint Harbormaster failed to build B13964: rGHC6bab649bde65: Improve checking of joins in Core Lint! BRANCHES master USERS simonpj (Author) COMMIT https://phabricator.haskell.org/rGHC6bab649bde65 EMAIL PREFERENCES https://phabricator.haskell.org/settings/panel/emailpreferences/ To: simonpj, Harbormaster -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Thu Feb 16 20:40:53 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Thu, 16 Feb 2017 15:40:53 -0500 Subject: Better perf for haddock.base, haddock.Cabal (f4aa998) In-Reply-To: <20170216174615.6170D3A584@ghc.haskell.org> References: <20170216174615.6170D3A584@ghc.haskell.org> Message-ID: <1487277653.2157.3.camel@joachim-breitner.de> Hi, Am Donnerstag, den 16.02.2017, 17:46 +0000 schrieb git at git.haskell.org: > commit f4aa9984790332a908e8b1321d00a839fb42c3ea > Author: Simon Peyton Jones > Date:   Thu Feb 16 17:44:58 2017 +0000 > >     Better perf for haddock.base, haddock.Cabal >      >     I think this is due to >       commit 6bab649bde653f13c15eba30d5007bef4a9a9d3a >       Author: Simon Peyton Jones >       Date:   Thu Feb 16 09:42:32 2017 +0000 >      >           Improve checking of joins in Core Lint >      >     Improvement is around 5%. no, https://perf.haskell.org/ghc/#revision/fc9d152b058f21ab03986ea722d0c94688b9969f clearly points to this commit: commit fc9d152b058f21ab03986ea722d0c94688b9969f Author: Simon Peyton Jones < simonpj at microsoft.com > Date:   Thu Feb 16 09:41:55 2017 +0000     Comments and tiny refactor only Which is not just a refactoring. If you look at the diff, e.g. at https://phabricator.haskell.org/rGHCfc9d152b058f21ab03986ea722d0c94688b9969f you will see that after your change, the “one shot arguments according to the environment” are no longer counted towards n_val_args in fun_uds and is_exp. And it seems they should not! Is that something you understand and can explain in a note? I guess https://phabricator.haskell.org/D3089 was merged a bit prematurely in that respect.¹ Greetings, Joachim ¹ There is a workflow problem with Phab’s DR: * A creates a new DR. * B requests changes. DR now in state “revision needed” * C requests changes. DR still in state “revision needed” * A makes changes. DR now in state “needs review” * C looks at the changes and finds his concern addressed and accepts the revision. DR now in state “accepted”. * G comes along, sees a DR in state “accepted” and lands it. Problem: B did not have the chance to check the new revision. -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From ben at smart-cactus.org Thu Feb 16 22:01:04 2017 From: ben at smart-cactus.org (Ben Gamari) Date: Thu, 16 Feb 2017 17:01:04 -0500 Subject: Better perf for haddock.base, haddock.Cabal (f4aa998) In-Reply-To: <1487277653.2157.3.camel@joachim-breitner.de> References: <20170216174615.6170D3A584@ghc.haskell.org> <1487277653.2157.3.camel@joachim-breitner.de> Message-ID: <87shnd7q3j.fsf@ben-laptop.smart-cactus.org> Joachim Breitner writes: > Hi, > ... > > I guess https://phabricator.haskell.org/D3089 was merged a bit > prematurely in that respect.¹ > > Greetings, > Joachim > > > ¹ There is a workflow problem with Phab’s DR: > * A creates a new DR. > * B requests changes. DR now in state “revision needed” > * C requests changes. DR still in state “revision needed” > * A makes changes. DR now in state “needs review” > * C looks at the changes and finds his concern addressed > and accepts the revision. DR now in state “accepted”. > * G comes along, sees a DR in state “accepted” and lands it. > Problem: B did not have the chance to check the new revision. > Actually, the problem in this particular case was the Simon left comments but didn't request changes. Had he done so the Diff wouldn't have entered "accepted" state until he accepted. Sorry if I had been a bit premature in merging this one. While I understand why this is the case, it can be a bit unfortunate in the case of an open-source project, where a drive-by reviewer might leave a comment, the author makes the requested change, and the reviewer never returns to accept the change. In this case the Diff remains in a sort of limbo, even if someone else accepts it. This is to some extent a social problem: In an ideal world reviewers would continue to submit reviews until the patch is merged. However, in the case of a project like GHC this is rarely the case. For this reason I sometimes need to ping reviewers and explicitly ask them to accept changes. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From david.feuer at gmail.com Thu Feb 16 22:12:43 2017 From: david.feuer at gmail.com (David Feuer) Date: Thu, 16 Feb 2017 17:12:43 -0500 Subject: Static data and RULES In-Reply-To: References: Message-ID: Ben Gamari and Reid Barton are interested in making it cheaper for static data to pass through simplification. The basic idea is that if a term is already made entirely of data constructors and literals, then there's nothing left to optimize. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. But on the other hand, RULES are apparently (according to Duncan Coutts) already broken for strict data constructors, because they have workers and wrappers. My thought: let's allow phased INLINE and NOINLINE pragmas for data constructors. The default would be INLINE. The ~ phase choice would not be available: once inline, always inline. Semantics ~~~~~~~~~~ For all constructors: If a constructor is allowed by pragmas to inline in a certain phase, then in that phase terms built from it can be considered static. Once static, always static. If a constructor is not allowed to inline in a certain phase, terms built from it will be considered non-static. After demand analysis and worker/wrapper, all constructors are considered inline. For strict constructors: A strict constructor wrapper prohibited from inlining in a certain phase simply will not. Strict constructor wrappers will all be allowed to inline after demand analysis and worker/wrapper. This matches the way we now handle wrappers actually created in that phase. Syntax: For GADT syntax, this is easy: data Foo ... where {-# INLINE [1] Bar #-} Bar :: ... For traditional syntax, I think it's probably best to pull the pragmas to the top: {-# NOINLINE Quux #-} data Baz ... = Quux ... | ... -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Thu Feb 16 22:18:33 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Thu, 16 Feb 2017 17:18:33 -0500 Subject: DR workflows In-Reply-To: <87shnd7q3j.fsf@ben-laptop.smart-cactus.org> References: <20170216174615.6170D3A584@ghc.haskell.org> <1487277653.2157.3.camel@joachim-breitner.de> <87shnd7q3j.fsf@ben-laptop.smart-cactus.org> Message-ID: <1487283513.2157.7.camel@joachim-breitner.de> Hi Am Donnerstag, den 16.02.2017, 17:01 -0500 schrieb Ben Gamari: > > ¹ There is a workflow problem with Phab’s DR: > >   * A creates a new DR. > >   * B requests changes. DR now in state “revision needed” > >   * C requests changes. DR still in state “revision needed” > >   * A makes changes. DR now in state “needs review” > >   * C looks at the changes and finds his concern addressed > >     and accepts the revision. DR now in state “accepted”. > >   * G comes along, sees a DR in state “accepted” and lands it. > >   Problem: B did not have the chance to check the new revision. > > > > Actually, the problem in this particular case was the Simon left > comments but didn't request changes. Had he done so the Diff wouldn't > have entered "accepted" state until he accepted. Indeed! I thought I saw “Simon requested changes“ in this one, but my memory was failing me here. So I partly retract my fussmaking here. > While I understand why this is the case, it can be a bit unfortunate in > the case of an open-source project, where a drive-by reviewer might > leave a comment, the author makes the requested change, and the reviewer > never returns to accept the change. In this case the Diff remains in a > sort of limbo, even if someone else accepts it. Would it not at least show up on Phab’s starting page, under “Ready to Review” or some of the other categories. In the worst case, the author can ping the reviewer here. I think it is fine that if someone requests changes to expect him to follow up. The drive-by reviewer should leave comments without requesting changes then. > This is to some extent a social problem: In an ideal world reviewers > would continue to submit reviews until the patch is merged. However, in > the case of a project like GHC this is rarely the case. For this reason > I sometimes need to ping reviewers and explicitly ask them to accept > changes. This is fine, I think. What I sometimes miss as a reviewer is to indicate: “As far as I am concerned, this looks good, but I did not review the whole thing”, for example if one aspect of a change interacts with “my” code in GHC, and I verified that this part is ok. Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From mail at joachim-breitner.de Thu Feb 16 22:20:51 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Thu, 16 Feb 2017 17:20:51 -0500 Subject: Static data and RULES In-Reply-To: References: Message-ID: <1487283651.2157.9.camel@joachim-breitner.de> Hi, Am Donnerstag, den 16.02.2017, 17:12 -0500 schrieb David Feuer: > Strict constructor wrappers will all be allowed to inline after > demand analysis and worker/wrapper. This matches the way we now > handle wrappers actually created in that phase. I am worried that DmdAnal will be less effective the code it sees does not have the wrappers of strict constructors already inlines. It may be that the strictness signature of the wrapper is sufficient to make up for this, but I am not sure. Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From david at well-typed.com Thu Feb 16 22:38:56 2017 From: david at well-typed.com (David Feuer) Date: Thu, 16 Feb 2017 17:38:56 -0500 Subject: Static data and RULES Message-ID: The vast majority would have no pragma, or at least wouldn't have an unphased NOINLINE pragma, so they would typically inline before demand analysis anyway. David FeuerWell-Typed, LLP  -------- Original message --------From: Joachim Breitner Date: 2/16/17 5:20 PM (GMT-05:00) To: ghc-devs at haskell.org Subject: Re: Static data and RULES Hi, Am Donnerstag, den 16.02.2017, 17:12 -0500 schrieb David Feuer: > Strict constructor wrappers will all be allowed to inline after > demand analysis and worker/wrapper. This matches the way we now > handle wrappers actually created in that phase. I am worried that DmdAnal will be less effective the code it sees does not have the wrappers of strict constructors already inlines. It may be that the strictness signature of the wrapper is sufficient to make up for this, but I am not sure. Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Thu Feb 16 23:33:23 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Thu, 16 Feb 2017 23:33:23 +0000 Subject: Better perf for haddock.base, haddock.Cabal (f4aa998) In-Reply-To: <1487277653.2157.3.camel@joachim-breitner.de> References: <20170216174615.6170D3A584@ghc.haskell.org> <1487277653.2157.3.camel@joachim-breitner.de> Message-ID: | clearly points to this commit: | | commit fc9d152b058f21ab03986ea722d0c94688b9969f | Author: Simon Peyton Jones < simonpj at microsoft.com > | Date: Thu Feb 16 09:41:55 2017 +0000 | | Comments and tiny refactor only Crumbs! You are right! I have NO IDEA why this effect is so large. I fixed the bug in occAnalApp when I was auditing your changes, but I couldn't think of a situation in which I would matter, and then I forgot all about it. It's hard to add a comment.... both the call to mkOneOcc and isExpandableApp were designed for the number of args the function is *syntactically* applied to. But the argOneShots needs how many it is *semantically* applied to, once. But is_exp only matters if isRhsEnv is true; and in that case I think occ_one_shots is empty (see rhsCtxt); so I doubt the change to is_exp makes any difference at all. It's a mystery. Ideally one would find out why. But life is short, and this is in the right direction. I've added a note to the ticket, FWIW Simon | -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Joachim | Breitner | Sent: 16 February 2017 20:41 | To: ghc-devs at haskell.org | Subject: Re: Better perf for haddock.base, haddock.Cabal (f4aa998) | | Hi, | | Am Donnerstag, den 16.02.2017, 17:46 +0000 schrieb git at git.haskell.org: | > commit f4aa9984790332a908e8b1321d00a839fb42c3ea | > Author: Simon Peyton Jones | > Date:   Thu Feb 16 17:44:58 2017 +0000 | > | >     Better perf for haddock.base, haddock.Cabal | > | >     I think this is due to | >       commit 6bab649bde653f13c15eba30d5007bef4a9a9d3a | >       Author: Simon Peyton Jones | >       Date:   Thu Feb 16 09:42:32 2017 +0000 | > | >           Improve checking of joins in Core Lint | > | >     Improvement is around 5%. | | no, | https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fperf.has | kell.org%2Fghc%2F%23revision%2Ffc9d152b058f21ab03986ea722d0c94688b9969f&d | ata=02%7C01%7Csimonpj%40microsoft.com%7Caacdd3c960ea4e56ea6c08d456ac2c5d% | 7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636228744888337816&sdata=vZW | XXwyBzBcUMliVMtS9vUFmlQuBXOhciC9uzSm7aW0%3D&reserved=0 | clearly points to this commit: | | commit fc9d152b058f21ab03986ea722d0c94688b9969f | Author: Simon Peyton Jones < simonpj at microsoft.com > | Date:   Thu Feb 16 09:41:55 2017 +0000 | |     Comments and tiny refactor only | | Which is not just a refactoring. If you look at the diff, e.g. at | | https://phabricator.haskell.org/rGHCfc9d152b058f21ab03986ea722d0c94688b99 | 69f | you will see that after your change, the “one shot arguments according to | the environment” are no longer counted towards n_val_args in fun_uds and | is_exp. And it seems they should not! Is that something you understand | and can explain in a note? | | I guess https://phabricator.haskell.org/D3089 was merged a bit | prematurely in that respect.¹ | | Greetings, | Joachim | | | ¹ There is a workflow problem with Phab’s DR: | * A creates a new DR. | * B requests changes. DR now in state “revision needed” | * C requests changes. DR still in state “revision needed” | * A makes changes. DR now in state “needs review” | * C looks at the changes and finds his concern addressed | and accepts the revision. DR now in state “accepted”. | * G comes along, sees a DR in state “accepted” and lands it. | Problem: B did not have the chance to check the new revision. | | | | | | | -- | Joachim “nomeata” Breitner |   mail at joachim-breitner.de • | https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.joac | him- | breitner.de%2F&data=02%7C01%7Csimonpj%40microsoft.com%7Caacdd3c960ea4e56e | a6c08d456ac2c5d%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636228744888 | 337816&sdata=vsGnQwAfqS%2B0hfL0ZLwnDy87eNSBeLltJQXqPOadnXo%3D&reserved=0 |   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F |   Debian Developer: nomeata at debian.org From simonpj at microsoft.com Thu Feb 16 23:35:32 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Thu, 16 Feb 2017 23:35:32 +0000 Subject: Static data and RULES In-Reply-To: References: Message-ID: I don’t understand any of this. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. Why won’t it keep happening? What is the problem you are trying to solve? Why does the fast-path make it harder? Maybe open a ticket? Simon From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of David Feuer Sent: 16 February 2017 22:13 To: Ben Gamari ; Reid Barton Cc: ghc-devs Subject: Static data and RULES Ben Gamari and Reid Barton are interested in making it cheaper for static data to pass through simplification. The basic idea is that if a term is already made entirely of data constructors and literals, then there's nothing left to optimize. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. But on the other hand, RULES are apparently (according to Duncan Coutts) already broken for strict data constructors, because they have workers and wrappers. My thought: let's allow phased INLINE and NOINLINE pragmas for data constructors. The default would be INLINE. The ~ phase choice would not be available: once inline, always inline. Semantics ~~~~~~~~~~ For all constructors: If a constructor is allowed by pragmas to inline in a certain phase, then in that phase terms built from it can be considered static. Once static, always static. If a constructor is not allowed to inline in a certain phase, terms built from it will be considered non-static. After demand analysis and worker/wrapper, all constructors are considered inline. For strict constructors: A strict constructor wrapper prohibited from inlining in a certain phase simply will not. Strict constructor wrappers will all be allowed to inline after demand analysis and worker/wrapper. This matches the way we now handle wrappers actually created in that phase. Syntax: For GADT syntax, this is easy: data Foo ... where {-# INLINE [1] Bar #-} Bar :: ... For traditional syntax, I think it's probably best to pull the pragmas to the top: {-# NOINLINE Quux #-} data Baz ... = Quux ... | ... -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Thu Feb 16 23:51:19 2017 From: david.feuer at gmail.com (David Feuer) Date: Thu, 16 Feb 2017 18:51:19 -0500 Subject: Static data and RULES In-Reply-To: References: Message-ID: Sorry; guess I should have given more background on that. This goes back to the performance problems Ben encountered in Typeable. The goal is to avoid trying to optimize something over and over that's never ever going to change. If we know that a term is made only of static data, we can skip it altogether in simplification. Suppose we have foo = Just (Right [1]) Then no amount of optimization will ever be useful. But what about RULES? If the outermost pattern in a rule matches on a data constructor, then it's not static anymore! We may be replacing it with something else. So we need a finer mechanism. We *also* need a finer mechanism for strict constructors in general. We need to avoid inlining those too early if they're mentioned in any position in RULES. Trying to make this work right automagically looks a bit tricky in the face of orphan rules and such. On Feb 16, 2017 6:35 PM, "Simon Peyton Jones" wrote: > I don’t understand any of this. > > > > However, RULES are allowed to match on data constructors and it would be > nice to let that keep happening. > > > > Why won’t it keep happening? What is the problem you are trying to > solve? Why does the fast-path make it harder? > > > > Maybe open a ticket? > > > > Simon > > > > *From:* ghc-devs [mailto:ghc-devs-bounces at haskell.org] *On Behalf Of *David > Feuer > *Sent:* 16 February 2017 22:13 > *To:* Ben Gamari ; Reid Barton > *Cc:* ghc-devs > *Subject:* Static data and RULES > > > > Ben Gamari and Reid Barton are interested in making it cheaper for static > data to pass through simplification. The basic idea is that if a term is > already made entirely of data constructors and literals, then there's > nothing left to optimize. > > > > However, RULES are allowed to match on data constructors and it would be > nice to let that keep happening. But on the other hand, RULES are > apparently (according to Duncan Coutts) already broken for strict data > constructors, because they have workers and wrappers. > > > > My thought: let's allow phased INLINE and NOINLINE pragmas for data > constructors. The default would be INLINE. The ~ phase choice would not be > available: once inline, always inline. > > > > Semantics > > ~~~~~~~~~~ > > > > For all constructors: > > > > If a constructor is allowed by pragmas to inline in a certain phase, then > in that phase terms built from it can be considered static. Once static, > always static. > > > > If a constructor is not allowed to inline in a certain phase, terms built > from it will be considered non-static. > > > > After demand analysis and worker/wrapper, all constructors are considered > inline. > > > > For strict constructors: > > > > A strict constructor wrapper prohibited from inlining in a certain phase > simply will not. > > > > Strict constructor wrappers will all be allowed to inline after demand > analysis and worker/wrapper. This matches the way we now handle wrappers > actually created in that phase. > > > > Syntax: > > > > For GADT syntax, this is easy: > > > > data Foo ... where > > {-# INLINE [1] Bar #-} > > Bar :: ... > > > > For traditional syntax, I think it's probably best to pull the pragmas to > the top: > > > > {-# NOINLINE Quux #-} > > data Baz ... = Quux ... | ... > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Thu Feb 16 23:53:53 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Thu, 16 Feb 2017 23:53:53 +0000 Subject: Static data and RULES In-Reply-To: References: Message-ID: I’m sorry I still don’t understand the problem. Can you give an example? It all works fine today; what will change in the proposed new scheme. Indeed what IS the proposed new scheme? I’m lost Simon From: David Feuer [mailto:david.feuer at gmail.com] Sent: 16 February 2017 23:51 To: Simon Peyton Jones Cc: ghc-devs ; Reid Barton ; Ben Gamari Subject: RE: Static data and RULES Sorry; guess I should have given more background on that. This goes back to the performance problems Ben encountered in Typeable. The goal is to avoid trying to optimize something over and over that's never ever going to change. If we know that a term is made only of static data, we can skip it altogether in simplification. Suppose we have foo = Just (Right [1]) Then no amount of optimization will ever be useful. But what about RULES? If the outermost pattern in a rule matches on a data constructor, then it's not static anymore! We may be replacing it with something else. So we need a finer mechanism. We *also* need a finer mechanism for strict constructors in general. We need to avoid inlining those too early if they're mentioned in any position in RULES. Trying to make this work right automagically looks a bit tricky in the face of orphan rules and such. On Feb 16, 2017 6:35 PM, "Simon Peyton Jones" > wrote: I don’t understand any of this. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. Why won’t it keep happening? What is the problem you are trying to solve? Why does the fast-path make it harder? Maybe open a ticket? Simon From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of David Feuer Sent: 16 February 2017 22:13 To: Ben Gamari >; Reid Barton > Cc: ghc-devs > Subject: Static data and RULES Ben Gamari and Reid Barton are interested in making it cheaper for static data to pass through simplification. The basic idea is that if a term is already made entirely of data constructors and literals, then there's nothing left to optimize. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. But on the other hand, RULES are apparently (according to Duncan Coutts) already broken for strict data constructors, because they have workers and wrappers. My thought: let's allow phased INLINE and NOINLINE pragmas for data constructors. The default would be INLINE. The ~ phase choice would not be available: once inline, always inline. Semantics ~~~~~~~~~~ For all constructors: If a constructor is allowed by pragmas to inline in a certain phase, then in that phase terms built from it can be considered static. Once static, always static. If a constructor is not allowed to inline in a certain phase, terms built from it will be considered non-static. After demand analysis and worker/wrapper, all constructors are considered inline. For strict constructors: A strict constructor wrapper prohibited from inlining in a certain phase simply will not. Strict constructor wrappers will all be allowed to inline after demand analysis and worker/wrapper. This matches the way we now handle wrappers actually created in that phase. Syntax: For GADT syntax, this is easy: data Foo ... where {-# INLINE [1] Bar #-} Bar :: ... For traditional syntax, I think it's probably best to pull the pragmas to the top: {-# NOINLINE Quux #-} data Baz ... = Quux ... | ... -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Fri Feb 17 00:08:16 2017 From: david.feuer at gmail.com (David Feuer) Date: Thu, 16 Feb 2017 19:08:16 -0500 Subject: Static data and RULES In-Reply-To: References: Message-ID: Semantically, the proposed scheme is very nearly equivalent to breaking *every* data constructor into a worker and a wrapper, and allowing INLINE and NOINLINE pragmas on the wrappers. That would allow terms built only from constructor workers and literals to be identified as they're constructed in any stage and left alone by the simplifier. It would also allow people using RULES that match on constructors to make those work reliably, by making sure the bindings they match on don't inline away or get marked static too early. Of course, we don't actually need to add more worker/wrapper pairs to do this; we can fake that. On Feb 16, 2017 6:53 PM, "Simon Peyton Jones" wrote: > I’m sorry I still don’t understand the problem. Can you give an example? > It all works fine today; what will change in the proposed new scheme. > Indeed what IS the proposed new scheme? > > > > I’m lost > > > > Simon > > > > *From:* David Feuer [mailto:david.feuer at gmail.com] > *Sent:* 16 February 2017 23:51 > *To:* Simon Peyton Jones > *Cc:* ghc-devs ; Reid Barton ; > Ben Gamari > *Subject:* RE: Static data and RULES > > > > Sorry; guess I should have given more background on that. This goes back > to the performance problems Ben encountered in Typeable. The goal is to > avoid trying to optimize something over and over that's never ever going to > change. If we know that a term is made only of static data, we can skip it > altogether in simplification. Suppose we have > > > > foo = Just (Right [1]) > > > > Then no amount of optimization will ever be useful. But what about RULES? > If the outermost pattern in a rule matches on a data constructor, then it's > not static anymore! We may be replacing it with something else. So we need > a finer mechanism. We *also* need a finer mechanism for strict constructors > in general. We need to avoid inlining those too early if they're mentioned > in any position in RULES. Trying to make this work right automagically > looks a bit tricky in the face of orphan rules and such. > > > > On Feb 16, 2017 6:35 PM, "Simon Peyton Jones" > wrote: > > I don’t understand any of this. > > > > However, RULES are allowed to match on data constructors and it would be > nice to let that keep happening. > > > > Why won’t it keep happening? What is the problem you are trying to > solve? Why does the fast-path make it harder? > > > > Maybe open a ticket? > > > > Simon > > > > *From:* ghc-devs [mailto:ghc-devs-bounces at haskell.org] *On Behalf Of *David > Feuer > *Sent:* 16 February 2017 22:13 > *To:* Ben Gamari ; Reid Barton > *Cc:* ghc-devs > *Subject:* Static data and RULES > > > > Ben Gamari and Reid Barton are interested in making it cheaper for static > data to pass through simplification. The basic idea is that if a term is > already made entirely of data constructors and literals, then there's > nothing left to optimize. > > > > However, RULES are allowed to match on data constructors and it would be > nice to let that keep happening. But on the other hand, RULES are > apparently (according to Duncan Coutts) already broken for strict data > constructors, because they have workers and wrappers. > > > > My thought: let's allow phased INLINE and NOINLINE pragmas for data > constructors. The default would be INLINE. The ~ phase choice would not be > available: once inline, always inline. > > > > Semantics > > ~~~~~~~~~~ > > > > For all constructors: > > > > If a constructor is allowed by pragmas to inline in a certain phase, then > in that phase terms built from it can be considered static. Once static, > always static. > > > > If a constructor is not allowed to inline in a certain phase, terms built > from it will be considered non-static. > > > > After demand analysis and worker/wrapper, all constructors are considered > inline. > > > > For strict constructors: > > > > A strict constructor wrapper prohibited from inlining in a certain phase > simply will not. > > > > Strict constructor wrappers will all be allowed to inline after demand > analysis and worker/wrapper. This matches the way we now handle wrappers > actually created in that phase. > > > > Syntax: > > > > For GADT syntax, this is easy: > > > > data Foo ... where > > {-# INLINE [1] Bar #-} > > Bar :: ... > > > > For traditional syntax, I think it's probably best to pull the pragmas to > the top: > > > > {-# NOINLINE Quux #-} > > data Baz ... = Quux ... | ... > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Fri Feb 17 00:30:03 2017 From: david.feuer at gmail.com (David Feuer) Date: Thu, 16 Feb 2017 19:30:03 -0500 Subject: Static data and RULES In-Reply-To: References: Message-ID: Let me give an example. Suppose we have data L = LCon1 Int | LCon2 data S = SCon !Int {-# RULES "L" LCon1 0 = LCon2 "S" forall x . f (SCon x) = g x #-} The immediate problem today is with "S". The SCon wrapper could very well inline before the rule has a chance to fire. We'd like to be able to phase that inline to give it a chance. The "L" rule becomes problematic when we try to identify static data the simplifier shouldn't have to try to optimize. If it identifies LCon 0 as static, the "L" rule will never fire. On Feb 16, 2017 7:08 PM, "David Feuer" wrote: > Semantically, the proposed scheme is very nearly equivalent to breaking > *every* data constructor into a worker and a wrapper, and allowing INLINE > and NOINLINE pragmas on the wrappers. That would allow terms built only > from constructor workers and literals to be identified as they're > constructed in any stage and left alone by the simplifier. It would also > allow people using RULES that match on constructors to make those work > reliably, by making sure the bindings they match on don't inline away or > get marked static too early. Of course, we don't actually need to add more > worker/wrapper pairs to do this; we can fake that. > > On Feb 16, 2017 6:53 PM, "Simon Peyton Jones" > wrote: > >> I’m sorry I still don’t understand the problem. Can you give an >> example? It all works fine today; what will change in the proposed new >> scheme. Indeed what IS the proposed new scheme? >> >> >> >> I’m lost >> >> >> >> Simon >> >> >> >> *From:* David Feuer [mailto:david.feuer at gmail.com] >> *Sent:* 16 February 2017 23:51 >> *To:* Simon Peyton Jones >> *Cc:* ghc-devs ; Reid Barton ; >> Ben Gamari >> *Subject:* RE: Static data and RULES >> >> >> >> Sorry; guess I should have given more background on that. This goes back >> to the performance problems Ben encountered in Typeable. The goal is to >> avoid trying to optimize something over and over that's never ever going to >> change. If we know that a term is made only of static data, we can skip it >> altogether in simplification. Suppose we have >> >> >> >> foo = Just (Right [1]) >> >> >> >> Then no amount of optimization will ever be useful. But what about RULES? >> If the outermost pattern in a rule matches on a data constructor, then it's >> not static anymore! We may be replacing it with something else. So we need >> a finer mechanism. We *also* need a finer mechanism for strict constructors >> in general. We need to avoid inlining those too early if they're mentioned >> in any position in RULES. Trying to make this work right automagically >> looks a bit tricky in the face of orphan rules and such. >> >> >> >> On Feb 16, 2017 6:35 PM, "Simon Peyton Jones" >> wrote: >> >> I don’t understand any of this. >> >> >> >> However, RULES are allowed to match on data constructors and it would be >> nice to let that keep happening. >> >> >> >> Why won’t it keep happening? What is the problem you are trying to >> solve? Why does the fast-path make it harder? >> >> >> >> Maybe open a ticket? >> >> >> >> Simon >> >> >> >> *From:* ghc-devs [mailto:ghc-devs-bounces at haskell.org] *On Behalf Of *David >> Feuer >> *Sent:* 16 February 2017 22:13 >> *To:* Ben Gamari ; Reid Barton >> *Cc:* ghc-devs >> *Subject:* Static data and RULES >> >> >> >> Ben Gamari and Reid Barton are interested in making it cheaper for static >> data to pass through simplification. The basic idea is that if a term is >> already made entirely of data constructors and literals, then there's >> nothing left to optimize. >> >> >> >> However, RULES are allowed to match on data constructors and it would be >> nice to let that keep happening. But on the other hand, RULES are >> apparently (according to Duncan Coutts) already broken for strict data >> constructors, because they have workers and wrappers. >> >> >> >> My thought: let's allow phased INLINE and NOINLINE pragmas for data >> constructors. The default would be INLINE. The ~ phase choice would not be >> available: once inline, always inline. >> >> >> >> Semantics >> >> ~~~~~~~~~~ >> >> >> >> For all constructors: >> >> >> >> If a constructor is allowed by pragmas to inline in a certain phase, then >> in that phase terms built from it can be considered static. Once static, >> always static. >> >> >> >> If a constructor is not allowed to inline in a certain phase, terms built >> from it will be considered non-static. >> >> >> >> After demand analysis and worker/wrapper, all constructors are considered >> inline. >> >> >> >> For strict constructors: >> >> >> >> A strict constructor wrapper prohibited from inlining in a certain phase >> simply will not. >> >> >> >> Strict constructor wrappers will all be allowed to inline after demand >> analysis and worker/wrapper. This matches the way we now handle wrappers >> actually created in that phase. >> >> >> >> Syntax: >> >> >> >> For GADT syntax, this is easy: >> >> >> >> data Foo ... where >> >> {-# INLINE [1] Bar #-} >> >> Bar :: ... >> >> >> >> For traditional syntax, I think it's probably best to pull the pragmas to >> the top: >> >> >> >> {-# NOINLINE Quux #-} >> >> data Baz ... = Quux ... | ... >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Fri Feb 17 00:33:12 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 17 Feb 2017 00:33:12 +0000 Subject: Static data and RULES In-Reply-To: References: Message-ID: The immediate problem today is with "S". The SCon wrapper could very well inline before the rule has a chance to fire. We'd like to be able to phase that inline to give it a chance. Yes that’s a problem today. It is orthogonal to the current thread. (As I happens I have fix in my tree.) The "L" rule becomes problematic when we try to identify static data the simplifier shouldn't have to try to optimize. If it identifies LCon 0 as static, the "L" rule will never fire. Why doesn’t it fire? I’m afraid I still do not understand what change is proposed, so I’m finding it difficult to see how to fix problems with it. Simon From: David Feuer [mailto:david.feuer at gmail.com] Sent: 17 February 2017 00:30 To: Simon Peyton Jones Cc: ghc-devs ; Reid Barton ; Ben Gamari Subject: RE: Static data and RULES Let me give an example. Suppose we have data L = LCon1 Int | LCon2 data S = SCon !Int {-# RULES "L" LCon1 0 = LCon2 "S" forall x . f (SCon x) = g x #-} The immediate problem today is with "S". The SCon wrapper could very well inline before the rule has a chance to fire. We'd like to be able to phase that inline to give it a chance. The "L" rule becomes problematic when we try to identify static data the simplifier shouldn't have to try to optimize. If it identifies LCon 0 as static, the "L" rule will never fire. On Feb 16, 2017 7:08 PM, "David Feuer" > wrote: Semantically, the proposed scheme is very nearly equivalent to breaking *every* data constructor into a worker and a wrapper, and allowing INLINE and NOINLINE pragmas on the wrappers. That would allow terms built only from constructor workers and literals to be identified as they're constructed in any stage and left alone by the simplifier. It would also allow people using RULES that match on constructors to make those work reliably, by making sure the bindings they match on don't inline away or get marked static too early. Of course, we don't actually need to add more worker/wrapper pairs to do this; we can fake that. On Feb 16, 2017 6:53 PM, "Simon Peyton Jones" > wrote: I’m sorry I still don’t understand the problem. Can you give an example? It all works fine today; what will change in the proposed new scheme. Indeed what IS the proposed new scheme? I’m lost Simon From: David Feuer [mailto:david.feuer at gmail.com] Sent: 16 February 2017 23:51 To: Simon Peyton Jones > Cc: ghc-devs >; Reid Barton >; Ben Gamari > Subject: RE: Static data and RULES Sorry; guess I should have given more background on that. This goes back to the performance problems Ben encountered in Typeable. The goal is to avoid trying to optimize something over and over that's never ever going to change. If we know that a term is made only of static data, we can skip it altogether in simplification. Suppose we have foo = Just (Right [1]) Then no amount of optimization will ever be useful. But what about RULES? If the outermost pattern in a rule matches on a data constructor, then it's not static anymore! We may be replacing it with something else. So we need a finer mechanism. We *also* need a finer mechanism for strict constructors in general. We need to avoid inlining those too early if they're mentioned in any position in RULES. Trying to make this work right automagically looks a bit tricky in the face of orphan rules and such. On Feb 16, 2017 6:35 PM, "Simon Peyton Jones" > wrote: I don’t understand any of this. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. Why won’t it keep happening? What is the problem you are trying to solve? Why does the fast-path make it harder? Maybe open a ticket? Simon From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of David Feuer Sent: 16 February 2017 22:13 To: Ben Gamari >; Reid Barton > Cc: ghc-devs > Subject: Static data and RULES Ben Gamari and Reid Barton are interested in making it cheaper for static data to pass through simplification. The basic idea is that if a term is already made entirely of data constructors and literals, then there's nothing left to optimize. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. But on the other hand, RULES are apparently (according to Duncan Coutts) already broken for strict data constructors, because they have workers and wrappers. My thought: let's allow phased INLINE and NOINLINE pragmas for data constructors. The default would be INLINE. The ~ phase choice would not be available: once inline, always inline. Semantics ~~~~~~~~~~ For all constructors: If a constructor is allowed by pragmas to inline in a certain phase, then in that phase terms built from it can be considered static. Once static, always static. If a constructor is not allowed to inline in a certain phase, terms built from it will be considered non-static. After demand analysis and worker/wrapper, all constructors are considered inline. For strict constructors: A strict constructor wrapper prohibited from inlining in a certain phase simply will not. Strict constructor wrappers will all be allowed to inline after demand analysis and worker/wrapper. This matches the way we now handle wrappers actually created in that phase. Syntax: For GADT syntax, this is easy: data Foo ... where {-# INLINE [1] Bar #-} Bar :: ... For traditional syntax, I think it's probably best to pull the pragmas to the top: {-# NOINLINE Quux #-} data Baz ... = Quux ... | ... -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at well-typed.com Fri Feb 17 00:46:58 2017 From: david at well-typed.com (David Feuer) Date: Thu, 16 Feb 2017 19:46:58 -0500 Subject: Static data and RULES In-Reply-To: References: Message-ID: <3256404.9R7KkH8FFI@squirrel> On Friday, February 17, 2017 12:33:12 AM EST Simon Peyton Jones via ghc-devs wrote: > The "L" rule becomes problematic when we try to identify static data the > simplifier shouldn't have to try to optimize. If it identifies LCon 0 as > static, the "L" rule will never fire. > Why doesn’t it fire? > > I’m afraid I still do not understand what change is proposed, so I’m finding > it difficult to see how to fix problems with it. I'm sorry; I wasn't trying to be obtuse; easy to drop context by mistake. The idea, at least roughly, is to have a "static" flag on each term. A term is considered static if it's 1. A Core literal, 2. A nullary constructor, or 3. A constructor whose arguments are all static. Once a term is flagged static, the simplifier simply shouldn't try to optimize it--doing so is simply a waste of time. The trouble is that rules like "L" can turn things that *look* utterly static into other things, through simplification that we then actually need! So we need to either try to figure out what's *really* static (which is complicated by orphan RULES) or we need to let users say so. I jumped for phased INLINE and NOINLINE pragmas because users are already accustomed to using those to say "I'm going to match on this with rules". It struck me also as a good way also to deal with the "S" rule that you've apparently found some other way around. David From ben at well-typed.com Fri Feb 17 03:23:43 2017 From: ben at well-typed.com (Ben Gamari) Date: Thu, 16 Feb 2017 22:23:43 -0500 Subject: GHC 8.2.1 status Message-ID: <87poih7b5s.fsf@ben-laptop.smart-cactus.org> Hello everyone, It has been a bit over a week since the last update regarding 8.2.1. At the moment we are on the final stretch leading up cutting the branch. Over the last week I have been cleaning up a variety of odds and ends around the tree, bumping core libraries, merging some last patches, smoke testing, and putting the final touches on the Typeable branch which will be merged shortly. However, during testing against Hackage I found a regression (#13255) due to the recent join-points merge that needs to be addressed before we can consider cutting a release candidate. This will likely be resolved soon, which should allow us to release a source release by mid-to-late next week (assuming no further regressions are found). Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at well-typed.com Fri Feb 17 03:34:51 2017 From: ben at well-typed.com (Ben Gamari) Date: Thu, 16 Feb 2017 22:34:51 -0500 Subject: Static data and RULES In-Reply-To: <3256404.9R7KkH8FFI@squirrel> References: <3256404.9R7KkH8FFI@squirrel> Message-ID: <87mvdl7an8.fsf@ben-laptop.smart-cactus.org> David Feuer writes: > On Friday, February 17, 2017 12:33:12 AM EST Simon Peyton Jones via ghc-devs > wrote: >> The "L" rule becomes problematic when we try to identify static data the >> simplifier shouldn't have to try to optimize. If it identifies LCon 0 as >> static, the "L" rule will never fire. > >> Why doesn’t it fire? >> >> I’m afraid I still do not understand what change is proposed, so I’m finding >> it difficult to see how to fix problems with it. > > I'm sorry; I wasn't trying to be obtuse; easy to drop context by mistake. The > idea, at least roughly, is to have a "static" flag on each term. A term is > considered static if it's > > 1. A Core literal, > 2. A nullary constructor, or > 3. A constructor whose arguments are all static. > > Once a term is flagged static, the simplifier simply shouldn't try to optimize > it--doing so is simply a waste of time. > For the record, David is referring to the proposal I briefly describe in ticket #13282. I started on a patch implementing this idea earlier this week, but eventually encountered enough tricky cases that I decided to put it aside for now to focus on the 8.2 release. Moreover, I have a sneaking suspicion Simon might be working along some similar threads. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From simonpj at microsoft.com Fri Feb 17 08:06:17 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 17 Feb 2017 08:06:17 +0000 Subject: Static data and RULES In-Reply-To: References: Message-ID: {-# RULES "L" LCon1 0 = LCon2 Oh I missed this entirely. You want to write a rule FOR a data constructor???? I thought you just meant one that matches on a data constructor. That is you want (L 0) to rewrite, all by itself, to LCon2? That had never occurred to me as a possibility. Bizarre. Let’s not do that. · GHC does not (knowingly) support it today · It is a deeply weird thing to do · If you want to do it, write you own “smart constructor” mkLCon1, that inlines when you say mkLCon1 x = LCon1 x {-# INILNE [0] mkLCon1 #-} {-# RULES “L” mkLCon1 x = LCon2 #-} Problem solved. Simon From: David Feuer [mailto:david.feuer at gmail.com] Sent: 17 February 2017 00:30 To: Simon Peyton Jones Cc: ghc-devs ; Reid Barton ; Ben Gamari Subject: RE: Static data and RULES Let me give an example. Suppose we have data L = LCon1 Int | LCon2 data S = SCon !Int {-# RULES "L" LCon1 0 = LCon2 "S" forall x . f (SCon x) = g x #-} The immediate problem today is with "S". The SCon wrapper could very well inline before the rule has a chance to fire. We'd like to be able to phase that inline to give it a chance. The "L" rule becomes problematic when we try to identify static data the simplifier shouldn't have to try to optimize. If it identifies LCon 0 as static, the "L" rule will never fire. On Feb 16, 2017 7:08 PM, "David Feuer" > wrote: Semantically, the proposed scheme is very nearly equivalent to breaking *every* data constructor into a worker and a wrapper, and allowing INLINE and NOINLINE pragmas on the wrappers. That would allow terms built only from constructor workers and literals to be identified as they're constructed in any stage and left alone by the simplifier. It would also allow people using RULES that match on constructors to make those work reliably, by making sure the bindings they match on don't inline away or get marked static too early. Of course, we don't actually need to add more worker/wrapper pairs to do this; we can fake that. On Feb 16, 2017 6:53 PM, "Simon Peyton Jones" > wrote: I’m sorry I still don’t understand the problem. Can you give an example? It all works fine today; what will change in the proposed new scheme. Indeed what IS the proposed new scheme? I’m lost Simon From: David Feuer [mailto:david.feuer at gmail.com] Sent: 16 February 2017 23:51 To: Simon Peyton Jones > Cc: ghc-devs >; Reid Barton >; Ben Gamari > Subject: RE: Static data and RULES Sorry; guess I should have given more background on that. This goes back to the performance problems Ben encountered in Typeable. The goal is to avoid trying to optimize something over and over that's never ever going to change. If we know that a term is made only of static data, we can skip it altogether in simplification. Suppose we have foo = Just (Right [1]) Then no amount of optimization will ever be useful. But what about RULES? If the outermost pattern in a rule matches on a data constructor, then it's not static anymore! We may be replacing it with something else. So we need a finer mechanism. We *also* need a finer mechanism for strict constructors in general. We need to avoid inlining those too early if they're mentioned in any position in RULES. Trying to make this work right automagically looks a bit tricky in the face of orphan rules and such. On Feb 16, 2017 6:35 PM, "Simon Peyton Jones" > wrote: I don’t understand any of this. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. Why won’t it keep happening? What is the problem you are trying to solve? Why does the fast-path make it harder? Maybe open a ticket? Simon From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of David Feuer Sent: 16 February 2017 22:13 To: Ben Gamari >; Reid Barton > Cc: ghc-devs > Subject: Static data and RULES Ben Gamari and Reid Barton are interested in making it cheaper for static data to pass through simplification. The basic idea is that if a term is already made entirely of data constructors and literals, then there's nothing left to optimize. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. But on the other hand, RULES are apparently (according to Duncan Coutts) already broken for strict data constructors, because they have workers and wrappers. My thought: let's allow phased INLINE and NOINLINE pragmas for data constructors. The default would be INLINE. The ~ phase choice would not be available: once inline, always inline. Semantics ~~~~~~~~~~ For all constructors: If a constructor is allowed by pragmas to inline in a certain phase, then in that phase terms built from it can be considered static. Once static, always static. If a constructor is not allowed to inline in a certain phase, terms built from it will be considered non-static. After demand analysis and worker/wrapper, all constructors are considered inline. For strict constructors: A strict constructor wrapper prohibited from inlining in a certain phase simply will not. Strict constructor wrappers will all be allowed to inline after demand analysis and worker/wrapper. This matches the way we now handle wrappers actually created in that phase. Syntax: For GADT syntax, this is easy: data Foo ... where {-# INLINE [1] Bar #-} Bar :: ... For traditional syntax, I think it's probably best to pull the pragmas to the top: {-# NOINLINE Quux #-} data Baz ... = Quux ... | ... -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Fri Feb 17 08:11:59 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 17 Feb 2017 08:11:59 +0000 Subject: Static data and RULES In-Reply-To: References: Message-ID: PS: before we go to some effort to optimise X, can we · do some measurements to ensure that X is a problem · check that the problem with X doesn’t have an easy solution For example: · Make a big file with lots of static data · Compile it · Check whether anything non-linear happens; how does compile time increase as you add more data? It would be entirely possible that there’s a quadratic something going on. [If this were true, then fixing the perf bug would benefit ALL programs.] · See how much faster it goes if we simply omit almost all the Core pipeline. Maybe not much! Perhaps all the cost is in the code generator. · Check the generated code to ensure that it really is just a few bytes per constructor. Maybe there’s some stupid and useless extra stuff being generated. [If this were true, the approach you propose will have no effect.] Let’s not rush to fix something until we are sure that the are fixing the real problem! I urged that we no do something special for Typeable but rather fix static data (if that is indeed the problem). Now I’m urging that we don’t do something special for static data until we are sure that the real problem is not elsewhere. Simon From: David Feuer [mailto:david.feuer at gmail.com] Sent: 17 February 2017 00:30 To: Simon Peyton Jones Cc: ghc-devs ; Reid Barton ; Ben Gamari Subject: RE: Static data and RULES Let me give an example. Suppose we have data L = LCon1 Int | LCon2 data S = SCon !Int {-# RULES "L" LCon1 0 = LCon2 "S" forall x . f (SCon x) = g x #-} The immediate problem today is with "S". The SCon wrapper could very well inline before the rule has a chance to fire. We'd like to be able to phase that inline to give it a chance. The "L" rule becomes problematic when we try to identify static data the simplifier shouldn't have to try to optimize. If it identifies LCon 0 as static, the "L" rule will never fire. On Feb 16, 2017 7:08 PM, "David Feuer" > wrote: Semantically, the proposed scheme is very nearly equivalent to breaking *every* data constructor into a worker and a wrapper, and allowing INLINE and NOINLINE pragmas on the wrappers. That would allow terms built only from constructor workers and literals to be identified as they're constructed in any stage and left alone by the simplifier. It would also allow people using RULES that match on constructors to make those work reliably, by making sure the bindings they match on don't inline away or get marked static too early. Of course, we don't actually need to add more worker/wrapper pairs to do this; we can fake that. On Feb 16, 2017 6:53 PM, "Simon Peyton Jones" > wrote: I’m sorry I still don’t understand the problem. Can you give an example? It all works fine today; what will change in the proposed new scheme. Indeed what IS the proposed new scheme? I’m lost Simon From: David Feuer [mailto:david.feuer at gmail.com] Sent: 16 February 2017 23:51 To: Simon Peyton Jones > Cc: ghc-devs >; Reid Barton >; Ben Gamari > Subject: RE: Static data and RULES Sorry; guess I should have given more background on that. This goes back to the performance problems Ben encountered in Typeable. The goal is to avoid trying to optimize something over and over that's never ever going to change. If we know that a term is made only of static data, we can skip it altogether in simplification. Suppose we have foo = Just (Right [1]) Then no amount of optimization will ever be useful. But what about RULES? If the outermost pattern in a rule matches on a data constructor, then it's not static anymore! We may be replacing it with something else. So we need a finer mechanism. We *also* need a finer mechanism for strict constructors in general. We need to avoid inlining those too early if they're mentioned in any position in RULES. Trying to make this work right automagically looks a bit tricky in the face of orphan rules and such. On Feb 16, 2017 6:35 PM, "Simon Peyton Jones" > wrote: I don’t understand any of this. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. Why won’t it keep happening? What is the problem you are trying to solve? Why does the fast-path make it harder? Maybe open a ticket? Simon From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of David Feuer Sent: 16 February 2017 22:13 To: Ben Gamari >; Reid Barton > Cc: ghc-devs > Subject: Static data and RULES Ben Gamari and Reid Barton are interested in making it cheaper for static data to pass through simplification. The basic idea is that if a term is already made entirely of data constructors and literals, then there's nothing left to optimize. However, RULES are allowed to match on data constructors and it would be nice to let that keep happening. But on the other hand, RULES are apparently (according to Duncan Coutts) already broken for strict data constructors, because they have workers and wrappers. My thought: let's allow phased INLINE and NOINLINE pragmas for data constructors. The default would be INLINE. The ~ phase choice would not be available: once inline, always inline. Semantics ~~~~~~~~~~ For all constructors: If a constructor is allowed by pragmas to inline in a certain phase, then in that phase terms built from it can be considered static. Once static, always static. If a constructor is not allowed to inline in a certain phase, terms built from it will be considered non-static. After demand analysis and worker/wrapper, all constructors are considered inline. For strict constructors: A strict constructor wrapper prohibited from inlining in a certain phase simply will not. Strict constructor wrappers will all be allowed to inline after demand analysis and worker/wrapper. This matches the way we now handle wrappers actually created in that phase. Syntax: For GADT syntax, this is easy: data Foo ... where {-# INLINE [1] Bar #-} Bar :: ... For traditional syntax, I think it's probably best to pull the pragmas to the top: {-# NOINLINE Quux #-} data Baz ... = Quux ... | ... -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at well-typed.com Fri Feb 17 14:48:34 2017 From: david at well-typed.com (David Feuer) Date: Fri, 17 Feb 2017 09:48:34 -0500 Subject: Static data and RULES In-Reply-To: References: Message-ID: <2579652.2WAtudeRfF@squirrel> I've never used such rules myself, but when I asked Duncan Coutts about whether and how such rules were used in the wild, he said > Well I've certainly tried to use that in the past. > A previous version of the cbor lib which used a different > representation did a lot of matching on constructors to re-arrange input to > an interpreter, until I discovered that GHC > actually uses constructor wrappers and that matching on constructors was > thus not reliable. He described such rules as "a totally legit thing to want to do". If a datatype represents an AST, then rewriting its terms can optimize the constructed programs. Of course, it's ultimately up to you. I have no dog in this race myself; my concern was for other people's code that could break as a result. Certainly such code is already fragile when strict constructors are involved, but if people have cleverly figured out that lazy constructors are more reliable in that regard, they could be using it. I don't know. David On Friday, February 17, 2017 8:06:17 AM EST Simon Peyton Jones via ghc-devs wrote: > {-# RULES "L" LCon1 0 = LCon2 > Oh I missed this entirely. You want to write a rule FOR a data > constructor???? I thought you just meant one that matches on a data > constructor. That is you want (L 0) to rewrite, all by itself, to LCon2? > That had never occurred to me as a possibility. Bizarre. Let’s not do > that. > > · GHC does not (knowingly) support it today > > · It is a deeply weird thing to do > > · If you want to do it, write you own “smart constructor” mkLCon1, > that inlines when you say > mkLCon1 x = LCon1 x > > {-# INILNE [0] mkLCon1 #-} > > {-# RULES “L” mkLCon1 x = LCon2 #-} > > > Problem solved. > Simon > > From: David Feuer [mailto:david.feuer at gmail.com] > Sent: 17 February 2017 00:30 > To: Simon Peyton Jones > Cc: ghc-devs ; Reid Barton ; Ben > Gamari Subject: RE: Static data and RULES > > Let me give an example. Suppose we have > > data L = LCon1 Int | LCon2 > data S = SCon !Int > > {-# RULES > "L" LCon1 0 = LCon2 > "S" forall x . f (SCon x) = g x > #-} > > The immediate problem today is with "S". The SCon wrapper could very well > inline before the rule has a chance to fire. We'd like to be able to phase > that inline to give it a chance. > The "L" rule becomes problematic when we try to identify static data the > simplifier shouldn't have to try to optimize. If it identifies LCon 0 as > static, the "L" rule will never fire. > On Feb 16, 2017 7:08 PM, "David Feuer" > > wrote: Semantically, > the proposed scheme is very nearly equivalent to breaking *every* data > constructor into a worker and a wrapper, and allowing INLINE and NOINLINE > pragmas on the wrappers. That would allow terms built only from constructor > workers and literals to be identified as they're constructed in any stage > and left alone by the simplifier. It would also allow people using RULES > that match on constructors to make those work reliably, by making sure the > bindings they match on don't inline away or get marked static too early. Of > course, we don't actually need to add more worker/wrapper pairs to do this; > we can fake that. > On Feb 16, 2017 6:53 PM, "Simon Peyton Jones" > > wrote: I’m sorry I > still don’t understand the problem. Can you give an example? It all works > fine today; what will change in the proposed new scheme. Indeed what IS > the proposed new scheme? > I’m lost > > Simon > > From: David Feuer > [mailto:david.feuer at gmail.com] Sent: 16 > February 2017 23:51 > To: Simon Peyton Jones > > Cc: ghc-devs > >; Reid Barton > >; Ben Gamari > > Subject: RE: Static data and > RULES > > Sorry; guess I should have given more background on that. This goes back to > the performance problems Ben encountered in Typeable. The goal is to avoid > trying to optimize something over and over that's never ever going to > change. If we know that a term is made only of static data, we can skip it > altogether in simplification. Suppose we have > foo = Just (Right [1]) > > Then no amount of optimization will ever be useful. But what about RULES? If > the outermost pattern in a rule matches on a data constructor, then it's > not static anymore! We may be replacing it with something else. So we need > a finer mechanism. We *also* need a finer mechanism for strict constructors > in general. We need to avoid inlining those too early if they're mentioned > in any position in RULES. Trying to make this work right automagically > looks a bit tricky in the face of orphan rules and such. > On Feb 16, 2017 6:35 PM, "Simon Peyton Jones" > > wrote: I don’t > understand any of this. > > However, RULES are allowed to match on data constructors and it would be > nice to let that keep happening. > Why won’t it keep happening? What is the problem you are trying to solve? > Why does the fast-path make it harder? > Maybe open a ticket? > > Simon > > From: ghc-devs > [mailto:ghc-devs-bounces at haskell.org] > On Behalf Of David Feuer Sent: 16 February 2017 22:13 > To: Ben Gamari >; Reid Barton > > Cc: ghc-devs > > > Subject: Static data and RULES > > Ben Gamari and Reid Barton are interested in making it cheaper for static > data to pass through simplification. The basic idea is that if a term is > already made entirely of data constructors and literals, then there's > nothing left to optimize. > However, RULES are allowed to match on data constructors and it would be > nice to let that keep happening. But on the other hand, RULES are > apparently (according to Duncan Coutts) already broken for strict data > constructors, because they have workers and wrappers. > My thought: let's allow phased INLINE and NOINLINE pragmas for data > constructors. The default would be INLINE. The ~ phase choice would not be > available: once inline, always inline. > Semantics > ~~~~~~~~~~ > > For all constructors: > > If a constructor is allowed by pragmas to inline in a certain phase, then in > that phase terms built from it can be considered static. Once static, > always static. > If a constructor is not allowed to inline in a certain phase, terms built > from it will be considered non-static. > After demand analysis and worker/wrapper, all constructors are considered > inline. > For strict constructors: > > A strict constructor wrapper prohibited from inlining in a certain phase > simply will not. > Strict constructor wrappers will all be allowed to inline after demand > analysis and worker/wrapper. This matches the way we now handle wrappers > actually created in that phase. > Syntax: > > For GADT syntax, this is easy: > > data Foo ... where > {-# INLINE [1] Bar #-} > Bar :: ... > > For traditional syntax, I think it's probably best to pull the pragmas to > the top: > {-# NOINLINE Quux #-} > data Baz ... = Quux ... | ... From simonpj at microsoft.com Fri Feb 17 15:12:15 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 17 Feb 2017 15:12:15 +0000 Subject: Trac #13255 Message-ID: Ben I have pushed a fix for #13255 (blocking the release) to wip/T13255-spj It contains a series of patches, of which the important one is the last. But Phabbing them exceeded my skill level. I'm rebuilding yet again, but I got a couple of strange testsuite errors. Here is one T2592: Heap exhausted; T2592: Current maximum heap size is 1048576 bytes (1 MB). T2592: Use `+RTS -M' to increase it. +T2592: Heap exhausted; +T2592: Current maximum heap size is 1048576 bytes (1 MB). +T2592: Use `+RTS -M' to increase it. Why would the identical message (from the RTS) now be printed twice? I'm baffled. Maybe a clean build will help. Meanwhile I'm out of time. Can I hand the branch off to you to complete and merge? Get back to me if problems. Simon -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at well-typed.com Fri Feb 17 15:21:37 2017 From: ben at well-typed.com (Ben Gamari) Date: Fri, 17 Feb 2017 10:21:37 -0500 Subject: Static data and RULES In-Reply-To: References: Message-ID: <87fujc7shq.fsf@ben-laptop.smart-cactus.org> Simon Peyton Jones writes: > PS: before we go to some effort to optimise X, can we > I briefly characterized this earlier this week. For a module exporting lots of static data of roughly the same type as TypeRep (e.g. data T = T Addr# Int# Int), the cost scales essentially linearly in the number of static bindings, so I don't think there's any easy non-linearity to fix here. However, compiler allocations roughly double when moving from -O0 to -O1 (from roughly 300 kB / binding to roughly 600 kB / binding). Allocations hardly increase any further with -O2. I just checked now and the C-- looks reasonable. Admittedly, allocations only doubling isn't so bad given how much it costs to optimize non-trivial code (e.g. an Ord instance). Unfortunately I didn't quantify this effect in my investigation earlier in the week. I'll do so now: With -O0 deriving even one set of simple Eq and Ord instances increases allocations while compiling even the 10000 static binding program by nearly 30%. This suggests that, compared to "real" code, simplification of the static bindings is relatively cheap. Indeed I should have checked this earlier. However, this is interesting as when I look back on my measurements of the comparing pre- and post-Typeable compilers on `lens`, I see that the largest changes in compiler allocations (as reported by -v) tend to be in demand analysis, called arity analysis, and the specialiser. This clearly needs further investigation. I've put the testcase here [1] if anyone wants to play with it. Cheers, - Ben [1] https://github.com/bgamari/ghc-static-data-opt-testbench -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From ben at well-typed.com Fri Feb 17 15:23:10 2017 From: ben at well-typed.com (Ben Gamari) Date: Fri, 17 Feb 2017 10:23:10 -0500 Subject: Trac #13255 In-Reply-To: References: Message-ID: <87d1eg7sf5.fsf@ben-laptop.smart-cactus.org> Simon Peyton Jones via ghc-devs writes: > Ben > I have pushed a fix for #13255 (blocking the release) to wip/T13255-spj > It contains a series of patches, of which the important one is the last. But Phabbing them exceeded my skill level. > I'm rebuilding yet again, but I got a couple of strange testsuite errors. Here is one > > > T2592: Heap exhausted; > > T2592: Current maximum heap size is 1048576 bytes (1 MB). > > T2592: Use `+RTS -M' to increase it. > > +T2592: Heap exhausted; > > +T2592: Current maximum heap size is 1048576 bytes (1 MB). > > +T2592: Use `+RTS -M' to increase it. > > Why would the identical message (from the RTS) now be printed twice? I'm baffled. A good question. I'll investigate. > Maybe a clean build will help. > Meanwhile I'm out of time. Can I hand the branch off to you to complete and merge? Of course. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From simonpj at microsoft.com Fri Feb 17 16:41:33 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 17 Feb 2017 16:41:33 +0000 Subject: Early inline Message-ID: Ben, David, Reid I have been working for months (on and off, mostly off, but very ON for the last week or two) on a very simple idea: the simplifier should inline things even in the "gentle" phase. It seems so simple. And it is: the key patch is tiny. But it stressed corners of the optimiser that were not stressed before; and digging into it showed opportunities I did not know about before. So I have ended up a with a whole series of patches, which are on wip/spj-early-inline branch 7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87 Error message wibbles accumulated from the preceding patches 0499c65d9fa45e7879e1e1264fdaa15274adcba6 Improve SetLevels for join points 3b2fc0827ff6cafa34836c2d9dc710b628c990b6 Change -ddump-tc-trace output in TcErrors, slightly 9ffdf62b0ca72c4f35579f9d6f31a9beebf23025 Improve pretty-printing of types 3f346eac06399a79adf48425018ee949cee245bf Add VarSet.anyDVarSet, allDVarSet 912e71eb3b4ec91e805ecf2236d1033e55e2933a The Early Inline Patch 7188cd13f8e54efa764d52ca016b87b3669b29f5 Small changes to expression sizing in CoreUnfold bfc6fa3f377d11bdfcdbf82b65bf2f39cb00b90c Fix SetLevels for makeStaticPtr 8b1cfea089faacb5b95ffcc3511e05faeabb8076 Extend CSE to handle recursive bindings 50411995641802568bb27c867afe804f91e0524c Combine identical case alterantives in CSE 2e077ccc736a0b2a622b7f42b7929966bddb4ded Inline data constructor wrappers in phase 2 only b868de53dd19f639c1070089ecff21948ff33e0d Make Specialise work with casts c767ae5f04a09ef71dcb8f67a17225a52c2cc5d2 Stop uniques ending up in SPEC rule names b49ed1f0102f93ca7f62632c436b41bd240b501f Occurrence-analyse the result of rule firings 607a735dfb99bb8f0edf466ccb01e732218c42ec Add -fspec-constr-keen 67a0c1872c0515f1f12ea68097a84e02da92f45b Refactor floating of bindings (fiBind) e90f4d7c6d3003039fa1647a3da3dafcaa75527b More tracing in SpecConstr Much to my surprise, we get some jolly nice improvements in compiler perf: 3% perf/compiler/T5837.run T5837 [stat too good] (normal) 7% perf/compiler/parsing001.run parsing001 [stat too good] (normal) 9% perf/compiler/T12234.run T12234 [stat too good] (optasm) 35% perf/compiler/T9020.run T9020 [stat too good] (optasm) 9% perf/compiler/T3064.run T3064 [stat too good] (normal) 13% perf/compiler/T9961.run T9961 [stat too good] (normal) 20% perf/compiler/T13056.run T13056 [stat too good] (optasm) 5% perf/compiler/T9872d.run T9872d [stat too good] (normal) 5% perf/compiler/T9872c.run T9872c [stat too good] (normal) 5% perf/compiler/T9872b.run T9872b [stat too good] (normal) 7% perf/compiler/T9872a.run T9872a [stat too good] (normal) 5% perf/compiler/T783.run T783 [stat too good] (normal) 35% perf/compiler/T12227.run T12227 [stat too good] (normal) 20% perf/compiler/T1969.run T1969 [stat too good] (normal) 5% perf/should_run/lazy-bs-alloc.run lazy-bs-alloc [stat too good] (normal) 5% perf/compiler/T12707.run T12707 [stat too good] (normal) 4% perf/compiler/T3294.run T3294 [stat too good] (normal) 1.5% perf/space_leaks/T4029.run T4029 [stat too good] (ghci) So what is left? I have sunk so much time into this and am still not QUITE out of the woods. I was left with Unexpected failures: codeGen/should_compile/debug.run debug [bad stdout] (normal) concurrent/should_run/T4030.run T4030 [bad exit code] (normal) I'm re-validating having pulled from HEAD, but I THINK that's all. Now * I don't know how to Phab these individually * I have not sweated through which patch is responsible for which perf improvments. Maybe Gipeda can tell? * I have not put each error message change with the correct patch. I don't know how much that matters. So this is to say: anything you guys can do to help get this actually Done would be really helpful. I'm out of time till Monday at least. It would be great to collect those performance improvements! Thanks! Simon -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Fri Feb 17 16:48:00 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 17 Feb 2017 16:48:00 +0000 Subject: Trac #13255 Message-ID: I've just rebuilt that branch from scratch. I see Unexpected failures: /tmp/ghctest-q4hnbi/test spaces/./codeGen/should_run/cgrun057.run cgrun057 [bad stderr] (profasm) /tmp/ghctest-q4hnbi/test spaces/./profiling/should_run/T2592.run T2592 [bad stderr] (profasm) /tmp/ghctest-q4hnbi/test spaces/./profiling/should_run/scc001.run scc001 [bad profile] (profasm) (I wish the test suite trimmed off those long paths in the summary...grr) Of these * T2592 is the strange repeated heap-exhaustion thing * scc001 looks like a harmless re-ordering but I don't know why * cgrun057 has this diff -*** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace: +*** Exception (reporting due to +RTS -xc): (THUNK_2_0), stack trace: I guess harmless. Thanks simon From: Simon Peyton Jones Sent: 17 February 2017 15:12 To: Ben Gamari Cc: ghc-devs Subject: Trac #13255 Ben I have pushed a fix for #13255 (blocking the release) to wip/T13255-spj It contains a series of patches, of which the important one is the last. But Phabbing them exceeded my skill level. I'm rebuilding yet again, but I got a couple of strange testsuite errors. Here is one T2592: Heap exhausted; T2592: Current maximum heap size is 1048576 bytes (1 MB). T2592: Use `+RTS -M' to increase it. +T2592: Heap exhausted; +T2592: Current maximum heap size is 1048576 bytes (1 MB). +T2592: Use `+RTS -M' to increase it. Why would the identical message (from the RTS) now be printed twice? I'm baffled. Maybe a clean build will help. Meanwhile I'm out of time. Can I hand the branch off to you to complete and merge? Get back to me if problems. Simon -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikolaj at well-typed.com Fri Feb 17 17:06:14 2017 From: mikolaj at well-typed.com (Mikolaj Konarski) Date: Fri, 17 Feb 2017 18:06:14 +0100 Subject: Early inline In-Reply-To: References: Message-ID: Yay! Is that related to the following ("I also want to investigate making INLINE pragmas fire in the "gentle" phase, on the grounds that that's what the programmer said.")? https://ghc.haskell.org/trac/ghc/ticket/12603#comment:30 On Fri, Feb 17, 2017 at 5:41 PM, Simon Peyton Jones via ghc-devs wrote: > Ben, David, Reid > > I have been working for months (on and off, mostly off, but very ON for the > last week or two) on a very simple idea: the simplifier should inline things > even in the “gentle” phase. > > It seems so simple. And it is: the key patch is tiny. > > But it stressed corners of the optimiser that were not stressed before; and > digging into it showed opportunities I did not know about before. > > So I have ended up a with a whole series of patches, which are on > wip/spj-early-inline branch > > 7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87 Error message wibbles accumulated > from the preceding patches > > 0499c65d9fa45e7879e1e1264fdaa15274adcba6 Improve SetLevels for join points > > 3b2fc0827ff6cafa34836c2d9dc710b628c990b6 Change -ddump-tc-trace output in > TcErrors, slightly > > 9ffdf62b0ca72c4f35579f9d6f31a9beebf23025 Improve pretty-printing of types > > 3f346eac06399a79adf48425018ee949cee245bf Add VarSet.anyDVarSet, allDVarSet > > 912e71eb3b4ec91e805ecf2236d1033e55e2933a The Early Inline Patch > > 7188cd13f8e54efa764d52ca016b87b3669b29f5 Small changes to expression sizing > in CoreUnfold > > bfc6fa3f377d11bdfcdbf82b65bf2f39cb00b90c Fix SetLevels for makeStaticPtr > > 8b1cfea089faacb5b95ffcc3511e05faeabb8076 Extend CSE to handle recursive > bindings > > 50411995641802568bb27c867afe804f91e0524c Combine identical case alterantives > in CSE > > 2e077ccc736a0b2a622b7f42b7929966bddb4ded Inline data constructor wrappers in > phase 2 only > > b868de53dd19f639c1070089ecff21948ff33e0d Make Specialise work with casts > > c767ae5f04a09ef71dcb8f67a17225a52c2cc5d2 Stop uniques ending up in SPEC rule > names > > b49ed1f0102f93ca7f62632c436b41bd240b501f Occurrence-analyse the result of > rule firings > > 607a735dfb99bb8f0edf466ccb01e732218c42ec Add -fspec-constr-keen > > 67a0c1872c0515f1f12ea68097a84e02da92f45b Refactor floating of bindings > (fiBind) > > e90f4d7c6d3003039fa1647a3da3dafcaa75527b More tracing in SpecConstr > > > > Much to my surprise, we get some jolly nice improvements in compiler perf: > > 3% perf/compiler/T5837.run T5837 [stat too good] (normal) > > 7% perf/compiler/parsing001.run parsing001 [stat too good] (normal) > > 9% perf/compiler/T12234.run T12234 [stat too good] (optasm) > > 35% perf/compiler/T9020.run T9020 [stat too good] (optasm) > > 9% perf/compiler/T3064.run T3064 [stat too good] (normal) > > 13% perf/compiler/T9961.run T9961 [stat too good] (normal) > > 20% perf/compiler/T13056.run T13056 [stat too good] (optasm) > > 5% perf/compiler/T9872d.run T9872d [stat too good] (normal) > > 5% perf/compiler/T9872c.run T9872c [stat too good] (normal) > > 5% perf/compiler/T9872b.run T9872b [stat too good] (normal) > > 7% perf/compiler/T9872a.run T9872a [stat too good] (normal) > > 5% perf/compiler/T783.run T783 [stat too good] (normal) > > 35% perf/compiler/T12227.run T12227 [stat too good] (normal) > > 20% perf/compiler/T1969.run T1969 [stat too good] (normal) > > 5% perf/should_run/lazy-bs-alloc.run lazy-bs-alloc [stat too good] > (normal) > > 5% perf/compiler/T12707.run T12707 [stat too good] (normal) > > > > 4% perf/compiler/T3294.run T3294 [stat too good] (normal) > > 1.5% perf/space_leaks/T4029.run T4029 [stat too good] (ghci) > > > > So what is left? I have sunk so much time into this and am still not QUITE > out of the woods. I was left with > > Unexpected failures: > > codeGen/should_compile/debug.run debug [bad stdout] (normal) > > concurrent/should_run/T4030.run T4030 [bad exit code] > (normal) > > I’m re-validating having pulled from HEAD, but I THINK that’s all. > > Now > > · I don’t know how to Phab these individually > > · I have not sweated through which patch is responsible for which > perf improvments. Maybe Gipeda can tell? > > · I have not put each error message change with the correct patch. > I don’t know how much that matters. > > So this is to say: anything you guys can do to help get this actually Done > would be really helpful. I’m out of time till Monday at least. > > It would be great to collect those performance improvements! > > Thanks! > > Simon > > > > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > From simonpj at microsoft.com Fri Feb 17 18:27:06 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 17 Feb 2017 18:27:06 +0000 Subject: Early inline In-Reply-To: References: Message-ID: | Yay! Is that related to the following ("I also want to investigate making | INLINE pragmas fire in the "gentle" phase, on the grounds that that's | what the programmer said.")? | Yes, precisely Simon | -----Original Message----- | From: Mikolaj Konarski [mailto:mikolaj at well-typed.com] | Sent: 17 February 2017 17:06 | To: Simon Peyton Jones | Cc: ghc-devs | Subject: Re: Early inline | | Yay! Is that related to the following ("I also want to investigate making | INLINE pragmas fire in the "gentle" phase, on the grounds that that's | what the programmer said.")? | | https://ghc.haskell.org/trac/ghc/ticket/12603#comment:30 | | | | On Fri, Feb 17, 2017 at 5:41 PM, Simon Peyton Jones via ghc-devs wrote: | > Ben, David, Reid | > | > I have been working for months (on and off, mostly off, but very ON | > for the last week or two) on a very simple idea: the simplifier should | > inline things even in the “gentle” phase. | > | > It seems so simple. And it is: the key patch is tiny. | > | > But it stressed corners of the optimiser that were not stressed | > before; and digging into it showed opportunities I did not know about | before. | > | > So I have ended up a with a whole series of patches, which are on | > wip/spj-early-inline branch | > | > 7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87 Error message wibbles | > accumulated from the preceding patches | > | > 0499c65d9fa45e7879e1e1264fdaa15274adcba6 Improve SetLevels for join | > points | > | > 3b2fc0827ff6cafa34836c2d9dc710b628c990b6 Change -ddump-tc-trace output | > in TcErrors, slightly | > | > 9ffdf62b0ca72c4f35579f9d6f31a9beebf23025 Improve pretty-printing of | > types | > | > 3f346eac06399a79adf48425018ee949cee245bf Add VarSet.anyDVarSet, | > allDVarSet | > | > 912e71eb3b4ec91e805ecf2236d1033e55e2933a The Early Inline Patch | > | > 7188cd13f8e54efa764d52ca016b87b3669b29f5 Small changes to expression | > sizing in CoreUnfold | > | > bfc6fa3f377d11bdfcdbf82b65bf2f39cb00b90c Fix SetLevels for | > makeStaticPtr | > | > 8b1cfea089faacb5b95ffcc3511e05faeabb8076 Extend CSE to handle | > recursive bindings | > | > 50411995641802568bb27c867afe804f91e0524c Combine identical case | > alterantives in CSE | > | > 2e077ccc736a0b2a622b7f42b7929966bddb4ded Inline data constructor | > wrappers in phase 2 only | > | > b868de53dd19f639c1070089ecff21948ff33e0d Make Specialise work with | > casts | > | > c767ae5f04a09ef71dcb8f67a17225a52c2cc5d2 Stop uniques ending up in | > SPEC rule names | > | > b49ed1f0102f93ca7f62632c436b41bd240b501f Occurrence-analyse the result | > of rule firings | > | > 607a735dfb99bb8f0edf466ccb01e732218c42ec Add -fspec-constr-keen | > | > 67a0c1872c0515f1f12ea68097a84e02da92f45b Refactor floating of bindings | > (fiBind) | > | > e90f4d7c6d3003039fa1647a3da3dafcaa75527b More tracing in SpecConstr | > | > | > | > Much to my surprise, we get some jolly nice improvements in compiler | perf: | > | > 3% perf/compiler/T5837.run T5837 [stat too good] (normal) | > | > 7% perf/compiler/parsing001.run parsing001 [stat too good] | (normal) | > | > 9% perf/compiler/T12234.run T12234 [stat too good] (optasm) | > | > 35% perf/compiler/T9020.run T9020 [stat too good] (optasm) | > | > 9% perf/compiler/T3064.run T3064 [stat too good] (normal) | > | > 13% perf/compiler/T9961.run T9961 [stat too good] (normal) | > | > 20% perf/compiler/T13056.run T13056 [stat too good] (optasm) | > | > 5% perf/compiler/T9872d.run T9872d [stat too good] (normal) | > | > 5% perf/compiler/T9872c.run T9872c [stat too good] (normal) | > | > 5% perf/compiler/T9872b.run T9872b [stat too good] (normal) | > | > 7% perf/compiler/T9872a.run T9872a [stat too good] (normal) | > | > 5% perf/compiler/T783.run T783 [stat too good] (normal) | > | > 35% perf/compiler/T12227.run T12227 [stat too good] | (normal) | > | > 20% perf/compiler/T1969.run T1969 [stat too good] (normal) | > | > 5% perf/should_run/lazy-bs-alloc.run lazy-bs-alloc [stat too good] | > (normal) | > | > 5% perf/compiler/T12707.run T12707 [stat too good] (normal) | > | > | > | > 4% perf/compiler/T3294.run T3294 [stat too good] (normal) | > | > 1.5% perf/space_leaks/T4029.run T4029 [stat too good] (ghci) | > | > | > | > So what is left? I have sunk so much time into this and am still not | QUITE | > out of the woods. I was left with | > | > Unexpected failures: | > | > codeGen/should_compile/debug.run debug [bad stdout] | (normal) | > | > concurrent/should_run/T4030.run T4030 [bad exit code] | > (normal) | > | > I’m re-validating having pulled from HEAD, but I THINK that’s all. | > | > Now | > | > · I don’t know how to Phab these individually | > | > · I have not sweated through which patch is responsible for | which | > perf improvments. Maybe Gipeda can tell? | > | > · I have not put each error message change with the correct | patch. | > I don’t know how much that matters. | > | > So this is to say: anything you guys can do to help get this actually | Done | > would be really helpful. I’m out of time till Monday at least. | > | > It would be great to collect those performance improvements! | > | > Thanks! | > | > Simon | > | > | > | > | > _______________________________________________ | > ghc-devs mailing list | > ghc-devs at haskell.org | > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.h | > askell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | devs&data=02%7C01%7Csimonpj%40microsoft.com%7C8c16ded135904fee0a8b08d4575 | 74965%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636229479871604558&sda | ta=Rduq%2B2qaF5MC1p0%2BO0GTV%2BmXK8En9xwHNM7KAYhto10%3D&reserved=0 | > From david at well-typed.com Fri Feb 17 18:32:45 2017 From: david at well-typed.com (David Feuer) Date: Fri, 17 Feb 2017 13:32:45 -0500 Subject: Early inline In-Reply-To: References: Message-ID: <2548778.iyDYrrQK2I@squirrel> Yes, we definely want these. Are you wanting each of these submitted as a separate differential *in order*? Or do you want a more complex mix-and-match? Also, are there any commits you think should be squashed? On Friday, February 17, 2017 4:41:33 PM EST Simon Peyton Jones via ghc-devs wrote: > Ben, David, Reid > I have been working for months (on and off, mostly off, but very ON for the > last week or two) on a very simple idea: the simplifier should inline > things even in the "gentle" phase. It seems so simple. And it is: the key > patch is tiny. > But it stressed corners of the optimiser that were not stressed before; and > digging into it showed opportunities I did not know about before. So I > have ended up a with a whole series of patches, which are on > wip/spj-early-inline branch > > 7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87 Error message wibbles accumulated > from the preceding patches > > 0499c65d9fa45e7879e1e1264fdaa15274adcba6 Improve SetLevels for join points > > 3b2fc0827ff6cafa34836c2d9dc710b628c990b6 Change -ddump-tc-trace output in > TcErrors, slightly > > 9ffdf62b0ca72c4f35579f9d6f31a9beebf23025 Improve pretty-printing of types > > 3f346eac06399a79adf48425018ee949cee245bf Add VarSet.anyDVarSet, allDVarSet > > 912e71eb3b4ec91e805ecf2236d1033e55e2933a The Early Inline Patch > > 7188cd13f8e54efa764d52ca016b87b3669b29f5 Small changes to expression sizing > in CoreUnfold > > bfc6fa3f377d11bdfcdbf82b65bf2f39cb00b90c Fix SetLevels for makeStaticPtr > > 8b1cfea089faacb5b95ffcc3511e05faeabb8076 Extend CSE to handle recursive > bindings > > 50411995641802568bb27c867afe804f91e0524c Combine identical case alterantives > in CSE > > 2e077ccc736a0b2a622b7f42b7929966bddb4ded Inline data constructor wrappers in > phase 2 only > > b868de53dd19f639c1070089ecff21948ff33e0d Make Specialise work with casts > > c767ae5f04a09ef71dcb8f67a17225a52c2cc5d2 Stop uniques ending up in SPEC rule > names > > b49ed1f0102f93ca7f62632c436b41bd240b501f Occurrence-analyse the result of > rule firings > > 607a735dfb99bb8f0edf466ccb01e732218c42ec Add -fspec-constr-keen > > 67a0c1872c0515f1f12ea68097a84e02da92f45b Refactor floating of bindings > (fiBind) > > e90f4d7c6d3003039fa1647a3da3dafcaa75527b More tracing in SpecConstr > > > Much to my surprise, we get some jolly nice improvements in compiler perf: > > 3% perf/compiler/T5837.run T5837 [stat too good] (normal) > > 7% perf/compiler/parsing001.run parsing001 [stat too good] (normal) > > 9% perf/compiler/T12234.run T12234 [stat too good] (optasm) > > 35% perf/compiler/T9020.run T9020 [stat too good] (optasm) > > 9% perf/compiler/T3064.run T3064 [stat too good] (normal) > > 13% perf/compiler/T9961.run T9961 [stat too good] (normal) > > 20% perf/compiler/T13056.run T13056 [stat too good] (optasm) > > 5% perf/compiler/T9872d.run T9872d [stat too good] (normal) > > 5% perf/compiler/T9872c.run T9872c [stat too good] (normal) > > 5% perf/compiler/T9872b.run T9872b [stat too good] (normal) > > 7% perf/compiler/T9872a.run T9872a [stat too good] (normal) > > 5% perf/compiler/T783.run T783 [stat too good] (normal) > > 35% perf/compiler/T12227.run T12227 [stat too good] (normal) > > 20% perf/compiler/T1969.run T1969 [stat too good] (normal) > > 5% perf/should_run/lazy-bs-alloc.run lazy-bs-alloc [stat too good] > (normal) > > 5% perf/compiler/T12707.run T12707 [stat too good] (normal) > > > > 4% perf/compiler/T3294.run T3294 [stat too good] (normal) > > 1.5% perf/space_leaks/T4029.run T4029 [stat too good] (ghci) > > So what is left? I have sunk so much time into this and am still not QUITE > out of the woods. I was left with > > Unexpected failures: > > codeGen/should_compile/debug.run debug [bad stdout] (normal) > > concurrent/should_run/T4030.run T4030 [bad exit code] > (normal) I'm re-validating having pulled from HEAD, but I THINK that's all. > Now > > * I don't know how to Phab these individually > > * I have not sweated through which patch is responsible for which > perf improvments. Maybe Gipeda can tell? > > * I have not put each error message change with the correct patch. > I don't know how much that matters. So this is to say: anything you guys > can do to help get this actually Done would be really helpful. I'm out of > time till Monday at least. It would be great to collect those performance > improvements! > Thanks! > Simon From mail at joachim-breitner.de Fri Feb 17 19:48:52 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Fri, 17 Feb 2017 14:48:52 -0500 Subject: Early inline In-Reply-To: References: Message-ID: <1487360932.26610.1.camel@joachim-breitner.de> Hi, Am Freitag, den 17.02.2017, 16:41 +0000 schrieb Simon Peyton Jones via ghc-devs: > ·         I have not sweated through which patch is responsible for > which perf improvments.  Maybe Gipeda can tell? yes it can! It does not draw nice graphs for branches yet, but it will (try to) build all the commits on the branch. Once that is done (can take a while), the branch will show up under “Branches” on https://perf.haskell.org/ghc/ Clicking on the hash next to the branch will show you the latest commit on that brach, together with its performance changes. That page also has a “parent” link that you can click to look at the previous patches in sequence. I can have a look once the patches are built. Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From simonpj at microsoft.com Fri Feb 17 20:57:44 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 17 Feb 2017 20:57:44 +0000 Subject: Early inline In-Reply-To: <2548778.iyDYrrQK2I@squirrel> References: <2548778.iyDYrrQK2I@squirrel> Message-ID: I can see that - it'd be nice to associate the perf improvements with the right patch - it'd be nice to associate the error-message wibbles with the right patch - it'd be nice to Phab them all so others can comment But life is short, so I'd be perfectly happy if we were able to just commit them, provided they validate collectively. It's up to you guys. There may be some more error message wibbles when you do full run (didn't have time to do that before leaving). Don't squash them.. each patch does something separate... it's not a stream of successive fixes to the same thing. I've already done the squashing. The SetLevels changes strictly subsume everything in the separate patch I sent Ben (cc ghc-devs) fixing #13255, and will conflict with it. If so, ignore the latter. Simon -----Original Message----- | From: David Feuer [mailto:david at well-typed.com] | Sent: 17 February 2017 18:33 | To: ghc-devs at haskell.org; Simon Peyton Jones | Cc: Ben Gamari ; Reid Barton ; | David Feuer | Subject: Re: Early inline | | Yes, we definely want these. Are you wanting each of these submitted as a | separate differential *in order*? Or do you want a more complex mix-and- | match? | Also, are there any commits you think should be squashed? | | On Friday, February 17, 2017 4:41:33 PM EST Simon Peyton Jones via ghc- | devs | wrote: | > Ben, David, Reid | > I have been working for months (on and off, mostly off, but very ON | > for the last week or two) on a very simple idea: the simplifier should | > inline things even in the "gentle" phase. It seems so simple. And it | > is: the key patch is tiny. | > But it stressed corners of the optimiser that were not stressed | > before; and digging into it showed opportunities I did not know about | > before. So I have ended up a with a whole series of patches, which are | > on wip/spj-early-inline branch | > | > 7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87 Error message wibbles | > accumulated from the preceding patches | > | > 0499c65d9fa45e7879e1e1264fdaa15274adcba6 Improve SetLevels for join | > points | > | > 3b2fc0827ff6cafa34836c2d9dc710b628c990b6 Change -ddump-tc-trace output | > in TcErrors, slightly | > | > 9ffdf62b0ca72c4f35579f9d6f31a9beebf23025 Improve pretty-printing of | > types | > | > 3f346eac06399a79adf48425018ee949cee245bf Add VarSet.anyDVarSet, | > allDVarSet | > | > 912e71eb3b4ec91e805ecf2236d1033e55e2933a The Early Inline Patch | > | > 7188cd13f8e54efa764d52ca016b87b3669b29f5 Small changes to expression | > sizing in CoreUnfold | > | > bfc6fa3f377d11bdfcdbf82b65bf2f39cb00b90c Fix SetLevels for | > makeStaticPtr | > | > 8b1cfea089faacb5b95ffcc3511e05faeabb8076 Extend CSE to handle | > recursive bindings | > | > 50411995641802568bb27c867afe804f91e0524c Combine identical case | > alterantives in CSE | > | > 2e077ccc736a0b2a622b7f42b7929966bddb4ded Inline data constructor | > wrappers in phase 2 only | > | > b868de53dd19f639c1070089ecff21948ff33e0d Make Specialise work with | > casts | > | > c767ae5f04a09ef71dcb8f67a17225a52c2cc5d2 Stop uniques ending up in | > SPEC rule names | > | > b49ed1f0102f93ca7f62632c436b41bd240b501f Occurrence-analyse the result | > of rule firings | > | > 607a735dfb99bb8f0edf466ccb01e732218c42ec Add -fspec-constr-keen | > | > 67a0c1872c0515f1f12ea68097a84e02da92f45b Refactor floating of bindings | > (fiBind) | > | > e90f4d7c6d3003039fa1647a3da3dafcaa75527b More tracing in SpecConstr | > | > | > Much to my surprise, we get some jolly nice improvements in compiler | perf: | > | > 3% perf/compiler/T5837.run T5837 [stat too good] (normal) | > | > 7% perf/compiler/parsing001.run parsing001 [stat too good] | (normal) | > | > 9% perf/compiler/T12234.run T12234 [stat too good] (optasm) | > | > 35% perf/compiler/T9020.run T9020 [stat too good] (optasm) | > | > 9% perf/compiler/T3064.run T3064 [stat too good] (normal) | > | > 13% perf/compiler/T9961.run T9961 [stat too good] (normal) | > | > 20% perf/compiler/T13056.run T13056 [stat too good] (optasm) | > | > 5% perf/compiler/T9872d.run T9872d [stat too good] (normal) | > | > 5% perf/compiler/T9872c.run T9872c [stat too good] (normal) | > | > 5% perf/compiler/T9872b.run T9872b [stat too good] (normal) | > | > 7% perf/compiler/T9872a.run T9872a [stat too good] (normal) | > | > 5% perf/compiler/T783.run T783 [stat too good] (normal) | > | > 35% perf/compiler/T12227.run T12227 [stat too good] | (normal) | > | > 20% perf/compiler/T1969.run T1969 [stat too good] (normal) | > | > 5% perf/should_run/lazy-bs-alloc.run lazy-bs-alloc [stat too good] | > (normal) | > | > 5% perf/compiler/T12707.run T12707 [stat too good] (normal) | > | > | > | > 4% perf/compiler/T3294.run T3294 [stat too good] (normal) | > | > 1.5% perf/space_leaks/T4029.run T4029 [stat too good] (ghci) | > | > So what is left? I have sunk so much time into this and am still not | QUITE | > out of the woods. I was left with | > | > Unexpected failures: | > | > codeGen/should_compile/debug.run debug [bad stdout] | (normal) | > | > concurrent/should_run/T4030.run T4030 [bad exit code] | > (normal) I'm re-validating having pulled from HEAD, but I THINK that's | all. | > Now | > | > * I don't know how to Phab these individually | > | > * I have not sweated through which patch is responsible for | which | > perf improvments. Maybe Gipeda can tell? | > | > * I have not put each error message change with the correct | patch. | > I don't know how much that matters. So this is to say: anything you | guys | > can do to help get this actually Done would be really helpful. I'm | out of | > time till Monday at least. It would be great to collect those | > performance improvements! | > Thanks! | > Simon | From v.dijk.bas at gmail.com Sat Feb 18 01:29:35 2017 From: v.dijk.bas at gmail.com (Bas van Dijk) Date: Sat, 18 Feb 2017 02:29:35 +0100 Subject: Static data and RULES In-Reply-To: <2579652.2WAtudeRfF@squirrel> References: <2579652.2WAtudeRfF@squirrel> Message-ID: I also remember using such rules in my code. See for example: https://github.com/basvandijk/aeson/blob/json-builder/Data/Aeson/Types/Internal.hs#L273 TIL rules like that are fragile. Bas Op 17 feb. 2017 3:49 p.m. schreef "David Feuer" : I've never used such rules myself, but when I asked Duncan Coutts about whether and how such rules were used in the wild, he said > Well I've certainly tried to use that in the past. > A previous version of the cbor lib which used a different > representation did a lot of matching on constructors to re-arrange input to > an interpreter, until I discovered that GHC > actually uses constructor wrappers and that matching on constructors was > thus not reliable . He described such rules as "a totally legit thing to want to do". If a datatype represents an AST, then rewriting its terms can optimize the constructed programs. Of course, it's ultimately up to you. I have no dog in this race myself; my concern was for other people's code that could break as a result. Certainly such code is already fragile when strict constructors are involved, but if people have cleverly figured out that lazy constructors are more reliable in that regard, they could be using it. I don't know. David On Friday, February 17, 2017 8:06:17 AM EST Simon Peyton Jones via ghc-devs wrote: > {-# RULES "L" LCon1 0 = LCon2 > Oh I missed this entirely. You want to write a rule FOR a data > constructor???? I thought you just meant one that matches on a data > constructor. That is you want (L 0) to rewrite, all by itself, to LCon2? > That had never occurred to me as a possibility. Bizarre. Let’s not do > that. > > · GHC does not (knowingly) support it today > > · It is a deeply weird thing to do > > · If you want to do it, write you own “smart constructor” mkLCon1, > that inlines when you say > mkLCon1 x = LCon1 x > > {-# INILNE [0] mkLCon1 #-} > > {-# RULES “L” mkLCon1 x = LCon2 #-} > > > Problem solved. > Simon > > From: David Feuer [mailto:david.feuer at gmail.com] > Sent: 17 February 2017 00:30 > To: Simon Peyton Jones > Cc: ghc-devs ; Reid Barton ; Ben > Gamari Subject: RE: Static data and RULES > > Let me give an example. Suppose we have > > data L = LCon1 Int | LCon2 > data S = SCon !Int > > {-# RULES > "L" LCon1 0 = LCon2 > "S" forall x . f (SCon x) = g x > #-} > > The immediate problem today is with "S". The SCon wrapper could very well > inline before the rule has a chance to fire. We'd like to be able to phase > that inline to give it a chance. > The "L" rule becomes problematic when we try to identify static data the > simplifier shouldn't have to try to optimize. If it identifies LCon 0 as > static, the "L" rule will never fire. > On Feb 16, 2017 7:08 PM, "David Feuer" > > wrote: Semantically, > the proposed scheme is very nearly equivalent to breaking *every* data > constructor into a worker and a wrapper, and allowing INLINE and NOINLINE > pragmas on the wrappers. That would allow terms built only from constructor > workers and literals to be identified as they're constructed in any stage > and left alone by the simplifier. It would also allow people using RULES > that match on constructors to make those work reliably, by making sure the > bindings they match on don't inline away or get marked static too early. Of > course, we don't actually need to add more worker/wrapper pairs to do this; > we can fake that. > On Feb 16, 2017 6:53 PM, "Simon Peyton Jones" > > wrote: I’m sorry I > still don’t understand the problem. Can you give an example? It all works > fine today; what will change in the proposed new scheme. Indeed what IS > the proposed new scheme? > I’m lost > > Simon > > From: David Feuer > [mailto:david.feuer at gmail.com] Sent: 16 > February 2017 23:51 > To: Simon Peyton Jones > > Cc: ghc-devs > >; Reid Barton > >; Ben Gamari > > Subject: RE: Static data and > RULES > > Sorry; guess I should have given more background on that. This goes back to > the performance problems Ben encountered in Typeable. The goal is to avoid > trying to optimize something over and over that's never ever going to > change. If we know that a term is made only of static data, we can skip it > altogether in simplification. Suppose we have > foo = Just (Right [1]) > > Then no amount of optimization will ever be useful. But what about RULES? If > the outermost pattern in a rule matches on a data constructor, then it's > not static anymore! We may be replacing it with something else. So we need > a finer mechanism. We *also* need a finer mechanism for strict constructors > in general. We need to avoid inlining those too early if they're mentioned > in any position in RULES. Trying to make this work right automagically > looks a bit tricky in the face of orphan rules and such. > On Feb 16, 2017 6:35 PM, "Simon Peyton Jones" > > wrote: I don’t > understand any of this. > > However, RULES are allowed to match on data constructors and it would be > nice to let that keep happening. > Why won’t it keep happening? What is the problem you are trying to solve? > Why does the fast-path make it harder? > Maybe open a ticket? > > Simon > > From: ghc-devs > [mailto:ghc-devs-bounces at haskell.org] > On Behalf Of David Feuer Sent: 16 February 2017 22:13 > To: Ben Gamari >; Reid Barton > > Cc: ghc-devs > > > Subject: Static data and RULES > > Ben Gamari and Reid Barton are interested in making it cheaper for static > data to pass through simplification. The basic idea is that if a term is > already made entirely of data constructors and literals, then there's > nothing left to optimize. > However, RULES are allowed to match on data constructors and it would be > nice to let that keep happening. But on the other hand, RULES are > apparently (according to Duncan Coutts) already broken for strict data > constructors, because they have workers and wrappers. > My thought: let's allow phased INLINE and NOINLINE pragmas for data > constructors. The default would be INLINE. The ~ phase choice would not be > available: once inline, always inline. > Semantics > ~~~~~~~~~~ > > For all constructors: > > If a constructor is allowed by pragmas to inline in a certain phase, then in > that phase terms built from it can be considered static. Once static, > always static. > If a constructor is not allowed to inline in a certain phase, terms built > from it will be considered non-static. > After demand analysis and worker/wrapper, all constructors are considered > inline. > For strict constructors: > > A strict constructor wrapper prohibited from inlining in a certain phase > simply will not. > Strict constructor wrappers will all be allowed to inline after demand > analysis and worker/wrapper. This matches the way we now handle wrappers > actually created in that phase. > Syntax: > > For GADT syntax, this is easy: > > data Foo ... where > {-# INLINE [1] Bar #-} > Bar :: ... > > For traditional syntax, I think it's probably best to pull the pragmas to > the top: > {-# NOINLINE Quux #-} > data Baz ... = Quux ... | ... _______________________________________________ ghc-devs mailing list ghc-devs at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Sun Feb 19 05:51:01 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Sun, 19 Feb 2017 00:51:01 -0500 Subject: Early inline In-Reply-To: References: Message-ID: <1487483461.17671.1.camel@joachim-breitner.de> Hi, perf.haskell.org has built all but the last patch in this sequence, so I can now see what it has to say about where the performance changes came from: Am Freitag, den 17.02.2017, 16:41 +0000 schrieb Simon Peyton Jones via ghc-devs: > So I  have ended up a with a whole series of patches, which are on > wip/spj-early-inline branch > 7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87 Error message wibbles accumulated from the preceding patches Not built yet, but probably not interesting. > 0499c65d9fa45e7879e1e1264fdaa15274adcba6 Improve SetLevels for join points nofib/time/hidden  0.376  + 5.59%  0.397  s econds > 3b2fc0827ff6cafa34836c2d9dc710b628c990b6 Change -ddump-tc-trace output in TcErrors, slightly no change > 9ffdf62b0ca72c4f35579f9d6f31a9beebf23025 Improve pretty-printing of types no change > 3f346eac06399a79adf48425018ee949cee245bf Add VarSet.anyDVarSet, allDVarSet no change > 912e71eb3b4ec91e805ecf2236d1033e55e2933a The Early Inline Patch > 7188cd13f8e54efa764d52ca016b87b3669b29f5 Small changes to expression sizing in CoreUnfold > bfc6fa3f377d11bdfcdbf82b65bf2f39cb00b90c Fix SetLevels for makeStaticPtr > 8b1cfea089faacb5b95ffcc3511e05faeabb8076 Extend CSE to handle recursive bindings > 50411995641802568bb27c867afe804f91e0524c Combine identical case alterantives in CSE > 2e077ccc736a0b2a622b7f42b7929966bddb4ded Inline data constructor wrappers in phase 2 only > b868de53dd19f639c1070089ecff21948ff33e0d Make Specialise work with casts > c767ae5f04a09ef71dcb8f67a17225a52c2cc5d2 Stop uniques ending up in SPEC rule names > b49ed1f0102f93ca7f62632c436b41bd240b501f Occurrence-analyse the result of rule firings > 607a735dfb99bb8f0edf466ccb01e732218c42ec Add -fspec-constr-keen > 67a0c1872c0515f1f12ea68097a84e02da92f45b Refactor floating of bindings (fiBind) These patches cannot be distinguished because all but the last one failed to build: compiler/simplCore/SimplCore.hs:435:48: error:             • Couldn't match type ‘CoreM ModGuts’                              with ‘CoreProgram -> CoreProgram’               Expected type: DynFlags -> CoreProgram -> CoreProgram                 Actual type: ModGuts -> CoreM ModGuts             • In the first argument of ‘doPassD’, namely ‘floatInwards’               In the expression: doPassD floatInwards               In the expression:                 {-# SCC "FloatInwards" #-} (doPassD floatInwards) https://github.com/nomeata/ghc-speed-logs/blob/ae1b6dcd32fd2c8578ef3eee4c6f8926d845cb97/bfc6fa3f377d11bdfcdbf82b65bf2f39cb00b90c.log.broken The overall effect of this patch was (as you already know): nofib/time/binary-trees  0.751  - 4.79%  0.715  seconds nofib/time/fannkuch-redux  4.751  - 3.85%  4.568  seconds nofib/time/integer  1.276  + 19.04%  1.519  seconds all sizes increase by 3 or 4%. tests/alloc/T10547  32406096  - 4.48%  30953160  bytes tests/alloc/T10858  259699544  - 4.94%  246866000  bytes tests/alloc/T12227  1654153320  - 35.87%  1060777528  bytes tests/alloc/T12234  75197448  - 7.02%  69918192  bytes tests/alloc/T12707  1309049328  - 5.06%  1242803272  bytes tests/alloc/T13035  90082344  - 4.04%  86438544  bytes tests/alloc/T13056  512447048  - 20.21%  408873760  bytes tests/alloc/T1969  756392264  - 19%  612713624  bytes tests/alloc/T3064  287429088  - 8.9%  261860968  bytes tests/alloc/T3294  2715661784  - 3.51%  2620404344  bytes tests/alloc/T4801  412672008  - 5.77%  388841920  bytes tests/alloc/T5321FD  470413728  - 3.67%  453148744  bytes tests/alloc/T5321Fun  500839840  - 3.11%  485276616  bytes tests/alloc/T5642  836251056  - 5.19%  792875648  bytes tests/alloc/T5837  51684016  - 3.97%  49631216  bytes tests/alloc/T6048  98489944  + 3.4%  101835168  bytes tests/alloc/T783  462334328  - 5.21%  438237272  bytes tests/alloc/T9020  775878448  - 35.27%  502248184  bytes tests/alloc/T9872a  3136944168  - 6.81%  2923428352  bytes tests/alloc/T9872b  3964092608  - 5.85%  3732226832  bytes tests/alloc/T9872c  3603773864  - 5.49%  3405843000  bytes tests/alloc/T9872d  466420232  - 5.1%  442644168  bytes tests/alloc/T9961  575612760  - 13.15%  499917080  bytes tests/alloc/lazy-bs-all 436680  - 3.77%  420224  bytes tests/alloc/parsing001  499038992  - 6.77%  465237088  bytes tests/alloc/T10547  32406096  - 4.48%  30953160  bytes tests/alloc/T10858  259699544  - 4.94%  246866000  bytes tests/alloc/T12227  1654153320  - 35.87%  1060777528  bytes tests/alloc/T12234  75197448  - 7.02%  69918192  bytes tests/alloc/T12707  1309049328  - 5.06%  1242803272  bytes tests/alloc/T13035  90082344  - 4.04%  86438544  bytes tests/alloc/T13056  512447048  - 20.21%  408873760  bytes tests/alloc/T1969  756392264  - 19%  612713624  bytes tests/alloc/T3064  287429088  - 8.9%  261860968  bytes tests/alloc/T3294  2715661784  - 3.51%  2620404344  bytes tests/alloc/T4801  412672008  - 5.77%  388841920  bytes tests/alloc/T5321FD  470413728  - 3.67%  453148744  bytes tests/alloc/T5321Fun  500839840  - 3.11%  485276616  bytes tests/alloc/T5642  836251056  - 5.19%  792875648  bytes tests/alloc/T5837  51684016  - 3.97%  49631216  bytes tests/alloc/T6048  98489944  + 3.4%  101835168  bytes tests/alloc/T783  462334328  - 5.21%  438237272  bytes tests/alloc/T9020  775878448  - 35.27%  502248184  bytes tests/alloc/T9872a  3136944168  - 6.81%  2923428352  bytes tests/alloc/T9872b  3964092608  - 5.85%  3732226832  bytes tests/alloc/T9872c  3603773864  - 5.49%  3405843000  bytes tests/alloc/T9872d  466420232  - 5.1%  442644168  bytes tests/alloc/T9961  575612760  - 13.15%  499917080  bytes tests/alloc/lazy-bs-all 436680   - 3.77%  420224  bytes tests/alloc/parsing001  499038992  - 6.77%  465237088  bytes > e90f4d7c6d3003039fa1647a3da3dafcaa75527b More tracing in SpecConstr no changes. Well, less helpful than expected, but hard to do better given a patch series where not every patch builds. Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From simonpj at microsoft.com Mon Feb 20 15:16:55 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Mon, 20 Feb 2017 15:16:55 +0000 Subject: Superclasses Message-ID: Edward In comment:23 of https://ghc.haskell.org/trac/ghc/ticket/11523 I claim that there is an infinite tower of superclasses, so that GHC can legitimately spin. You have not responded for nearly a year. Do you agree? Simon -------------- next part -------------- An HTML attachment was scrubbed... URL: From lonetiger at gmail.com Mon Feb 20 15:58:58 2017 From: lonetiger at gmail.com (Phyx) Date: Mon, 20 Feb 2017 15:58:58 +0000 Subject: MSYS2 update (those who build on Windows please read) Message-ID: Hi Windows devs, February comes with a major change in behavior for MSYS2/Cygwin. Tools such as awk/sed etc now use binary mode unless on a text mount: https://cygwin.com/ml/cygwin-announce/2017-02/msg00036.html This is problematic because GHC etc only use the underlying OS to determine how to output line endings. As such we output \r\n but in sed et al $ will no longer match line endings. Which means out scripts are currently broken. Do not upgrade your MSYS2 install until a workaround for this is in place or you will be unable to compile GHC. If you have updated your MSYS2 then using a text mount may be the easiest option to get a working build again. As it seems just downgrading the tools alone is not enough. Thanks, Tamar -------------- next part -------------- An HTML attachment was scrubbed... URL: From ekmett at gmail.com Mon Feb 20 21:01:55 2017 From: ekmett at gmail.com (Edward Kmett) Date: Mon, 20 Feb 2017 16:01:55 -0500 Subject: Superclasses In-Reply-To: References: Message-ID: I'm rather incapacitated at the moment as I just got out of major surgery, so I'm not in a good place to check particulars right now. I can definitely say I'd like some way to attain an equivalent result, but I accept that it may not be possible with the machinery we have. -Edward On Mon, Feb 20, 2017 at 10:16 AM, Simon Peyton Jones wrote: > Edward > > In comment:23 of https://ghc.haskell.org/trac/ghc/ticket/11523 I claim > that there is an infinite tower of superclasses, so that GHC can > legitimately spin. > > You have not responded for nearly a year. > > Do you agree? > > Simon > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Tue Feb 21 12:38:50 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Tue, 21 Feb 2017 12:38:50 +0000 Subject: Time library broken Message-ID: I'm getting this libraries/time/lib/Data/Time/Clock/Internal/SystemTime.hs:1:14: warning: [-Wtrustworthy-safe] 'Data.Time.Clock.Internal.SystemTime' is marked as Trustworthy but has been inferred as safe! | 1 | {-# LANGUAGE Trustworthy #-} | ^^^^^^^^^^^ Since I use -Werror in stage2, my build fails. Simon -------------- next part -------------- An HTML attachment was scrubbed... URL: From ryan.gl.scott at gmail.com Tue Feb 21 15:41:53 2017 From: ryan.gl.scott at gmail.com (Ryan Scott) Date: Tue, 21 Feb 2017 10:41:53 -0500 Subject: Time library broken Message-ID: There also appears to be a plain old build failure on Windows with time-1.8. Here's an excerpt [1] from a failing Harbormaster build: libraries\time\lib\Data\Time\Clock\Internal\SystemTime.hs:57:5: error: Not in scope: data constructor ‘FILETIME’ Perhaps you meant ‘Win32.FILETIME’ (imported from System.Win32.Time) | 57 | FILETIME ft <- Win32.getSystemTimeAsFileTime | ^^^^^^^^ Ryan S. ----- [1] https://phabricator.haskell.org/harbormaster/build/21312/?l=100 From gracjanpolak at gmail.com Tue Feb 21 17:45:50 2017 From: gracjanpolak at gmail.com (Gracjan Polak) Date: Tue, 21 Feb 2017 18:45:50 +0100 Subject: XTypeApplication and @spaces Message-ID: Hi all, I was thinking about implementing @Type syntax highlight for haskell-mode and noticed a rule about spacing required before @-sign. I do not understand where does this rule come from and what does it buy us. Experimentation shows that @-patterns do not care about spaces at all: Prelude> let f a @ Nothing = print a in f Nothing Nothing Comment next to implementation says: "This, of course, conflicts with as-patterns. The conflict arises because expressions and patterns use the same parser, and also because we want to allow type patterns within expression patterns." As I understand pattern and expression contexts are always separate in Haskell so the part just after 'of course' is not clear to me. Can I get an example for "we want to allow type patterns within expression patterns"? I understand the part "expressions and patterns use the same parser" but then I'd rather file a bug report about this one. Rationale: I'd rather limit usage for horizontal space to separate tokens on the lexer level. This looks like it tries to promote space to separate things on parser level, which is rather hard to get right in crude parsers that we have for syntax highligh, indentation, completion and the like. -- Gracjan -------------- next part -------------- An HTML attachment was scrubbed... URL: From rae at cs.brynmawr.edu Tue Feb 21 18:55:05 2017 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Tue, 21 Feb 2017 13:55:05 -0500 Subject: XTypeApplication and @spaces In-Reply-To: References: Message-ID: <3B971F73-DE00-4BFA-A72D-6F190965EFF5@cs.brynmawr.edu> > On Feb 21, 2017, at 12:45 PM, Gracjan Polak wrote: > > Hi all, > > I was thinking about implementing @Type syntax highlight for haskell-mode and noticed a rule about spacing required before @-sign. Thanks for looking into this! > > I do not understand where does this rule come from and what does it buy us. > > Experimentation shows that @-patterns do not care about spaces at all: Quite true. > > Comment next to implementation says: "This, of course, conflicts with as-patterns. The conflict arises because expressions and patterns use the same parser, and also because we want to allow type patterns within expression patterns." > > As I understand pattern and expression contexts are always separate in Haskell so the part just after 'of course' is not clear to me. Sadly, this is not true. We don’t always know whether we’re parsing an expression or a pattern. Specifically, imagine this prefix of a Haskell definition: foo = do Just x Is `Just x` the result of `foo`? If so, then `Just x` is an expression. Or is this the beginning of `Just x <- blargh`. If so, then `Just x` is a pattern. We don’t know until we see either a semicolon (possibly inserted by layout rules) or an arrow, which could be arbitrarily far away. So we must have a combined expression/pattern parser. > > Can I get an example for "we want to allow type patterns within expression patterns”? This is to allow for future expansion of the @Type syntax, to allow usage in patterns. For example we might want id :: a -> a id @b x = (x :: b) where the @b brings b, a scoped type variable, into scope. > > I understand the part "expressions and patterns use the same parser" but then I'd rather file a bug report about this one. > > Rationale: I'd rather limit usage for horizontal space to separate tokens on the lexer level. With -XTypeApplications, GHC lexes ‘ @‘ and ‘@‘ separately. (Actually, the ‘ @‘ lexeme doesn’t require a space there -- just something that cannot appear in an identifier). As-patterns require the ‘@‘ lexeme, while type applications require the ’ @‘ lexeme. When -XTypeApplications is not turned on, this change in lexer behavior is not enabled. > This looks like it tries to promote space to separate things on parser level, which is rather hard to get right in crude parsers that we have for syntax highligh, indentation, completion and the like. This is a really good point, and something we should keep in mind as we continue to tinker with syntax. Perhaps the ghc-proposals process will bring such problems to light sooner. I’m sorry our design decisions here have caused trouble! Richard > > -- > Gracjan > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at well-typed.com Tue Feb 21 19:09:04 2017 From: david at well-typed.com (David Feuer) Date: Tue, 21 Feb 2017 14:09:04 -0500 Subject: Status of early-inline branch Message-ID: <16728675.iSmk54NC6A@squirrel> I've been working on trying to get the branch in shape for review and such, but I see that you're also still working on it. So we don't tread on each other's toes too much, I'm wondering if you could give me a sense of what the status is, which commits are firm and which you might change, etc. Thanks, David Feuer From david at well-typed.com Tue Feb 21 19:11:21 2017 From: david at well-typed.com (David Feuer) Date: Tue, 21 Feb 2017 14:11:21 -0500 Subject: Status of early-inline branch In-Reply-To: <16728675.iSmk54NC6A@squirrel> References: <16728675.iSmk54NC6A@squirrel> Message-ID: <2564707.vxY7gSe5Yx@squirrel> On Tuesday, February 21, 2017 2:09:04 PM EST David Feuer wrote: > I've been working on trying to get the branch in shape for review and such, > but I see that you're also still working on it. So we don't tread on each > other's toes too much, I'm wondering if you could give me a sense of what > the status is, which commits are firm and which you might change, etc. > > Thanks, > David Feuer Oh, and it would probably be easier if you work on top of my rebased version (D3167). That will at least avoid having to rehash the same things quite so many times, allow perf test results to be useful in the face of Ben's Typeable changes, etc. From gracjanpolak at gmail.com Tue Feb 21 20:40:59 2017 From: gracjanpolak at gmail.com (Gracjan Polak) Date: Tue, 21 Feb 2017 21:40:59 +0100 Subject: XTypeApplication and @spaces In-Reply-To: <3B971F73-DE00-4BFA-A72D-6F190965EFF5@cs.brynmawr.edu> References: <3B971F73-DE00-4BFA-A72D-6F190965EFF5@cs.brynmawr.edu> Message-ID: 2017-02-21 19:55 GMT+01:00 Richard Eisenberg : > As I understand pattern and expression contexts are always separate in > Haskell so the part just after 'of course' is not clear to me. > > > Sadly, this is not true. We don’t always know whether we’re parsing an > expression or a pattern. Specifically, imagine this prefix of a Haskell > definition: > > foo = do > Just x > Ah yes, partial parses. I did not think about this. > With -XTypeApplications, GHC lexes ‘ @‘ and ‘@‘ separately. > For the record: GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help Prelude> :set -XTypeApplications Prelude> let f x at Nothing = print x in f Nothing Nothing Prelude> let f x @Nothing = print x in f Nothing :3:5: error: Parse error in pattern: f x @Nothing Prelude> let f x@ Nothing = print x in f Nothing Nothing Prelude> let f x @ Nothing = print x in f Nothing :11:5: error: Parse error in pattern: f x @Nothing Prelude> :set -XNoTypeApplications Prelude> let f x at Nothing = print x in f Nothing Nothing Prelude> let f x@ Nothing = print x in f Nothing Nothing Prelude> let f x @Nothing = print x in f Nothing Nothing Prelude> let f x @ Nothing = print x in f Nothing Nothing > Perhaps the ghc-proposals process will bring such problems to light > sooner. I’m sorry our design decisions here have caused trouble! > As I understand keeping Language Report full up to date is a lot of work, but keeping just the sections about Lexing and Parsing up to date should be a part of ghc-proposals in my opinion, so that independent tools have information to rely on. -- Gracjan -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Tue Feb 21 23:14:00 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Tue, 21 Feb 2017 23:14:00 +0000 Subject: Status of early-inline branch In-Reply-To: <16728675.iSmk54NC6A@squirrel> References: <16728675.iSmk54NC6A@squirrel> Message-ID: It's ready to go. I'm just doing small deltas. Go for it; It's fine as-is. Anything else is just further progress. You can always put stuff up and I can plonk any further patches on top of whatever you finally commit. Anyway, go for it.. don't wait for me. And tell me if I'm getting in the way The only blocker as far as I know is those two failing tests Simon | -----Original Message----- | From: David Feuer [mailto:david at well-typed.com] | Sent: 21 February 2017 19:09 | To: Simon Peyton Jones | Cc: ghc-devs at haskell.org | Subject: Status of early-inline branch | | I've been working on trying to get the branch in shape for review and | such, but I see that you're also still working on it. So we don't tread | on each other's toes too much, I'm wondering if you could give me a sense | of what the status is, which commits are firm and which you might change, | etc. | | Thanks, | David Feuer From simonpj at microsoft.com Wed Feb 22 14:08:38 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Wed, 22 Feb 2017 14:08:38 +0000 Subject: Windows build broken Message-ID: Please please please could some one fix this? On windows. It's frustrating being unable to build. Please please Simon libraries\time\lib\Data\Time\Clock\Internal\SystemTime.hs:57:5: error: Not in scope: data constructor FILETIME Perhaps you meant Win32.FILETIME (imported from System.Win32.Time) | 57 | FILETIME ft <- Win32.getSystemTimeAsFileTime | ^^^^^^^^ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lonetiger at gmail.com Wed Feb 22 14:13:32 2017 From: lonetiger at gmail.com (Phyx) Date: Wed, 22 Feb 2017 14:13:32 +0000 Subject: Windows build broken In-Reply-To: References: Message-ID: The package has been fixed already but the submodule hasn't been updated. For a quick fix just cd into libraries/time and checkout master. I was hesitant to push the new submodule since we hadn't branched yet for 8.2 On Wed, 22 Feb 2017, 14:09 Simon Peyton Jones via ghc-devs, < ghc-devs at haskell.org> wrote: > Please please please could some one fix this? On windows. > > It’s frustrating being unable to build. > > Please > > please > > Simon > > > > libraries\time\lib\Data\Time\Clock\Internal\SystemTime.hs:57:5: error: > > Not in scope: data constructor FILETIME > > Perhaps you meant Win32.FILETIME (imported from > System.Win32.Time) > > | > > 57 | FILETIME ft <- Win32.getSystemTimeAsFileTime > > | ^^^^^^^^ > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Wed Feb 22 14:36:53 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Wed, 22 Feb 2017 14:36:53 +0000 Subject: Windows build broken In-Reply-To: References: Message-ID: well HEAD is broken, so surely it should go either forward or backward. But the status quo is not good. My instinct: push the new submodule. But I defer to Ben etc Simon From: Phyx [mailto:lonetiger at gmail.com] Sent: 22 February 2017 14:14 To: Simon Peyton Jones ; ghc-devs at haskell.org Cc: Ashley Yakeley Subject: Re: Windows build broken The package has been fixed already but the submodule hasn't been updated. For a quick fix just cd into libraries/time and checkout master. I was hesitant to push the new submodule since we hadn't branched yet for 8.2 On Wed, 22 Feb 2017, 14:09 Simon Peyton Jones via ghc-devs, > wrote: Please please please could some one fix this? On windows. It’s frustrating being unable to build. Please please Simon libraries\time\lib\Data\Time\Clock\Internal\SystemTime.hs:57:5: error: Not in scope: data constructor FILETIME Perhaps you meant Win32.FILETIME (imported from System.Win32.Time) | 57 | FILETIME ft <- Win32.getSystemTimeAsFileTime | ^^^^^^^^ _______________________________________________ ghc-devs mailing list ghc-devs at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs -------------- next part -------------- An HTML attachment was scrubbed... URL: From lonetiger at gmail.com Wed Feb 22 14:46:43 2017 From: lonetiger at gmail.com (Phyx) Date: Wed, 22 Feb 2017 14:46:43 +0000 Subject: Windows build broken In-Reply-To: References: Message-ID: Head of ghc is broken not head of time. Ghc is currently set to 6e202ed while head is 4eb06c0. So checking out the master branch of libraries/time should bring you to a working build. I am currently without my ssh keys so cannot push it. If someone else wants to update it? Otherwise I'll do so when I get home. On Wed, 22 Feb 2017, 14:36 Simon Peyton Jones, wrote: > well HEAD is broken, so surely it should go either forward or backward. > But the status quo is not good. > > > > My instinct: push the new submodule. But I defer to Ben etc > > > > Simon > > > > *From:* Phyx [mailto:lonetiger at gmail.com] > *Sent:* 22 February 2017 14:14 > *To:* Simon Peyton Jones ; ghc-devs at haskell.org > *Cc:* Ashley Yakeley > *Subject:* Re: Windows build broken > > > > The package has been fixed already but the submodule hasn't been updated. > For a quick fix just cd into libraries/time and checkout master. > > I was hesitant to push the new submodule since we hadn't branched yet for > 8.2 > > > > On Wed, 22 Feb 2017, 14:09 Simon Peyton Jones via ghc-devs, < > ghc-devs at haskell.org> wrote: > > Please please please could some one fix this? On windows. > > It’s frustrating being unable to build. > > Please > > please > > Simon > > > > libraries\time\lib\Data\Time\Clock\Internal\SystemTime.hs:57:5: error: > > Not in scope: data constructor FILETIME > > Perhaps you meant Win32.FILETIME (imported from > System.Win32.Time) > > | > > 57 | FILETIME ft <- Win32.getSystemTimeAsFileTime > > | ^^^^^^^^ > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Wed Feb 22 15:08:28 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Wed, 22 Feb 2017 15:08:28 +0000 Subject: Windows build broken In-Reply-To: References: Message-ID: Tonight is fine – thank you! From: Phyx [mailto:lonetiger at gmail.com] Sent: 22 February 2017 14:47 To: Simon Peyton Jones Cc: ghc-devs at haskell.org Subject: Re: Windows build broken Head of ghc is broken not head of time. Ghc is currently set to 6e202ed while head is 4eb06c0. So checking out the master branch of libraries/time should bring you to a working build. I am currently without my ssh keys so cannot push it. If someone else wants to update it? Otherwise I'll do so when I get home. On Wed, 22 Feb 2017, 14:36 Simon Peyton Jones, > wrote: well HEAD is broken, so surely it should go either forward or backward. But the status quo is not good. My instinct: push the new submodule. But I defer to Ben etc Simon From: Phyx [mailto:lonetiger at gmail.com] Sent: 22 February 2017 14:14 To: Simon Peyton Jones >; ghc-devs at haskell.org Cc: Ashley Yakeley > Subject: Re: Windows build broken The package has been fixed already but the submodule hasn't been updated. For a quick fix just cd into libraries/time and checkout master. I was hesitant to push the new submodule since we hadn't branched yet for 8.2 On Wed, 22 Feb 2017, 14:09 Simon Peyton Jones via ghc-devs, > wrote: Please please please could some one fix this? On windows. It’s frustrating being unable to build. Please please Simon libraries\time\lib\Data\Time\Clock\Internal\SystemTime.hs:57:5: error: Not in scope: data constructor FILETIME Perhaps you meant Win32.FILETIME (imported from System.Win32.Time) | 57 | FILETIME ft <- Win32.getSystemTimeAsFileTime | ^^^^^^^^ _______________________________________________ ghc-devs mailing list ghc-devs at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Wed Feb 22 15:10:44 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Wed, 22 Feb 2017 15:10:44 +0000 Subject: Windows build broken In-Reply-To: <87zihexqb4.fsf@ptsecurity.com> References: <87zihexqb4.fsf@ptsecurity.com> Message-ID: Re-adding ghc-devs. | Settup up things so that all master pushes go through a build&smoke-test-on- | all-relevant-platforms purgatory shouldn't be that problematic.. I know. We discuss it periodically The trouble is that it takes work to do these things (reliably, solidly) and everyone is busy. If someone felt able to step up to doing it, it'd be great. Simon | -----Original Message----- | From: Kosyrev Serge [mailto:skosyrev at ptsecurity.com] | Sent: 22 February 2017 14:18 | To: Simon Peyton Jones | Subject: Re: Windows build broken | | Simon, | | It pains me to see how something trivially preventable by a functioning | "continuous integration" setup keeps causing you trouble so regularly. | | Settup up things so that all master pushes go through a build&smoke-test-on- | all-relevant-platforms purgatory shouldn't be that problematic.. | | I know, it's not my ground to meddle in, but I just can't be calmly watching | this entirely preventable suffering.. | | Simon Peyton Jones via ghc-devs writes: | > Please please please could some one fix this? On windows. | > | > It’s frustrating being unable to build. | > | > Please | > | > please | > | > Simon | > | > libraries\time\lib\Data\Time\Clock\Internal\SystemTime.hs:57:5: error: | > | > Not in scope: data constructor FILETIME | > | > Perhaps you meant Win32.FILETIME (imported from System.Win32.Time) | > | > | | > | > 57 | FILETIME ft <- Win32.getSystemTimeAsFileTime | > | > | ^^^^^^^^ | | -- | с уважениeм / respectfully, not a GHC developer at all, Косырев Сергей | -- | “Most deadly errors arise from obsolete assumptions.” | -- Frank Herbert, Children of Dune From ashley at semantic.org Wed Feb 22 20:59:56 2017 From: ashley at semantic.org (Ashley Yakeley) Date: Wed, 22 Feb 2017 12:59:56 -0800 Subject: Windows build broken In-Reply-To: References: Message-ID: <1487797196.4042.12.camel@semantic.org> Please set your "time" submodule to the "ghc" branch. It should always represent a stable release. -- Ashley On Wed, 2017-02-22 at 14:13 +0000, Phyx wrote: > The package has been fixed already but the submodule hasn't been > updated. For a quick fix just cd into libraries/time and checkout > master. > I was hesitant to push the new submodule since we hadn't branched yet > for 8.2 > > On Wed, 22 Feb 2017, 14:09 Simon Peyton Jones via ghc-devs, > @haskell.org> wrote: > > Please please please could some one fix this?  On windows. > > It’s frustrating being unable to build. > > Please > > please > > Simon > >   > > libraries\time\lib\Data\Time\Clock\Internal\SystemTime.hs:57:5: > > error: > >     Not in scope: data constructor    FILETIME   > >     Perhaps you meant    Win32.FILETIME    (imported from > > System.Win32.Time) > >    | > > 57 |     FILETIME ft <- Win32.getSystemTimeAsFileTime > >    |     ^^^^^^^^ > > _______________________________________________ > > ghc-devs mailing list > > ghc-devs at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ryan.gl.scott at gmail.com Thu Feb 23 19:51:41 2017 From: ryan.gl.scott at gmail.com (Ryan Scott) Date: Thu, 23 Feb 2017 14:51:41 -0500 Subject: Deriving Data for poly-kinded datatypes Message-ID: Hi Pedro, I'm quite confused by a peculiarity of deriving Data (more info in Trac #13327 [1]). In particular, if you write this: data T phantom = T deriving Data Then the derived Data instance is NOT this: instance Typeable phantom => Data (T phantom) where ... But instead, it's this: instance Data phantom => Data (T phantom) where ... dataCast1 f = gcast1 f The gcast1 part is why it requires the stronger (Data phantom) context, as you noted in Trac #4028 [2]. What confuses me, however, is that is apparently does not carry over to poly-kinded datatypes. For instance, if you write this: data T (phantom :: k) = T deriving Data Then you do NOT get this instance: instance Data (phantom :: *) => Data (T phantom) where ... dataCast1 f = gcast1 f But instead, you get this instance! instance (Typeable k, Typeable (phantom :: k)) => Data (T phantom) where ... -- No implementation for dataCast1 This is quite surprising to me. I'm not knowledgeable enough about Data to know for sure if this is an oversight, expected behavior, or something else, so I was hoping you (or someone else highly knowledgeable about SYB-style generic programming) could help me out here. In particular: 1. Does emitting "dataCast1 f = gcast1 f" for datatypes of kind (k -> *) make sense? Or does it only make sense for types of kind (* -> *)? 2. Is there an alternate way to define dataCast1 that doesn't require the stronger Data context, but instead only requires the more general Typeable context? Ryan S. ----- [1] https://ghc.haskell.org/trac/ghc/ticket/13327 [2] https://ghc.haskell.org/trac/ghc/ticket/4028#comment:5 From dreixel at gmail.com Thu Feb 23 22:25:11 2017 From: dreixel at gmail.com (=?UTF-8?Q?Jos=C3=A9_Pedro_Magalh=C3=A3es?=) Date: Thu, 23 Feb 2017 22:25:11 +0000 Subject: Deriving Data for poly-kinded datatypes In-Reply-To: References: Message-ID: Hi Ryan, I can't recall any particular reason to avoid including dataCast1 in the Data instance for poly-kinded datatypes. Have you tried applying the example in #4028 to a poly-kinded datatype? It might be that it was done simply to avoid forcing the kind of the parameter to be *, and hence losing the polymorphism (possibly at the price of losing generic function extension). I'm not aware of a way to define dataCast1 without the Data context. Then again, I think it's only used for generic function extension (ext1Q and friends); can you find a way to make that work without the Data constraint? Cheers, Pedro On 23 February 2017 at 19:51, Ryan Scott wrote: > Hi Pedro, > > I'm quite confused by a peculiarity of deriving Data (more info in > Trac #13327 [1]). In particular, if you write this: > > data T phantom = T > deriving Data > > Then the derived Data instance is NOT this: > > instance Typeable phantom => Data (T phantom) where > ... > > But instead, it's this: > > instance Data phantom => Data (T phantom) where > ... > dataCast1 f = gcast1 f > > The gcast1 part is why it requires the stronger (Data phantom) > context, as you noted in Trac #4028 [2]. > > What confuses me, however, is that is apparently does not carry over > to poly-kinded datatypes. For instance, if you write this: > > data T (phantom :: k) = T > deriving Data > > Then you do NOT get this instance: > > instance Data (phantom :: *) => Data (T phantom) where > ... > dataCast1 f = gcast1 f > > But instead, you get this instance! > > instance (Typeable k, Typeable (phantom :: k)) => Data (T phantom) > where > ... > -- No implementation for dataCast1 > > This is quite surprising to me. I'm not knowledgeable enough about > Data to know for sure if this is an oversight, expected behavior, or > something else, so I was hoping you (or someone else highly > knowledgeable about SYB-style generic programming) could help me out > here. > > In particular: > > 1. Does emitting "dataCast1 f = gcast1 f" for datatypes of kind (k -> > *) make sense? Or does it only make sense for types of kind (* -> *)? > 2. Is there an alternate way to define dataCast1 that doesn't require > the stronger Data context, but instead only requires the more general > Typeable context? > > Ryan S. > ----- > [1] https://ghc.haskell.org/trac/ghc/ticket/13327 > [2] https://ghc.haskell.org/trac/ghc/ticket/4028#comment:5 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ekmett at gmail.com Thu Feb 23 22:49:01 2017 From: ekmett at gmail.com (Edward Kmett) Date: Thu, 23 Feb 2017 17:49:01 -0500 Subject: Deriving Data for poly-kinded datatypes In-Reply-To: References: Message-ID: Some thoughts on the topic: admittedly, probably not very useful. A couple of obvious statements: 1) gcast1 itself operationally makes sense regardless of the kind of the argument you're skipping past. gcast1 :: forall c t t' a. (Typeable t, Typeable t') => c (t a) -> Maybe (c (t' a)) This is an operation we can define pretty easily, however we want. It works more or less by definition. It was included in the original paper. 2) dataCast1 on the other hand is an member of the class, and it needs that 'Data d' constraint or it can't do its job. dataCast1 :: (Data a, Typeable t) => (forall d. Data d => c (t d)) -> Maybe (c a) Attempting to weaken the Data d constraint there doesn't work, because then dataCast1 wouldn't be able to do its job. Without it you can't write ext1Q in terms of dataCast1, as noted in the but about 'bogusDataCast' in the original paper: Scrap More Boilerplate: Reflection, Zips and Generalized Casts Since then we obviously picked up polymorphic kinds, which muddled the story about when a data instance is for a type that looks like `T d`. On the other hand, the user will be the one calling this method, and they'll have to take Data instances for d and use them to generate c (t d). Knowledge of if argument is of kind * is purely local, though. If t is Typeable and d is Data, then (t d), d is kind *, t :: * -> *. So to call dataCast1, the user has to already know the argument is kind *, and that the type t that they are trying to use (maybe not the T in the data instance itself) is of kind * -> *. There is no contradiction in trying to call this on a data type with the wrong kind for it to succeed. T is not necessarily t. It is our job to check if it is. Supplying the default shouldn't lock our data instance to the form T a. If for some reason adding this default would break the instance We can make a more interesting default that does something like look at the kind of the argument first to determine if it is kind * before proceeding after casting to ensure the kinds match. *tl;dr** yes, it would seem it would be worth fixing the instances of Data produced to supply dataCast1 when the kind of the argument is polymorphic. Otherwise turning on PolyKinds in a package will simply break dataCast1 for basically all of its data types.* -Edward P.S. Ultimately, in a perfect world we'd be able to unify dataCast1 and dataCast2 with some tricky base case for kind k1 = * and induction over k -> k1. Off hand, I don't see how to do it. I played for a while with trying to write a higher kinded Data to support this, but my scribbles didn't cohere into usable code. gfoldl pretty much locks you into kind *. I even tried playing with profunctors and powers here to no real avail. I do have some old Data1 code in an syb-extras package that I use to write a few 'impossible' Data instances, but that seems to be solving a different, if related, problem, and doesn't scale up to arbitrary kinds. Ideally there'd be a plausible Data that makes sense for other kinds k, and everything could become dataCast1, w/ dataCast2, and the missing higher versions just an iterated application of it. I just don't see that there is a way to turn it into code. On Thu, Feb 23, 2017 at 2:51 PM, Ryan Scott wrote: > Hi Pedro, > > I'm quite confused by a peculiarity of deriving Data (more info in > Trac #13327 [1]). In particular, if you write this: > > data T phantom = T > deriving Data > > Then the derived Data instance is NOT this: > > instance Typeable phantom => Data (T phantom) where > ... > > But instead, it's this: > > instance Data phantom => Data (T phantom) where > ... > dataCast1 f = gcast1 f > > The gcast1 part is why it requires the stronger (Data phantom) > context, as you noted in Trac #4028 [2]. > > What confuses me, however, is that is apparently does not carry over > to poly-kinded datatypes. For instance, if you write this: > > data T (phantom :: k) = T > deriving Data > > Then you do NOT get this instance: > > instance Data (phantom :: *) => Data (T phantom) where > ... > dataCast1 f = gcast1 f > > But instead, you get this instance! > > instance (Typeable k, Typeable (phantom :: k)) => Data (T phantom) > where > ... > -- No implementation for dataCast1 > > This is quite surprising to me. I'm not knowledgeable enough about > Data to know for sure if this is an oversight, expected behavior, or > something else, so I was hoping you (or someone else highly > knowledgeable about SYB-style generic programming) could help me out > here. > > In particular: > > 1. Does emitting "dataCast1 f = gcast1 f" for datatypes of kind (k -> > *) make sense? Or does it only make sense for types of kind (* -> *)? > 2. Is there an alternate way to define dataCast1 that doesn't require > the stronger Data context, but instead only requires the more general > Typeable context? > > Ryan S. > ----- > [1] https://ghc.haskell.org/trac/ghc/ticket/13327 > [2] https://ghc.haskell.org/trac/ghc/ticket/4028#comment:5 > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at well-typed.com Fri Feb 24 00:29:58 2017 From: david at well-typed.com (David Feuer) Date: Thu, 23 Feb 2017 19:29:58 -0500 Subject: Datacon RULES test Message-ID: <5940772.WVctn8BmBG@squirrel> For good or ill, Simon doesn't want RULES for datacons. T12689 has to be removed (leaving T12689a, which is still fine). But I don't know enough about what you're doing with T12689broken to know how to make it express the right idea after this change. Can you please advise? Thanks, David Feuer Well-Typed LLP From ryan.gl.scott at gmail.com Fri Feb 24 03:30:39 2017 From: ryan.gl.scott at gmail.com (Ryan Scott) Date: Thu, 23 Feb 2017 22:30:39 -0500 Subject: Deriving Data for poly-kinded datatypes In-Reply-To: References: Message-ID: > Supplying the default shouldn't lock our data instance to the form T a. If for some reason adding this default would break the instance We can make a more interesting default that does something like look at the kind of the argument first to determine if it is kind * before proceeding after casting to ensure the kinds match. Interesting. Do you happen to know how to write this "more interesting default"? I've tried various things, but sadly I can't escape past the typechecker. My attempt that made it the furthest was this: {-# LANGUAGE GADTs #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeOperators #-} module DataCast where import Data.Data import Data.Kind (Type) data T (phantom :: k) = T dataCast1T :: forall k c t (phantom :: k). (Typeable k, Typeable t, Typeable phantom) => (forall d. Data d => c (t d)) -> Maybe (c (T phantom)) dataCast1T f = case eqT :: Maybe (k :~: Type) of Nothing -> Nothing Just Refl -> gcast1 f This would work were it not for the constraints involved: Could not deduce (Data phantom) arising from a use of ‘f’ It seems that applying f is forcing the type parameter to T (phantom) to be a Data instance, which obviously can't happen if (phantom :: k). I don't know a way around this, though, as I'm not aware of a way to "defer" a class constraint (unlike equality constraints, which can be deferred via Typeable). Ryan S. On Thu, Feb 23, 2017 at 5:49 PM, Edward Kmett wrote: > Some thoughts on the topic: admittedly, probably not very useful. > > A couple of obvious statements: > > > > 1) > > gcast1 itself operationally makes sense regardless of the kind of the > argument you're skipping past. > > gcast1 :: forall c t t' a. (Typeable t, Typeable t') => c (t a) -> Maybe (c > (t' a)) > > This is an operation we can define pretty easily, however we want. It works > more or less by definition. It was included in the original paper. > > > > 2) > > dataCast1 on the other hand is an member of the class, and it needs that > 'Data d' constraint or it can't do its job. > > dataCast1 :: (Data a, Typeable t) => (forall d. Data d => c (t d)) -> Maybe > (c a) > > Attempting to weaken the Data d constraint there doesn't work, because then > dataCast1 wouldn't be able to do its job. Without it you can't write ext1Q > in terms of dataCast1, as noted in the but about 'bogusDataCast' in the > original paper: Scrap More Boilerplate: Reflection, Zips and Generalized > Casts > > > > > Since then we obviously picked up polymorphic kinds, which muddled the story > about when a data instance is for a type that looks like `T d`. > > On the other hand, the user will be the one calling this method, and they'll > have to take Data instances for d and use them to generate c (t d). > Knowledge of if argument is of kind * is purely local, though. If t is > Typeable and d is Data, then (t d), d is kind *, t :: * -> *. So to call > dataCast1, the user has to already know the argument is kind *, and that the > type t that they are trying to use (maybe not the T in the data instance > itself) is of kind * -> *. > > There is no contradiction in trying to call this on a data type with the > wrong kind for it to succeed. T is not necessarily t. It is our job to check > if it is. > > Supplying the default shouldn't lock our data instance to the form T a. If > for some reason adding this default would break the instance We can make a > more interesting default that does something like look at the kind of the > argument first to determine if it is kind * before proceeding after casting > to ensure the kinds match. > > tl;dr yes, it would seem it would be worth fixing the instances of Data > produced to supply dataCast1 when the kind of the argument is polymorphic. > Otherwise turning on PolyKinds in a package will simply break dataCast1 for > basically all of its data types. > > -Edward > > P.S. Ultimately, in a perfect world we'd be able to unify dataCast1 and > dataCast2 with some tricky base case for kind k1 = * and induction over k -> > k1. Off hand, I don't see how to do it. I played for a while with trying to > write a higher kinded Data to support this, but my scribbles didn't cohere > into usable code. gfoldl pretty much locks you into kind *. I even tried > playing with profunctors and powers here to no real avail. I do have some > old Data1 code in an syb-extras package that I use to write a few > 'impossible' Data instances, but that seems to be solving a different, if > related, problem, and doesn't scale up to arbitrary kinds. Ideally there'd > be a plausible Data that makes sense for other kinds k, and everything could > become dataCast1, w/ dataCast2, and the missing higher versions just an > iterated application of it. I just don't see that there is a way to turn it > into code. > > > On Thu, Feb 23, 2017 at 2:51 PM, Ryan Scott wrote: >> >> Hi Pedro, >> >> I'm quite confused by a peculiarity of deriving Data (more info in >> Trac #13327 [1]). In particular, if you write this: >> >> data T phantom = T >> deriving Data >> >> Then the derived Data instance is NOT this: >> >> instance Typeable phantom => Data (T phantom) where >> ... >> >> But instead, it's this: >> >> instance Data phantom => Data (T phantom) where >> ... >> dataCast1 f = gcast1 f >> >> The gcast1 part is why it requires the stronger (Data phantom) >> context, as you noted in Trac #4028 [2]. >> >> What confuses me, however, is that is apparently does not carry over >> to poly-kinded datatypes. For instance, if you write this: >> >> data T (phantom :: k) = T >> deriving Data >> >> Then you do NOT get this instance: >> >> instance Data (phantom :: *) => Data (T phantom) where >> ... >> dataCast1 f = gcast1 f >> >> But instead, you get this instance! >> >> instance (Typeable k, Typeable (phantom :: k)) => Data (T phantom) >> where >> ... >> -- No implementation for dataCast1 >> >> This is quite surprising to me. I'm not knowledgeable enough about >> Data to know for sure if this is an oversight, expected behavior, or >> something else, so I was hoping you (or someone else highly >> knowledgeable about SYB-style generic programming) could help me out >> here. >> >> In particular: >> >> 1. Does emitting "dataCast1 f = gcast1 f" for datatypes of kind (k -> >> *) make sense? Or does it only make sense for types of kind (* -> *)? >> 2. Is there an alternate way to define dataCast1 that doesn't require >> the stronger Data context, but instead only requires the more general >> Typeable context? >> >> Ryan S. >> ----- >> [1] https://ghc.haskell.org/trac/ghc/ticket/13327 >> [2] https://ghc.haskell.org/trac/ghc/ticket/4028#comment:5 >> _______________________________________________ >> ghc-devs mailing list >> ghc-devs at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > > From ekmett at gmail.com Fri Feb 24 05:14:07 2017 From: ekmett at gmail.com (Edward Kmett) Date: Fri, 24 Feb 2017 00:14:07 -0500 Subject: Deriving Data for poly-kinded datatypes In-Reply-To: References: Message-ID: That is a right mess. I've now stepped a bit outside of what I think is a practical recommendation, but let's just keep playing for the fun of it. This is going to be hard to do without access to GHC at the moment but here goes: If phantom was of kind * then dataCast1 would need the (Data phantom), so we need some sort of way to supply it. Looks like we'd need some 'Data if *'. We don't have exponentials in the type checker though. They are admissable, just not a thing GHC does today. We could fake it with some nastiness perhaps: class (Typeable t, Typeable k) => DataIfStar (k :: t) where dataIf :: (t ~ Type) => proxy k -> (Data k => r) -> r You might be able to make a couple of overlapping instances, as much as it pains me to consider. (Here be dragons, I haven't thought this through. instance Data k => DataIfStar k where -- overlapping dataIf _ r = r instance DataIfStar k where -- overlapped dataIf _ _ = undefined Then after you check k ~ Type in the instance you could invoke dataIf using the knowledge that k ~ Type to pull the Data phantom instance into scope. You'd get a type signature like: dataCast1T :: forall k c t (phantom :: k). (Typeable t, DataIfStar phantom) => (forall d. Data d => c (t d)) -> Maybe (c (T phantom)) which would mean the Data instance for T phantom would get a constraint like: instance DataIfStar phantom => Data (T phantom) Does that make sense? -Edward On Thu, Feb 23, 2017 at 10:30 PM, Ryan Scott wrote: > > Supplying the default shouldn't lock our data instance to the form T a. > If for some reason adding this default would break the instance We can make > a more interesting default that does something like look at the kind of the > argument first to determine if it is kind * before proceeding after casting > to ensure the kinds match. > > Interesting. Do you happen to know how to write this "more interesting > default"? I've tried various things, but sadly I can't escape past the > typechecker. My attempt that made it the furthest was this: > > {-# LANGUAGE GADTs #-} > {-# LANGUAGE PolyKinds #-} > {-# LANGUAGE RankNTypes #-} > {-# LANGUAGE ScopedTypeVariables #-} > {-# LANGUAGE TypeInType #-} > {-# LANGUAGE TypeOperators #-} > module DataCast where > > import Data.Data > import Data.Kind (Type) > > data T (phantom :: k) = T > > dataCast1T :: forall k c t (phantom :: k). > (Typeable k, Typeable t, Typeable phantom) > => (forall d. Data d => c (t d)) > -> Maybe (c (T phantom)) > dataCast1T f = case eqT :: Maybe (k :~: Type) of > Nothing -> Nothing > Just Refl -> gcast1 f > > This would work were it not for the constraints involved: > > Could not deduce (Data phantom) arising from a use of ‘f’ > > It seems that applying f is forcing the type parameter to T (phantom) > to be a Data instance, which obviously can't happen if (phantom :: k). > I don't know a way around this, though, as I'm not aware of a way to > "defer" a class constraint (unlike equality constraints, which can be > deferred via Typeable). > > Ryan S. > > On Thu, Feb 23, 2017 at 5:49 PM, Edward Kmett wrote: > > Some thoughts on the topic: admittedly, probably not very useful. > > > > A couple of obvious statements: > > > > > > > > 1) > > > > gcast1 itself operationally makes sense regardless of the kind of the > > argument you're skipping past. > > > > gcast1 :: forall c t t' a. (Typeable t, Typeable t') => c (t a) -> Maybe > (c > > (t' a)) > > > > This is an operation we can define pretty easily, however we want. It > works > > more or less by definition. It was included in the original paper. > > > > > > > > 2) > > > > dataCast1 on the other hand is an member of the class, and it needs that > > 'Data d' constraint or it can't do its job. > > > > dataCast1 :: (Data a, Typeable t) => (forall d. Data d => c (t d)) -> > Maybe > > (c a) > > > > Attempting to weaken the Data d constraint there doesn't work, because > then > > dataCast1 wouldn't be able to do its job. Without it you can't write > ext1Q > > in terms of dataCast1, as noted in the but about 'bogusDataCast' in the > > original paper: Scrap More Boilerplate: Reflection, Zips and Generalized > > Casts > > > > > > > > > > Since then we obviously picked up polymorphic kinds, which muddled the > story > > about when a data instance is for a type that looks like `T d`. > > > > On the other hand, the user will be the one calling this method, and > they'll > > have to take Data instances for d and use them to generate c (t d). > > Knowledge of if argument is of kind * is purely local, though. If t is > > Typeable and d is Data, then (t d), d is kind *, t :: * -> *. So to call > > dataCast1, the user has to already know the argument is kind *, and that > the > > type t that they are trying to use (maybe not the T in the data instance > > itself) is of kind * -> *. > > > > There is no contradiction in trying to call this on a data type with the > > wrong kind for it to succeed. T is not necessarily t. It is our job to > check > > if it is. > > > > Supplying the default shouldn't lock our data instance to the form T a. > If > > for some reason adding this default would break the instance We can make > a > > more interesting default that does something like look at the kind of the > > argument first to determine if it is kind * before proceeding after > casting > > to ensure the kinds match. > > > > tl;dr yes, it would seem it would be worth fixing the instances of Data > > produced to supply dataCast1 when the kind of the argument is > polymorphic. > > Otherwise turning on PolyKinds in a package will simply break dataCast1 > for > > basically all of its data types. > > > > -Edward > > > > P.S. Ultimately, in a perfect world we'd be able to unify dataCast1 and > > dataCast2 with some tricky base case for kind k1 = * and induction over > k -> > > k1. Off hand, I don't see how to do it. I played for a while with trying > to > > write a higher kinded Data to support this, but my scribbles didn't > cohere > > into usable code. gfoldl pretty much locks you into kind *. I even tried > > playing with profunctors and powers here to no real avail. I do have some > > old Data1 code in an syb-extras package that I use to write a few > > 'impossible' Data instances, but that seems to be solving a different, if > > related, problem, and doesn't scale up to arbitrary kinds. Ideally > there'd > > be a plausible Data that makes sense for other kinds k, and everything > could > > become dataCast1, w/ dataCast2, and the missing higher versions just an > > iterated application of it. I just don't see that there is a way to turn > it > > into code. > > > > > > On Thu, Feb 23, 2017 at 2:51 PM, Ryan Scott > wrote: > >> > >> Hi Pedro, > >> > >> I'm quite confused by a peculiarity of deriving Data (more info in > >> Trac #13327 [1]). In particular, if you write this: > >> > >> data T phantom = T > >> deriving Data > >> > >> Then the derived Data instance is NOT this: > >> > >> instance Typeable phantom => Data (T phantom) where > >> ... > >> > >> But instead, it's this: > >> > >> instance Data phantom => Data (T phantom) where > >> ... > >> dataCast1 f = gcast1 f > >> > >> The gcast1 part is why it requires the stronger (Data phantom) > >> context, as you noted in Trac #4028 [2]. > >> > >> What confuses me, however, is that is apparently does not carry over > >> to poly-kinded datatypes. For instance, if you write this: > >> > >> data T (phantom :: k) = T > >> deriving Data > >> > >> Then you do NOT get this instance: > >> > >> instance Data (phantom :: *) => Data (T phantom) where > >> ... > >> dataCast1 f = gcast1 f > >> > >> But instead, you get this instance! > >> > >> instance (Typeable k, Typeable (phantom :: k)) => Data (T phantom) > >> where > >> ... > >> -- No implementation for dataCast1 > >> > >> This is quite surprising to me. I'm not knowledgeable enough about > >> Data to know for sure if this is an oversight, expected behavior, or > >> something else, so I was hoping you (or someone else highly > >> knowledgeable about SYB-style generic programming) could help me out > >> here. > >> > >> In particular: > >> > >> 1. Does emitting "dataCast1 f = gcast1 f" for datatypes of kind (k -> > >> *) make sense? Or does it only make sense for types of kind (* -> *)? > >> 2. Is there an alternate way to define dataCast1 that doesn't require > >> the stronger Data context, but instead only requires the more general > >> Typeable context? > >> > >> Ryan S. > >> ----- > >> [1] https://ghc.haskell.org/trac/ghc/ticket/13327 > >> [2] https://ghc.haskell.org/trac/ghc/ticket/4028#comment:5 > >> _______________________________________________ > >> ghc-devs mailing list > >> ghc-devs at haskell.org > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Fri Feb 24 08:47:50 2017 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Fri, 24 Feb 2017 08:47:50 +0000 Subject: Datacon RULES test In-Reply-To: <5940772.WVctn8BmBG@squirrel> References: <5940772.WVctn8BmBG@squirrel> Message-ID: NB: the actual ticket Trac #12689 is /not/ about rules /for/ data cons. It's about rules that /match/ datacons. It's only the latter I object to. The test T12689 sort of snuck in there under false pretences :-). Also I'm not permanently set against rules for datacons. It's just that I think there are equally good ways to achieve the same thing, and it smells wrong to me: we should hesitate before making passive data into active stuff. (And I think we have more urgent things to do.) Simon | -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of David | Feuer | Sent: 24 February 2017 00:30 | To: Joachim Breitner | Cc: ghc-devs at haskell.org | Subject: Datacon RULES test | | For good or ill, Simon doesn't want RULES for datacons. T12689 has to be | removed (leaving T12689a, which is still fine). But I don't know enough | about what you're doing with T12689broken to know how to make it express the | right idea after this change. Can you please advise? | | Thanks, | David Feuer | Well-Typed LLP | _______________________________________________ | ghc-devs mailing list | ghc-devs at haskell.org | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haskell | .org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc- | devs&data=02%7C01%7Csimonpj%40microsoft.com%7C56fda079ff6d40e055fa08d45c4c46 | 0c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636234930063764323&sdata=B9Z | ECrVpzUxDMH9EDVMMULa7VysoC6ZirvairVe0ILk%3D&reserved=0 From ryan.gl.scott at gmail.com Fri Feb 24 16:13:48 2017 From: ryan.gl.scott at gmail.com (Ryan Scott) Date: Fri, 24 Feb 2017 11:13:48 -0500 Subject: Deriving Data for poly-kinded datatypes In-Reply-To: References: Message-ID: Yikes, I was afraid of reaching for something like DataIfStar. But I don't have any other ideas, so let's play along with that example. Frustratingly, I can't even write the class definition of DataIfStar. If I do, GHC yells at me like so: • Expected a type, but ‘k’ has kind ‘t’ • In the first argument of ‘Data’, namely ‘k’ In the type signature: dataIf :: (t ~ Type) => proxy k -> (Data k => r) -> r -> r In the class declaration for ‘DataIfStar’ In other words, GHC isn't smart enough to see that in the (Data k => r) argument, k's kind t should be the same as *. This is pretty annoying, because this overlapping instances trick only works due to the fact that their instance heads distinguish between kinds. In other words, if you were to change the definition of DataIfStar to this: class Typeable k => DataIfStar (k :: *) where dataIf :: proxy k -> (Data k => r) -> r -> r Then although the class declaration would now typecheck, the two instances below it would be flagged as duplicate instances because they now have the same instance head! Ugh. Somehow, I need to be able to defer an equality constraint at the type level, but just writing (t ~ Type) => ... doesn't quite work, unfortunately. Ryan S. On Fri, Feb 24, 2017 at 12:14 AM, Edward Kmett wrote: > That is a right mess. > > I've now stepped a bit outside of what I think is a practical > recommendation, but let's just keep playing for the fun of it. > > This is going to be hard to do without access to GHC at the moment but here > goes: > > If phantom was of kind * then dataCast1 would need the (Data phantom), so we > need some sort of way to supply it. > > Looks like we'd need some 'Data if *'. We don't have exponentials in the > type checker though. They are admissable, just not a thing GHC does today. > We could fake it with some nastiness perhaps: > > class (Typeable t, Typeable k) => DataIfStar (k :: t) where > dataIf :: (t ~ Type) => proxy k -> (Data k => r) -> r > > You might be able to make a couple of overlapping instances, as much as it > pains me to consider. (Here be dragons, I haven't thought this through. > > instance Data k => DataIfStar k where -- overlapping > dataIf _ r = r > > instance DataIfStar k where -- overlapped > dataIf _ _ = undefined > > Then after you check k ~ Type in the instance you could invoke dataIf using > the knowledge that k ~ Type to pull the Data phantom instance into scope. > You'd get a type signature like: > > dataCast1T :: forall k c t (phantom :: k). > (Typeable t, DataIfStar phantom) > => (forall d. Data d => c (t d)) > -> Maybe (c (T phantom)) > > which would mean the Data instance for T phantom would get a constraint > like: > > instance DataIfStar phantom => Data (T phantom) > > Does that make sense? > > -Edward > > > > > On Thu, Feb 23, 2017 at 10:30 PM, Ryan Scott > wrote: >> >> > Supplying the default shouldn't lock our data instance to the form T a. >> > If for some reason adding this default would break the instance We can make >> > a more interesting default that does something like look at the kind of the >> > argument first to determine if it is kind * before proceeding after casting >> > to ensure the kinds match. >> >> Interesting. Do you happen to know how to write this "more interesting >> default"? I've tried various things, but sadly I can't escape past the >> typechecker. My attempt that made it the furthest was this: >> >> {-# LANGUAGE GADTs #-} >> {-# LANGUAGE PolyKinds #-} >> {-# LANGUAGE RankNTypes #-} >> {-# LANGUAGE ScopedTypeVariables #-} >> {-# LANGUAGE TypeInType #-} >> {-# LANGUAGE TypeOperators #-} >> module DataCast where >> >> import Data.Data >> import Data.Kind (Type) >> >> data T (phantom :: k) = T >> >> dataCast1T :: forall k c t (phantom :: k). >> (Typeable k, Typeable t, Typeable phantom) >> => (forall d. Data d => c (t d)) >> -> Maybe (c (T phantom)) >> dataCast1T f = case eqT :: Maybe (k :~: Type) of >> Nothing -> Nothing >> Just Refl -> gcast1 f >> >> This would work were it not for the constraints involved: >> >> Could not deduce (Data phantom) arising from a use of ‘f’ >> >> It seems that applying f is forcing the type parameter to T (phantom) >> to be a Data instance, which obviously can't happen if (phantom :: k). >> I don't know a way around this, though, as I'm not aware of a way to >> "defer" a class constraint (unlike equality constraints, which can be >> deferred via Typeable). >> >> Ryan S. >> >> On Thu, Feb 23, 2017 at 5:49 PM, Edward Kmett wrote: >> > Some thoughts on the topic: admittedly, probably not very useful. >> > >> > A couple of obvious statements: >> > >> > >> > >> > 1) >> > >> > gcast1 itself operationally makes sense regardless of the kind of the >> > argument you're skipping past. >> > >> > gcast1 :: forall c t t' a. (Typeable t, Typeable t') => c (t a) -> Maybe >> > (c >> > (t' a)) >> > >> > This is an operation we can define pretty easily, however we want. It >> > works >> > more or less by definition. It was included in the original paper. >> > >> > >> > >> > 2) >> > >> > dataCast1 on the other hand is an member of the class, and it needs that >> > 'Data d' constraint or it can't do its job. >> > >> > dataCast1 :: (Data a, Typeable t) => (forall d. Data d => c (t d)) -> >> > Maybe >> > (c a) >> > >> > Attempting to weaken the Data d constraint there doesn't work, because >> > then >> > dataCast1 wouldn't be able to do its job. Without it you can't write >> > ext1Q >> > in terms of dataCast1, as noted in the but about 'bogusDataCast' in the >> > original paper: Scrap More Boilerplate: Reflection, Zips and Generalized >> > Casts >> > >> > >> > >> > >> > Since then we obviously picked up polymorphic kinds, which muddled the >> > story >> > about when a data instance is for a type that looks like `T d`. >> > >> > On the other hand, the user will be the one calling this method, and >> > they'll >> > have to take Data instances for d and use them to generate c (t d). >> > Knowledge of if argument is of kind * is purely local, though. If t is >> > Typeable and d is Data, then (t d), d is kind *, t :: * -> *. So to call >> > dataCast1, the user has to already know the argument is kind *, and that >> > the >> > type t that they are trying to use (maybe not the T in the data instance >> > itself) is of kind * -> *. >> > >> > There is no contradiction in trying to call this on a data type with the >> > wrong kind for it to succeed. T is not necessarily t. It is our job to >> > check >> > if it is. >> > >> > Supplying the default shouldn't lock our data instance to the form T a. >> > If >> > for some reason adding this default would break the instance We can make >> > a >> > more interesting default that does something like look at the kind of >> > the >> > argument first to determine if it is kind * before proceeding after >> > casting >> > to ensure the kinds match. >> > >> > tl;dr yes, it would seem it would be worth fixing the instances of Data >> > produced to supply dataCast1 when the kind of the argument is >> > polymorphic. >> > Otherwise turning on PolyKinds in a package will simply break dataCast1 >> > for >> > basically all of its data types. >> > >> > -Edward >> > >> > P.S. Ultimately, in a perfect world we'd be able to unify dataCast1 and >> > dataCast2 with some tricky base case for kind k1 = * and induction over >> > k -> >> > k1. Off hand, I don't see how to do it. I played for a while with trying >> > to >> > write a higher kinded Data to support this, but my scribbles didn't >> > cohere >> > into usable code. gfoldl pretty much locks you into kind *. I even tried >> > playing with profunctors and powers here to no real avail. I do have >> > some >> > old Data1 code in an syb-extras package that I use to write a few >> > 'impossible' Data instances, but that seems to be solving a different, >> > if >> > related, problem, and doesn't scale up to arbitrary kinds. Ideally >> > there'd >> > be a plausible Data that makes sense for other kinds k, and everything >> > could >> > become dataCast1, w/ dataCast2, and the missing higher versions just an >> > iterated application of it. I just don't see that there is a way to turn >> > it >> > into code. >> > >> > >> > On Thu, Feb 23, 2017 at 2:51 PM, Ryan Scott >> > wrote: >> >> >> >> Hi Pedro, >> >> >> >> I'm quite confused by a peculiarity of deriving Data (more info in >> >> Trac #13327 [1]). In particular, if you write this: >> >> >> >> data T phantom = T >> >> deriving Data >> >> >> >> Then the derived Data instance is NOT this: >> >> >> >> instance Typeable phantom => Data (T phantom) where >> >> ... >> >> >> >> But instead, it's this: >> >> >> >> instance Data phantom => Data (T phantom) where >> >> ... >> >> dataCast1 f = gcast1 f >> >> >> >> The gcast1 part is why it requires the stronger (Data phantom) >> >> context, as you noted in Trac #4028 [2]. >> >> >> >> What confuses me, however, is that is apparently does not carry over >> >> to poly-kinded datatypes. For instance, if you write this: >> >> >> >> data T (phantom :: k) = T >> >> deriving Data >> >> >> >> Then you do NOT get this instance: >> >> >> >> instance Data (phantom :: *) => Data (T phantom) where >> >> ... >> >> dataCast1 f = gcast1 f >> >> >> >> But instead, you get this instance! >> >> >> >> instance (Typeable k, Typeable (phantom :: k)) => Data (T phantom) >> >> where >> >> ... >> >> -- No implementation for dataCast1 >> >> >> >> This is quite surprising to me. I'm not knowledgeable enough about >> >> Data to know for sure if this is an oversight, expected behavior, or >> >> something else, so I was hoping you (or someone else highly >> >> knowledgeable about SYB-style generic programming) could help me out >> >> here. >> >> >> >> In particular: >> >> >> >> 1. Does emitting "dataCast1 f = gcast1 f" for datatypes of kind (k -> >> >> *) make sense? Or does it only make sense for types of kind (* -> *)? >> >> 2. Is there an alternate way to define dataCast1 that doesn't require >> >> the stronger Data context, but instead only requires the more general >> >> Typeable context? >> >> >> >> Ryan S. >> >> ----- >> >> [1] https://ghc.haskell.org/trac/ghc/ticket/13327 >> >> [2] https://ghc.haskell.org/trac/ghc/ticket/4028#comment:5 >> >> _______________________________________________ >> >> ghc-devs mailing list >> >> ghc-devs at haskell.org >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs >> > >> > > > From lonetiger at gmail.com Fri Feb 24 19:41:49 2017 From: lonetiger at gmail.com (Phyx) Date: Fri, 24 Feb 2017 19:41:49 +0000 Subject: MSYS2 update (those who build on Windows please read) In-Reply-To: References: Message-ID: Hi all, MSYS2 maintainers have agreed that the change by Cygwin constitudes a regression for the MSYS2 project and patched out the changes. It's now safe to upgrade MSYS2 again. Tamar On Mon, Feb 20, 2017 at 3:58 PM, Phyx wrote: > Hi Windows devs, > > February comes with a major change in behavior for MSYS2/Cygwin. > Tools such as awk/sed etc now use binary mode unless on a text mount: > https://cygwin.com/ml/cygwin-announce/2017-02/msg00036.html > > This is problematic because GHC etc only use the underlying OS to > determine > how to output line endings. As such we output \r\n but in sed et al $ will > no longer match line endings. Which means out scripts are currently broken. > > Do not upgrade your MSYS2 install until a workaround for this is in place > or you will be unable to compile GHC. > > If you have updated your MSYS2 then using a text mount may be the easiest > option to get a working build again. As it seems just downgrading the tools > alone is not enough. > > Thanks, > Tamar -------------- next part -------------- An HTML attachment was scrubbed... URL: From ryan.gl.scott at gmail.com Fri Feb 24 22:24:50 2017 From: ryan.gl.scott at gmail.com (Ryan Scott) Date: Fri, 24 Feb 2017 17:24:50 -0500 Subject: Deriving Data for poly-kinded datatypes In-Reply-To: References: Message-ID: I pushed some more on this and managed to get something which "works". That is, I was able to declare a Data instance for T: data T (phantom :: k) = T instance (Typeable k, Typeable phantom, Possibly Data phantom) => Data (T (phantom :: k)) where ... dataCast1 = dataCast1T (More in a second about what `dataCast1T` and `Possibly` are). Now I was able to use this ext1Q combinator: newtype Q q x = Q { unQ :: x -> q } ext1Q :: (Data d, Typeable t) => (d -> q) -> (forall e. Data e => t e -> q) -> d -> q ext1Q def ext arg = case dataCast1 (Q ext) of Just (Q ext') -> ext' arg Nothing -> def arg on different values of T without restricting the parameter to kind *: test1, test2, test3 :: Char test1 = (const 'p') `ext1Q` (\T -> 'q') $ (T :: T ()) test2 = (const 'p') `ext1Q` (\T -> 'q') $ (T :: T Char) test3 = (const 'p') `ext1Q` (\T -> 'q') $ (T :: T (NotADataInstance :: Type -> Type)) main :: IO () main = putStrLn [test1, test2, test3] And if you run `main`, you get "qqp" as the output, as you'd expect! That's because () and Char are Data Instances, so ext1Q picks the second function to run, whereas NotADataInstance isn't, so the first function is ran. The full source code is at [1]. So how does it work? Well, it's not pretty. First, we draw upon an extremely specialized dictionary datatype: data D (p :: k -> Constraint) (x :: j) where D :: forall (p :: k -> Constraint) (x :: k). p x => D p x Notice how the D constructor forces the kind of x and the kind of p's first argument to be the same--this is crucial for the trick to work, since we need evidence that the kinds are the same when we pattern-match on D. Now we define this class: class Possibly p x where possibly :: proxy1 p -> proxy2 x -> Maybe (D p x) This is like DataIfStar, but more general. We can define a fall-through instance for Data like so: instance {-# OVERLAPPABLE #-} Possibly Data (x :: j) where possibly _ _ = Nothing I wasn't able to define a single overlapping instance for all things of kind *, but I did have some success defining instances individually for each Data instance: instance {-# OVERLAPPING #-} Possibly Data () where possibly _ _ = Just D instance {-# OVERLAPPING #-} Possibly Data Char where possibly _ _ = Just D Finally, we're able to define a version of dataCast1 for T that doesn't overly constrain its type parameter: dataCast1T :: forall k c t (phantom :: k). (Typeable t, Possibly Data phantom) => (forall d. Data d => c (t d)) -> Maybe (c (T phantom)) dataCast1T f = case possibly (Proxy :: Proxy Data) (Proxy :: Proxy phantom) of Nothing -> Nothing Just D -> gcast1 f Miraculously, this typechecks. We use `possibly` to check two things: 1. Is (phantom :: *)? 2. Furthermore, is there a (Data phantom) instance in scope? If we successfully pattern-match on the resulting dictionary, then GHC has evidence for these two things in scope, so we are able to call gcast1 successfully. Now that I'm done explaining this, let me make it clear that this is NOT at all what I think the proper solution should look like, since `Possibly` and `D` feel way too hacky. I'll need to think a bit about how we can take some ideas from this sketch and turn them into sensible, reusable abstractions. Ryan S. ----- [1] https://gist.github.com/RyanGlScott/9ec8665e7feefa6aa870b5ac85ae3663 On Fri, Feb 24, 2017 at 11:13 AM, Ryan Scott wrote: > Yikes, I was afraid of reaching for something like DataIfStar. But I > don't have any other ideas, so let's play along with that example. > > Frustratingly, I can't even write the class definition of DataIfStar. > If I do, GHC yells at me like so: > > • Expected a type, but ‘k’ has kind ‘t’ > • In the first argument of ‘Data’, namely ‘k’ > In the type signature: > dataIf :: (t ~ Type) => proxy k -> (Data k => r) -> r -> r > In the class declaration for ‘DataIfStar’ > > In other words, GHC isn't smart enough to see that in the (Data k => > r) argument, k's kind t should be the same as *. This is pretty > annoying, because this overlapping instances trick only works due to > the fact that their instance heads distinguish between kinds. In other > words, if you were to change the definition of DataIfStar to this: > > class Typeable k => DataIfStar (k :: *) where > dataIf :: proxy k -> (Data k => r) -> r -> r > > Then although the class declaration would now typecheck, the two > instances below it would be flagged as duplicate instances because > they now have the same instance head! Ugh. > > Somehow, I need to be able to defer an equality constraint at the type > level, but just writing (t ~ Type) => ... doesn't quite work, > unfortunately. > > Ryan S. > > On Fri, Feb 24, 2017 at 12:14 AM, Edward Kmett wrote: >> That is a right mess. >> >> I've now stepped a bit outside of what I think is a practical >> recommendation, but let's just keep playing for the fun of it. >> >> This is going to be hard to do without access to GHC at the moment but here >> goes: >> >> If phantom was of kind * then dataCast1 would need the (Data phantom), so we >> need some sort of way to supply it. >> >> Looks like we'd need some 'Data if *'. We don't have exponentials in the >> type checker though. They are admissable, just not a thing GHC does today. >> We could fake it with some nastiness perhaps: >> >> class (Typeable t, Typeable k) => DataIfStar (k :: t) where >> dataIf :: (t ~ Type) => proxy k -> (Data k => r) -> r >> >> You might be able to make a couple of overlapping instances, as much as it >> pains me to consider. (Here be dragons, I haven't thought this through. >> >> instance Data k => DataIfStar k where -- overlapping >> dataIf _ r = r >> >> instance DataIfStar k where -- overlapped >> dataIf _ _ = undefined >> >> Then after you check k ~ Type in the instance you could invoke dataIf using >> the knowledge that k ~ Type to pull the Data phantom instance into scope. >> You'd get a type signature like: >> >> dataCast1T :: forall k c t (phantom :: k). >> (Typeable t, DataIfStar phantom) >> => (forall d. Data d => c (t d)) >> -> Maybe (c (T phantom)) >> >> which would mean the Data instance for T phantom would get a constraint >> like: >> >> instance DataIfStar phantom => Data (T phantom) >> >> Does that make sense? >> >> -Edward >> >> >> >> >> On Thu, Feb 23, 2017 at 10:30 PM, Ryan Scott >> wrote: >>> >>> > Supplying the default shouldn't lock our data instance to the form T a. >>> > If for some reason adding this default would break the instance We can make >>> > a more interesting default that does something like look at the kind of the >>> > argument first to determine if it is kind * before proceeding after casting >>> > to ensure the kinds match. >>> >>> Interesting. Do you happen to know how to write this "more interesting >>> default"? I've tried various things, but sadly I can't escape past the >>> typechecker. My attempt that made it the furthest was this: >>> >>> {-# LANGUAGE GADTs #-} >>> {-# LANGUAGE PolyKinds #-} >>> {-# LANGUAGE RankNTypes #-} >>> {-# LANGUAGE ScopedTypeVariables #-} >>> {-# LANGUAGE TypeInType #-} >>> {-# LANGUAGE TypeOperators #-} >>> module DataCast where >>> >>> import Data.Data >>> import Data.Kind (Type) >>> >>> data T (phantom :: k) = T >>> >>> dataCast1T :: forall k c t (phantom :: k). >>> (Typeable k, Typeable t, Typeable phantom) >>> => (forall d. Data d => c (t d)) >>> -> Maybe (c (T phantom)) >>> dataCast1T f = case eqT :: Maybe (k :~: Type) of >>> Nothing -> Nothing >>> Just Refl -> gcast1 f >>> >>> This would work were it not for the constraints involved: >>> >>> Could not deduce (Data phantom) arising from a use of ‘f’ >>> >>> It seems that applying f is forcing the type parameter to T (phantom) >>> to be a Data instance, which obviously can't happen if (phantom :: k). >>> I don't know a way around this, though, as I'm not aware of a way to >>> "defer" a class constraint (unlike equality constraints, which can be >>> deferred via Typeable). >>> >>> Ryan S. >>> >>> On Thu, Feb 23, 2017 at 5:49 PM, Edward Kmett wrote: >>> > Some thoughts on the topic: admittedly, probably not very useful. >>> > >>> > A couple of obvious statements: >>> > >>> > >>> > >>> > 1) >>> > >>> > gcast1 itself operationally makes sense regardless of the kind of the >>> > argument you're skipping past. >>> > >>> > gcast1 :: forall c t t' a. (Typeable t, Typeable t') => c (t a) -> Maybe >>> > (c >>> > (t' a)) >>> > >>> > This is an operation we can define pretty easily, however we want. It >>> > works >>> > more or less by definition. It was included in the original paper. >>> > >>> > >>> > >>> > 2) >>> > >>> > dataCast1 on the other hand is an member of the class, and it needs that >>> > 'Data d' constraint or it can't do its job. >>> > >>> > dataCast1 :: (Data a, Typeable t) => (forall d. Data d => c (t d)) -> >>> > Maybe >>> > (c a) >>> > >>> > Attempting to weaken the Data d constraint there doesn't work, because >>> > then >>> > dataCast1 wouldn't be able to do its job. Without it you can't write >>> > ext1Q >>> > in terms of dataCast1, as noted in the but about 'bogusDataCast' in the >>> > original paper: Scrap More Boilerplate: Reflection, Zips and Generalized >>> > Casts >>> > >>> > >>> > >>> > >>> > Since then we obviously picked up polymorphic kinds, which muddled the >>> > story >>> > about when a data instance is for a type that looks like `T d`. >>> > >>> > On the other hand, the user will be the one calling this method, and >>> > they'll >>> > have to take Data instances for d and use them to generate c (t d). >>> > Knowledge of if argument is of kind * is purely local, though. If t is >>> > Typeable and d is Data, then (t d), d is kind *, t :: * -> *. So to call >>> > dataCast1, the user has to already know the argument is kind *, and that >>> > the >>> > type t that they are trying to use (maybe not the T in the data instance >>> > itself) is of kind * -> *. >>> > >>> > There is no contradiction in trying to call this on a data type with the >>> > wrong kind for it to succeed. T is not necessarily t. It is our job to >>> > check >>> > if it is. >>> > >>> > Supplying the default shouldn't lock our data instance to the form T a. >>> > If >>> > for some reason adding this default would break the instance We can make >>> > a >>> > more interesting default that does something like look at the kind of >>> > the >>> > argument first to determine if it is kind * before proceeding after >>> > casting >>> > to ensure the kinds match. >>> > >>> > tl;dr yes, it would seem it would be worth fixing the instances of Data >>> > produced to supply dataCast1 when the kind of the argument is >>> > polymorphic. >>> > Otherwise turning on PolyKinds in a package will simply break dataCast1 >>> > for >>> > basically all of its data types. >>> > >>> > -Edward >>> > >>> > P.S. Ultimately, in a perfect world we'd be able to unify dataCast1 and >>> > dataCast2 with some tricky base case for kind k1 = * and induction over >>> > k -> >>> > k1. Off hand, I don't see how to do it. I played for a while with trying >>> > to >>> > write a higher kinded Data to support this, but my scribbles didn't >>> > cohere >>> > into usable code. gfoldl pretty much locks you into kind *. I even tried >>> > playing with profunctors and powers here to no real avail. I do have >>> > some >>> > old Data1 code in an syb-extras package that I use to write a few >>> > 'impossible' Data instances, but that seems to be solving a different, >>> > if >>> > related, problem, and doesn't scale up to arbitrary kinds. Ideally >>> > there'd >>> > be a plausible Data that makes sense for other kinds k, and everything >>> > could >>> > become dataCast1, w/ dataCast2, and the missing higher versions just an >>> > iterated application of it. I just don't see that there is a way to turn >>> > it >>> > into code. >>> > >>> > >>> > On Thu, Feb 23, 2017 at 2:51 PM, Ryan Scott >>> > wrote: >>> >> >>> >> Hi Pedro, >>> >> >>> >> I'm quite confused by a peculiarity of deriving Data (more info in >>> >> Trac #13327 [1]). In particular, if you write this: >>> >> >>> >> data T phantom = T >>> >> deriving Data >>> >> >>> >> Then the derived Data instance is NOT this: >>> >> >>> >> instance Typeable phantom => Data (T phantom) where >>> >> ... >>> >> >>> >> But instead, it's this: >>> >> >>> >> instance Data phantom => Data (T phantom) where >>> >> ... >>> >> dataCast1 f = gcast1 f >>> >> >>> >> The gcast1 part is why it requires the stronger (Data phantom) >>> >> context, as you noted in Trac #4028 [2]. >>> >> >>> >> What confuses me, however, is that is apparently does not carry over >>> >> to poly-kinded datatypes. For instance, if you write this: >>> >> >>> >> data T (phantom :: k) = T >>> >> deriving Data >>> >> >>> >> Then you do NOT get this instance: >>> >> >>> >> instance Data (phantom :: *) => Data (T phantom) where >>> >> ... >>> >> dataCast1 f = gcast1 f >>> >> >>> >> But instead, you get this instance! >>> >> >>> >> instance (Typeable k, Typeable (phantom :: k)) => Data (T phantom) >>> >> where >>> >> ... >>> >> -- No implementation for dataCast1 >>> >> >>> >> This is quite surprising to me. I'm not knowledgeable enough about >>> >> Data to know for sure if this is an oversight, expected behavior, or >>> >> something else, so I was hoping you (or someone else highly >>> >> knowledgeable about SYB-style generic programming) could help me out >>> >> here. >>> >> >>> >> In particular: >>> >> >>> >> 1. Does emitting "dataCast1 f = gcast1 f" for datatypes of kind (k -> >>> >> *) make sense? Or does it only make sense for types of kind (* -> *)? >>> >> 2. Is there an alternate way to define dataCast1 that doesn't require >>> >> the stronger Data context, but instead only requires the more general >>> >> Typeable context? >>> >> >>> >> Ryan S. >>> >> ----- >>> >> [1] https://ghc.haskell.org/trac/ghc/ticket/13327 >>> >> [2] https://ghc.haskell.org/trac/ghc/ticket/4028#comment:5 >>> >> _______________________________________________ >>> >> ghc-devs mailing list >>> >> ghc-devs at haskell.org >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs >>> > >>> > >> >> From david.feuer at gmail.com Mon Feb 27 20:42:03 2017 From: david.feuer at gmail.com (David Feuer) Date: Mon, 27 Feb 2017 15:42:03 -0500 Subject: Proposal: make throwIO and throw strict Message-ID: It's possible for code to throw an exception that itself throws an imprecise exception. Such an exception is a bit tricky to catch. For example: import Control.Exception strange = throwIO (undefined :: SomeException) `catch` \ex -> case () of _ | Just _ <- (fromException ex :: Maybe IOError) -> print "IOError" | otherwise -> print "Something else" You might think that this would catch the exception and print "Something else", but in fact it does not. If others think this is as surprising as I do, then I think we should make throwIO and throw strict, so an exception will never itself be bottom. Using throwIO' !e = throwIO e in the code above instead of throwIO allows the exception to be caught. A more conservative approach might be to just force result of toException before calling raise#, but this only works when users use an explicit type signature to fix the expression type, rather than an exception constructor. David