Zulip Chat Archive
Stream: general
Topic: eta for structures
Reid Barton (Aug 01 2018 at 18:55):
Is definitional eta for structures something we are likely to get at some point?
Gabriel Ebner (Aug 01 2018 at 18:56):
I'd be surprised.
Reid Barton (Aug 01 2018 at 18:58):
In the absence of eta, another feature request would be "lazy matching" in lambdas and lets
Reid Barton (Aug 01 2018 at 18:58):
analogous to ~ patterns in Haskell
Gabriel Ebner (Aug 01 2018 at 19:02):
For everyone else, this means λ \<x,y\>, x + y
gets desugared to λ p, p.1 + p.2
. I don't think it is planned, but you might be able to do the desugaring yourself.
Reid Barton (Aug 01 2018 at 19:02):
There are some definitions in data.equiv for example which I can't use conveniently, because they match on the input equivalence before producing a constructor.
Reid Barton (Aug 01 2018 at 19:03):
But rewriting them with the constructor outermost becomes quite ugly.
Reid Barton (Aug 01 2018 at 19:05):
(not at computer, and don't remember the specific names)
Reid Barton (Aug 01 2018 at 19:08):
Was imagining including a ~ in the syntax for lazy patterns, not changing the current semantics.
Reid Barton (Aug 01 2018 at 19:25):
Though I wonder when you would ever want the "strict" version, figuratively speaking.
Patrick Massot (Aug 01 2018 at 21:15):
For everyone else, this means
λ \<x,y\>, x + y
gets desugared toλ p, p.1 + p.2
. I don't think it is planned, but you might be able to do the desugaring yourself.
+1 I keep trying to type that and being disappointed.
Mario Carneiro (Aug 04 2018 at 06:38):
Someone recently pointed out a mathlib definition that uses case analysis like this that was causing problems, but now I can't find it. Can anyone else find it?
Chris Hughes (Aug 04 2018 at 07:01):
+
and *
in localization.
Mario Carneiro (Aug 04 2018 at 07:34):
are you sure? I don't see that when I search in the chat
Chris Hughes (Aug 04 2018 at 07:44):
I definitely made a comment about it, but there's probably something else as well.
Chris Hughes (Aug 04 2018 at 07:45):
https://leanprover.zulipchat.com/#narrow/stream/113488-general/subject/match.20in.20defs
Mario Carneiro (Aug 04 2018 at 07:48):
ah, okay (I searched for "localization")
Kenny Lau (Oct 10 2018 at 21:15):
Should we replace those definitions with the better definitions?
Last updated: Dec 20 2023 at 11:08 UTC