Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-05-18 18:13:37 × nut quits (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Ping timeout: 252 seconds)
2021-05-18 18:14:10 × ddellaco_ quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Ping timeout: 252 seconds)
2021-05-18 18:14:34 ddellacosta joins (~ddellacos@ool-44c73afa.dyn.optonline.net)
2021-05-18 18:15:35 Sheilong joins (uid293653@gateway/web/irccloud.com/x-yvifpnpfisssiqhx)
2021-05-18 18:19:02 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-05-18 18:23:25 justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311)
2021-05-18 18:23:57 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 260 seconds)
2021-05-18 18:24:27 <dminuoso> altern: writeBlob demands that whatever monad you run in, has a way of safely allocating/deallocating resources - that behavior is described by the typeclass MonadResource. So if you want to use writeBlob, you can only do this in any monad that has an instance MonadResource. The only standard way to obtain such a monad, is to apply ResourceT to whatever monad you have.
2021-05-18 18:24:31 stree joins (~stree@68.36.8.116)
2021-05-18 18:24:43 <dminuoso> And then write your code in terms of that monad.
2021-05-18 18:24:50 <altern> dminuoso, if I write runResourceT $ writeBlob (BS.unpack path) (BlobString $ BS.pack content)
2021-05-18 18:24:50 <altern> I get No instance for (Git.Libgit2.HasLgRepo
2021-05-18 18:24:50 <altern> (ResourceT (ReaderT LgRepo IO)))
2021-05-18 18:24:54 × rajivr quits (uid269651@gateway/web/irccloud.com/x-goyypkkhhsgxwnjf) (Quit: Connection closed for inactivity)
2021-05-18 18:25:25 <dminuoso> No rather
2021-05-18 18:25:27 <dminuoso> addFileToRepository :: TreeFilePath -> String -> CommitMessage -> ReaderT LgRepo IO ()
2021-05-18 18:25:29 <dminuoso> This should become
2021-05-18 18:25:41 × boxscape quits (4ff0bb95@p4ff0bb95.dip0.t-ipconnect.de) (Quit: Connection closed)
2021-05-18 18:25:50 <dminuoso> addFileToRepository :: TreeFilePath -> String -> CommitMessage -> ReaderT LgRepo (ResourceT IO) ()
2021-05-18 18:26:22 <dminuoso> (And then, you might want to replace your `lift` with just `liftIO`, so you dont have to do `lift (lift ...)`)
2021-05-18 18:26:35 × ddellacosta quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Remote host closed the connection)
2021-05-18 18:26:38 <dminuoso> Then instead of
2021-05-18 18:26:41 <dminuoso> runReaderT (addFileToRepository "content4.txt" "content4" "added content4 file") repo
2021-05-18 18:27:24 <dminuoso> runReaderT (runResourceT (addFileToRepository "content4.txt" "content4" "added content4 file")) repo
2021-05-18 18:27:39 <altern> dminuoso, how about all the rest monadic calls that I have in this do section?
2021-05-18 18:27:49 <dminuoso> It should all work out
2021-05-18 18:28:06 <dminuoso> There might be some line I missed, but you can lift through that too
2021-05-18 18:28:21 <dminuoso> all the gitlib code is written mtl-style, so that needs no touching
2021-05-18 18:28:35 × DavidEichmann quits (~david@156.59.147.147.dyn.plus.net) (Remote host closed the connection)
2021-05-18 18:28:40 <dminuoso> just the `lift` (for future, just always use liftIO if you want to lift IO stuff, that way you dont have to worry if you add more layers to your monad transformer stack)
2021-05-18 18:30:26 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 260 seconds)
2021-05-18 18:30:46 × deviantfero quits (~deviantfe@190.150.27.58) (Ping timeout: 240 seconds)
2021-05-18 18:32:52 <altern> dminuoso, I got it working! the only difference in my code with what you said is the order of transformers: runResourceT (runReaderT (addFileToRepository "content4.txt" "content4" "added content4 file") repo)
2021-05-18 18:33:04 epicte7us joins (~epictetus@ip72-194-54-201.sb.sd.cox.net)
2021-05-18 18:35:16 <dminuoso> Oh, yeah my bad.
2021-05-18 18:36:13 <altern> dminuoso, now the problem is that file does not get committed at all even to staging area..
2021-05-18 18:36:30 <altern> probably I chased writeBlob in vain
2021-05-18 18:36:33 × ep1ctetus_ quits (~epictetus@ip72-194-54-201.sb.sd.cox.net) (Ping timeout: 260 seconds)
2021-05-18 18:36:48 <altern> it does not make a difference whether I use it
2021-05-18 18:37:12 ozzymcduff joins (~mathieu@81-234-151-21-no94.tbcn.telia.com)
2021-05-18 18:42:38 <dminuoso> Mmm, from the looks of it, git_index_add is nowhere used in the entire library.
2021-05-18 18:42:51 <altern> yes
2021-05-18 18:43:05 <altern> I could not find it either
2021-05-18 18:43:14 ubert joins (~Thunderbi@p200300ecdf259daae6b318fffe838f33.dip0.t-ipconnect.de)
2021-05-18 18:44:06 <dminuoso> Ah hold on
2021-05-18 18:44:19 <dminuoso> Was looking the wrong way, I think I have a clue how this works
2021-05-18 18:45:12 jacks2 joins (~bc817c21@217.29.117.252)
2021-05-18 18:45:18 × qwerty2o_ quits (~qwerty2o@89-138-23-24.bb.netvision.net.il) (Ping timeout: 268 seconds)
2021-05-18 18:45:30 bitmagie joins (~Thunderbi@200116b8065d270045c75b2c90c4988b.dip.versatel-1u1.de)
2021-05-18 18:45:37 ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta)
2021-05-18 18:45:40 × bitmagie quits (~Thunderbi@200116b8065d270045c75b2c90c4988b.dip.versatel-1u1.de) (Client Quit)
2021-05-18 18:46:29 × tromp quits (~tromp@dhcp-077-249-230-040.chello.nl) (Remote host closed the connection)
2021-05-18 18:47:13 × DTZUZU_ quits (~DTZUZO@205.ip-149-56-132.net) (Ping timeout: 240 seconds)
2021-05-18 18:48:04 chris___ joins (~chris@81.96.113.213)
2021-05-18 18:50:10 × ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 265 seconds)
2021-05-18 18:50:14 × justsomeguy quits (~justsomeg@unaffiliated/--/x-3805311) (Ping timeout: 268 seconds)
2021-05-18 18:51:35 <dminuoso> altern: It looks as if writeIndex was not implemented by any of the backends.
2021-05-18 18:52:27 × cub3s_ quits (bifunc2@gateway/vpn/protonvpn/bifunc2) (Quit: Leaving)
2021-05-18 18:53:32 <altern> dminuoso, maybe Git.Tree.Builder package functions would help..
2021-05-18 18:53:48 <altern> there are putEntry, putBlob and so on
2021-05-18 18:54:00 <altern> but I tried it, it does not really help
2021-05-18 18:54:08 ddellacosta joins (~ddellacos@ool-44c73afa.dyn.optonline.net)
2021-05-18 18:54:53 qwerty2o_ joins (~qwerty2o@89-138-23-24.bb.netvision.net.il)
2021-05-18 18:55:11 DTZUZU_ joins (~DTZUZO@205.ip-149-56-132.net)
2021-05-18 18:55:23 LKoen joins (~LKoen@2a01cb0407597a00e9242d9eac3f1601.ipv6.abo.wanadoo.fr)
2021-05-18 18:55:27 justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311)
2021-05-18 18:55:37 kritzefitz joins (~kritzefit@212.86.56.80)
2021-05-18 18:55:48 <dminuoso> altern: Well, presumably for completely automatic interaction, you dont even need the staging area?
2021-05-18 18:55:49 × DTZUZU_ quits (~DTZUZO@205.ip-149-56-132.net) (Read error: Connection reset by peer)
2021-05-18 18:56:07 DTZUZU_ joins (~DTZUZO@205.ip-149-56-132.net)
2021-05-18 18:56:08 <altern> dminuoso, no, not really
2021-05-18 18:56:11 <dminuoso> writeIndex would, presumably, just turn the index into a tree object (e.g. like git-write-tree)
2021-05-18 18:56:31 tromp joins (~tromp@dhcp-077-249-230-040.chello.nl)
2021-05-18 18:57:02 <dminuoso> so just create the tree objects yourself?
2021-05-18 18:57:28 <altern> I do this in newOid <- createTree $ putEntry path BlobEntry {blobEntryKind = PlainBlob, blobEntryOid = blobOid}
2021-05-18 18:59:20 <dminuoso> altern: https://github.com/jwiegley/hsubconvert/blob/master/Main.hs
2021-05-18 18:59:32 <dminuoso> This source code displays usage of gitlib
2021-05-18 19:00:47 × sqrt2 quits (~ben@unaffiliated/sqrt2) (Ping timeout: 260 seconds)
2021-05-18 19:00:53 sqrt2_ joins (~ben@unaffiliated/sqrt2)
2021-05-18 19:01:11 <dminuoso> https://github.com/jwiegley/gitlib/blob/master/gitlib-test/Git/Smoke.hs might also be useful
2021-05-18 19:01:24 <dminuoso> The latter is probably easier to look at
2021-05-18 19:01:32 <dminuoso> https://github.com/jwiegley/gitlib/blob/master/gitlib-test/Git/Smoke.hs#L106-L129
2021-05-18 19:02:46 cub3s_ joins (bifunc2@gateway/vpn/protonvpn/bifunc2)
2021-05-18 19:02:48 <cub3s_> Typeclass question: Vector (vector package) has a Store (store package) instance (and this instance is in the store package). Sized vectors (from vector-sized package), which are just wrappers around Vector but with a size tagged in the type, have no Store instance in either package.
2021-05-18 19:03:44 × ericsagn1 quits (~ericsagne@2405:6580:0:5100:dcc7:3c52:3009:4cfd) (Ping timeout: 245 seconds)
2021-05-18 19:03:50 <cub3s_> What are some good ways to introduce a Store instance for sized vectors to the ecosystem? (I know I can create my own newtype wrapper for my own code, but if I want to put it on hackage, into which package should it go? Should it go into a new package?)
2021-05-18 19:04:55 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-05-18 19:05:35 deviantfero joins (~deviantfe@190.150.27.58)
2021-05-18 19:08:21 <altern> dminuoso, I do not see what I am doing differently
2021-05-18 19:08:35 <altern> from the approach in Smoke.hs
2021-05-18 19:09:21 <dminuoso> cub3s_: Mmm, what about https://hackage.haskell.org/package/vector-sized-1.4.3.1/docs/Data-Vector-Storable-Sized.html ?
2021-05-18 19:11:28 Deide joins (~Deide@217.155.19.23)
2021-05-18 19:11:53 × stree quits (~stree@68.36.8.116) (Quit: Caught exception)
2021-05-18 19:11:55 × CrazyPython quits (~crazypyth@206.214.238.6) (Ping timeout: 252 seconds)
2021-05-18 19:12:18 stree joins (~stree@68.36.8.116)
2021-05-18 19:12:43 Qwerky joins (~qwerky@178.197.228.14)
2021-05-18 19:12:56 × justsomeguy quits (~justsomeg@unaffiliated/--/x-3805311) (Quit: WeeChat 3.0.1)
2021-05-18 19:14:21 TK__ joins (~cinch@2601:1c0:5201:2100:9992:f75f:4988:2a3c)
2021-05-18 19:15:09 × jpds quits (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 240 seconds)
2021-05-18 19:16:34 ericsagn1 joins (~ericsagne@2405:6580:0:5100:7767:3034:663c:8014)

All times are in UTC.