2025/06/20

Newest at the top

2025-06-20 13:23:03 +0200trickard_(~trickard@cpe-60-98-47-163.wireline.com.au)
2025-06-20 13:22:50 +0200trickard_(~trickard@cpe-60-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-06-20 13:17:08 +0200prdak(~Thunderbi@user/prdak) prdak
2025-06-20 13:10:29 +0200Square(~Square@user/square) (Ping timeout: 260 seconds)
2025-06-20 13:01:27 +0200jespada(~jespada@r167-61-135-10.dialup.adsl.anteldata.net.uy) jespada
2025-06-20 12:55:28 +0200trickard_(~trickard@cpe-60-98-47-163.wireline.com.au)
2025-06-20 12:55:14 +0200trickard(~trickard@cpe-60-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-06-20 12:46:17 +0200prdak(~Thunderbi@user/prdak) (Read error: Connection reset by peer)
2025-06-20 12:43:16 +0200Frostillicus(~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net)
2025-06-20 12:42:45 +0200prdak(~Thunderbi@user/prdak) prdak
2025-06-20 12:40:44 +0200kuribas(~user@ip-188-118-57-242.reverse.destiny.be) (Ping timeout: 260 seconds)
2025-06-20 12:38:59 +0200Frostillicus(~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net) (Ping timeout: 260 seconds)
2025-06-20 12:35:37 +0200trickard_trickard
2025-06-20 12:32:30 +0200 <haskellbridge> <Profpatsch> I don’t much care for games of find the prettier definition
2025-06-20 12:31:49 +0200 <haskellbridge> <Profpatsch> probably
2025-06-20 12:29:58 +0200 <tomsmeding> Profpatsch: first time looking at contravariant, but isn't 'adapt >$< a `divided` b' the same as 'divide adapt a b'
2025-06-20 12:28:23 +0200 <tomsmeding> side-note: I highly doubt that 'INLINE divide2' pragma is necessary
2025-06-20 12:26:08 +0200 <haskellbridge> <Profpatsch> It’s like a holy grail that was just lying on the floor in the corner somewhere
2025-06-20 12:25:40 +0200 <haskellbridge> <Profpatsch> I haven’t seen it before
2025-06-20 12:25:34 +0200 <haskellbridge> <Profpatsch> I think I’m also, like, the first person to find a dual to "do" notation for Divide?
2025-06-20 12:25:14 +0200 <tomsmeding> if that works for you, then that's a solution too, indeed
2025-06-20 12:24:52 +0200 <haskellbridge> <Profpatsch> I added an _ to coerce it to a function and now it works
2025-06-20 12:24:34 +0200 <haskellbridge> <Profpatsch> tomsmeding: takk for explanation
2025-06-20 12:24:29 +0200merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-06-20 12:23:51 +0200merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 268 seconds)
2025-06-20 12:22:09 +0200 <tomsmeding> *stowed
2025-06-20 12:22:01 +0200 <tomsmeding> and without having to disable the monomorphism restriction, which is a rather big hammer that you'd like to leave sowed away if possible
2025-06-20 12:21:39 +0200 <tomsmeding> that will cause GHC to infer the polymorphic type, without you having to write out the constraints
2025-06-20 12:21:22 +0200 <tomsmeding> Profpatsch: here is an alternative: write `baz :: _ => Build r` and enable -XPartialTypeSignatures, and perhaps set -Wno-partial-type-signatures
2025-06-20 12:19:59 +0200 <tomsmeding> because this can be a very unexpected and undesirable introduction of recomputation (and hence slowness), GHC refuses to do this by default
2025-06-20 12:19:33 +0200 <tomsmeding> a non-function has the interesting property that once evaluated, it will not be evaluated again; when it's a (polymorphic) function, every use will implicitly apply it to its type class dictionaries, and hence it will be recomputed at every use site
2025-06-20 12:18:53 +0200 <tomsmeding> because those constraints become actual arguments at runtime (dictionary translation), and hence for a non-function, that generalisation process would _make it a function_
2025-06-20 12:18:24 +0200 <tomsmeding> if the monomorphism restriction is enabled, GHC will only do this final generalisation process for things that are already functions, i.e. have >=1 argument
2025-06-20 12:18:10 +0200trickard_(~trickard@cpe-60-98-47-163.wireline.com.au)
2025-06-20 12:17:52 +0200 <tomsmeding> any constraints that existed on them become constraints on the function
2025-06-20 12:17:43 +0200trickard_(~trickard@cpe-60-98-47-163.wireline.com.au) (Ping timeout: 244 seconds)
2025-06-20 12:17:35 +0200 <tomsmeding> then, if a function definition without a type signature still has unknown unification variables, they are implicitly "generalised" by introducing a forall quantifier for them
2025-06-20 12:16:53 +0200 <tomsmeding> Profpatch: "because it follows directly from the definition of divide2" -- no, how the type inference algorithm works is it first instantiates all forall quantifiers with unknown type variables ("unification variables"), collects all constraints arising from your program and instantiates type variables in order to satisfy the constraints, and then looks at the result
2025-06-20 12:16:40 +0200Frostillicus(~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net)
2025-06-20 12:14:53 +0200 <tomsmeding> doesn't sound relevant here
2025-06-20 12:14:42 +0200 <tomsmeding> defaulting is for guessing an instantiation for an ambiguous type variable based on the type class constraints on that variable
2025-06-20 12:14:29 +0200merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-06-20 12:14:17 +0200 <haskellbridge> <Profpatsch> Things are looking bright for contravariant syntax
2025-06-20 12:13:47 +0200 <haskellbridge> <Profpatsch> bar :: (HasField "foo" a Text, HasField "bar" a Natural) => p -> TextBuilder a
2025-06-20 12:13:47 +0200 <haskellbridge> <Profpatsch> bar _ = field #foo textT <> "foo" <> (field #bar naturalDecimalT)
2025-06-20 12:13:41 +0200merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds)
2025-06-20 12:13:28 +0200 <haskellbridge> <Profpatsch> field LabelPrx a = getField @l >$< a
2025-06-20 12:13:28 +0200 <haskellbridge> <Profpatsch> field :: forall f l a b. (Contravariant f, HasField l a b) => LabelPrx l -> f b -> f a
2025-06-20 12:12:46 +0200 <ames> but like is there an actual problem here? if you turn off the monomorphism restriction or just add a dummy argument to baz ghc infers exactly the type you want (± the dummy argument, i guess)
2025-06-20 12:09:09 +0200 <ames> i don't know really how defaulting works and i don't want to find out either i consider it a misfeature