Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-17 12:21:54 × plutoniix quits (~q@175.176.222.7) (Quit: Leaving)
2020-11-17 12:22:20 lahwran joins (~lahwran@185.163.110.116)
2020-11-17 12:23:50 <merijn> kuribas: My strategy is, convert old data to latest format on input and write code only against the latest format
2020-11-17 12:24:16 <merijn> kuribas: The problem becomes limited to 1) detecting old input formats and 2) writing conversion logic
2020-11-17 12:24:49 <kuribas> merijn: we have the opposite problem. When we do computations, we should not use new computations on old data, only new data.
2020-11-17 12:25:15 <kuribas> merijn: because otherwise the customer will be surprised their data changed.
2020-11-17 12:25:27 × lahwran quits (~lahwran@185.163.110.116) (Remote host closed the connection)
2020-11-17 12:25:38 <kuribas> so I want some versioning system where I can pass the version number to the computation, and it picks the right version.
2020-11-17 12:25:45 <merijn> That's the same problem, except you can skip conversion forwards :p
2020-11-17 12:26:03 <kuribas> and the compotation is a GADT describing what needs to be done (and can be serialized to disk).
2020-11-17 12:26:38 sphalerite is now known as LinuxHackerman
2020-11-17 12:26:51 LinuxHackerman is now known as sphalerite
2020-11-17 12:27:02 <kuribas> merijn: you mean, convert to the latest format, but have custom logic for each version?
2020-11-17 12:27:30 <kuribas> I wonder how to make it manageable...
2020-11-17 12:28:05 <lortabac> kuribas: you need a way to convert from any version to the latest one
2020-11-17 12:28:06 <opqdonut> that's the question various sql migration libraries have been trying to answer for ages
2020-11-17 12:28:10 <dminuoso> 13:23:50 merijn | kuribas: My strategy is, convert old data to latest format on input and write code only against the latest format
2020-11-17 12:28:12 <dminuoso> 13:24:49 kuribas | merijn: we have the opposite problem. When we do computations, we should not use new computations on old data, only new data.
2020-11-17 12:28:14 <dminuoso> How is that opposite?
2020-11-17 12:28:20 <dminuoso> It sounds *exactly* like whe merijn suggests
2020-11-17 12:28:45 <opqdonut> keeping around rich enough test data for all those conversions is the hard part in my experience
2020-11-17 12:28:52 <kuribas> dminuoso: because the old logic should remain exactly the same
2020-11-17 12:28:53 <opqdonut> the slow code bloat in itself isn't that bad
2020-11-17 12:29:39 <kuribas> dminuoso: it's not new logic against old data, it's old logic against new data.
2020-11-17 12:29:55 <lortabac> kuribas: if you only add and remove fields (never modify) it is more manageable
2020-11-17 12:30:03 <dminuoso> opqdonut: I dont think its that complex of a problem. We just maintain a list `[Migration]` where `data Migration = Migration { migVersion :: Integer, migQuery :: Connection -> IO () }`, imho most "migration libraries" are just overengineered solutions because people seem to be afraid to write 5 lines of code for themselves.
2020-11-17 12:30:48 <kuribas> lortabac: that's a way of course. If I modify a function, represented by SomeFun in the GADT, I could make a new one SomeFunV2 when I modify SomeFun.
2020-11-17 12:30:56 idhugo joins (~idhugo@80-62-116-101-mobile.dk.customer.tdc.net)
2020-11-17 12:32:28 <lortabac> kuribas: most of the time when you add a new field the conversion function will simply provide some default value (ex. Nothing) on the fields that were missing
2020-11-17 12:32:46 <opqdonut> dminuoso: I agree
2020-11-17 12:33:40 Guest92179 joins (~ericb2@185.204.1.185)
2020-11-17 12:34:06 <lortabac> then you have to ensure that the new logic does not do anything new when that field has the default value
2020-11-17 12:34:15 <merijn> kuribas: That just means you need a "Map Version YourComputation" and do a lookup
2020-11-17 12:34:52 <merijn> kuribas: I wouldn't bother with fancy polymorphic solutions, just keep a copy of each old version in a separate module and call as appropriate
2020-11-17 12:35:07 <kuribas> merijn: or just compute :: Version -> ComputationExpression -> Result
2020-11-17 12:35:53 <merijn> Either way, although having a data structure might be more convenient to keep up to date
2020-11-17 12:36:00 hackage hmatrix 0.20.1 - Numeric Linear Algebra https://hackage.haskell.org/package/hmatrix-0.20.1 (DominicSteinitz)
2020-11-17 12:36:12 <merijn> kuribas: https://github.com/merijn/Belewitte/tree/master/benchmark-analysis/src/Schema/Model
2020-11-17 12:36:15 <merijn> kuribas: https://github.com/merijn/Belewitte/blob/master/benchmark-analysis/src/Schema/Model.hs#L71-L215
2020-11-17 12:36:50 <merijn> kuribas: You can skip the data migration and instead dispatch
2020-11-17 12:36:51 <kuribas> merijn: right, I could import the functions that haven't changed from the previous version...
2020-11-17 12:37:18 <merijn> kuribas: Whenever I change the schema, I copy the old schema into a new V<n> module and import it qualified, then call it
2020-11-17 12:37:41 <merijn> You get a lot of modules, but maintenance is a breeze (i.e. there is none :p)
2020-11-17 12:38:11 <kuribas> the only worry I have is that you'ld need to dig through different versions of the module to find the implementation...
2020-11-17 12:38:49 × danvet_ quits (~danvet@2a02:168:57f4:0:5f80:650d:c6e6:3453) (Quit: Leaving)
2020-11-17 12:39:14 <kuribas> for example I have sumNumbers :: [Double] -> Double which hasn't changed from V3 through V1, then I would need to look in V3, then V2, then V1...
2020-11-17 12:39:37 <kuribas> well I guess emacs or vscode where to find it...
2020-11-17 12:39:50 Amras joins (~Amras@unaffiliated/amras0000)
2020-11-17 12:39:58 <kuribas> merijn: alright, I'll give it a try :)
2020-11-17 12:41:40 mputz joins (~Thunderbi@dslb-084-058-211-084.084.058.pools.vodafone-ip.de)
2020-11-17 12:43:59 <Axman6> kuribas: have you seen what acid-state/the library it uses does?
2020-11-17 12:44:02 × Ariakenom quits (~Ariakenom@h-158-174-22-49.NA.cust.bahnhof.se) (Ping timeout: 260 seconds)
2020-11-17 12:44:04 × mputz quits (~Thunderbi@dslb-084-058-211-084.084.058.pools.vodafone-ip.de) (Client Quit)
2020-11-17 12:44:54 Ariakenom joins (~Ariakenom@h-98-128-229-104.NA.cust.bahnhof.se)
2020-11-17 12:46:32 heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net)
2020-11-17 12:47:55 <kuribas> Axman6: yes, some time ago, I don't remember it that well.
2020-11-17 12:47:59 <kuribas> but I prefer a simple solution
2020-11-17 12:49:46 <merijn> safe-copy
2020-11-17 12:50:05 <merijn> Axman6: But that's basically the same scheme I proposed, but with TH
2020-11-17 12:50:56 × heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds)
2020-11-17 12:56:18 <kuribas> I prefer boring haskell :)
2020-11-17 12:57:03 Lord_of_Life_ is now known as Lord_of_Life
2020-11-17 12:57:43 × raichoo quits (~raichoo@213.240.178.58) (Read error: Connection reset by peer)
2020-11-17 12:58:17 da39a3ee5e6b4b0d joins (~da39a3ee5@cm-171-98-79-192.revip7.asianet.co.th)
2020-11-17 12:59:09 × xff0x quits (~fox@2001:1a81:52d5:6a00:633e:9aec:a495:3349) (Ping timeout: 272 seconds)
2020-11-17 12:59:54 xff0x joins (~fox@2001:1a81:52d5:6a00:7dc4:a65f:e69e:5679)
2020-11-17 12:59:59 raichoo joins (~raichoo@213.240.178.58)
2020-11-17 13:00:34 <aplainzetakind> What do I need to do to make a local library available to a v2-style build environment (specifically asking for xmonad-contrib to build xmonad from the repo).
2020-11-17 13:01:38 <merijn> aplainzetakind: As in you have package A and B both locally, with A depending on the local copy of B?
2020-11-17 13:02:11 <aplainzetakind> Yes.
2020-11-17 13:02:33 <merijn> You'll want a cabal.project/cabal.project.local file
2020-11-17 13:02:35 <merijn> aplainzetakind: https://cabal.readthedocs.io/en/latest/nix-local-build.html#local-versus-external-packages
2020-11-17 13:02:37 <__monty__> aplainzetakind: I think you'll want to add a package stanza in cabal.project.
2020-11-17 13:02:45 texasmynsted joins (~texasmyns@212.102.45.118)
2020-11-17 13:02:55 <aplainzetakind> Thanks.
2020-11-17 13:02:56 <merijn> https://cabal.readthedocs.io/en/latest/cabal-project.html#specifying-the-local-packages
2020-11-17 13:04:30 urodna joins (~urodna@unaffiliated/urodna)
2020-11-17 13:05:39 FreeBirdLjj joins (~freebirdl@101.228.42.108)
2020-11-17 13:05:40 nbloomf joins (~nbloomf@2600:1700:ad14:3020:5d4c:3718:c0a8:9f94)
2020-11-17 13:06:19 × _noblegas quits (uid91066@gateway/web/irccloud.com/x-urdkltrndaedsfvo) (Quit: Connection closed for inactivity)
2020-11-17 13:08:53 × Rudd0 quits (~Rudd0@185.189.115.108) (Ping timeout: 265 seconds)
2020-11-17 13:09:07 × raichoo quits (~raichoo@213.240.178.58) (Read error: Connection reset by peer)
2020-11-17 13:09:21 raichoo joins (~raichoo@213.240.178.58)
2020-11-17 13:10:52 m0b10s joins (53dff9cb@gateway/web/cgi-irc/kiwiirc.com/ip.83.223.249.203)
2020-11-17 13:12:45 × supercoven quits (~Supercove@dsl-hkibng31-54fae2-107.dhcp.inet.fi) (Ping timeout: 240 seconds)
2020-11-17 13:14:11 <m0b10s> Hi, just one question, if i have a tuple and i need to take one element “index i” but i have difrent types on the tuple, is it possible to take the element índex x with just one function?
2020-11-17 13:19:18 <p0a> m0b10s: It should be, tuples don't need to have the same type
2020-11-17 13:19:25 × idhugo quits (~idhugo@80-62-116-101-mobile.dk.customer.tdc.net) (Ping timeout: 272 seconds)
2020-11-17 13:19:48 <p0a> m0b10s: for example, fst (1, 'a') ==> 1
2020-11-17 13:20:11 <merijn> No, I think he wants a numerical indexing to extract from a tuple
2020-11-17 13:20:19 <merijn> And the answer is "no, you can't write that"
2020-11-17 13:20:35 <hc> I think you can, with 'hacks'...
2020-11-17 13:20:35 <merijn> At least, not without a bunch of super ugly nightmarish extensions and mess
2020-11-17 13:20:52 <hc> like fun :: Int -> Tuple -> Maybe a
2020-11-17 13:21:05 <hc> where fun returns either a Just a or Nothing if the types don't match
2020-11-17 13:22:12 <dminuoso> % (1, 'a') ^. _2
2020-11-17 13:22:13 <yahb> dminuoso: 'a'
2020-11-17 13:22:14 × m0b10s quits (53dff9cb@gateway/web/cgi-irc/kiwiirc.com/ip.83.223.249.203) (Quit: Connection closed)
2020-11-17 13:22:19 <dminuoso> % (1, 123, "foobar") ^. _2
2020-11-17 13:22:19 <yahb> dminuoso: 123

All times are in UTC.