Logs: freenode/#haskell
| 2021-02-27 22:49:08 | <koz_> | NieDzejkob: What exactly are you trying to do? |
| 2021-02-27 22:49:25 | × | gehmehgeh_ quits (~ircuser1@gateway/tor-sasl/gehmehgeh) (Quit: Leaving) |
| 2021-02-27 22:50:31 | <NieDzejkob> | I basically need to thread many different parts of context through the same state monad, so I'm using State TMap |
| 2021-02-27 22:51:06 | <NieDzejkob> | I have a typeclass that provides the initial value so I was hoping I could do instance InitialValue a => MonadState a (State TMap) |
| 2021-02-27 22:52:25 | <koz_> | Yeah, that's why it won't work. You wanna newtype and then define over that. |
| 2021-02-27 22:52:49 | <koz_> | For State, the instance is (MonadState s (State s)) |
| 2021-02-27 22:52:55 | <koz_> | And the fundep burns that in. |
| 2021-02-27 22:53:00 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-02-27 22:53:20 | <NieDzejkob> | yeah, I'm simplifying. I do have a newtype |
| 2021-02-27 22:53:57 | <NieDzejkob> | the issue is that there are many possible state types for the same monad type |
| 2021-02-27 22:53:58 | <int-e> | :t gets |
| 2021-02-27 22:53:59 | <lambdabot> | MonadState s m => (s -> a) -> m a |
| 2021-02-27 22:55:27 | <ski> | the FDs here always felt awkward |
| 2021-02-27 22:55:41 | <NieDzejkob> | what's the motivation for that functional dep? |
| 2021-02-27 22:55:47 | <nshepperd> | i sometimes think about the difference between "class MonadState s m | m -> s; instance MonadState Foo Bar" and "class MonadState s m; instance (s ~ Foo) => MonadState s Bar" |
| 2021-02-27 22:55:55 | <merijn> | That's because all the classes in mtl are bad anyway, tbh |
| 2021-02-27 22:56:14 | <ski> | being able to identify which state/environment/output to refer to, solely from its type |
| 2021-02-27 22:56:16 | <dolio> | It ensures that the relevant instance can be inferred from just `m`. |
| 2021-02-27 22:56:29 | <int-e> | NieDzejkob: so you can write 'get' and the result type is inferred |
| 2021-02-27 22:56:41 | <nshepperd> | the latter lets you have effectively different fundep rules for each instance, but doesn't give as good inference when the second parameter is unknown |
| 2021-02-27 22:56:46 | → | cntrl joins (~cntrl_@p200300ea6f41360063c0e986f070bad8.dip0.t-ipconnect.de) |
| 2021-02-27 22:56:46 | <dolio> | Otherwise you'd need to annotate every use of `get` with the type of state you want to extract, unless it was determined by something else. |
| 2021-02-27 22:57:16 | <ski> | yea .. better would possibly be to associate some kind of labels or identifiers with it |
| 2021-02-27 22:57:27 | <int-e> | it's a design decision... you get better type inference if the monad determines what the embedded state's type is |
| 2021-02-27 22:57:39 | × | cntrl quits (~cntrl_@p200300ea6f41360063c0e986f070bad8.dip0.t-ipconnect.de) (Client Quit) |
| 2021-02-27 22:58:03 | → | nbloomf joins (~nbloomf@2600:1700:ad14:3020:b84a:c23b:9840:733b) |
| 2021-02-27 22:58:41 | → | systemhalted joins (~aqualogic@71-129-231-253.lightspeed.rcsntx.sbcglobal.net) |
| 2021-02-27 22:59:08 | <koz_> | jared-w: Ping on Github Actions for Haskell-related stuff. |
| 2021-02-27 22:59:22 | <int-e> | it might also fit better with transformers which would otherwise easily become very overlapping (if you don't have the fundep you may be tempted to lift MonadState through a StateT... because who would have the same state type twice in a transformer stack?) |
| 2021-02-27 23:00:02 | <NieDzejkob> | ski: yeah, but I'd like the declaration of each part of state to be self-contained in the component that uses it |
| 2021-02-27 23:00:06 | <int-e> | (which will work fine until somebody does exactly that) |
| 2021-02-27 23:00:08 | → | finn_elija joins (~finn_elij@gateway/tor-sasl/finnelija/x-67402716) |
| 2021-02-27 23:00:33 | <nshepperd> | you could use lens combinators in this case. without a typeclass even, unless you really have a good reason for wanting to look things up by type specifically |
| 2021-02-27 23:00:40 | <ski> | (yea, and ideally, doing that should be a reasonable thing to do) |
| 2021-02-27 23:00:56 | <ski> | NieDzejkob : not sure what you have in mind by that |
| 2021-02-27 23:02:26 | × | systemhalted quits (~aqualogic@71-129-231-253.lightspeed.rcsntx.sbcglobal.net) (Remote host closed the connection) |
| 2021-02-27 23:02:33 | → | systemhalted joins (~aqualogic@71-129-231-253.lightspeed.rcsntx.sbcglobal.net) |
| 2021-02-27 23:05:55 | × | elliott_ quits (~elliott_@pool-108-51-101-42.washdc.fios.verizon.net) (Ping timeout: 276 seconds) |
| 2021-02-27 23:08:58 | × | Varis quits (~Tadas@unaffiliated/varis) (Remote host closed the connection) |
| 2021-02-27 23:09:44 | inkbottle | is now known as zebrag |
| 2021-02-27 23:10:45 | × | systemhalted quits (~aqualogic@71-129-231-253.lightspeed.rcsntx.sbcglobal.net) (Ping timeout: 264 seconds) |
| 2021-02-27 23:10:59 | → | bergey joins (~user@pool-74-108-99-127.nycmny.fios.verizon.net) |
| 2021-02-27 23:11:05 | × | fendor_ quits (~fendor@178.165.128.181.wireless.dyn.drei.com) (Read error: Connection reset by peer) |
| 2021-02-27 23:13:20 | × | conal quits (~conal@208.91.109.22) (Quit: Computer has gone to sleep.) |
| 2021-02-27 23:13:47 | → | pavonia joins (~user@unaffiliated/siracusa) |
| 2021-02-27 23:16:29 | × | bergey quits (~user@pool-74-108-99-127.nycmny.fios.verizon.net) (Ping timeout: 260 seconds) |
| 2021-02-27 23:16:51 | × | ddellacosta quits (~ddellacos@86.106.143.10) (Remote host closed the connection) |
| 2021-02-27 23:17:17 | → | elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) |
| 2021-02-27 23:20:57 | × | acarrico quits (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net) (Ping timeout: 265 seconds) |
| 2021-02-27 23:21:05 | → | ezrakilty joins (~ezrakilty@97-113-55-149.tukw.qwest.net) |
| 2021-02-27 23:21:55 | × | alx741 quits (~alx741@186.178.108.37) (Quit: alx741) |
| 2021-02-27 23:22:15 | → | conal joins (~conal@192.145.118.121) |
| 2021-02-27 23:24:32 | <NieDzejkob> | OH, so import cycles are an error and I actually NEED to do this |
| 2021-02-27 23:25:38 | <fresheyeball> | https://gitlab.com/fresheyeball/Shpadoinkle/-/blob/master/html/Shpadoinkle/Html/Memo.hs#L44 |
| 2021-02-27 23:25:39 | <davean> | NieDzejkob: there are ways to do cylces, but they're special. You should avoid it. |
| 2021-02-27 23:25:48 | <fresheyeball> | turns out I am wrong about what this bit of code does |
| 2021-02-27 23:25:52 | <fresheyeball> | but I don't know how to fix it |
| 2021-02-27 23:26:02 | <fresheyeball> | I thought it would make an IORef on the first eval |
| 2021-02-27 23:26:09 | <fresheyeball> | and then re-use it for subsequent evals |
| 2021-02-27 23:26:20 | <fresheyeball> | but ghci is showing me it runs that monad on each eval |
| 2021-02-27 23:26:41 | <fresheyeball> | I added putStrLn between 44 and 45 and it prints each time |
| 2021-02-27 23:28:34 | <fresheyeball> | oh shit I see it |
| 2021-02-27 23:28:37 | <fresheyeball> | duck duck |
| 2021-02-27 23:31:29 | NieDzejkob | quacks |
| 2021-02-27 23:35:12 | <NieDzejkob> | Okay, let me try explaining what I'm trying to do again. Let's say I have a set of modules, and each of them defines a data type. I want to create a state monad that holds one of each type (the Context), and write operations in the Context monad, where each module uses its own part. I'm currently using a type-indexed map, and the simple-somewhat-ugly approach of just defining a record with all of the types doesn't work because of an import cycle. Any |
| 2021-02-27 23:35:12 | <NieDzejkob> | other options? |
| 2021-02-27 23:35:23 | × | Sheilong quits (uid293653@gateway/web/irccloud.com/x-bfiroajaabomwjor) (Quit: Connection closed for inactivity) |
| 2021-02-27 23:37:29 | → | olligobber joins (olligobber@gateway/vpn/privateinternetaccess/olligobber) |
| 2021-02-27 23:40:23 | → | heatsink joins (~heatsink@2600:1700:bef1:5e10:44cd:7ec7:332d:f0ab) |
| 2021-02-27 23:45:39 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds) |
| 2021-02-27 23:45:45 | → | usr25 joins (~usr25@unaffiliated/usr25) |
| 2021-02-27 23:50:08 | × | ezrakilty quits (~ezrakilty@97-113-55-149.tukw.qwest.net) (Remote host closed the connection) |
| 2021-02-27 23:51:43 | × | usr25 quits (~usr25@unaffiliated/usr25) (Ping timeout: 245 seconds) |
| 2021-02-27 23:51:45 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:b84a:c23b:9840:733b) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-02-27 23:56:03 | → | nbloomf joins (~nbloomf@2600:1700:ad14:3020:b84a:c23b:9840:733b) |
| 2021-02-27 23:59:53 | × | fresheyeball quits (~isaac@c-71-237-105-37.hsd1.co.comcast.net) (Quit: WeeChat 2.9) |
| 2021-02-28 00:04:14 | <hyiltiz-M> | But how in seven hells did you put yourself in such a situation? Sounds like you needed a bunch of custom type classes instead, no? |
| 2021-02-28 00:09:02 | × | heatsink quits (~heatsink@2600:1700:bef1:5e10:44cd:7ec7:332d:f0ab) (Ping timeout: 264 seconds) |
| 2021-02-28 00:12:19 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:b84a:c23b:9840:733b) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-02-28 00:13:00 | → | falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) |
| 2021-02-28 00:17:35 | × | hiroaki_ quits (~hiroaki@2a02:908:4b18:8c40:331:1c71:e87e:3061) (Ping timeout: 272 seconds) |
| 2021-02-28 00:17:55 | × | perrier-jouet quits (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) (Quit: WeeChat 3.0) |
| 2021-02-28 00:19:57 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-02-28 00:22:14 | → | sh9 joins (~sh9@softbank060116136158.bbtec.net) |
| 2021-02-28 00:25:36 | × | falafel quits (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) (Ping timeout: 240 seconds) |
| 2021-02-28 00:25:52 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 276 seconds) |
| 2021-02-28 00:26:37 | → | ddellacosta joins (~ddellacos@86.106.143.58) |
| 2021-02-28 00:31:09 | × | ddellacosta quits (~ddellacos@86.106.143.58) (Ping timeout: 260 seconds) |
| 2021-02-28 00:31:45 | × | darjeeling_ quits (~darjeelin@122.245.218.150) (Ping timeout: 264 seconds) |
| 2021-02-28 00:37:59 | → | heatsink joins (~heatsink@2600:1700:bef1:5e10:44cd:7ec7:332d:f0ab) |
| 2021-02-28 00:40:34 | → | elliott__ joins (~elliott@pool-108-51-101-42.washdc.fios.verizon.net) |
| 2021-02-28 00:40:48 | → | bennofs_ joins (~quassel@dslb-188-106-243-069.188.106.pools.vodafone-ip.de) |
| 2021-02-28 00:43:00 | × | hendursa1 quits (~weechat@gateway/tor-sasl/hendursaga) (Quit: hendursa1) |
| 2021-02-28 00:43:23 | → | hendursaga joins (~weechat@gateway/tor-sasl/hendursaga) |
| 2021-02-28 00:44:13 | → | Wuzzy joins (~Wuzzy@p5b0df7c2.dip0.t-ipconnect.de) |
| 2021-02-28 00:44:57 | × | bennofs__ quits (~quassel@dslb-094-222-055-234.094.222.pools.vodafone-ip.de) (Ping timeout: 264 seconds) |
| 2021-02-28 00:45:43 | × | Tario quits (~Tario@201.192.165.173) (Read error: Connection reset by peer) |
| 2021-02-28 00:46:15 | → | da39a3ee5e6b4b0d joins (~da39a3ee5@2403:6200:8876:c8ae:4c2c:c3c0:6062:2fc9) |
| 2021-02-28 00:46:23 | × | conal quits (~conal@192.145.118.121) (Quit: Computer has gone to sleep.) |
| 2021-02-28 00:48:37 | × | elfets quits (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) (Ping timeout: 276 seconds) |
All times are in UTC.