Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,804,438 events total
2021-08-24 17:53:16 <cdsmith> Yikes! Hope your back gets better quickly
2021-08-24 17:54:13 <cdsmith> You definitely need two foralls if you want type-level explicit quantifiers. That's clear from the GHC user guide.
2021-08-24 17:54:30 <cdsmith> like: forall a. forall (x :: a). ...
2021-08-24 17:54:54 <cdsmith> But none of the user guide examples have a context for the RULE
2021-08-24 17:58:35 × wroathe quits (~wroathe@user/wroathe) (Ping timeout: 250 seconds)
2021-08-24 17:59:21 × enoq quits (~enoq@2a05:1141:1f5:5600:b9c9:721a:599:bfe7) (Quit: enoq)
2021-08-24 18:00:05 zer0bitz joins (~zer0bitz@dsl-hkibng31-58c384-213.dhcp.inet.fi)
2021-08-24 18:00:53 <cdsmith> Builds, but doesn't work: https://code.world/haskell#Pd4WZhPErm5DuwdYa4YzL8g
2021-08-24 18:01:55 gensyst joins (gensyst@user/gensyst)
2021-08-24 18:03:32 × mud quits (~mud@user/kadoban) (Remote host closed the connection)
2021-08-24 18:03:35 <gensyst> What's the way to stream a list to/from files? If the byte length of each element is not always same, how do you indicate a "separator"?
2021-08-24 18:04:23 smarton joins (~smarton@gnu/webmaster/smarton)
2021-08-24 18:04:36 × ec_ quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 244 seconds)
2021-08-24 18:04:50 <cdsmith> gensyst: There are several ways: lazy I/O is convenient for scripting, but not suitable for long-running programs. Libraries like conduit, pipes, and io-streams are better for long-running programs.
2021-08-24 18:05:40 <gensyst> cdsmith, yes that's what i actually meant by "list".. even with conduit, i still have the question how the data is read back into haskell
2021-08-24 18:06:03 <gensyst> How does "it" know where to separate?
2021-08-24 18:06:04 × Guest42 quits (~Guest42@adsl-72-50-7-6.prtc.net) (Ping timeout: 246 seconds)
2021-08-24 18:06:53 <gensyst> conduit just gets me bytestring chunks i presume
2021-08-24 18:07:12 <gensyst> (when reading a file)
2021-08-24 18:07:58 ubert joins (~Thunderbi@178.165.204.112.wireless.dyn.drei.com)
2021-08-24 18:08:59 × smarton quits (~smarton@gnu/webmaster/smarton) (Read error: Connection reset by peer)
2021-08-24 18:09:29 × eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:a8c1:f34:41fc:ef3d) (Remote host closed the connection)
2021-08-24 18:09:45 ec_ joins (~ec@gateway/tor-sasl/ec)
2021-08-24 18:10:17 smarton joins (~smarton@gnu/webmaster/smarton)
2021-08-24 18:12:41 × gentauro quits (~gentauro@user/gentauro) (Read error: Connection reset by peer)
2021-08-24 18:12:53 <cdsmith> Right. I also lets you unpush leftovers. So you can read a chunk, look for the next separator, and either emit an element downstream and then unpush the leftover, or else block to read more if you don't have a complete element
2021-08-24 18:13:12 <cdsmith> There may be combinators to make that sort of thing easier. I honestly am not knowledgable about conduit off-hand
2021-08-24 18:13:23 <cdsmith> Looking at docs now to see if there's something I see there
2021-08-24 18:15:23 × fef quits (~thedawn@user/thedawn) (Remote host closed the connection)
2021-08-24 18:15:58 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 252 seconds)
2021-08-24 18:17:07 × buggymcbugfix quits (~buggymcbu@p4fcaa0a6.dip0.t-ipconnect.de) (Ping timeout: 240 seconds)
2021-08-24 18:17:10 <carter> cdsmith: yeah I don’t think that other rule will ever run except in code in ghci
2021-08-24 18:17:23 eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:a8c1:f34:41fc:ef3d)
2021-08-24 18:18:11 gentauro joins (~gentauro@user/gentauro)
2021-08-24 18:18:34 doyougnu joins (~user@c-73-25-202-122.hsd1.or.comcast.net)
2021-08-24 18:19:35 <cdsmith> gensyst: Looks like takeExactlyUntilE might be your friend here if you want to take everything up to a field separator. Or line, if that field separator is \n
2021-08-24 18:19:35 × smarton quits (~smarton@gnu/webmaster/smarton) (Read error: Connection reset by peer)
2021-08-24 18:20:14 smarton joins (~smarton@gnu/webmaster/smarton)
2021-08-24 18:20:34 × wrengr_away quits (~wrengr@56.4.82.34.bc.googleusercontent.com) (Quit: leaving)
2021-08-24 18:20:45 <gensyst> cdsmith, ok so it all boils down to some sort of magic separators?
2021-08-24 18:20:50 <gensyst> (if byte length of each is not fixed)
2021-08-24 18:21:40 <cdsmith> Sure, that's one way to do it. Another would be to use some kind of parser. Depends on what your input data looks like. If you get to choose, then separating with \n and using linesUnbounded or something like that seems good.
2021-08-24 18:23:14 jakalx parts (~jakalx@base.jakalx.net) (Error from remote client)
2021-08-24 18:23:31 × cohn quits (~noone@user/cohn) (Quit: leaving)
2021-08-24 18:23:44 <gensyst> cdsmith, ah i think your "unpush leftovers" is the key. combined with "decodeExPortionWith" here: https://hackage.haskell.org/package/store-0.7.12/docs/Data-Store.html
2021-08-24 18:25:16 mud joins (~mud@user/kadoban)
2021-08-24 18:25:26 <cdsmith> gensyst: Yes, that will work. https://hackage.haskell.org/package/conduit-1.3.4.1/docs/Data-Conduit.html#v:leftover is how you unread the rest
2021-08-24 18:25:55 <gensyst> thanks!
2021-08-24 18:26:54 × maroloccio quits (~marolocci@37.100.40.252) (Quit: WeeChat 3.0)
2021-08-24 18:27:10 smarton parts (~smarton@gnu/webmaster/smarton) (Leaving)
2021-08-24 18:29:28 wrengr joins (~wrengr@56.72.82.34.bc.googleusercontent.com)
2021-08-24 18:30:03 <cdsmith> carter: Yeah, I think that required x to be polymorphic, which isn't what I want
2021-08-24 18:30:43 <cdsmith> So I'm back with https://code.world/haskell#PPy7SH19I_3Pu4KUz7s3K_g and no idea how to do the suggested fix
2021-08-24 18:31:33 delYsid joins (~user@84-115-55-45.cable.dynamic.surfer.at)
2021-08-24 18:33:34 × gensyst quits (gensyst@user/gensyst) (Quit: Leaving)
2021-08-24 18:34:34 PinealGlandOptic parts (~PinealGla@195.60.174.145) ()
2021-08-24 18:37:31 <carter> So …. I think it’s actually impossible in ghcs current rule engine to express what you want. It might be possible in a future ghc or a different system. Partly because type class constraints are only solved at type checking time, and this rule kinda creates a new type class dictionary pass through site that didn’t exist at the time of type checking. Because the rule that would introduce it hasn’t run till after type checking
2021-08-24 18:38:36 <carter> Like, you could imagine some sort of version of rules that sortah works backward to add those inference constraints. But I think the only fix you can do is add a show constraint to the parent
2021-08-24 18:38:47 <carter> cdsmith: wait! There’s a tool you can use
2021-08-24 18:38:53 <carter> That might do what you want
2021-08-24 18:39:45 <carter> https://github.com/well-typed/recover-rtti … would this work for you or does it need to run in ghcjs?
2021-08-24 18:40:23 <carter> In which case, we could just ffi bind an evil js print fucntion as a -> String and just use that ?
2021-08-24 18:41:02 <carter> Would
2021-08-24 18:41:05 <carter> That work?
2021-08-24 18:41:37 <cdsmith> I want this to work in as many places as possible. Found https://stackoverflow.com/questions/19745038/ghc-rewrite-rule-specialising-a-function-for-a-type-class, which points to https://hackage.haskell.org/package/ifcxt, which is bitrotted but looks easy to understand and reproduce in HMock
2021-08-24 18:42:08 <cdsmith> So I think that solves it (as well as explaining why RULES aren't viable, just as you did)
2021-08-24 18:43:03 <carter> Ohhh the bit about not being in a type class?
2021-08-24 18:43:16 <carter> I don’t think that’s even the issue, though it’s related
2021-08-24 18:44:12 <carter> Hrmmm. Yeah this gets into needing something like multimethods for runtime attempts to work
2021-08-24 18:44:50 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-24 18:45:10 Vajb joins (~Vajb@hag-jnsbng11-58c3ab-85.dhcp.inet.fi)
2021-08-24 18:46:43 lavaman joins (~lavaman@98.38.249.169)
2021-08-24 18:46:58 × ec_ quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 244 seconds)
2021-08-24 18:47:08 _crazygirl joins (~hola@213.94.16.140)
2021-08-24 18:48:03 oxide joins (~lambda@user/oxide)
2021-08-24 18:48:25 × _crazygirl quits (~hola@213.94.16.140) (Killed (ozone (No Spam)))
2021-08-24 18:52:44 × remedan quits (~remedan@balak.me) (Quit: Bye!)
2021-08-24 18:54:30 ec_ joins (~ec@gateway/tor-sasl/ec)
2021-08-24 18:57:28 Sinbad joins (~Sinbad@user/sinbad)
2021-08-24 18:57:40 jakalx joins (~jakalx@base.jakalx.net)
2021-08-24 19:01:29 remedan joins (~remedan@balak.me)
2021-08-24 19:04:16 × doyougnu quits (~user@c-73-25-202-122.hsd1.or.comcast.net) (Remote host closed the connection)
2021-08-24 19:05:19 × mei quits (~mei@user/mei) (Ping timeout: 250 seconds)
2021-08-24 19:05:46 × Lycurgus quits (~juan@cpe-45-46-140-49.buffalo.res.rr.com) (Quit: Exeunt)
2021-08-24 19:07:10 jumper149 joins (~jumper149@80.240.31.34)
2021-08-24 19:07:50 buggymcbugfix joins (~buggymcbu@p4fcaa0a6.dip0.t-ipconnect.de)
2021-08-24 19:08:06 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2021-08-24 19:11:31 × cuz quits (~user@38.140.58.234) (Ping timeout: 252 seconds)
2021-08-24 19:12:27 × buggymcbugfix quits (~buggymcbu@p4fcaa0a6.dip0.t-ipconnect.de) (Ping timeout: 240 seconds)
2021-08-24 19:14:44 × mc47 quits (~mc47@xmonad/TheMC47) (Remote host closed the connection)
2021-08-24 19:17:58 d0ku joins (~d0ku@178.43.56.75.ipv4.supernova.orange.pl)
2021-08-24 19:18:47 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
2021-08-24 19:22:26 × eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:a8c1:f34:41fc:ef3d) (Remote host closed the connection)
2021-08-24 19:23:25 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-08-24 19:23:25 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Changing host)
2021-08-24 19:23:25 wroathe joins (~wroathe@user/wroathe)
2021-08-24 19:24:02 mniip_ is now known as mniip
2021-08-24 19:26:27 cuz joins (~user@38.140.58.234)
2021-08-24 19:29:16 Erutuon joins (~Erutuon@user/erutuon)
2021-08-24 19:29:41 maroloccio joins (~marolocci@37.100.40.252)

All times are in UTC.