Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-07 21:42:10 lemmih joins (~lemmih@2406:3003:2072:44:194c:74d8:3073:4082)
2021-04-07 21:44:00 × Sheilong quits (uid293653@gateway/web/irccloud.com/x-yckkwdautnlneayq) (Quit: Connection closed for inactivity)
2021-04-07 21:46:34 hiroaki_ joins (~hiroaki@2a02:908:4b18:8c40:bdf7:105d:7ce:39c2)
2021-04-07 21:47:08 notzmv joins (~zmv@unaffiliated/zmv)
2021-04-07 21:49:18 noCheese joins (~nocheese@2a01:4f8:211:39b::30:1)
2021-04-07 21:49:18 × noCheese quits (~nocheese@2a01:4f8:211:39b::30:1) (Changing host)
2021-04-07 21:49:18 noCheese joins (~nocheese@unaffiliated/nocheese)
2021-04-07 21:50:03 × kozowu quits (uid44796@gateway/web/irccloud.com/x-roldfjkcrdyqvqea) (Quit: Connection closed for inactivity)
2021-04-07 21:50:18 × dwt quits (~dwt@2601:2c6:8080:618:e121:3ef9:65e4:167e) (Quit: Leaving)
2021-04-07 21:50:29 × noCheese quits (~nocheese@unaffiliated/nocheese) (Client Quit)
2021-04-07 21:51:49 Althar joins (5e039f1a@94.3.159.26)
2021-04-07 21:52:04 × zebrag quits (~inkbottle@aaubervilliers-654-1-2-51.w83-200.abo.wanadoo.fr) (Quit: Konversation terminated!)
2021-04-07 21:52:24 <Althar> Hello all, I was hoping someone could help me understand what is probably a trivial issue
2021-04-07 21:52:24 zebrag joins (~inkbottle@aaubervilliers-654-1-2-51.w83-200.abo.wanadoo.fr)
2021-04-07 21:52:49 kiweun joins (~kiweun@2607:fea8:2a62:9600:4d74:8eef:fc60:8feb)
2021-04-07 21:52:57 <Althar> I have a type, such that : 'type ResourceOpT r m a = StateT (ResourceCache r) m a'
2021-04-07 21:53:04 noCheese joins (~nocheese@static.52.177.251.148.clients.your-server.de)
2021-04-07 21:53:04 × noCheese quits (~nocheese@static.52.177.251.148.clients.your-server.de) (Changing host)
2021-04-07 21:53:04 noCheese joins (~nocheese@unaffiliated/nocheese)
2021-04-07 21:53:07 × notzmv quits (~zmv@unaffiliated/zmv) (Ping timeout: 260 seconds)
2021-04-07 21:53:18 <Althar> Why is it that 'instance (MonadIO m) => Logger ( StateT s m )' works
2021-04-07 21:53:30 <Althar> but not 'instance (MonadIO m) => Logger ( ResourceOpT r m )'
2021-04-07 21:53:33 <Althar> aren't they equivalent?
2021-04-07 21:53:50 dwt joins (~dwt@2601:2c6:8080:618:e121:3ef9:65e4:167e)
2021-04-07 21:54:09 notzmv joins (~zmv@unaffiliated/zmv)
2021-04-07 21:55:06 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 240 seconds)
2021-04-07 21:56:32 <Althar> In my case, having the instance be defined for StateT is an even better abstraction but I am curious why the more specific instance (so to speak) complains that 'should have 3 arguments, but has been given 2'
2021-04-07 21:56:55 <Althar> In case it wasn't obvious, I am still learning
2021-04-07 21:58:40 × dwt quits (~dwt@2601:2c6:8080:618:e121:3ef9:65e4:167e) (Quit: Leaving)
2021-04-07 22:00:59 × heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-04-07 22:01:03 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
2021-04-07 22:01:19 heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-04-07 22:01:27 machinedgod joins (~machinedg@24.105.81.50)
2021-04-07 22:02:52 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-04-07 22:04:13 × __monty__ quits (~toonn@unaffiliated/toonn) (Quit: leaving)
2021-04-07 22:05:06 × crestfallen quits (~john@128.32.176.159) (Remote host closed the connection)
2021-04-07 22:06:11 × michalz quits (~user@185.246.204.39) (Remote host closed the connection)
2021-04-07 22:07:47 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 248 seconds)
2021-04-07 22:10:39 × fiedlr quits (~fiedlr@83.148.33.254) (Remote host closed the connection)
2021-04-07 22:11:04 aerona joins (~aerona@2600:6c54:4600:f300:a1c5:a27d:d58e:3c09)
2021-04-07 22:11:11 × machinedgod quits (~machinedg@24.105.81.50) (Ping timeout: 246 seconds)
2021-04-07 22:13:16 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-04-07 22:14:01 <monochrom> "type ResourceOpT r m a =" 3 arguments right there: r, m, a
2021-04-07 22:14:39 <monochrom> Then apply https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-730004.2.2
2021-04-07 22:14:49 <monochrom> "Type constructor symbols T introduced by type synonym declarations cannot be partially applied; it is a static error to use T without the full number of arguments."
2021-04-07 22:14:52 <maerwald> https://haskell.foundation/en/who-we-are/ is this outdated?
2021-04-07 22:16:18 <monochrom> The less obvious trick is that you are allowed "type ResourceOpT r m = StateT (ResourceCache r) m"
2021-04-07 22:16:57 <monochrom> Hell, delete that m too for maximum future convenience.
2021-04-07 22:17:17 <Althar> Ok, this is starting to make sense, I think
2021-04-07 22:17:23 × notzmv quits (~zmv@unaffiliated/zmv) (Ping timeout: 260 seconds)
2021-04-07 22:17:25 <Althar> I'll remove the m, I guess it is redundant here
2021-04-07 22:17:56 × fendor quits (~fendor@91.141.2.173.wireless.dyn.drei.com) (Remote host closed the connection)
2021-04-07 22:18:05 × heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-04-07 22:18:13 dwt joins (~dwt@c-98-200-58-177.hsd1.tx.comcast.net)
2021-04-07 22:18:21 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 265 seconds)
2021-04-07 22:18:34 <Althar> So in this instance, is it better practice to define the instance for the more abstract type, or is there a way for me to not make ResourceOpT a type synonym?
2021-04-07 22:20:02 <monochrom> Type synonym is pretended abstraction.
2021-04-07 22:20:34 arturh joins (~arturh@93.176.180.48)
2021-04-07 22:20:34 <monochrom> Hell, I'm be more frank and blunt. Type synonym is not making up one's mind whether it's an abstraction or not.
2021-04-07 22:21:11 <monochrom> OK, in fairness, some people just intend an abberviation, not an abstraction. That's fine.
2021-04-07 22:22:01 × coot quits (~coot@37.30.55.131.nat.umts.dynamic.t-mobile.pl) (Quit: coot)
2021-04-07 22:22:09 <Althar> it does mean that if I change ResourceOpT to be built from something else, my instance of StateT will no longer apply
2021-04-07 22:22:39 × mnrmnaugh quits (~mnrmnaugh@unaffiliated/mnrmnaugh) (Quit: Leaving)
2021-04-07 22:22:45 <Althar> I was hoping that by having instance of ResourceOpT, it would hold up, so long as the MonadIO constraint held
2021-04-07 22:23:26 <Althar> call it 'encapsulation' if you will (for lack of a better term)
2021-04-07 22:23:42 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-04-07 22:24:07 <monochrom> "encapsulation" is even falser.
2021-04-07 22:24:29 <monochrom> Type synonyms are completely transparent.
2021-04-07 22:24:42 mnrmnaugh joins (~mnrmnaugh@unaffiliated/mnrmnaugh)
2021-04-07 22:24:51 maiqthefalse joins (uid494950@gateway/web/irccloud.com/x-lubjogfdgluyqicn)
2021-04-07 22:25:02 <monochrom> Everything is exposed. Nothing is encapsulated.
2021-04-07 22:25:22 <Althar> Ok, so this works : 'instance (MonadIO m) => Logger ( ResourceOpT r m )'
2021-04-07 22:25:45 × arturh quits (~arturh@93.176.180.48) (Quit: Lost terminal)
2021-04-07 22:25:49 <Althar> With 'type ResourceOpT r = StateT (ResourceCache r)'
2021-04-07 22:26:00 <monochrom> If you have "type MyType = [Int]" and attempt "instance Show MyType", compiler says you're doing "instance Show [Int]", this overlaps with everything else left right and centre. Not an encapsulation at all.
2021-04-07 22:26:23 <fresheyeball> is there a way with cabal to have a common stanza in a file shared between cabal files?
2021-04-07 22:26:39 <fresheyeball> I have the same stanza copy pasta all over the place
2021-04-07 22:26:44 <sclv> nope
2021-04-07 22:26:50 <dcoutts_> Within a cabal file yes, but between cabal files no.
2021-04-07 22:27:01 <fresheyeball> well drat, I left hpack too soon
2021-04-07 22:27:18 <sclv> cabal files are part of package manifests. since you have one cabal file per sdist tarball it wouldn't make much sense
2021-04-07 22:27:34 <Althar> monochrom I get that, but what I didn't understand was that if they were synonymous, why it falls apart when I substitute the synonyms
2021-04-07 22:27:39 <sclv> you could share some things (but not deps directly) through a shared .project file
2021-04-07 22:27:43 <dcoutts_> And you can have multiple components (including multiple libs) in a single cabal file.
2021-04-07 22:28:19 <monochrom> What is an example of "falls apart when I substitute the synonyms"?
2021-04-07 22:28:23 <Althar> once I got rid of the redundant types from the type declaration as per your suggestion, the compiler is happy
2021-04-07 22:28:43 <Althar> 'type ResourceOpT r m a = StateT (ResourceCache r) m a'
2021-04-07 22:28:56 <monochrom> That's the "Type constructor symbols T introduced by type synonym declarations cannot be partially applied; it is a static error to use T without the full number of arguments." as said.
2021-04-07 22:29:06 × pfurla quits (~pfurla@ool-182ed2e2.dyn.optonline.net) (Ping timeout: 240 seconds)
2021-04-07 22:29:18 elliott_ joins (~elliott@pool-108-51-101-42.washdc.fios.verizon.net)
2021-04-07 22:29:24 × elliott_ quits (~elliott@pool-108-51-101-42.washdc.fios.verizon.net) (Client Quit)
2021-04-07 22:30:01 <Althar> Is it still a type synonym here ?
2021-04-07 22:30:06 elliott_ joins (~elliott@pool-108-51-101-42.washdc.fios.verizon.net)
2021-04-07 22:30:06 <monochrom> Yes.
2021-04-07 22:30:08 × elliott_ quits (~elliott@pool-108-51-101-42.washdc.fios.verizon.net) (Client Quit)
2021-04-07 22:30:08 <Althar> 'type ResourceOpT r = StateT (ResourceCache r)'
2021-04-07 22:30:12 <monochrom> Yes.
2021-04-07 22:30:17 <Althar> so why does it work in this case
2021-04-07 22:30:32 <Althar> I can do 'instance (MonadIO m) => Logger ( ResourceOpT r m )'
2021-04-07 22:31:15 <monochrom> It expands to "instance (MonadIO m) => Logger ( StateT (ResourceCache r) m)"

All times are in UTC.