Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,797,167 events total
2026-02-25 15:52:54 × housemate quits (~housemate@202.7.248.67) (Quit: https://ineedsomeacidtocalmmedown.space/)
2026-02-25 15:56:43 × uli-fem quits (~uli-fem@118.210.1.123) (Ping timeout: 264 seconds)
2026-02-25 15:57:49 housemate joins (~housemate@202.7.248.67)
2026-02-25 15:59:20 × Psychotic1 quits (~Psychotic@65.sub-174-245-22.myvzw.com) (Ping timeout: 245 seconds)
2026-02-25 15:59:46 Psychotic1 joins (~Psychotic@2600:1007:b0aa:7216:54da:2a86:8a54:a2c4)
2026-02-25 16:01:08 Psychotic1_ joins (~Psychotic@2600:1007:b0aa:7216:54da:2a86:8a54:a2c4)
2026-02-25 16:01:37 × weary-traveler quits (~user@user/user363627) (Remote host closed the connection)
2026-02-25 16:01:49 Psychotic1__ joins (~Psychotic@2600:1007:b0aa:7216:54da:2a86:8a54:a2c4)
2026-02-25 16:04:15 × Psychotic1 quits (~Psychotic@2600:1007:b0aa:7216:54da:2a86:8a54:a2c4) (Ping timeout: 246 seconds)
2026-02-25 16:05:39 × Psychotic1_ quits (~Psychotic@2600:1007:b0aa:7216:54da:2a86:8a54:a2c4) (Ping timeout: 246 seconds)
2026-02-25 16:07:28 × Psychotic1__ quits (~Psychotic@2600:1007:b0aa:7216:54da:2a86:8a54:a2c4) (Remote host closed the connection)
2026-02-25 16:11:57 prdak joins (~Thunderbi@user/prdak)
2026-02-25 16:12:58 × prdak quits (~Thunderbi@user/prdak) (Read error: Connection reset by peer)
2026-02-25 16:13:16 prdak joins (~Thunderbi@user/prdak)
2026-02-25 16:13:24 × chele quits (~chele@user/chele) (Remote host closed the connection)
2026-02-25 16:16:17 × prdak quits (~Thunderbi@user/prdak) (Remote host closed the connection)
2026-02-25 16:16:37 prdak joins (~Thunderbi@user/prdak)
2026-02-25 16:24:59 × Maxdamantus quits (~Maxdamant@user/maxdamantus) (Server closed connection)
2026-02-25 16:25:15 Maxdamantus joins (~Maxdamant@user/maxdamantus)
2026-02-25 16:26:19 uli-fem joins (~uli-fem@118.210.1.123)
2026-02-25 16:29:44 <EvanR> if chromoblob goes to the oracle and comes back with a ghc which chooses the optimal implementation for String at each point in the program, and optimal conversion points. Then I want it to also work on cartesian vs polar complex numbers please
2026-02-25 16:30:11 <EvanR> feel free to pile on other examples
2026-02-25 16:31:28 × housemate quits (~housemate@202.7.248.67) (Quit: https://ineedsomeacidtocalmmedown.space/)
2026-02-25 16:33:36 × uli-fem quits (~uli-fem@118.210.1.123) (Ping timeout: 255 seconds)
2026-02-25 16:43:02 housemate joins (~housemate@202.7.248.67)
2026-02-25 16:48:54 <ski> @ghc
2026-02-25 16:48:54 <lambdabot> Can't happen
2026-02-25 16:49:10 messewix joins (~jmc@user/messewix)
2026-02-25 16:49:22 uli-fem joins (~uli-fem@118.210.1.123)
2026-02-25 16:49:55 <ski> loop@(map f) (x:xs) = f x : loop xs -- would be nice to be able to do this kind of thing
2026-02-25 16:51:16 <ski> (fooWith cfg)@(let cfg = defaultCfg in foo) ... = ... -- or this
2026-02-25 16:52:43 × st_aldini quits (~Thunderbi@136.48.46.187) (Quit: st_aldini)
2026-02-25 16:53:27 <EvanR> what's this @ sign
2026-02-25 16:53:36 × uli-fem quits (~uli-fem@118.210.1.123) (Ping timeout: 246 seconds)
2026-02-25 16:54:35 <Clint> as-pattern
2026-02-25 16:54:59 × EvanR quits (~EvanR@user/evanr) (Server closed connection)
2026-02-25 16:55:24 EvanR joins (~EvanR@user/evanr)
2026-02-25 16:56:29 <ski> > let f :: Integer -> Integer; f ?x = ?x + 1 in f (f 3)
2026-02-25 16:56:31 <lambdabot> <hint>:1:32: error: Expression syntax in pattern: ?x
2026-02-25 16:57:05 <ski> yes. the second `@' would be the generalization of and/conjunction-pattern
2026-02-25 16:58:21 <ski> where `let cfg = defaultCfg in foo' is a pattern that matches the input to `foo', and additionally binds `cfg' to `defaultCfg' (so that regardless of whether we use the `fooWith' or the `foo' entry point to the code, `cfg' will be in scope in the body)
2026-02-25 16:59:41 × fgarcia quits (~lei@user/fgarcia) (Ping timeout: 268 seconds)
2026-02-25 17:01:39 × misterfish quits (~misterfis@84.53.85.146) (Ping timeout: 246 seconds)
2026-02-25 17:03:39 × lortabac quits (~lortabac@mx1.fracta.dev) (Server closed connection)
2026-02-25 17:03:53 lortabac joins (~lortabac@mx1.fracta.dev)
2026-02-25 17:04:29 <ski> it would be nice to be able to say something like `(frob,barf) = (\ ?cfg -> foo,\ ?cfg -> bar) where foo :: (?cfg :: ...) => ...; foo = ..?cfg..foo..bar..; bar :: (?cfg :: ...) => ...; bar = ..?cfg..foo.bar..' (having a common "config" argument in scope, over mutual recursion, avoiding repeating it in the recursive calls)
2026-02-25 17:05:31 <ski> maybe there's be some version of
2026-02-25 17:05:52 <ski> foo@(frob cfg) = ..cfg..foo..bar..
2026-02-25 17:06:01 <ski> bar@(barf cfg) = ..cfg..foo..bar..
2026-02-25 17:06:08 <ski> to express this ..
2026-02-25 17:06:39 <ski> (issue is how to (reasonably) get both `foo' and `bar' in scope in both bodies ..)
2026-02-25 17:08:59 × sondr3 quits (sondr3@2a01:7e01::f03c:92ff:fe06:7664) (Server closed connection)
2026-02-25 17:09:09 sondr3 joins (sondr3@2a01:7e01::f03c:92ff:fe06:7664)
2026-02-25 17:10:29 <ski> (for the `loop' & `map' case above, `loop' doesn't explicitly bind the `f' parameter (and so must already assume `f' already comes from somewhere), so `loop' would just be in scope in the body, and not be in scope elsewhere `map' is in scope (where `f' isn't). in the `fooWith' & `foo' case, both conjuncts does bind `cfg', so both `fooWith' and `foo' makes sense here to use in a scope where `cfg' is not bound)
2026-02-25 17:10:37 <haskellbridge> <ijouw> You want (f g) to implicitly use another function named g that is in scope at use site?
2026-02-25 17:11:34 <ski> no
2026-02-25 17:11:47 <ski> (this is not about dynamic scope)
2026-02-25 17:15:19 <ski> (it's not clear whether by `f g' you mean an expression, or a pattern, btw ..)
2026-02-25 17:16:50 <ski> this is about creative uses of patterns and scoping, to effect some convenience/elegance, for certain kinds of definition idioms
2026-02-25 17:18:55 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 245 seconds)
2026-02-25 17:20:59 <ski> (a) the `loop' and `map' case would be a way to give a *local* name for the function you're defining, applied to some prefix of the formal parameters, so that you don't need to repeat those parameters at recursive calls. this abbreviated form would naturally only be in scope inside the definition, and not elsewhere (because we would not know which value `f' would be bound to). it would be possible to use an
2026-02-25 17:21:05 <ski> explicit recursive call, passing some different value(s) for the prefix parameters, which would then bind the identifier (`loop') here to this *new* prefix, for that recursive call (this can e.g. be useful, if you're passing around an environment to an interpreter or type checker, mostly you want to pass along the same environment, but sometimes you want to change it)
2026-02-25 17:23:02 <ski> (b) sometimes you have a general version of a function, and one version specialized to passing some default value for a parameter, as exemplified by `fooWith' & `foo'. as indicated, this could be done with conjunctive patterns, and `let'-`in'-patterns
2026-02-25 17:24:14 <haskellbridge> <ijouw> Do you intend foo = ..?cfg..foo..bar.. to be recursive?
2026-02-25 17:25:35 uli-fem joins (~uli-fem@118.210.1.123)
2026-02-25 17:25:52 <ski> (c) sometimes you want to do (a), but for mutually recursive functions, wanting to avoid passing around the *same* identical prefix parameters. so, i was pondering how one could possibly effect that, with a minimum of fuss. one attempt was to locally bind the respective parameters to an implicit `?cfg' (implementation detail), and then use that for the local, mutually recursive, definitions. there might be a
2026-02-25 17:25:59 <ski> nicer way to do it, but one would need to explain how `foo' could be in scope in the `barf' definition, and how `bar' could be in scope in the `frob' definition
2026-02-25 17:26:36 <ski> ijouw : yes (that's why i wrote `foo' and `bar' in `..?cfg..foo.bar..', to indicate that those three would be allowed to occur free in that body)
2026-02-25 17:27:08 jmcantrell_ joins (~weechat@user/jmcantrell)
2026-02-25 17:27:37 <haskellbridge> <ijouw> After enabling OverloadedRecordDot my brain parses that weirdly
2026-02-25 17:27:59 ski prefers to pretend that extension does not exist
2026-02-25 17:30:14 <ski> (btw, it would perhaps look neater to say `foo where cfg = defaultCfg' in place of `let cfg = defaultCfg in foo' .. but `where' is not an expression, attaches to defining equations (and `case' branches))
2026-02-25 17:30:17 × uli-fem quits (~uli-fem@118.210.1.123) (Ping timeout: 248 seconds)
2026-02-25 17:34:19 <haskellbridge> <ijouw> Using current language, I would likely try to solve the dependency by making foo and bar a function and using liftA2 a lot and other pointfree stuff so cfg is never specified (but that will likely not make it readable).
2026-02-25 17:34:49 <ski> yea, that's too invasive
2026-02-25 17:35:05 × emaczen quits (~user@user/emaczen) (Remote host closed the connection)
2026-02-25 17:36:10 <ski> a somewhat related thing is the `local <decls> in <decls> end' declaration, in SML. it declares the latter declarations (between `in' and `end'), while hiding the former ones, letting them be in scope in the latter ones, but not visible elsewhere
2026-02-25 17:37:00 <ski> in Haskell, you often have to resort to `(foo,bar) = (myFoo,MyBar) where myFoo = ...; myBar = ...; extraDef = ...', for this, which is ugly
2026-02-25 17:37:38 <ski> in SML, this would be `local fun extraDef ... = ... in fun foo ... = ... and bar ... = ... end'
2026-02-25 17:38:04 <ski> (`fun ... and ...' is mutual recursive functions)
2026-02-25 17:38:09 emaczen joins (~user@user/emaczen)
2026-02-25 17:38:19 fgarcia joins (~lei@user/fgarcia)
2026-02-25 17:40:01 <ski> (of course, you could simply hide, not export, `extraDef', from the module in question. but it's often nice to restrict scope more, to make sure it's evident that `extraDef' isn't used elsewhere in the module. and Haskell doesn't allow nested submodules ..)
2026-02-25 17:41:22 <EvanR> I have to admit I'm a never nester
2026-02-25 17:41:42 <ski> you never define local functions in a `where' or `let' ?
2026-02-25 17:45:16 <ski> (.. sometimes i also want to use `if' or `case', at declaration level. `if ... then {f x = ...; g y z = ...} else {f x = ...; g y z = ...}'. having declarations as the body of the branches, conditionally defining in one of several ways (all branches have to define the same identifiers, naturally))
2026-02-25 17:45:20 tromp joins (~textual@2001:1c00:3487:1b00:7955:9591:6018:7ef9)
2026-02-25 17:45:54 <__monty__> I love Agda's approach to scoping, https://agda.readthedocs.io/en/latest/language/module-system.html
2026-02-25 17:47:15 <EvanR> ski, I do, but often it's a oneliner, and or doesn't appear indented more than 1
2026-02-25 17:47:41 <EvanR> this was a joke about indentation levels rather than submodules
2026-02-25 17:48:21 <EvanR> putting non trivial functions inside a where clause always bites me since then I can't use it in the repl
2026-02-25 17:49:00 <ski> __monty__ : reminds me that in OCaml, you can not only do `M.f x (M.g y z)', but you can also say `M.(f x (g y z))', where for `M.(...)', the identifiers exported by `M' are all in scope directly in the expression `...'
2026-02-25 17:49:12 × euphores quits (~SASL_euph@user/euphores) (Quit: Leaving.)
2026-02-25 17:49:41 <ski> (iow, this is a shorter way to say `let open M in ...')
2026-02-25 17:50:42 <ski> EvanR : mm, yep. i recall pondering a type system that would let you access them, from an interactor / debugger
2026-02-25 17:51:25 <haskellbridge> <ijouw> can you do that top level?
2026-02-25 17:51:36 <ski> (oh, and iirc, with breakpoints in GHCi, you can access them, if you break inside such a scope)
2026-02-25 17:51:53 <ski> how do you mean, ijouw ?
2026-02-25 17:52:25 <EvanR> the power of the OOP dot
2026-02-25 17:52:26 v0id_7 joins (~v0id_7@user/v0id-7:62772)

All times are in UTC.