Logs: liberachat/#haskell
| 2021-06-22 10:27:33 | × | Alex_test quits (~al_test@178.34.160.156) (Ping timeout: 258 seconds) |
| 2021-06-22 10:27:56 | × | AlexZenon quits (~alzenon@178.34.160.156) (Ping timeout: 258 seconds) |
| 2021-06-22 10:28:00 | <Las[m]> | I have a C library I'm using with that isn't thread-safe, so I was thinking of restricting all interaction with it to one bound thread. Are there any common approaches for this? I was thinking I could perhaps somehow send over the IO actions I want to perform through some channel-like thing and then get the result back after performing it in the other thread. |
| 2021-06-22 10:28:01 | → | teaSlurper joins (~chris@81.96.113.213) |
| 2021-06-22 10:28:18 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:e846:fcb5:a54b:afb8) (Ping timeout: 240 seconds) |
| 2021-06-22 10:28:53 | → | fizbin joins (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) |
| 2021-06-22 10:29:32 | × | AlexNoo quits (~AlexNoo@178.34.160.156) (Ping timeout: 265 seconds) |
| 2021-06-22 10:30:16 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-06-22 10:30:37 | → | Morrow joins (~MorrowM_@147.161.8.246) |
| 2021-06-22 10:31:15 | × | killsushi_ quits (~killsushi@user/killsushi/x-5912268) (Quit: Leaving) |
| 2021-06-22 10:32:45 | × | teaSlurper quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2021-06-22 10:33:25 | → | teaSlurper joins (~chris@81.96.113.213) |
| 2021-06-22 10:33:31 | × | lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-06-22 10:35:16 | → | Meh joins (~Meh@202.14.120.214) |
| 2021-06-22 10:35:40 | Meh | is now known as Guest4839 |
| 2021-06-22 10:35:44 | → | pbrisbin joins (~patrick@pool-173-49-147-28.phlapa.fios.verizon.net) |
| 2021-06-22 10:36:19 | × | Guest4839 quits (~Meh@202.14.120.214) (Client Quit) |
| 2021-06-22 10:37:54 | × | teaSlurper quits (~chris@81.96.113.213) (Ping timeout: 258 seconds) |
| 2021-06-22 10:45:55 | → | zyklotomic joins (~ethan@2604:a880:800:10::79f:8001) |
| 2021-06-22 10:46:13 | <zyklotomic> | is there syntax sugar for declaring instances for multiple types in one line? |
| 2021-06-22 10:46:40 | <zyklotomic> | instead of having to do instance Eq TypeA, newline, instance Eq TypeB |
| 2021-06-22 10:46:50 | <merijn> | I don't think there is |
| 2021-06-22 10:46:52 | <zyklotomic> | can I like do instance Eq TypeA typeB in one go |
| 2021-06-22 10:46:57 | <zyklotomic> | ah i see, just checking, thanks |
| 2021-06-22 10:47:01 | → | mikail_ joins (~mikail@2a02:c7f:bc9c:3100:ae93:93fc:603f:ceaf) |
| 2021-06-22 10:47:04 | <merijn> | tbh, I've never really had so many types to define instance on that it was relevant |
| 2021-06-22 10:47:35 | <zyklotomic> | yeah it isnt' super necessary, thought it might just potentially make it cleaner |
| 2021-06-22 10:47:40 | <merijn> | zyklotomic: If you have an empty isntance declaration you could just tag it onto the type definitiin via deriving, no? |
| 2021-06-22 10:48:40 | <tomsmeding> | Las[m]: you may be interested in http://www.vex.net/~trebla/haskell/ghc-conc-ffi.xhtml |
| 2021-06-22 10:48:53 | × | xff0x quits (~xff0x@2001:1a81:5218:4800:8168:2dc2:e054:da2) (Ping timeout: 252 seconds) |
| 2021-06-22 10:49:20 | <zyklotomic> | i'm not entirely sure, not all typeclasses though |
| 2021-06-22 10:49:25 | → | xff0x joins (~xff0x@2001:1a81:5218:4800:1515:545a:1239:1833) |
| 2021-06-22 10:49:50 | <zyklotomic> | merijn: like, iirc, there is an AnyTypeDeriving extension, forgot the exact name |
| 2021-06-22 10:50:41 | <zyklotomic> | maybe i'm not understanding correctly, am noob |
| 2021-06-22 10:51:16 | → | kayprish joins (~kayprish@46.240.143.86) |
| 2021-06-22 10:51:42 | <zyklotomic> | -XGeneralizedNewTypeDeriving i think |
| 2021-06-22 10:52:13 | <lortabac> | zyklotomic: there is DeriveAnyClass, but it goes in the opposite sense: you can derive multiple classes for a single type |
| 2021-06-22 10:53:11 | <lortabac> | also, that extension can be confusing (unless you specify the strategy explicitly with DerivingStrategies) |
| 2021-06-22 10:53:16 | → | mnrmnaugh joins (~mnrmnaugh@pool-96-252-87-182.bstnma.fios.verizon.net) |
| 2021-06-22 10:53:35 | <zyklotomic> | you mean GenearilezdNewTypeDeriving? |
| 2021-06-22 10:53:44 | <zyklotomic> | by "that extension" |
| 2021-06-22 10:53:50 | <lortabac> | DeriveAnyClass |
| 2021-06-22 10:53:56 | <zyklotomic> | ah ok |
| 2021-06-22 10:54:55 | <zyklotomic> | lortabac, merijn: thanks, the both of you, for your input |
| 2021-06-22 10:55:53 | <zyklotomic> | the confusing part makes sense yes, because otherwise it feels too auto-magical |
| 2021-06-22 11:00:11 | → | teaSlurper joins (~chris@81.96.113.213) |
| 2021-06-22 11:00:52 | × | gehmehgeh quits (~user@user/gehmehgeh) (Quit: Leaving) |
| 2021-06-22 11:03:36 | <Las[m]> | tomsmeding: Thanks! This looks like a nice resouce |
| 2021-06-22 11:03:36 | <Las[m]> | resource* |
| 2021-06-22 11:04:18 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-06-22 11:04:20 | <tomsmeding> | written by an active member of this channel :) |
| 2021-06-22 11:05:44 | × | fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Remote host closed the connection) |
| 2021-06-22 11:06:59 | <Cale> | zyklotomic: If it really got serious, it'd be possible to generate a lot of instances like that using TemplateHaskell (but you probably want more than a few) |
| 2021-06-22 11:07:14 | × | pbrisbin quits (~patrick@pool-173-49-147-28.phlapa.fios.verizon.net) (Ping timeout: 265 seconds) |
| 2021-06-22 11:08:00 | → | stevenxl joins (~stevenlei@174.128.182.215) |
| 2021-06-22 11:08:38 | × | ubert quits (~Thunderbi@2a02:8109:9880:303c:ca5b:76ff:fe29:f233) (Quit: ubert) |
| 2021-06-22 11:08:42 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 252 seconds) |
| 2021-06-22 11:08:55 | <zyklotomic> | Cale: have never dabbled in TemplateHaskell before lol, but yeah my use case right now definitely doesnt justify it |
| 2021-06-22 11:11:01 | → | chddr joins (~Thunderbi@31.148.23.125) |
| 2021-06-22 11:11:52 | × | teaSlurper quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2021-06-22 11:15:12 | → | biggs joins (~biggs@host-80-43-81-131.as13285.net) |
| 2021-06-22 11:17:48 | → | fizbin joins (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) |
| 2021-06-22 11:22:13 | × | fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Ping timeout: 265 seconds) |
| 2021-06-22 11:22:26 | → | machinedgod joins (~machinedg@135-23-192-217.cpe.pppoe.ca) |
| 2021-06-22 11:22:39 | × | Codaraxis quits (~Codaraxis@user/codaraxis) (Read error: Connection reset by peer) |
| 2021-06-22 11:22:59 | → | Codaraxis joins (~Codaraxis@user/codaraxis) |
| 2021-06-22 11:25:16 | × | fef quits (~thedawn@user/thedawn) (Ping timeout: 244 seconds) |
| 2021-06-22 11:26:28 | × | Scotty_Trees quits (~Scotty_Tr@162-234-179-169.lightspeed.brhmal.sbcglobal.net) (Remote host closed the connection) |
| 2021-06-22 11:27:07 | → | hseg joins (~gesh@185.120.126.29) |
| 2021-06-22 11:27:47 | × | biggs quits (~biggs@host-80-43-81-131.as13285.net) (Quit: Client closed) |
| 2021-06-22 11:28:08 | <hseg> | Hi. Am trying to construct a list, and have the entire expression be an empty list if any of the preconditions fail |
| 2021-06-22 11:28:19 | <hseg> | have written two ways: http://ix.io/3qJM |
| 2021-06-22 11:28:31 | <hseg> | but neither is aesthetically appealing |
| 2021-06-22 11:29:48 | <hseg> | (especially considering these lists occur in an expression context, so I'd have tm:tm':complicated_term:... |
| 2021-06-22 11:30:20 | × | involans quits (~alex@cpc92718-cmbg20-2-0-cust157.5-4.cable.virginm.net) (Ping timeout: 252 seconds) |
| 2021-06-22 11:30:24 | × | unyu quits (~pyon@user/pyon) (Quit: WeeChat 3.2) |
| 2021-06-22 11:31:15 | <Las[m]> | tomsmeding: this is a nice resource, but it doesn't describe a way of executing an `IO a` in a specific OS thread, which is what I want |
| 2021-06-22 11:31:31 | <Las[m]> | since I want to provide a safe abstraction over the library |
| 2021-06-22 11:32:47 | × | trcc quits (~trcc@2-104-60-169-cable.dk.customer.tdc.net) () |
| 2021-06-22 11:33:00 | → | trcc joins (~trcc@2-104-60-169-cable.dk.customer.tdc.net) |
| 2021-06-22 11:33:55 | × | trcc quits (~trcc@2-104-60-169-cable.dk.customer.tdc.net) (Client Quit) |
| 2021-06-22 11:34:09 | → | trcc joins (~trcc@2-104-60-169-cable.dk.customer.tdc.net) |
| 2021-06-22 11:34:42 | × | euandreh_ quits (~euandreh@2804:14c:33:9fe5:4732:d8b1:5f78:9a82) (Ping timeout: 240 seconds) |
| 2021-06-22 11:35:28 | <dminuoso> | % let pred = (< 3) in foldrM (\x xs -> if (pred x) then (Just (x:xs)) else Nothing) [] [1,2,2] |
| 2021-06-22 11:35:28 | <yahb> | dminuoso: Just [1,2,2] |
| 2021-06-22 11:35:31 | <dminuoso> | hseg: This maybe? |
| 2021-06-22 11:35:43 | → | euandreh_ joins (~euandreh@2804:14c:33:9fe5:3fd5:92e4:b3b4:44e0) |
| 2021-06-22 11:35:48 | <dminuoso> | Im thinking this can be improved still, just busy with other stuff |
| 2021-06-22 11:37:58 | → | fef joins (~thedawn@user/thedawn) |
| 2021-06-22 11:38:51 | <merijn> | Las[m]: You can't specify a specific OS thread. You can require that a Haskell thread always executes on the *same* OS thread |
| 2021-06-22 11:39:35 | <merijn> | Las[m]: i.e. you can say "this haskell thread should always run on the same thread" for cases where you call C code that uses, thread local storage, for example |
| 2021-06-22 11:39:50 | × | wei2912 quits (~wei2912@112.199.250.21) (Quit: Lost terminal) |
| 2021-06-22 11:41:35 | × | awth13 quits (~user@user/awth13) (Remote host closed the connection) |
| 2021-06-22 11:41:53 | <dminuoso> | Ah perhaps you could write: |
| 2021-06-22 11:42:06 | <dminuoso> | % let pred = (< 3) in foldrM (\x xs -> guard (pred x); Just (x:xs)) [] [1,2,2] |
| 2021-06-22 11:42:06 | <yahb> | dminuoso: ; <interactive>:23:52: error: parse error on input `;' |
| 2021-06-22 11:42:13 | <dminuoso> | % let pred = (< 3) in foldrM (\x xs -> do { guard (pred x); Just (x:xs) }) [] [1,2,2] |
| 2021-06-22 11:42:13 | <yahb> | dminuoso: Just [1,2,2] |
| 2021-06-22 11:42:17 | <dminuoso> | This looks kind of nice |
| 2021-06-22 11:42:51 | <Las[m]> | merijn: then couldn't I somehow pass over the `IO a` I want to execute to some bound thread over a channel or similar? |
All times are in UTC.