Re: Template Haskell determinism

2016-07-01 Thread Edward Z. Yang
ould be based on > >> > > everything but the NameU int, but 'Eq' would still follow it > >> > > > >> > > A few ideas for different approaches to resolving this: > >> > > > >> > > 1) Document it. Less appealing than

Re: Template Haskell determinism

2016-06-29 Thread Michael Sloan
> > really handle these well. In that case, the ordering would be based on >>> > > everything but the NameU int, but 'Eq' would still follow it >>> > > >>> > > A few ideas for different approaches to resolving this: >>> > > >>>

Re: Template Haskell determinism

2016-06-29 Thread Michael Sloan
gt; > > >> > > 1) Document it. Less appealing than fixing it in the API, but still >> > would >> > > be good. >> > > >> > > 2) Remove the 'Ord' instance, and force the user to pick 'NamePartialOrd' >> > &g

Re: Template Haskell determinism

2016-06-29 Thread Edward Z. Yang
Remove the 'Ord' instance, and force the user to pick 'NamePartialOrd' > > > newtype (partial ord on the non-unique info), or 'UnstableNameOrd' > > newtype > > > (current behavior). A trickyness of this approach is that you&#x

Re: Template Haskell determinism

2016-06-10 Thread Michael Sloan
vior). A trickyness of this approach is that you'd need > > containers that can handle (PartialOrd k, Eq k) keys. In lots of cases > > people are using the 'Ord' instance with 'Name's that are not 'NameU', so > > this would break a lot of c

Re: Template Haskell determinism

2016-06-05 Thread Edward Z. Yang
containers that can handle (PartialOrd k, Eq k) keys. In lots of cases > people are using the 'Ord' instance with 'Name's that are not 'NameU', so > this would break a lot of code that was already deterministic. > > 3) Some approaches like this ordering key, but I'm

Re: Template Haskell determinism

2016-06-04 Thread Michael Sloan
re using the 'Ord' instance with 'Name's that are not 'NameU', so this would break a lot of code that was already deterministic. 3) Some approaches like this ordering key, but I'm not sure how it will help when comparing NameUs from different modules? > S

Re: Template Haskell determinism

2016-06-02 Thread Richard Eisenberg
On Jun 2, 2016, at 7:12 AM, Simon Peyton Jones wrote: > > But why is NameU exposed to clients? GHC needs to know, but clients don’t. > What use are these packages making of it? > singletons uses NameU in two places: 1. To generate unique numbers. It would be easy enough for me to put this

RE: Template Haskell determinism

2016-06-02 Thread Simon Peyton Jones
at use are these packages making of it? S From: ghc-devs [mailto:ghc-devs-boun...@haskell.org] On Behalf Of Michael Sloan Sent: 02 June 2016 02:07 To: Bartosz Nitka Cc: ghc-devs Devs Subject: Re: Template Haskell determinism +1 to solving this. Not sure about the approach, but assuming th

Re: Template Haskell determinism

2016-06-01 Thread Michael Sloan
+1 to solving this. Not sure about the approach, but assuming the following concerns are addressed, I'm (+1) on it too: This solution is clever! However, I think there is some difficulty to determining this ordering key. Namely, what happens when I construct the (Set Name) using results from mu

Re: Template Haskell determinism

2016-05-31 Thread Richard Eisenberg
On May 31, 2016, at 9:54 AM, Bartosz Nitka wrote: > I'd like to get feedback if this is an acceptable solution and if the problem > is worth solving. I don't have an opinion about "worth solving". While I understand your description of the problem and believe you that it crops up in practice,

Template Haskell determinism

2016-05-31 Thread Bartosz Nitka
Template Haskell with its ability to do arbitrary IO is non-deterministic by design. You could for example embed the current date in a file. There is however one kind of non-deterministic behavior that you can trigger accidentally. It has to do with how Names are reified. If you take a look at the