Newest at the top
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 +0200 | Frostillicus | (~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 +0200 | merijn | (~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 +0200 | merijn | (~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 |
2025-06-20 12:05:59 +0200 | <haskellbridge> | <Profpatsch> No I guess that’s only if I control the type class |
2025-06-20 12:05:12 +0200 | <haskellbridge> | <Profpatsch> ames: Can I specify a type defaulting rule for this function? |
2025-06-20 12:02:39 +0200 | <ames> | https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/monomorphism.html |
2025-06-20 12:01:47 +0200 | <haskellbridge> | <Profpatsch> It does work |
2025-06-20 12:01:40 +0200 | <haskellbridge> | <Profpatsch> ames: ohh! if I reformulate as baz bar = divide2 #foo stringT #bar bar |
2025-06-20 12:00:16 +0200 | <ames> | baz |
2025-06-20 12:00:00 +0200 | <haskellbridge> | <Profpatsch> what’s not a function? |
2025-06-20 11:59:47 +0200 | <ames> | well the problem is exactly that it's not a function and ghc does not want to make it one by quantifying over your HasField(s) |
2025-06-20 11:59:28 +0200 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-06-20 11:58:58 +0200 | <haskellbridge> | <Profpatsch> cause it should follow directly from the definition of divide2 |
2025-06-20 11:58:41 +0200 | <haskellbridge> | <Profpatsch> ames: But then again, ideally HLS could infer the function signature nonetheless |
2025-06-20 11:58:03 +0200 | <haskellbridge> | <Profpatsch> I want to make use of Divisible contravariants ergonomic, but without too much overloading going on; I guess if I just use it somewhere in code it should be fine |
2025-06-20 11:57:54 +0200 | econo_ | (uid147250@id-147250.tinside.irccloud.com) (Quit: Connection closed for inactivity) |
2025-06-20 11:57:14 +0200 | <haskellbridge> | <Profpatsch> ames: Oh you mean cause GHC needs to infer monomorphic types for toplevel |
2025-06-20 11:56:21 +0200 | <ames> | this is just a monomorphism restriction thing |
2025-06-20 11:53:57 +0200 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds) |
2025-06-20 11:53:15 +0200 | <haskellbridge> | <Profpatsch> I feel like it should be possible in principle |
2025-06-20 11:51:39 +0200 | xff0x | (~xff0x@fsb6a9491c.tkyc517.ap.nuro.jp) (Ping timeout: 245 seconds) |
2025-06-20 11:51:27 +0200 | <haskellbridge> | <Profpatsch> I tried the r1 ~ r2 trick, but that does not seem to work |
2025-06-20 11:51:17 +0200 | <haskellbridge> | <Profpatsch> I’d like GHC to infer the HasField instances via divide2 automatically, but it is stumped |
2025-06-20 11:50:55 +0200 | <haskellbridge> | <Profpatsch> In particular, the definitions of bar and baz |
2025-06-20 11:50:43 +0200 | <haskellbridge> | <Profpatsch> https://play.haskell.org/saved/vc4ycTs6 |
2025-06-20 11:50:41 +0200 | <haskellbridge> | <Profpatsch> I need some input from somebody with type-fool knowledge |
2025-06-20 11:49:45 +0200 | m5zs7k | (aquares@web10.mydevil.net) m5zs7k |
2025-06-20 11:42:33 +0200 | trickard_ | (~trickard@cpe-60-98-47-163.wireline.com.au) |
2025-06-20 11:42:19 +0200 | trickard_ | (~trickard@cpe-60-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
2025-06-20 11:40:10 +0200 | AlexZenon | (~alzenon@178.34.163.228) |
2025-06-20 11:38:25 +0200 | m5zs7k | (aquares@web10.mydevil.net) (Ping timeout: 248 seconds) |
2025-06-20 11:38:13 +0200 | szkl | (uid110435@id-110435.uxbridge.irccloud.com) (Quit: Connection closed for inactivity) |
2025-06-20 11:34:44 +0200 | gmg | (~user@user/gehmehgeh) gehmehgeh |
2025-06-20 11:34:28 +0200 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-06-20 11:33:17 +0200 | prdak | (~Thunderbi@user/prdak) (Ping timeout: 244 seconds) |
2025-06-20 11:30:47 +0200 | AlexZenon | (~alzenon@178.34.163.228) (Client Quit) |
2025-06-20 11:30:11 +0200 | AlexZenon | (~alzenon@178.34.163.228) |
2025-06-20 11:28:49 +0200 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds) |
2025-06-20 11:28:30 +0200 | AlexZenon | (~alzenon@178.34.163.228) (Quit: ;-) |
2025-06-20 11:21:33 +0200 | gmg | (~user@user/gehmehgeh) (Ping timeout: 244 seconds) |