Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-20 23:20:48 × frozenErebus quits (~frozenEre@94.129.70.18) (Ping timeout: 256 seconds)
2021-03-20 23:21:26 <__minoru__shirae> so "foo x $ bar baz <|> quux" translates to "foo x (bar baz <|> quux)" instead of "(foo x (bar baz)) <|> quux", right?
2021-03-20 23:21:46 <__minoru__shirae> I see "infixl 3" in front of <|> in documentation
2021-03-20 23:22:06 <__minoru__shirae> how to read that?
2021-03-20 23:22:15 × chenshen quits (~chenshen@2620:10d:c090:400::5:d9c5) (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
2021-03-20 23:22:28 <__minoru__shirae> it is left-associative and has precedence of 3
2021-03-20 23:23:04 Ishutin joins (~ishutin@84-236-21-59.pool.digikabel.hu)
2021-03-20 23:24:25 × cartwright quits (~chatting@gateway/tor-sasl/cantstanya) (Remote host closed the connection)
2021-03-20 23:24:37 <ski> yes
2021-03-20 23:25:34 × zebrag quits (~inkbottle@aaubervilliers-654-1-109-157.w86-212.abo.wanadoo.fr) (Quit: Konversation terminated!)
2021-03-20 23:25:53 zebrag joins (~inkbottle@aaubervilliers-654-1-109-157.w86-212.abo.wanadoo.fr)
2021-03-20 23:26:40 <mniip> high precedence means it binds tighter
2021-03-20 23:26:45 cartwright joins (~chatting@gateway/tor-sasl/cantstanya)
2021-03-20 23:27:02 <mniip> juxtaposition (function application) has precedence of 10
2021-03-20 23:28:22 <__minoru__shirae> ok, I see that $ operator's precedence is 0 and it means that it binds less tightly
2021-03-20 23:29:03 <__minoru__shirae> I found a weird page while looking for that information
2021-03-20 23:29:09 <__minoru__shirae> look at this: http://amityskills.com/dr-oetker-dlum/haskell-operator-precedence-36cf63
2021-03-20 23:29:22 <__minoru__shirae> some garbage text
2021-03-20 23:29:33 <mniip> looks like SEO
2021-03-20 23:31:34 <mniip> shower thought: what is instead of syntax that forces tighter binding (parentheses) we had syntax that forces less tight binding
2021-03-20 23:31:38 <mniip> what if*
2021-03-20 23:32:53 <__minoru__shirae> like, starting a new line with an operator decreases its precendence
2021-03-20 23:33:15 <mniip> I was thinking say `+` is + whose precedence has been reduced by 10
2021-03-20 23:33:18 <mniip> ``+`` so on
2021-03-20 23:33:20 <bbhoss> is it possible to pattern match against something using an existing assignment? any special operator or will it just work?
2021-03-20 23:33:36 <mniip> bbhoss, you mean like f x x = ... ?
2021-03-20 23:33:43 <mniip> then no
2021-03-20 23:33:48 <ski> bbhoss : only if it's a data constructor (or pattern synonym)
2021-03-20 23:33:58 <e> mniip: why not just have [f x] can't be f x, [x + 1] can't be x + 1, etc
2021-03-20 23:34:08 × RandomArcher quits (~isho@90.153.235.252) (Ping timeout: 240 seconds)
2021-03-20 23:34:09 <ski> for non-linear patterns like what mniip showed, you need `f x0 x1 | x0 == x1 = ...'
2021-03-20 23:34:24 × myShoggoth quits (~myShoggot@75.164.81.55) (Ping timeout: 256 seconds)
2021-03-20 23:34:26 <bbhoss> in this case I'd like to match on an argument value inside of a case
2021-03-20 23:34:33 <mniip> e, what do you mean
2021-03-20 23:34:51 <e> mniip: so [a b] c would be a (b c) since you've forbidden (a b) c
2021-03-20 23:35:01 <ski> similarly, if `x' is already bound, and you want `f x = ...' to only match on that value of `x', rather than binding a new `x' (shadowing the old one), you need `f y | x == y = ...'
2021-03-20 23:35:18 <ski> bbhoss ^
2021-03-20 23:35:23 <mniip> I... don't have an intuitive way of reading that
2021-03-20 23:35:42 <e> it's a completely ridiculous idea
2021-03-20 23:35:51 <mniip> I wanted mine to not be
2021-03-20 23:36:05 <e> maybe there's a non-ridiculous interpretation, that's just what it made me think of
2021-03-20 23:36:13 <e> instead of specifying the grouping you want, specify the groupings you don't want
2021-03-20 23:36:28 <ski> (in Erlang (borrowing this from Prolog), mentioning an already bound variable `X' in a pattern would match on its current value. and in Oz, there's a syntax to achieve this, too)
2021-03-20 23:36:53 <mniip> e, when flattening a tree into a list, I think there's too many trees in the fiber for your idea to work
2021-03-20 23:37:14 chenshen joins (~chenshen@2620:10d:c090:400::5:d9c5)
2021-03-20 23:37:42 <e> you might need to be able to specify multiple overlapping disallowed groupings
2021-03-20 23:37:44 <ski> bbhoss : anyway, you can use guards inside of `case'-`of', as well
2021-03-20 23:37:52 <mniip> anyway I'm talking about like
2021-03-20 23:37:53 hackage higgledy 0.4.1.1 - Partial types as a type constructor. https://hackage.haskell.org/package/higgledy-0.4.1.1 (i_am_tom)
2021-03-20 23:38:31 <mniip> a / b `/` c ``/`` d, a / b `/` c / d, a ``/`` b `/` c / d
2021-03-20 23:38:34 × chenshen quits (~chenshen@2620:10d:c090:400::5:d9c5) (Client Quit)
2021-03-20 23:38:36 <monochrom> There are too many groups I don't want, and only one grouping I want.
2021-03-20 23:39:09 <ski> i wonder if there's any implemented language that adopts the dot convention, from e.g. early papers by Peano, et al.
2021-03-20 23:39:12 <mniip> it's like reverse parenthesizing
2021-03-20 23:39:36 <monochrom> Moreoever, in practice, if you spend 10 pages to rule out what you don't want instead of one sentence saying what you want, your reader would be rightful in thinking that you're trolling.
2021-03-20 23:39:43 <mniip> ski, which dot?
2021-03-20 23:40:11 <ski> a + b .*: c - d ./ e
2021-03-20 23:40:13 <ski> meaning
2021-03-20 23:40:24 <ski> (a + b) * ((c - d) / e)
2021-03-20 23:40:30 <mniip> oh
2021-03-20 23:40:33 <mniip> I remember that
2021-03-20 23:40:38 <olligobber> wtf is that
2021-03-20 23:40:52 <ski> olligobber : notation from before there were any (machine) computers
2021-03-20 23:40:56 <__minoru__shirae> monochrom: I heard some word and forgot it, it means describing god by saying what it's not (and what it's not like). like a "negative description" or something
2021-03-20 23:41:06 <mniip> basically instead of having fixed precedences for operators, you say
2021-03-20 23:41:33 <mniip> if you encouter <n dots> operator <m dots>, then the LHS is parsed at precedence n, and the RHS at precedence m
2021-03-20 23:42:08 <e> ((a / b) / c) / d == a / [b / [c / d]]; (a / b) / (c / d) == a / [b / c] / d; a / (b / (c / d)) == [[a / b] / c] / d
2021-03-20 23:42:13 <ski> (in practice, it was even a bit more involved, since they also used a bare `.' for multiplication/conjunction)
2021-03-20 23:42:16 <e> maybe it doesn't work on longer expressions
2021-03-20 23:42:26 <mniip> controversial but
2021-03-20 23:42:29 <mniip> I like that dot notation
2021-03-20 23:43:26 <ski> olligobber : it's used in some early papers on logic
2021-03-20 23:44:15 <monochrom> I independently invented that dot notation many years ago when replying on haskell-cafe a beginner's flawed wish "how to get rid of parentheses".
2021-03-20 23:44:37 <mniip> I feel like I've just invented it here above
2021-03-20 23:44:45 <monochrom> And if I were not so lazy, I would have made a package of it on hackage on an April 1, too.
2021-03-20 23:44:49 <mniip> except my operators always have the same number of dots on the left and right
2021-03-20 23:44:58 <monochrom> Yeah me too.
2021-03-20 23:45:09 <e> it's not too late to change that
2021-03-20 23:45:21 <mniip> GHC only has 10 precedences
2021-03-20 23:45:23 <mniip> :(
2021-03-20 23:45:24 Vadrigar joins (~Vadrigar@ip5b417208.dynamic.kabel-deutschland.de)
2021-03-20 23:45:27 <monochrom> But I really have better things to do.
2021-03-20 23:45:47 <mniip> you don't prepare for april fools for years in advance?
2021-03-20 23:45:50 <ski> absolute precedence levels is the wrong thing anyway, i think
2021-03-20 23:46:27 <ski> Prolog has 1200 (or maybe it's 1201 ?) precedence levels
2021-03-20 23:46:45 <mniip> ski, are you suggesting precedence levels settled by inequality constraints?
2021-03-20 23:46:59 <__minoru__shirae> why not just use fractions for precedence levels instead of 1200 levels
2021-03-20 23:47:12 <mniip> with A ? B ! C declined as ambiguous if ? and ! aren't (transitively) related
2021-03-20 23:47:13 <e> mniip: i mean that's how languages with BNF operator definitions do it (effectively)
2021-03-20 23:47:38 × Varis quits (~Tadas@unaffiliated/varis) (Remote host closed the connection)
2021-03-20 23:47:42 <ski> mniip : i think, there should probably be a way of specifying abstractly named groups / precedence levels, and to specify individual operators as belonging to such a group
2021-03-20 23:47:45 <mniip> BNF operator definitions means you have a baked in fixed number of operators
2021-03-20 23:47:52 <ski> mniip : yea, something like that
2021-03-20 23:48:16 <e> mniip: not if you allow code to change the BNF at parse time
2021-03-20 23:48:32 <ski> (semirelatedly, i've toyed a little bit with what would happen if we give up transitivity)
2021-03-20 23:48:51 slack1256 joins (~slack1256@dvc-186-186-101-190.movil.vtr.net)
2021-03-20 23:49:04 <mniip> you mean explicit productions for going between expr_i and expr_j?
2021-03-20 23:49:44 × Vadrigar quits (~Vadrigar@ip5b417208.dynamic.kabel-deutschland.de) (Ping timeout: 240 seconds)
2021-03-20 23:49:58 <glguy> I'd like to be able to have a collection of disjoint precedences rather than all operations having to share some common numbering
2021-03-20 23:50:00 <ski> it seems to me that if `a op0 b op1 c op2 d' parses as `a op0 (b op1 (c op2 d))', then it's reasonable to expect `a op0 bc op2 d' to parse as `a op0 (bc op2 d)' (assuming `a',`b',`bc',`c',`d' are all atomic, say)

All times are in UTC.