2022-01-20 00:01:57 +0100 | little_mac | (~little_ma@2601:410:4300:3ce0:d001:2aa2:4908:56e6) (Ping timeout: 240 seconds) |
2022-01-20 00:05:50 +0100 | little_mac | (~little_ma@2601:410:4300:3ce0:d001:2aa2:4908:56e6) |
2022-01-20 00:07:09 +0100 | alMalsamo | (~alMalsamo@gateway/tor-sasl/almalsamo) (Ping timeout: 276 seconds) |
2022-01-20 00:09:59 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 00:12:24 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) |
2022-01-20 00:17:06 +0100 | namkeleser | (~namkelese@124.188.192.57) |
2022-01-20 00:19:29 +0100 | perrierjouet | (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) (Quit: WeeChat 3.4) |
2022-01-20 00:20:05 +0100 | Codaraxis__ | (~Codaraxis@user/codaraxis) (Ping timeout: 256 seconds) |
2022-01-20 00:20:35 +0100 | szkl_ | (uid110435@id-110435.uxbridge.irccloud.com) () |
2022-01-20 00:21:08 +0100 | szkl_ | (uid110435@id-110435.uxbridge.irccloud.com) |
2022-01-20 00:21:25 +0100 | szkl_ | (uid110435@id-110435.uxbridge.irccloud.com) (Client Quit) |
2022-01-20 00:21:54 +0100 | szkl | (uid110435@id-110435.uxbridge.irccloud.com) |
2022-01-20 00:24:32 +0100 | albet70 | (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection) |
2022-01-20 00:25:53 +0100 | kaph | (~kaph@net-2-47-208-144.cust.vodafonedsl.it) |
2022-01-20 00:26:45 +0100 | alMalsamo | (~alMalsamo@gateway/tor-sasl/almalsamo) |
2022-01-20 00:28:09 +0100 | `2jt | (~jtomas@10.red-83-58-228.dynamicip.rima-tde.net) |
2022-01-20 00:28:15 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) |
2022-01-20 00:30:20 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:dd9f:9c7:a4ae:c7f9) |
2022-01-20 00:30:39 +0100 | albet70 | (~xxx@2400:8902::f03c:92ff:fe60:98d8) |
2022-01-20 00:31:28 +0100 | AlexNoo_ | (~AlexNoo@94.233.241.14) |
2022-01-20 00:32:42 +0100 | little_mac | (~little_ma@2601:410:4300:3ce0:d001:2aa2:4908:56e6) (Remote host closed the connection) |
2022-01-20 00:33:32 +0100 | AlexZenon | (~alzenon@178.34.162.42) (Ping timeout: 240 seconds) |
2022-01-20 00:33:56 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) (Ping timeout: 250 seconds) |
2022-01-20 00:34:32 +0100 | Alex_test | (~al_test@178.34.162.42) (Ping timeout: 240 seconds) |
2022-01-20 00:34:48 +0100 | AlexNoo | (~AlexNoo@178.34.162.42) (Ping timeout: 250 seconds) |
2022-01-20 00:35:46 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) (Quit: WeeChat 3.4) |
2022-01-20 00:36:28 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) |
2022-01-20 00:39:11 +0100 | Alex_test | (~al_test@94.233.241.14) |
2022-01-20 00:39:28 +0100 | AlexZenon | (~alzenon@94.233.241.14) |
2022-01-20 00:43:19 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 256 seconds) |
2022-01-20 00:49:59 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:edf9:3833:cff9:92b3) (Quit: Textual IRC Client: www.textualapp.com) |
2022-01-20 00:50:24 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 250 seconds) |
2022-01-20 00:53:48 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) |
2022-01-20 00:55:17 +0100 | machinedgod | (~machinedg@24.105.81.50) (Ping timeout: 268 seconds) |
2022-01-20 00:56:55 +0100 | Akiva | (~Akiva@user/Akiva) (Ping timeout: 256 seconds) |
2022-01-20 00:57:42 +0100 | ski | (~ski@remote11.chalmers.se) |
2022-01-20 00:58:58 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 00:58:58 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 00:58:58 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 00:59:11 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) (Ping timeout: 256 seconds) |
2022-01-20 00:59:55 +0100 | max22- | (~maxime@2a01cb08833598003263d82d70b82807.ipv6.abo.wanadoo.fr) (Remote host closed the connection) |
2022-01-20 01:00:19 +0100 | vglfr | (~vglfr@88.155.46.9) (Ping timeout: 256 seconds) |
2022-01-20 01:01:38 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) (Remote host closed the connection) |
2022-01-20 01:01:54 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) |
2022-01-20 01:03:17 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 240 seconds) |
2022-01-20 01:09:57 +0100 | `2jt | (~jtomas@10.red-83-58-228.dynamicip.rima-tde.net) (Ping timeout: 240 seconds) |
2022-01-20 01:10:08 +0100 | Cajun | (~Cajun@user/cajun) (Quit: Client closed) |
2022-01-20 01:10:23 +0100 | perrierjouet | (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) |
2022-01-20 01:11:57 +0100 | wmacmil | (~wmacmil@83-233-165-97.cust.bredband2.com) (Ping timeout: 240 seconds) |
2022-01-20 01:12:56 +0100 | Erutuon | (~Erutuon@user/erutuon) (Ping timeout: 250 seconds) |
2022-01-20 01:13:01 +0100 | lamba | (~lamba@c-73-16-71-87.hsd1.ma.comcast.net) |
2022-01-20 01:15:08 +0100 | <janus> | i have seen people prefixing their record field names with underscore, i think it is because they want the name to be free to use for the lens |
2022-01-20 01:15:34 +0100 | <janus> | but now i saw a suggestion that if you use generic-lens, you don't have to have the underscore |
2022-01-20 01:15:49 +0100 | <janus> | but then consumers will be forced to use generic-lens to use the library, no? |
2022-01-20 01:15:49 +0100 | Erutuon | (~Erutuon@user/erutuon) |
2022-01-20 01:16:24 +0100 | Gurkenglas | (~Gurkengla@dslb-002-203-144-204.002.203.pools.vodafone-ip.de) (Ping timeout: 250 seconds) |
2022-01-20 01:18:33 +0100 | _\_ | ding |
2022-01-20 01:18:54 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:b4b9:8efe:259f:8f94) |
2022-01-20 01:20:00 +0100 | lamba | (~lamba@c-73-16-71-87.hsd1.ma.comcast.net) (Remote host closed the connection) |
2022-01-20 01:20:32 +0100 | Tuplanolla | (~Tuplanoll@91-159-68-166.elisa-laajakaista.fi) (Quit: Leaving.) |
2022-01-20 01:20:33 +0100 | perrierjouet | (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) (Quit: WeeChat 3.4) |
2022-01-20 01:21:59 +0100 | ding | _\_ |
2022-01-20 01:23:38 +0100 | xb0o2 | (~xb0o2@user/xb0o2) (Quit: Client closed) |
2022-01-20 01:23:58 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:b4b9:8efe:259f:8f94) (Quit: Textual IRC Client: www.textualapp.com) |
2022-01-20 01:28:15 +0100 | _\_ | (~o@user/ding) (Quit: ___) |
2022-01-20 01:28:24 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) (Remote host closed the connection) |
2022-01-20 01:28:27 +0100 | _\_ | (~o@2001:19f0:5:14c2:5400:2ff:fee0:a42c) |
2022-01-20 01:28:34 +0100 | <Axman6> | the fields are still available, so you can just use them as records. generic lens lets you say get #someField without needing to generate lenses ahead of time |
2022-01-20 01:28:37 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) |
2022-01-20 01:28:44 +0100 | perrierjouet | (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) |
2022-01-20 01:28:49 +0100 | _\_ | (~o@2001:19f0:5:14c2:5400:2ff:fee0:a42c) (Remote host closed the connection) |
2022-01-20 01:29:03 +0100 | _\_ | (~o@2001:19f0:5:14c2:5400:2ff:fee0:a42c) |
2022-01-20 01:30:56 +0100 | delYsid | (~user@84-115-55-45.cable.dynamic.surfer.at) (Remote host closed the connection) |
2022-01-20 01:31:17 +0100 | machinedgod | (~machinedg@24.105.81.50) |
2022-01-20 01:32:32 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 240 seconds) |
2022-01-20 01:36:54 +0100 | vicfred | (~vicfred@user/vicfred) (Quit: Leaving) |
2022-01-20 01:36:57 +0100 | wmacmil | (~wmacmil@83-233-165-97.cust.bredband2.com) |
2022-01-20 01:37:31 +0100 | hughjfchen | (~hughjfche@vmi556545.contaboserver.net) (Quit: WeeChat 2.8) |
2022-01-20 01:38:50 +0100 | <janus> | Axman6: ok, but you wouldn't be able to use the lenses without #someField, if i understand correctly. so it requires user to learn generic-lens, but the advantage is that the source becomes more compact. |
2022-01-20 01:39:03 +0100 | <janus> | and presumably compilation gets a lot slower since Generic is slow to generate |
2022-01-20 01:39:15 +0100 | widelec-BB | (~widelec@cpe-109-207-144-181.docsis.tczew.net.pl) (Quit: ) |
2022-01-20 01:39:57 +0100 | wmacmil | (~wmacmil@83-233-165-97.cust.bredband2.com) (Client Quit) |
2022-01-20 01:40:25 +0100 | <jackdk> | janus: sounds like the tradeoff to me. Since amazonka-2.0 will require a generic optics lib of some form (although it provides explicit lenses if you don't mine a lot of keystrokes), I'll probably refactor my other stuff to use generic lens and drop underscores |
2022-01-20 01:40:27 +0100 | <geekosaur> | which is slower, th or generics? |
2022-01-20 01:40:48 +0100 | <jackdk> | also note, you can use generic-lens either as `field @"foo"` or as an overloaded label `#foo` |
2022-01-20 01:42:03 +0100 | <janus> | jackdk: actually i asked this question because i saw the thread on amazonka suggesting to get rid of the underscores :O why do you say they will require a generic optics lib? master still contains normal lenses. |
2022-01-20 01:42:25 +0100 | <Axman6> | Generics have the benefit of only needing to be run once, TH can/may/does need to be recompiled right? |
2022-01-20 01:42:44 +0100 | pretty_dumm_guy | (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) (Quit: WeeChat 3.4) |
2022-01-20 01:43:07 +0100 | <janus> | geekosaur: i don't know, i just heard that deriving Generic is slow. but it will only be for a few types, so won't matter |
2022-01-20 01:43:21 +0100 | Midjak | (~Midjak@may53-1-78-226-116-92.fbx.proxad.net) (Quit: This computer has gone to sleep) |
2022-01-20 01:43:24 +0100 | <Axman6> | the new lenses generated in amazonka are... ugly to say the least |
2022-01-20 01:43:36 +0100 | <jackdk> | janus: the lenses in the generates service bindings are like `typeName_fieldName` and in a separate module. I will probably remove the underscores on record fields in a future PR |
2022-01-20 01:43:40 +0100 | <Axman6> | using a lens library will be a much more pleasant option |
2022-01-20 01:43:42 +0100 | <jackdk> | s/generates/generated/ |
2022-01-20 01:44:07 +0100 | <jackdk> | I think there is a long-term plan to break the lens dep entirely |
2022-01-20 01:44:27 +0100 | <geekosaur> | Axman6, both happen during compilation. I think the only thing that helps is what jackdk said about a separate module, which you can't do wiith TH |
2022-01-20 01:44:32 +0100 | <Axman6> | I should know this, but are the smart constructors still being generated in amazonka jackdk? |
2022-01-20 01:44:39 +0100 | <geekosaur> | so with luck that module wouldn't need to be recompiled often |
2022-01-20 01:44:49 +0100 | vysn | (~vysn@user/vysn) |
2022-01-20 01:44:56 +0100 | <jackdk> | (you can provide van Laarhoven lenses using only the types in `base`, but prisms need `profunctors`) |
2022-01-20 01:44:59 +0100 | <Axman6> | I mean that having TH in a file can cause it to be recompiled when nothing has changed |
2022-01-20 01:45:04 +0100 | texasmynsted | (~texasmyns@99.96.221.112) (WeeChat 3.3) |
2022-01-20 01:45:21 +0100 | <geekosaur> | I think only if the TH adds an extra dependency |
2022-01-20 01:45:23 +0100 | <jackdk> | Axman6: constructor functions take all the required fields as arguments, yes. |
2022-01-20 01:45:31 +0100 | <janus> | jackdk: what is your github username? if i may ask. i am ysangkok |
2022-01-20 01:45:32 +0100 | <geekosaur> | addDependentFile or something like that |
2022-01-20 01:45:39 +0100 | <jackdk> | Note that the lenses are generated by the amazonka generator |
2022-01-20 01:45:52 +0100 | <albet70> | is there login session package for scotty? |
2022-01-20 01:45:53 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:dd9f:9c7:a4ae:c7f9) (Remote host closed the connection) |
2022-01-20 01:46:14 +0100 | <Axman6> | jackdk: great, that's one of my favourite amazonka features, and I thought I'd seen those were disappearing |
2022-01-20 01:46:32 +0100 | _\_ | (~o@2001:19f0:5:14c2:5400:2ff:fee0:a42c) (Changing host) |
2022-01-20 01:46:32 +0100 | _\_ | (~o@user/offon) |
2022-01-20 01:46:41 +0100 | <Axman6> | not sure where I got that idea |
2022-01-20 01:47:17 +0100 | <jackdk> | Axman6: they do need work - the hashable-1.4 change caused some of them to change argument order. there's a long-term plan to move to Data.Map, I think |
2022-01-20 01:47:21 +0100 | <jackdk> | janus: endgame |
2022-01-20 01:47:27 +0100 | <janus> | aaah ok it's youuu |
2022-01-20 01:47:37 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) (Ping timeout: 240 seconds) |
2022-01-20 01:47:51 +0100 | <jackdk> | uh oh |
2022-01-20 01:48:01 +0100 | <Axman6> | janus: is the hero of Amazonka's renewed development, and deserves as much beer or beer substitutes as he can cope with |
2022-01-20 01:48:06 +0100 | [_] | (~itchyjunk@user/itchyjunk/x-7353470) |
2022-01-20 01:48:07 +0100 | <Axman6> | jackdk* |
2022-01-20 01:48:37 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) |
2022-01-20 01:48:47 +0100 | <jackdk> | lol |
2022-01-20 01:49:03 +0100 | <janus> | i would happily send a bottle of booze or green tea! |
2022-01-20 01:49:37 +0100 | [itchyjunk] | (~itchyjunk@user/itchyjunk/x-7353470) (Ping timeout: 240 seconds) |
2022-01-20 01:50:11 +0100 | <janus> | jackdk: are you planning to remove the underscores before amazonka2 is out? |
2022-01-20 01:50:36 +0100 | <jackdk> | janus: yeah probably. It's not a big change, and it's probably the best chance we'll have for breaking changes |
2022-01-20 01:51:15 +0100 | <jackdk> | the reason it didn't happen sooner is that there were a lot of constants naming environment variables, which clashed with field names in `Env'`. Once the auth rework goes in, they all go away. |
2022-01-20 01:51:38 +0100 | <janus> | oooh ok, that makes sense |
2022-01-20 01:52:41 +0100 | perrierjouet | (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) (Quit: WeeChat 3.4) |
2022-01-20 01:52:45 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
2022-01-20 01:53:01 +0100 | <janus> | but just so that i can understand amazonkas view of these lens tradeoffs, it sounds like the ideal solution is to have non-underscored record field names, that are exported, and then have the consumer use generic-lens or generic-optics if they like. but they won't be forced to because the record selector will still be there |
2022-01-20 01:53:38 +0100 | <janus> | and because the consumer generates their own lenses using the generic instance, amazonka won't need to rely on any optics library |
2022-01-20 01:54:43 +0100 | perrierjouet | (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) |
2022-01-20 01:54:51 +0100 | azimut_ | (~azimut@gateway/tor-sasl/azimut) |
2022-01-20 01:55:08 +0100 | <jackdk> | that's what I understand Brendan's view to be, yeah. |
2022-01-20 01:55:42 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 276 seconds) |
2022-01-20 01:56:02 +0100 | <monochrom> | janus: You can s/or/and/, young people in Hong Kong like to mix green tea with booze! |
2022-01-20 01:56:25 +0100 | jgeerds | (~jgeerds@55d4090e.access.ecotel.net) (Ping timeout: 256 seconds) |
2022-01-20 01:56:35 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) (Remote host closed the connection) |
2022-01-20 01:56:48 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) |
2022-01-20 01:57:00 +0100 | [_] | [itchyjunk] |
2022-01-20 01:57:06 +0100 | <janus> | . o O ( maybe it will go through customs more easily like that ) |
2022-01-20 01:57:11 +0100 | <jackdk> | the tradeoff is the additional compile time for the Generic instance (which happens regardless, since it's too useful to omit) and some additional instance searching at the lens use site. |
2022-01-20 01:57:37 +0100 | <Axman6> | Removing lens as a dep of amazonka would be great (as much as I love lens) |
2022-01-20 01:58:20 +0100 | yauhsien | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) |
2022-01-20 01:58:32 +0100 | <janus> | right, seems like a sensible view! i just don't have any experience with generic-lens so i was surprised that such a high-profile library would go this route. but now that i understand the tradeoffs it seems totally sensible |
2022-01-20 01:58:52 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 250 seconds) |
2022-01-20 01:59:25 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 01:59:25 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 01:59:25 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 01:59:37 +0100 | <janus> | since the record field selectors are still exported, the most conservative can still opt out |
2022-01-20 01:59:47 +0100 | mvk | (~mvk@2607:fea8:5cdd:f000::55f8) |
2022-01-20 02:00:00 +0100 | bontaq | (~user@ool-45779fe5.dyn.optonline.net) (Ping timeout: 256 seconds) |
2022-01-20 02:00:10 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) (Ping timeout: 250 seconds) |
2022-01-20 02:00:35 +0100 | <awpr> | where does the compiled and optimized code for generics-derived lenses live under this model? |
2022-01-20 02:01:18 +0100 | <Axman6> | I think these days that generic-lens is a very sensible option, the performance of the lenses themselves is the same as what you'd write by hand, but there's probably some compilation time cost. But compiling lens as a dependency is also a massive cost |
2022-01-20 02:01:23 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-20 02:01:38 +0100 | <Axman6> | probably at the usesite? |
2022-01-20 02:01:41 +0100 | <awpr> | if amazonka has no dependency on a lens library, it can't be part of amazonka's modules. that means it must be part of the client modules, in the form of instances specialized out of the ones in generic-lens |
2022-01-20 02:01:47 +0100 | <pfurla-matrix> | what's the difference between generic vs TH lenses compile time? |
2022-01-20 02:02:03 +0100 | <awpr> | which IIUC would mean you have to re-specialize-and-optimize them in every module that uses them |
2022-01-20 02:02:07 +0100 | <Axman6> | not sure if they are defined in a type class, so there'd only be one instance of each lens |
2022-01-20 02:03:12 +0100 | <monochrom> | Hahaha I'm re-doing <*> for Cont again (newtype Cont r a = Cont((a->r)->r)). I now have the pointfree expression: Cont pf <*> Cont pa = Cont (pf . (pa .) . (.)). No idea what it means now haha. |
2022-01-20 02:03:13 +0100 | <jackdk> | interestingly, generic-lens doesn't depend on a lens library either - it implements its own definitions |
2022-01-20 02:03:39 +0100 | <awpr> | even if they are in a class, it'd have to be a highly polymorphic instance vaguely similar to `(Generic a, HasField "abc" (Rep a)) => IsLabel "abc" (SomeLens a etc)` |
2022-01-20 02:03:43 +0100 | <Axman6> | I guess the benefit is that you only pay for the lenses you actually use, instead of paying for the lens generation of every type in every package you use |
2022-01-20 02:04:05 +0100 | <Axman6> | awpr: I think that's basically what it is |
2022-01-20 02:04:21 +0100 | <awpr> | so either it's disastrously slow, or it still gets copied/specialized into every module that uses it |
2022-01-20 02:04:28 +0100 | <awpr> | I'd assume the latter |
2022-01-20 02:04:36 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:6819:b864:4bf9:4b6e) |
2022-01-20 02:05:40 +0100 | lavaman | (~lavaman@98.38.249.169) (Ping timeout: 256 seconds) |
2022-01-20 02:06:12 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) (Ping timeout: 268 seconds) |
2022-01-20 02:06:58 +0100 | <jackdk> | `field :: forall {field :: GHC.Types.Symbol} {s} {t} {a} {b} {f :: * -> *}. (HasField field s t a b, Functor f) => (a -> f b) -> s -> f t` |
2022-01-20 02:08:30 +0100 | <awpr> | so if you hit the cases where Generic is slow, then suddenly every module downstream that uses a lens pays that tax on every compile, unless I'm missing some GHC magic to avoid re-specializing instances |
2022-01-20 02:09:39 +0100 | <awpr> | it might be worth measuring some compile times and looking at some Core before assuming it'll be cheaper to have everyone downstream generate their own lenses vs. generating them up-front with TH in one place |
2022-01-20 02:10:36 +0100 | <jackdk> | amazonka is a nasty case because it's so big. before the newtype/pattern synonym fix, the EC2 instances were represented by a 400+ member sum type |
2022-01-20 02:10:57 +0100 | hughjfchen | (~hughjfche@vmi556545.contaboserver.net) |
2022-01-20 02:10:59 +0100 | <Axman6> | I feel like that optimisation deserves a blog post on its own |
2022-01-20 02:11:01 +0100 | <jackdk> | forcing people to generate every lens in every type in a service binding they use could well be worse |
2022-01-20 02:11:17 +0100 | jkaye | (~jkaye@2601:281:200:1958:837d:401b:4a0:3b8f) (Ping timeout: 240 seconds) |
2022-01-20 02:11:24 +0100 | <awpr> | so uh, Generic compilation costs tend to be quadratic-ish in the size of the type |
2022-01-20 02:11:33 +0100 | albet70 | (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection) |
2022-01-20 02:12:04 +0100 | <jackdk> | I kinda want to do it to our big enum of currency codes, for similar reasons. (we use an explicit Read instance because the stock one was noticeably slow in profiling) |
2022-01-20 02:12:32 +0100 | <Axman6> | the fix Jack mentopned above significantly reduces those instances, by replacing enums with newtyped Text values and pattern synonyms, so the Generic instances become tiny |
2022-01-20 02:12:32 +0100 | <awpr> | my personal threshold for assuming Generic will start causing problems in performance and/or compile times is somewhere in the range of 8-16 fields/constructors |
2022-01-20 02:12:34 +0100 | <jackdk> | yeah so that giant sum type no longer exists, it's a newtype with a bunch of pattern synonyms. This also makes it robust to the launch of new instance types by aws |
2022-01-20 02:13:04 +0100 | <awpr> | ah, yeah, that certainly improves things. but still beware of very large types with Generic |
2022-01-20 02:13:22 +0100 | lbseale | (~ep1ctetus@user/ep1ctetus) (Quit: Leaving) |
2022-01-20 02:13:50 +0100 | <jackdk> | Were I to spitball a guess, I would say that the mean record size is probably 12, the median a fair bit lower, and probably a few really chonky ones out there |
2022-01-20 02:14:15 +0100 | <awpr> | and it's not just in compiling the Generic instance itself, it's potentially in everything that gets specialized/optimized against that Generic instance -- e.g. a generics-based lens |
2022-01-20 02:15:07 +0100 | <jackdk> | which will almost always be applied to a request or response type i.e. a record with no type variables derived from a boto service definition |
2022-01-20 02:16:49 +0100 | myShoggoth | (~myShoggot@97-120-67-120.ptld.qwest.net) (Ping timeout: 256 seconds) |
2022-01-20 02:17:20 +0100 | <awpr> | 8 fields for me is where I've seen Generic methods start refusing to inline, so I'd definitely check Core at the call sites with generic-lens on maybe the 90th percentile records to see if it's actually managed to fuse everything down into something that looks like a hand-written lens |
2022-01-20 02:17:40 +0100 | albet70 | (~xxx@2400:8902::f03c:92ff:fe60:98d8) |
2022-01-20 02:19:01 +0100 | <awpr> | the largest record they test in the inspection test has 6 fields https://github.com/kcsongor/generic-lens/blob/master/generic-lens/test/Spec.hs |
2022-01-20 02:19:12 +0100 | <jackdk> | https://dl.acm.org/doi/pdf/10.1145/3236780 Section 8 talks a lot about performance and the use of inspection testing |
2022-01-20 02:19:35 +0100 | <jackdk> | unfortunately most of it is a description of how the techniques work as opposed to whether they rowk |
2022-01-20 02:19:39 +0100 | <jackdk> | s/rowk/work/ |
2022-01-20 02:20:58 +0100 | <jackdk> | unfortunately their benchmarks are against other generic traversal libs and not direct field-accessor lenses |
2022-01-20 02:21:15 +0100 | perrierjouet | (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) (Quit: WeeChat 3.4) |
2022-01-20 02:21:48 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) (Remote host closed the connection) |
2022-01-20 02:22:02 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) |
2022-01-20 02:22:15 +0100 | <jackdk> | also, I should point out: if the large records are slow to generate and run lens code on, _and_ the use of lenses to fill out/read from your AWS api calls are a performance bottleneck, then it's possible to get the lenses emitted by the amazonka generator and use thos |
2022-01-20 02:22:17 +0100 | <jackdk> | e* |
2022-01-20 02:24:26 +0100 | perrierjouet | (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) |
2022-01-20 02:29:38 +0100 | alp | (~alp@user/alp) (Ping timeout: 268 seconds) |
2022-01-20 02:30:47 +0100 | <Axman6> | Does anyone know of a good pattern for running some code at application start without needing to have the user of a library call something like mySpecialMain in their main definiton? Thinking specifically about libraries which bind to C libraries which need some sort of initialisation before you use them |
2022-01-20 02:30:48 +0100 | perrierjouet | (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) (Remote host closed the connection) |
2022-01-20 02:31:04 +0100 | perrierjouet | (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) |
2022-01-20 02:31:42 +0100 | <EvanR_> | spooky action insertion injection |
2022-01-20 02:32:13 +0100 | <geekosaur> | either a wrapper which uses bracket, or a monad whose initialization/"run" function does the init |
2022-01-20 02:35:17 +0100 | <Axman6> | I'd love a way to inject something into the application initialisation. thought about doing something like initialise :: (); initialise = unsafePerformIO initCLib; myFunc :: Foo -> Bar; myFunc = initialise `seq` \foo -> ..., but that seems error prone |
2022-01-20 02:35:38 +0100 | <Axman6> | NOINLINE and all the other nonsense |
2022-01-20 02:35:43 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) |
2022-01-20 02:36:00 +0100 | <EvanR_> | override main, preferrably with a configurable hierarchy to maybe correctly order the actions among each other then run real main |
2022-01-20 02:36:17 +0100 | <EvanR_> | when that fails, build a more terrible system to manage it |
2022-01-20 02:36:26 +0100 | <EvanR_> | wait thats the other language |
2022-01-20 02:36:41 +0100 | <Axman6> | C? Java? |
2022-01-20 02:36:47 +0100 | <EvanR_> | ruby, php, python |
2022-01-20 02:36:48 +0100 | <geekosaur> | sounds like a terrible sbuse of main-is: to me |
2022-01-20 02:36:59 +0100 | <geekosaur> | *abuse |
2022-01-20 02:37:02 +0100 | <EvanR_> | what, we can do that? |
2022-01-20 02:37:06 +0100 | <geekosaur> | yep |
2022-01-20 02:37:16 +0100 | EvanR_ | attempts to hold the can of worms closed with all their might |
2022-01-20 02:38:25 +0100 | jackdk | grabs crowbar. Let's crack this bad boy open |
2022-01-20 02:38:50 +0100 | <EvanR_> | even the likes of https://hackage.haskell.org/package/java-bridge-0.20130606.3/docs/Foreign-Java.html requires you to start using java with the runJava function |
2022-01-20 02:39:09 +0100 | <EvanR_> | instead of injecting it before main |
2022-01-20 02:39:55 +0100 | <jackdk> | Axman6: does the lib you are binding have a deinit()? |
2022-01-20 02:39:58 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 02:40:01 +0100 | faustind | (~faustin@M014008067225.v4.enabler.ne.jp) |
2022-01-20 02:40:08 +0100 | <Axman6> | I don't believe so |
2022-01-20 02:40:19 +0100 | <geekosaur> | https://cabal.readthedocs.io/en/3.4/cabal-package.html#pkg-field-executable-main-is |
2022-01-20 02:40:57 +0100 | <geekosaur> | which I believe also uses ghc's -main-is :) |
2022-01-20 02:40:57 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) (Ping timeout: 240 seconds) |
2022-01-20 02:41:23 +0100 | <EvanR_> | my main is- |
2022-01-20 02:41:31 +0100 | <EvanR_> | my main is- |
2022-01-20 02:41:57 +0100 | machinedgod | (~machinedg@24.105.81.50) (Ping timeout: 240 seconds) |
2022-01-20 02:41:58 +0100 | <jackdk> | Axman6: is the init() in the lib idempotent? |
2022-01-20 02:42:07 +0100 | <jackdk> | Just call it before each call =) |
2022-01-20 02:42:08 +0100 | kaph | (~kaph@net-2-47-208-144.cust.vodafonedsl.it) (Read error: Connection reset by peer) |
2022-01-20 02:46:48 +0100 | notzmv | (~zmv@user/notzmv) |
2022-01-20 02:47:28 +0100 | notzmv | (~zmv@user/notzmv) (Read error: Connection reset by peer) |
2022-01-20 02:49:01 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) (Remote host closed the connection) |
2022-01-20 02:49:10 +0100 | geekosaur | (~geekosaur@xmonad/geekosaur) (Quit: Leaving) |
2022-01-20 02:49:14 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) |
2022-01-20 02:51:03 +0100 | geekosaur | (~geekosaur@xmonad/geekosaur) |
2022-01-20 02:55:38 +0100 | yauhsien | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) (Ping timeout: 250 seconds) |
2022-01-20 02:59:15 +0100 | <Axman6> | EvanR_: the real Shim Shady? |
2022-01-20 02:59:24 +0100 | <EvanR_> | wow... |
2022-01-20 02:59:36 +0100 | <Axman6> | I'm here all week |
2022-01-20 03:01:05 +0100 | johnsonz | (~bc8147f2@cerf.good1.com) |
2022-01-20 03:02:28 +0100 | razetime | (~quassel@49.207.203.87) |
2022-01-20 03:03:42 +0100 | califax- | (~califax@user/califx) |
2022-01-20 03:04:32 +0100 | notzmv | (~zmv@user/notzmv) |
2022-01-20 03:06:18 +0100 | n3t | (n3t@user/n3t) (Ping timeout: 256 seconds) |
2022-01-20 03:06:52 +0100 | benin | (~benin@183.82.179.241) |
2022-01-20 03:07:51 +0100 | califax | (~califax@user/califx) (Ping timeout: 276 seconds) |
2022-01-20 03:07:52 +0100 | califax- | califax |
2022-01-20 03:10:27 +0100 | wyrd | (~wyrd@gateway/tor-sasl/wyrd) (Ping timeout: 276 seconds) |
2022-01-20 03:11:52 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) |
2022-01-20 03:12:49 +0100 | sekun[m] | (~hsekmatri@2001:470:69fc:105::d18f) |
2022-01-20 03:13:40 +0100 | slac74781 | (~slack1256@186.11.27.197) (Ping timeout: 256 seconds) |
2022-01-20 03:14:03 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 256 seconds) |
2022-01-20 03:14:43 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) (Remote host closed the connection) |
2022-01-20 03:14:56 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) |
2022-01-20 03:15:47 +0100 | Jing | (~hedgehog@240e:390:7c53:a7e1:d57f:4bb8:924b:5be3) |
2022-01-20 03:15:57 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) (Ping timeout: 240 seconds) |
2022-01-20 03:20:51 +0100 | stiell | (~stiell@gateway/tor-sasl/stiell) (Ping timeout: 276 seconds) |
2022-01-20 03:23:57 +0100 | neurocyte0917090 | (~neurocyte@user/neurocyte) (Ping timeout: 240 seconds) |
2022-01-20 03:25:22 +0100 | <jackdk> | @remember Axman6 EvanR_: my main is-, my main is-, Axman6: the real Shim Shady? |
2022-01-20 03:25:22 +0100 | <lambdabot> | It is forever etched in my memory. |
2022-01-20 03:26:05 +0100 | <EvanR_> | guess I'll fix my nick |
2022-01-20 03:26:11 +0100 | EvanR_ | EvanR |
2022-01-20 03:26:11 +0100 | <Axman6> | @quote Axman6 |
2022-01-20 03:26:11 +0100 | <lambdabot> | Axman6 says: let blah f x = f (blah f x) in blah ("blah "++) "" |
2022-01-20 03:26:39 +0100 | <Axman6> | who @remembers that... |
2022-01-20 03:26:56 +0100 | <jackdk> | blah |
2022-01-20 03:27:16 +0100 | <EvanR> | > let blah f x = f (blah f x) in blah ("blah "++) "" |
2022-01-20 03:27:18 +0100 | <lambdabot> | "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah ... |
2022-01-20 03:29:02 +0100 | xff0x | (~xff0x@2001:1a81:525d:1e00:f1de:1cfe:e8a8:d6c0) (Ping timeout: 240 seconds) |
2022-01-20 03:30:57 +0100 | mvk | (~mvk@2607:fea8:5cdd:f000::55f8) (Ping timeout: 240 seconds) |
2022-01-20 03:31:04 +0100 | xff0x | (~xff0x@2001:1a81:5280:6800:37be:8663:af54:fc92) |
2022-01-20 03:31:32 +0100 | ProfSimm | (~ProfSimm@87.227.196.109) (Remote host closed the connection) |
2022-01-20 03:35:11 +0100 | jenna8912 | (~jenna@c-107-5-104-51.hsd1.mi.comcast.net) (Quit: Reconnecting) |
2022-01-20 03:35:23 +0100 | jenna8912 | (~jenna@c-107-5-104-51.hsd1.mi.comcast.net) |
2022-01-20 03:37:49 +0100 | ukari | (~ukari@user/ukari) |
2022-01-20 03:40:18 +0100 | fizzsegfaultbuzz | (~segfaultf@135-180-0-138.static.sonic.net) (Ping timeout: 256 seconds) |
2022-01-20 03:41:25 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) (Remote host closed the connection) |
2022-01-20 03:41:39 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) |
2022-01-20 03:43:05 +0100 | x_kuru | (~xkuru@user/xkuru) (Read error: Connection reset by peer) |
2022-01-20 03:49:29 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) |
2022-01-20 03:49:34 +0100 | <romesrf> | hey everyone |
2022-01-20 03:51:47 +0100 | <romesrf> | i'm trying to call a function f :: (C x) => x -> ..., in which one of the instances of C is Text, with a string literal, however i get the "ambiguous type variable" error, even though no other IsString instances C |
2022-01-20 03:52:39 +0100 | <romesrf> | maybe is there anyway to say that if I have a string literal then it should be Text? i was trying to avoid having to explicitly type the argument always |
2022-01-20 03:54:59 +0100 | <EvanR> | extended defaulting rules? |
2022-01-20 03:55:10 +0100 | kaph | (~kaph@net-2-47-208-144.cust.vodafonedsl.it) |
2022-01-20 03:55:48 +0100 | <romesrf> | @EvanR could I apply the extended default rules just to this one function? |
2022-01-20 03:55:48 +0100 | <lambdabot> | Unknown command, try @list |
2022-01-20 03:56:18 +0100 | Unode | (~Unode@194.94.44.220) (Ping timeout: 260 seconds) |
2022-01-20 03:56:19 +0100 | <EvanR> | um if it's one function why not put a type signature telling it you want Text |
2022-01-20 03:56:52 +0100 | <romesrf> | it's a query class: a lot of things can mean a query, but when its a string literal, i want it to be text |
2022-01-20 03:58:02 +0100 | <romesrf> | is it possible to use implications in the constraints? this doesn't work :) : IsString q => q ~ Text |
2022-01-20 03:58:28 +0100 | <EvanR> | sounds like a bad interaction between two classes |
2022-01-20 03:58:55 +0100 | <EvanR> | a utility function with an actual type signature is all I can think of |
2022-01-20 04:00:06 +0100 | stiell | (~stiell@gateway/tor-sasl/stiell) |
2022-01-20 04:01:05 +0100 | <romesrf> | right |
2022-01-20 04:01:05 +0100 | namkeleser | (~namkelese@124.188.192.57) (Ping timeout: 256 seconds) |
2022-01-20 04:01:21 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-20 04:01:32 +0100 | Unode | (~Unode@194.94.44.220) |
2022-01-20 04:01:45 +0100 | brettgilio | (~brettgili@x-node.gq) |
2022-01-20 04:13:38 +0100 | bgamari_ | bgamari |
2022-01-20 04:18:37 +0100 | zmt01 | (~zmt00@user/zmt00) (Ping timeout: 240 seconds) |
2022-01-20 04:19:41 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) |
2022-01-20 04:20:25 +0100 | kimjetwav | (~user@2607:fea8:2363:8f00:d445:4a94:576b:ee4c) |
2022-01-20 04:21:04 +0100 | lavaman | (~lavaman@98.38.249.169) (Remote host closed the connection) |
2022-01-20 04:22:30 +0100 | zmt00 | (~zmt00@user/zmt00) |
2022-01-20 04:22:48 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) (Ping timeout: 256 seconds) |
2022-01-20 04:24:28 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) (Ping timeout: 250 seconds) |
2022-01-20 04:24:59 +0100 | Kaiepi | (~Kaiepi@156.34.47.253) (Remote host closed the connection) |
2022-01-20 04:25:21 +0100 | Kaiepi | (~Kaiepi@156.34.47.253) |
2022-01-20 04:28:35 +0100 | Jing | (~hedgehog@240e:390:7c53:a7e1:d57f:4bb8:924b:5be3) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-20 04:29:54 +0100 | pavonia | (~user@user/siracusa) |
2022-01-20 04:32:38 +0100 | myShoggoth | (~myShoggot@97-120-67-120.ptld.qwest.net) |
2022-01-20 04:32:58 +0100 | raym | (~raym@user/raym) (Ping timeout: 268 seconds) |
2022-01-20 04:34:02 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) |
2022-01-20 04:34:08 +0100 | td_ | (~td@muedsl-82-207-238-121.citykom.de) (Ping timeout: 256 seconds) |
2022-01-20 04:35:57 +0100 | td_ | (~td@muedsl-82-207-238-049.citykom.de) |
2022-01-20 04:36:13 +0100 | joo-_ | (~joo-_@fsf/member/joo--) (Ping timeout: 256 seconds) |
2022-01-20 04:37:37 +0100 | mbuf | (~Shakthi@122.174.254.114) |
2022-01-20 04:37:41 +0100 | joo-_ | (~joo-_@fsf/member/joo--) |
2022-01-20 04:38:40 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) (Ping timeout: 256 seconds) |
2022-01-20 04:39:25 +0100 | raym | (~raym@user/raym) |
2022-01-20 04:43:57 +0100 | fef | (~thedawn@user/thedawn) |
2022-01-20 04:51:18 +0100 | razetime | (~quassel@49.207.203.87) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
2022-01-20 04:51:36 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-20 04:53:13 +0100 | <d34df00d> | Is there any library that considers n-ary tuples of the form (a, a, a) as traversables? |
2022-01-20 04:53:42 +0100 | <jackdk> | Control.Lens.Each |
2022-01-20 04:53:56 +0100 | <jackdk> | https://hackage.haskell.org/package/lens-5.0.1/docs/Control-Lens-Each.html |
2022-01-20 04:54:36 +0100 | seer | (~delicacie@2601:6c4:4080:3f80:3467:b430:2332:6b36) |
2022-01-20 04:54:39 +0100 | seer | Inst |
2022-01-20 04:54:42 +0100 | Inst | giggles |
2022-01-20 04:54:53 +0100 | <Inst> | @evanr, I have a copy of The Craft of Functional Programming and I can see why you guys use it. |
2022-01-20 04:54:53 +0100 | <lambdabot> | Unknown command, try @list |
2022-01-20 04:55:16 +0100 | <Inst> | it's very newbie friendly and explains the fundamental concepts exceptionally well |
2022-01-20 04:55:39 +0100 | <Inst> | also, in more entertaining news, I'm spying on someone's Python course |
2022-01-20 04:55:40 +0100 | raym | (~raym@user/raym) (Ping timeout: 256 seconds) |
2022-01-20 04:55:56 +0100 | <Inst> | apparently the instructor complained because everyone decided to solve sieve of erastothenes via lists, objects, etc |
2022-01-20 04:56:06 +0100 | lavaman | (~lavaman@98.38.249.169) (Ping timeout: 250 seconds) |
2022-01-20 04:57:12 +0100 | <d34df00d> | lens of course. |
2022-01-20 04:57:14 +0100 | <Inst> | this is an intro python course, btw |
2022-01-20 04:57:15 +0100 | raym | (~raym@user/raym) |
2022-01-20 04:57:16 +0100 | <d34df00d> | jackdk: thanks! |
2022-01-20 04:57:22 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) (Killed (NickServ (Forcing logout FinnElija -> finn_elija))) |
2022-01-20 04:57:22 +0100 | finn_elija | (~finn_elij@user/finn-elija/x-0085643) |
2022-01-20 04:57:22 +0100 | finn_elija | FinnElija |
2022-01-20 04:57:57 +0100 | <EvanR> | yeah as exciting as some intro python course sounds right now what about haskell |
2022-01-20 04:58:40 +0100 | <Inst> | busy, i need to lose weight |
2022-01-20 04:58:46 +0100 | <Inst> | friend said she'd be available after her class finishes on the 24th |
2022-01-20 04:59:14 +0100 | <Inst> | i'm still confused about algebraic data types, etc |
2022-01-20 04:59:24 +0100 | <Inst> | defining FAM as a toolkit on type-constructed values is not incorrect, right? |
2022-01-20 04:59:40 +0100 | <Inst> | or rather, values on which a type constructor is applied |
2022-01-20 05:00:15 +0100 | raym | (~raym@user/raym) (Read error: Connection reset by peer) |
2022-01-20 05:00:17 +0100 | <EvanR> | type ctors don't apply to values, since haskell doesn't have dependent types |
2022-01-20 05:00:33 +0100 | <EvanR> | still |
2022-01-20 05:00:35 +0100 | cheater | (~Username@user/cheater) (Ping timeout: 256 seconds) |
2022-01-20 05:01:17 +0100 | <Inst> | type-constructed types is still my preferred explanation, but it's wrong because you can have types that are type constructed types |
2022-01-20 05:01:26 +0100 | <EvanR> | defining something as toolkit doesn't sound right, it doesn't even sound wrong! |
2022-01-20 05:02:37 +0100 | <monochrom> | The flexibility of natural language. |
2022-01-20 05:03:30 +0100 | <Inst> | is concrete type on which a type constructor has been applied correct? |
2022-01-20 05:03:54 +0100 | cheater | (~Username@user/cheater) |
2022-01-20 05:04:42 +0100 | <Inst> | i'm basically trying to make the "containers" metaphor correct, by making it less abstract and strictly concrete |
2022-01-20 05:05:14 +0100 | yauhsien | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) |
2022-01-20 05:05:54 +0100 | <Inst> | the obvious exceptions are treating (->) r as a type, and therefore being allowed to fmap a function over a function |
2022-01-20 05:06:13 +0100 | <EvanR> | (->) r can be considered a container |
2022-01-20 05:06:14 +0100 | <Inst> | and data Proxy a = Proxy, where the types are retained, but the values are discarded |
2022-01-20 05:06:26 +0100 | <EvanR> | container is the gift that keeps on giving |
2022-01-20 05:06:44 +0100 | <Inst> | sort of equivalent to context in a certain way |
2022-01-20 05:07:03 +0100 | <Inst> | container is just too concrete, whereas context is general enough to be correct, but too general to be understandable |
2022-01-20 05:07:05 +0100 | <EvanR> | Proxy a can be considered a container that is always empty |
2022-01-20 05:07:36 +0100 | <EvanR> | () is a container that always has a boring value with no information |
2022-01-20 05:07:54 +0100 | <boxscape_> | hmm sad that I have to write `do {foo <- action; let ?foo = foo; ...}` instead of `do {?foo <- action; ...}` |
2022-01-20 05:08:37 +0100 | <glguy> | boxscape_: let ?foo is basically a completely separate thing. It's also not recursive, so you can do stuff like: let ?foo = ?foo + 1 in (and it doesn't loop) |
2022-01-20 05:08:46 +0100 | <boxscape_> | I see |
2022-01-20 05:10:26 +0100 | <EvanR> | containers of type Void conspicuously don't exist |
2022-01-20 05:10:30 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 05:10:37 +0100 | <EvanR> | but are still containers! |
2022-01-20 05:11:26 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) |
2022-01-20 05:12:07 +0100 | <Inst> | https://bartoszmilewski.com/2014/01/14/functors-are-containers/ |
2022-01-20 05:12:18 +0100 | <Inst> | it's his preferred metaphor |
2022-01-20 05:12:29 +0100 | ukari | (~ukari@user/ukari) (Remote host closed the connection) |
2022-01-20 05:12:53 +0100 | ukari | (~ukari@user/ukari) |
2022-01-20 05:13:01 +0100 | <EvanR> | yeah, it's a metaphor that can't fail |
2022-01-20 05:13:18 +0100 | <EvanR> | sort of like an untyped, unchecked programming language xD |
2022-01-20 05:14:22 +0100 | <EvanR> | everyone knows what a container is, so if you describe anything as one, they automatically understand you? |
2022-01-20 05:19:37 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) (Remote host closed the connection) |
2022-01-20 05:19:51 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) |
2022-01-20 05:22:45 +0100 | <Inst> | defining FAM as f a / m a might be the easiest way about it |
2022-01-20 05:23:25 +0100 | <Inst> | explain that f / m has bad notation, but it should be thought of as any type constructor for which the resulting type can have a legal functor / applicative / monad instance, as applicable |
2022-01-20 05:23:37 +0100 | whatsupdoc | (uid509081@id-509081.hampstead.irccloud.com) |
2022-01-20 05:27:17 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-20 05:28:36 +0100 | werneta | (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 250 seconds) |
2022-01-20 05:29:41 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) |
2022-01-20 05:29:57 +0100 | meer | (~delicacie@2601:6c4:4080:3f80:40d5:abfe:845e:ad8f) |
2022-01-20 05:30:29 +0100 | werneta | (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
2022-01-20 05:30:52 +0100 | deadmarshal | (~deadmarsh@95.38.3.145) |
2022-01-20 05:30:55 +0100 | <lechner> | Hi, do I have to force some kind of a rebuild in cabal after upgrading ghc? Some of my aeson types now generate Strings rather than Ints (via Generic). Something seems off |
2022-01-20 05:31:39 +0100 | <glguy> | lechner: Different versions of aeson might have different APIs, though I don't know of a String vs Int change off the top of my head |
2022-01-20 05:31:56 +0100 | lavaman | (~lavaman@98.38.249.169) (Ping timeout: 256 seconds) |
2022-01-20 05:31:57 +0100 | <glguy> | you build in cabal using different versions of ghc would be largely unrelated |
2022-01-20 05:32:05 +0100 | <lechner> | ok |
2022-01-20 05:32:17 +0100 | Inst | (~delicacie@2601:6c4:4080:3f80:3467:b430:2332:6b36) (Ping timeout: 240 seconds) |
2022-01-20 05:32:38 +0100 | <glguy> | Can you share some particular code that changed, or a type error , or something? |
2022-01-20 05:33:20 +0100 | <lechner> | Error: Error in $.groups[0]['input_files'][0].hints[4].pointer['line_position']: parsing Int failed, expected Number, but encountered String |
2022-01-20 05:33:51 +0100 | <lechner> | Same type (same file) for both receiver and sender |
2022-01-20 05:33:57 +0100 | <lechner> | Maybe Int |
2022-01-20 05:34:14 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) (Ping timeout: 250 seconds) |
2022-01-20 05:37:31 +0100 | laslmtdwbcs^ | (~laslmtdwb@wsip-98-188-242-61.mc.at.cox.net) (Remote host closed the connection) |
2022-01-20 05:39:17 +0100 | <glguy> | and what's the json value at that path? |
2022-01-20 05:40:39 +0100 | <lechner> | "line_position" : "1" |
2022-01-20 05:41:46 +0100 | <lechner> | it's interleaved with "line_position" : 0 and "line_position" : 15 |
2022-01-20 05:42:21 +0100 | <glguy> | so it should have been 1 but it was "1"? |
2022-01-20 05:43:09 +0100 | <lechner> | yes, but maybe i'm misreading my logs. it's possible they arrive that way |
2022-01-20 05:43:32 +0100 | <c_wraith> | that sounds like the sort of thing that would happen with JSON apis |
2022-01-20 05:43:38 +0100 | <lechner> | it can't be Haskell! |
2022-01-20 05:43:40 +0100 | yauhsien | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) (Remote host closed the connection) |
2022-01-20 05:43:45 +0100 | <c_wraith> | clean data? Not in these parts! |
2022-01-20 05:44:58 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 256 seconds) |
2022-01-20 05:45:20 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) (Remote host closed the connection) |
2022-01-20 05:45:42 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) |
2022-01-20 05:45:56 +0100 | <lechner> | "JSON::XS will encode ... scalars that have last been used in a string context before encoding as JSON strings" "and anything else as number value" |
2022-01-20 05:46:01 +0100 | yauhsien | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) |
2022-01-20 05:47:00 +0100 | <lechner> | Haskell vs Perl: "You can force the type to be a JSON number by numifying it:" |
2022-01-20 05:47:57 +0100 | <lechner> | they suggest $x += 0 or $x *= 1 |
2022-01-20 05:48:03 +0100 | <lechner> | i love haskell |
2022-01-20 05:48:22 +0100 | EvanR | attempts to force "yahoo!" to be a number |
2022-01-20 05:48:40 +0100 | <EvanR> | be a number dammit! |
2022-01-20 05:50:36 +0100 | <lechner> | my son, age 8, thinks "one google" is a really large number |
2022-01-20 05:50:51 +0100 | <c_wraith> | well... that's not entirely wrong. Just a matter of spelling. |
2022-01-20 05:50:52 +0100 | <glguy> | Perl, the home of "0 but true" |
2022-01-20 05:51:00 +0100 | <c_wraith> | "one googol" is a really large number. |
2022-01-20 05:51:02 +0100 | <ephemient> | integers above 2^53 can't be easily represented as integers in JS (because that's outside of float64's integral range) so it's at least somewhat common to see guidelines to use strings in JSON instead |
2022-01-20 05:51:24 +0100 | <ephemient> | e.g. Twitter's id_str because tweet IDs don't fit in JS integral range |
2022-01-20 05:51:36 +0100 | <glguy> | yeah, sometimes I have really long files and I need my line numbers to be strings instead of imprecise floats *nod* |
2022-01-20 05:52:19 +0100 | <EvanR> | stupid SQL should start counting by 2, and by 4 etc when they get to 2^53 |
2022-01-20 05:52:33 +0100 | yauhsien | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) (Remote host closed the connection) |
2022-01-20 05:52:40 +0100 | <EvanR> | so it's webscale |
2022-01-20 05:53:22 +0100 | yauhsien | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) |
2022-01-20 05:53:28 +0100 | <ephemient> | c_wraith: raku "fixes" that, `0 but true` becoming an actual first-class thing 🙃 |
2022-01-20 05:54:09 +0100 | <c_wraith> | ruby also has 0 as true |
2022-01-20 05:54:38 +0100 | zebrag | (~chris@user/zebrag) (Quit: Konversation terminated!) |
2022-01-20 05:55:06 +0100 | <ephemient> | I mean that Raku allows for `$x but $y` to mean "a value that behaves like $x if used in X-ly and behaves like $y if used Y-ly". what could possibly tgo wrong |
2022-01-20 05:55:38 +0100 | <ephemient> | anyhow, I don't see a way to enable lenient parsing of JSON in Aeson… |
2022-01-20 05:57:29 +0100 | <ephemient> | (iirc gson and jackson both happily deserialize strings to numbers if the target field is a number) |
2022-01-20 05:57:42 +0100 | <glguy> | lenient parsing, when you find a string but didn't expect a string, parse it as more json and see if that helps |
2022-01-20 05:58:04 +0100 | yauhsien | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) (Ping timeout: 250 seconds) |
2022-01-20 05:58:11 +0100 | <c_wraith> | recursiver json |
2022-01-20 05:58:39 +0100 | <EvanR> | FCC guidelines, your code should tolerate any garbage in it receives. Also your code should never produce garbage. |
2022-01-20 05:59:15 +0100 | <glguy> | It'd be cleaner if languges that didn't have proper number types represented the numbers they found in json as strings |
2022-01-20 05:59:18 +0100 | <c_wraith> | It's amazing how much damage has been done because people believe Postel's law is a good idea |
2022-01-20 05:59:22 +0100 | CiaoSen | (~Jura@p200300c95737a2002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 250 seconds) |
2022-01-20 05:59:49 +0100 | <glguy> | rather than languages with proper number types having to encode numbers as strings |
2022-01-20 06:00:03 +0100 | slowButPresent | (~slowButPr@user/slowbutpresent) (Quit: leaving) |
2022-01-20 06:00:06 +0100 | bontaq | (~user@ool-45779fe5.dyn.optonline.net) |
2022-01-20 06:00:32 +0100 | <Axman6> | Google has some protocol, IIRC for replacing NTP, which has as part of its specification that servers _will_ send garbage occasionally, so that implementations are forced to actually deal with them |
2022-01-20 06:01:06 +0100 | <EvanR> | nice, so you're violating the spec unless you send some garbage sometimes |
2022-01-20 06:01:09 +0100 | <EvanR> | at least twice a week |
2022-01-20 06:01:31 +0100 | <glguy> | panic: no panics |
2022-01-20 06:02:08 +0100 | Sgeo | (~Sgeo@user/sgeo) |
2022-01-20 06:03:29 +0100 | Sgeo_ | (~Sgeo@user/sgeo) (Ping timeout: 256 seconds) |
2022-01-20 06:04:24 +0100 | ChanServ | -o Axman6 |
2022-01-20 06:04:46 +0100 | <Axman6> | Well that was fun while it lasted |
2022-01-20 06:05:42 +0100 | <ephemient> | IIRC that's a thing in TLS 1.3 as well, sending random values in some places to try to prevent all the middleboxes from fixating on specific patterns that prevent further evolution of the protocol (since that's been a huge thorn in updating SSL) |
2022-01-20 06:06:22 +0100 | <ephemient> | the real world sucks :( |
2022-01-20 06:06:32 +0100 | [itchyjunk] | (~itchyjunk@user/itchyjunk/x-7353470) (Remote host closed the connection) |
2022-01-20 06:08:17 +0100 | geranim0 | (~geranim0@modemcable242.171-178-173.mc.videotron.ca) (Ping timeout: 240 seconds) |
2022-01-20 06:09:48 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-20 06:16:28 +0100 | raym | (~raym@user/raym) |
2022-01-20 06:19:39 +0100 | tommd | (~tommd@67-42-147-226.ptld.qwest.net) |
2022-01-20 06:24:09 +0100 | fef | (~thedawn@user/thedawn) (Ping timeout: 276 seconds) |
2022-01-20 06:26:57 +0100 | <EvanR> | and is deeply magical |
2022-01-20 06:33:10 +0100 | deadmarshal | (~deadmarsh@95.38.3.145) (Ping timeout: 250 seconds) |
2022-01-20 06:33:30 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) |
2022-01-20 06:34:05 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) (Ping timeout: 256 seconds) |
2022-01-20 06:34:25 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) |
2022-01-20 06:35:47 +0100 | xkuru | (~xkuru@user/xkuru) |
2022-01-20 06:37:17 +0100 | xff0x | (~xff0x@2001:1a81:5280:6800:37be:8663:af54:fc92) (Ping timeout: 240 seconds) |
2022-01-20 06:38:03 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) (Ping timeout: 256 seconds) |
2022-01-20 06:38:16 +0100 | xff0x | (~xff0x@2001:1a81:5280:6800:a068:90b7:b174:1f03) |
2022-01-20 06:39:54 +0100 | <qrpnxz> | Just realized my scanl can become a traversal with a State monad arrow. Don't know if this is for the better, but it's pretty cool. |
2022-01-20 06:40:14 +0100 | deadmarshal | (~deadmarsh@95.38.3.145) |
2022-01-20 06:42:34 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) |
2022-01-20 06:47:02 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) (Ping timeout: 250 seconds) |
2022-01-20 07:07:01 +0100 | kilolympus | (~kilolympu@31.205.200.235) |
2022-01-20 07:08:37 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) (Ping timeout: 240 seconds) |
2022-01-20 07:16:10 +0100 | chomwitt | (~chomwitt@2a02:587:dc0b:200:12c3:7bff:fe6d:d374) |
2022-01-20 07:20:10 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-20 07:20:43 +0100 | vglfr | (~vglfr@88.155.46.9) |
2022-01-20 07:21:57 +0100 | myShoggoth | (~myShoggot@97-120-67-120.ptld.qwest.net) (Ping timeout: 240 seconds) |
2022-01-20 07:27:07 +0100 | tommd | (~tommd@67-42-147-226.ptld.qwest.net) (Remote host closed the connection) |
2022-01-20 07:27:16 +0100 | tommd | (~tommd@67-42-147-226.ptld.qwest.net) |
2022-01-20 07:27:56 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 07:27:56 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 07:27:56 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 07:30:13 +0100 | boxscape_ | (~boxscape_@p4ff0b9d5.dip0.t-ipconnect.de) (Quit: Connection closed) |
2022-01-20 07:32:24 +0100 | Jing | (~hedgehog@240e:390:7c53:a7e1:c8cd:ea83:c8cd:4ca3) |
2022-01-20 07:33:01 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-20 07:33:16 +0100 | takuan | (~takuan@178-116-218-225.access.telenet.be) |
2022-01-20 07:33:32 +0100 | <pavonia> | Is there a function in base to efficiently test if a list has a length of at least n elements? |
2022-01-20 07:35:22 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) |
2022-01-20 07:37:03 +0100 | <ephemient> | not . null . drop (n - 1) |
2022-01-20 07:40:40 +0100 | <pavonia> | Hhm, interesting |
2022-01-20 07:41:16 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 07:48:22 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-20 07:48:40 +0100 | wei2912 | (~wei2912@138.75.71.147) |
2022-01-20 07:49:00 +0100 | _ht | (~quassel@2a02:a468:b619:1:4334:88f2:ba01:c6e) |
2022-01-20 07:49:12 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) |
2022-01-20 07:52:17 +0100 | vglfr | (~vglfr@88.155.46.9) (Ping timeout: 256 seconds) |
2022-01-20 07:56:23 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) |
2022-01-20 08:01:08 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) (Ping timeout: 250 seconds) |
2022-01-20 08:01:34 +0100 | YoungFrog | (~youngfrog@2a02:a03f:c21b:f900:9952:728:f039:79c2) (Ping timeout: 250 seconds) |
2022-01-20 08:01:53 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-20 08:03:03 +0100 | tommd | (~tommd@67-42-147-226.ptld.qwest.net) (Ping timeout: 256 seconds) |
2022-01-20 08:11:43 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) (Quit: coot) |
2022-01-20 08:11:59 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) |
2022-01-20 08:12:33 +0100 | Akiva | (~Akiva@user/Akiva) |
2022-01-20 08:14:16 +0100 | Guest8079 | (~Guest80@host-79-36-216-236.retail.telecomitalia.it) |
2022-01-20 08:14:49 +0100 | dut | (~dut@user/dut) (Read error: Connection reset by peer) |
2022-01-20 08:15:42 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 256 seconds) |
2022-01-20 08:24:20 +0100 | dut | (~dut@user/dut) |
2022-01-20 08:24:50 +0100 | cyphase | (~cyphase@user/cyphase) (Ping timeout: 268 seconds) |
2022-01-20 08:25:16 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-20 08:29:40 +0100 | cyphase | (~cyphase@user/cyphase) |
2022-01-20 08:29:45 +0100 | Sgeo | (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
2022-01-20 08:32:41 +0100 | wei2912 | (~wei2912@138.75.71.147) (Remote host closed the connection) |
2022-01-20 08:32:58 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) |
2022-01-20 08:33:12 +0100 | Erutuon | (~Erutuon@user/erutuon) (Ping timeout: 250 seconds) |
2022-01-20 08:36:05 +0100 | Erutuon | (~Erutuon@user/erutuon) |
2022-01-20 08:36:57 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) (Ping timeout: 240 seconds) |
2022-01-20 08:37:06 +0100 | razetime | (~quassel@49.207.203.87) |
2022-01-20 08:39:01 +0100 | chomwitt | (~chomwitt@2a02:587:dc0b:200:12c3:7bff:fe6d:d374) (Ping timeout: 268 seconds) |
2022-01-20 08:40:57 +0100 | zmt00 | (~zmt00@user/zmt00) (Ping timeout: 240 seconds) |
2022-01-20 08:41:27 +0100 | fendor | (~fendor@77.119.169.94.wireless.dyn.drei.com) |
2022-01-20 08:41:34 +0100 | you | (~ShmoSeph@173-167-220-193-ip-static.hfc.comcastbusiness.net) |
2022-01-20 08:41:35 +0100 | michalz | (~michalz@185.246.204.107) |
2022-01-20 08:42:18 +0100 | n3t | (n3t@s45.mydevil.net) |
2022-01-20 08:42:54 +0100 | dolio | (~dolio@130.44.130.54) (Ping timeout: 256 seconds) |
2022-01-20 08:43:06 +0100 | dolio | (~dolio@130.44.130.54) |
2022-01-20 08:44:54 +0100 | vysn | (~vysn@user/vysn) (Ping timeout: 250 seconds) |
2022-01-20 08:45:29 +0100 | spaceseller | (~spacesell@31.147.205.13) |
2022-01-20 08:46:13 +0100 | dhouthoo | (~dhouthoo@178-117-36-167.access.telenet.be) |
2022-01-20 08:48:47 +0100 | johnsonz | (~bc8147f2@cerf.good1.com) (Quit: CGI:IRC (Session timeout)) |
2022-01-20 08:51:21 +0100 | deadmarshal | (~deadmarsh@95.38.3.145) (Ping timeout: 268 seconds) |
2022-01-20 08:52:34 +0100 | zmt00 | (~zmt00@user/zmt00) |
2022-01-20 08:54:46 +0100 | simendsjo | (~user@84.211.91.241) |
2022-01-20 08:55:36 +0100 | alMalsamo | (~alMalsamo@gateway/tor-sasl/almalsamo) (Ping timeout: 276 seconds) |
2022-01-20 08:56:10 +0100 | jespada | (~jespada@87.74.36.188) (Ping timeout: 250 seconds) |
2022-01-20 08:56:25 +0100 | gehmehgeh | (~user@user/gehmehgeh) |
2022-01-20 08:56:57 +0100 | zmt00 | (~zmt00@user/zmt00) (Ping timeout: 240 seconds) |
2022-01-20 08:57:35 +0100 | obfusk_ | (~quassel@a82-161-150-56.adsl.xs4all.nl) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
2022-01-20 08:57:58 +0100 | obfusk | (~quassel@a82-161-150-56.adsl.xs4all.nl) |
2022-01-20 08:58:27 +0100 | zaquest | (~notzaques@5.130.79.72) (Remote host closed the connection) |
2022-01-20 08:58:38 +0100 | jespada | (~jespada@87.74.36.188) |
2022-01-20 08:58:46 +0100 | d0ku | (~d0ku@178.43.152.233.ipv4.supernova.orange.pl) |
2022-01-20 09:00:33 +0100 | mncheck | (~mncheck@193.224.205.254) |
2022-01-20 09:00:36 +0100 | mncheck | (~mncheck@193.224.205.254) (Remote host closed the connection) |
2022-01-20 09:02:20 +0100 | zaquest | (~notzaques@5.130.79.72) |
2022-01-20 09:04:00 +0100 | shriekingnoise | (~shrieking@201.231.16.156) (Quit: Quit) |
2022-01-20 09:06:36 +0100 | monochrom | (trebla@216.138.220.146) (Quit: NO CARRIER) |
2022-01-20 09:07:34 +0100 | ubert | (~Thunderbi@p200300ecdf099440f4ae4d8df8b0fc6d.dip0.t-ipconnect.de) |
2022-01-20 09:09:31 +0100 | alp | (~alp@user/alp) |
2022-01-20 09:10:36 +0100 | `2jt | (~jtomas@10.red-83-58-228.dynamicip.rima-tde.net) |
2022-01-20 09:14:29 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) |
2022-01-20 09:17:57 +0100 | shapr | (~user@2601:7c0:c37c:46d0:d31:791c:8c24:e54b) (Ping timeout: 240 seconds) |
2022-01-20 09:19:08 +0100 | Erutuon | (~Erutuon@user/erutuon) (Ping timeout: 250 seconds) |
2022-01-20 09:21:36 +0100 | chomwitt | (~chomwitt@athedsl-15695.home.otenet.gr) |
2022-01-20 09:24:43 +0100 | mc47 | (~mc47@xmonad/TheMC47) |
2022-01-20 09:28:47 +0100 | monochrom | (trebla@216.138.220.146) |
2022-01-20 09:29:03 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) |
2022-01-20 09:29:57 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) (Ping timeout: 240 seconds) |
2022-01-20 09:30:39 +0100 | timCF | (~timCF@200-149-20-81.sta.estpak.ee) (Quit: leaving) |
2022-01-20 09:32:08 +0100 | cfricke | (~cfricke@user/cfricke) |
2022-01-20 09:33:48 +0100 | chele | (~chele@user/chele) |
2022-01-20 09:38:37 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-20 09:39:47 +0100 | neverwas | (jpneverwas@swissbox.unperson.link) (Remote host closed the connection) |
2022-01-20 09:40:50 +0100 | <gentauro> | anybody know if `long_list_align: multiline` is "disabled" in `stylish-haskell +0.12`? |
2022-01-20 09:41:42 +0100 | <gentauro> | it seems to go for `inline` no matter which value I assign to `long_list_align` |
2022-01-20 09:47:29 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:6819:b864:4bf9:4b6e) (Remote host closed the connection) |
2022-01-20 09:49:49 +0100 | machinedgod | (~machinedg@24.105.81.50) |
2022-01-20 09:50:49 +0100 | spaceseller | (~spacesell@31.147.205.13) (Leaving) |
2022-01-20 09:52:09 +0100 | <meer> | also evanr: why the hell do people not recommend Haskell: The Craft of Functional Programming? |
2022-01-20 09:52:12 +0100 | <meer> | It's a GREAT book |
2022-01-20 09:52:14 +0100 | meer | Inst |
2022-01-20 09:52:30 +0100 | <Inst> | It's a shame it's obsolete |
2022-01-20 09:52:40 +0100 | <Inst> | or rather pretty damn old, it's just going through a lot of comp sci concepts |
2022-01-20 09:54:12 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 09:54:12 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 09:54:12 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 09:55:25 +0100 | <caro> | Ho I didn't know this book :D |
2022-01-20 09:55:41 +0100 | max22- | (~maxime@2a01cb0883359800fa0f988ba1000107.ipv6.abo.wanadoo.fr) |
2022-01-20 09:56:36 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) |
2022-01-20 09:57:20 +0100 | YoungFrog | (~youngfrog@39.129-180-91.adsl-dyn.isp.belgacom.be) |
2022-01-20 09:58:57 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 240 seconds) |
2022-01-20 10:00:31 +0100 | <Inst> | https://www.amazon.com/Haskell-Functional-Programming-International-Computer/dp/0201882957 |
2022-01-20 10:00:39 +0100 | <Inst> | it's more for my needs, i.e, looking for intro comp sci with Haskell book |
2022-01-20 10:00:53 +0100 | <Inst> | also ANU's needs, they use it in their intro comp sci with Haskell book |
2022-01-20 10:00:58 +0100 | cfricke | (~cfricke@user/cfricke) (Quit: WeeChat 3.3) |
2022-01-20 10:02:26 +0100 | Erutuon | (~Erutuon@user/erutuon) |
2022-01-20 10:02:42 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 10:05:37 +0100 | kuribas | (~user@ptr-25vy0i99jv0pb0h8fdc.18120a2.ip6.access.telenet.be) |
2022-01-20 10:06:44 +0100 | tomsmeding | reads that URL and sees "International Computer", *nods* |
2022-01-20 10:12:38 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
2022-01-20 10:15:42 +0100 | briandaed | (~briandaed@185.234.208.208.r.toneticgroup.pl) |
2022-01-20 10:16:39 +0100 | <caro> | I have found the PDF :D |
2022-01-20 10:17:44 +0100 | geekosaur | (~geekosaur@xmonad/geekosaur) (Killed (NickServ (GHOST command used by allbery_b))) |
2022-01-20 10:17:44 +0100 | allbery_b | (~geekosaur@xmonad/geekosaur) |
2022-01-20 10:17:47 +0100 | allbery_b | geekosaur |
2022-01-20 10:19:37 +0100 | bontaq | (~user@ool-45779fe5.dyn.optonline.net) (Ping timeout: 240 seconds) |
2022-01-20 10:19:57 +0100 | you | (~ShmoSeph@173-167-220-193-ip-static.hfc.comcastbusiness.net) (Quit: Textual IRC Client: www.textualapp.com) |
2022-01-20 10:20:22 +0100 | alMalsamo | (~alMalsamo@gateway/tor-sasl/almalsamo) |
2022-01-20 10:23:01 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 256 seconds) |
2022-01-20 10:23:25 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
2022-01-20 10:24:59 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 10:24:59 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 10:24:59 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 10:27:05 +0100 | neverwas | (jpneverwas@swissbox.unperson.link) |
2022-01-20 10:29:15 +0100 | simendsjo | (~user@84.211.91.241) (Ping timeout: 256 seconds) |
2022-01-20 10:29:49 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-20 10:31:45 +0100 | AlexNoo_ | AlexNoo |
2022-01-20 10:33:40 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 250 seconds) |
2022-01-20 10:34:10 +0100 | you | (~ShmoSeph@173-167-220-193-ip-static.hfc.comcastbusiness.net) |
2022-01-20 10:34:34 +0100 | razetime | (~quassel@49.207.203.87) (Read error: Connection reset by peer) |
2022-01-20 10:34:45 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) |
2022-01-20 10:34:55 +0100 | gdd | (~gdd@129.199.146.230) (Ping timeout: 256 seconds) |
2022-01-20 10:35:21 +0100 | gdd | (~gdd@129.199.146.230) |
2022-01-20 10:35:47 +0100 | razetime | (~quassel@49.207.203.87) |
2022-01-20 10:39:27 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) (Ping timeout: 256 seconds) |
2022-01-20 10:40:49 +0100 | <Axman6> | We generaqlly don't encourage stealing the creative works of people that have contributed to the Haskell community so substancially caro. If you want to be that sort of person, then keep it to yourself |
2022-01-20 10:43:11 +0100 | phma | (phma@2001:5b0:215d:e318:4fbc:412:b7cd:6bd5) (Read error: Connection reset by peer) |
2022-01-20 10:43:36 +0100 | phma | (phma@2001:5b0:215d:e318:4fbc:412:b7cd:6bd5) |
2022-01-20 10:43:44 +0100 | <you> | huh? |
2022-01-20 10:44:05 +0100 | mmhat | (~mmh@55d49b67.access.ecotel.net) |
2022-01-20 10:48:12 +0100 | pera | (~pera@user/pera) |
2022-01-20 10:48:23 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:b4a5:7793:d27c:8dec) |
2022-01-20 10:48:36 +0100 | MajorBiscuit | (~MajorBisc@wlan-145-94-218-113.wlan.tudelft.nl) |
2022-01-20 10:51:12 +0100 | darchitect | (~darchitec@2a00:23c6:3584:df00:8fb:65a6:c5ec:35ce) (Quit: WeeChat 3.4) |
2022-01-20 10:51:37 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) (Ping timeout: 240 seconds) |
2022-01-20 10:52:37 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:b4a5:7793:d27c:8dec) (Ping timeout: 240 seconds) |
2022-01-20 10:52:37 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480:1b88:50f:dae0:9293) (Ping timeout: 240 seconds) |
2022-01-20 10:55:17 +0100 | __monty__ | (~toonn@user/toonn) |
2022-01-20 10:55:47 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 10:55:47 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 10:55:47 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 10:55:53 +0100 | Akiva | (~Akiva@user/Akiva) (Ping timeout: 256 seconds) |
2022-01-20 10:56:05 +0100 | you | (~ShmoSeph@173-167-220-193-ip-static.hfc.comcastbusiness.net) (Remote host closed the connection) |
2022-01-20 10:59:53 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) |
2022-01-20 11:00:03 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 11:00:59 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-20 11:04:31 +0100 | tzh | (~tzh@c-24-21-73-154.hsd1.wa.comcast.net) (Quit: zzz) |
2022-01-20 11:06:35 +0100 | yauhsien | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) |
2022-01-20 11:09:39 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-20 11:11:45 +0100 | yauhsien | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) (Ping timeout: 256 seconds) |
2022-01-20 11:16:22 +0100 | econo | (uid147250@user/econo) (Quit: Connection closed for inactivity) |
2022-01-20 11:24:24 +0100 | <maerwald> | Axman6: stealing? |
2022-01-20 11:26:33 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 11:31:17 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 240 seconds) |
2022-01-20 11:33:05 +0100 | Gurkenglas | (~Gurkengla@dslb-002-203-144-204.002.203.pools.vodafone-ip.de) |
2022-01-20 11:36:43 +0100 | <[exa]> | you wouldn't steal a haskell |
2022-01-20 11:36:46 +0100 | <nshepperd> | piracy on the high seas |
2022-01-20 11:38:02 +0100 | random-jellyfish | (~random-je@user/random-jellyfish) |
2022-01-20 11:38:37 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:7985:a982:d93:11f) |
2022-01-20 11:39:01 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) |
2022-01-20 11:40:01 +0100 | <maerwald> | whether downloading a PDF from the internet, that is under copyright, is really stealing isn't an easy call and depends on country etc. |
2022-01-20 11:40:10 +0100 | razetime | (~quassel@49.207.203.87) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
2022-01-20 11:40:18 +0100 | <maerwald> | better to not make assumptions |
2022-01-20 11:40:45 +0100 | <maerwald> | the author also might have given explicit permission to certain websites |
2022-01-20 11:43:18 +0100 | Lord_of_Life_ | (~Lord@user/lord-of-life/x-2819915) |
2022-01-20 11:44:14 +0100 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 256 seconds) |
2022-01-20 11:46:08 +0100 | Lord_of_Life_ | Lord_of_Life |
2022-01-20 11:49:30 +0100 | mvk | (~mvk@2607:fea8:5cdd:f000::55f8) |
2022-01-20 11:52:10 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) (Ping timeout: 256 seconds) |
2022-01-20 11:55:17 +0100 | Inst | (~delicacie@2601:6c4:4080:3f80:40d5:abfe:845e:ad8f) (Ping timeout: 240 seconds) |
2022-01-20 11:55:34 +0100 | chomwitt | (~chomwitt@athedsl-15695.home.otenet.gr) (Ping timeout: 256 seconds) |
2022-01-20 11:55:57 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) (Ping timeout: 240 seconds) |
2022-01-20 11:57:20 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 11:57:20 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 11:57:20 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 12:01:05 +0100 | alx741 | (~alx741@157.100.93.160) |
2022-01-20 12:02:11 +0100 | ardell | (~ardell@user/ardell) |
2022-01-20 12:02:22 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-20 12:03:53 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 256 seconds) |
2022-01-20 12:04:04 +0100 | raym | (~raym@user/raym) (Ping timeout: 256 seconds) |
2022-01-20 12:05:42 +0100 | raym | (~raym@user/raym) |
2022-01-20 12:07:11 +0100 | ksqsf | (~user@2001:da8:d800:611:c47:42e1:e1e6:df73) |
2022-01-20 12:10:31 +0100 | zer0bitz | (~zer0bitz@2001:2003:f444:a000:295b:27c3:87b1:2b8f) |
2022-01-20 12:10:37 +0100 | mvk | (~mvk@2607:fea8:5cdd:f000::55f8) (Ping timeout: 240 seconds) |
2022-01-20 12:19:34 +0100 | xb0o2 | (~xb0o2@user/xb0o2) |
2022-01-20 12:19:50 +0100 | Erutuon | (~Erutuon@user/erutuon) (Ping timeout: 250 seconds) |
2022-01-20 12:22:42 +0100 | <ski> | (stealing implies removing access) |
2022-01-20 12:23:51 +0100 | phma | (phma@2001:5b0:215d:e318:4fbc:412:b7cd:6bd5) (Read error: Connection reset by peer) |
2022-01-20 12:24:19 +0100 | <[exa]> | [high profile music brand lawyer voice:] rEmOvInG AcCeSs tO rEvEnUe MoNeYs!! |
2022-01-20 12:24:52 +0100 | fef | (~thedawn@user/thedawn) |
2022-01-20 12:25:21 +0100 | vysn | (~vysn@user/vysn) |
2022-01-20 12:25:59 +0100 | michalz | (~michalz@185.246.204.107) (Ping timeout: 256 seconds) |
2022-01-20 12:27:29 +0100 | rusrushal13 | (~rusrushal@2409:4056:193:1b10:a38a:9a8:8f21:e6f1) |
2022-01-20 12:32:42 +0100 | fef | (~thedawn@user/thedawn) (Ping timeout: 276 seconds) |
2022-01-20 12:34:00 +0100 | michalz | (~michalz@185.246.204.37) |
2022-01-20 12:34:18 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 12:34:18 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 12:34:18 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 12:34:33 +0100 | yassernasc | (~yassernas@2804:29b8:505a:f33d:7937:b295:da60:ef94) |
2022-01-20 12:38:12 +0100 | jakalx | (~jakalx@base.jakalx.net) () |
2022-01-20 12:39:35 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-20 12:44:26 +0100 | SummerSonw | (~The_viole@203.77.49.232) |
2022-01-20 12:45:15 +0100 | random-jellyfish | (~random-je@user/random-jellyfish) (Ping timeout: 256 seconds) |
2022-01-20 12:46:19 +0100 | <absence> | has anyone used nix to build docker images from haskell code? i have this peculiar problem that if my .cabal file contains both an executable and a library (only used by the executable), the resulting docker image contains ghc, gcc, +++ and is enormous, whereas if the .cabal file only contains an executable, the docker image contains only what's necessary and is relatively small |
2022-01-20 12:47:44 +0100 | <absence> | i imagine it's something about libraries depending on ghc because they're not particularily useful on their own |
2022-01-20 12:49:32 +0100 | <maerwald> | if you link dynamically maybe |
2022-01-20 12:49:59 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:e9df:c2d7:9ffb:4631) |
2022-01-20 12:50:56 +0100 | lavaman | (~lavaman@98.38.249.169) (Remote host closed the connection) |
2022-01-20 12:53:54 +0100 | <jackdk> | statically link with haskell.nix, but mind lgpl concerns if you distribute images |
2022-01-20 12:54:17 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:e9df:c2d7:9ffb:4631) (Ping timeout: 240 seconds) |
2022-01-20 12:55:32 +0100 | ksqsf | (~user@2001:da8:d800:611:c47:42e1:e1e6:df73) (Ping timeout: 240 seconds) |
2022-01-20 12:55:46 +0100 | <absence> | hm, not sure i understand. the executable and the library are both "my" code, why would there be lgpl concerns? just to make sure we're on the same page, everything works if i only have an executable in the cabal file. the problems only occur if i add a library as well |
2022-01-20 12:57:06 +0100 | <[exa]> | absence: you might be packing up and distributing other people's code too, if you have dependencies |
2022-01-20 12:57:23 +0100 | `2jt | (~jtomas@10.red-83-58-228.dynamicip.rima-tde.net) (Remote host closed the connection) |
2022-01-20 12:59:42 +0100 | <absence> | [exa]: sure, but that's true in general? anyway, for the sake of argument, let's say i have no dependencies, because this is reproducable when only depending on base |
2022-01-20 13:00:53 +0100 | <[exa]> | then I guess you should be okay |
2022-01-20 13:01:15 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) |
2022-01-20 13:01:19 +0100 | <[exa]> | the point was to remember checking licenses if you decide to pack a statically linked blob and send it to people |
2022-01-20 13:01:22 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 13:02:50 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) |
2022-01-20 13:03:19 +0100 | <absence> | i don't think i will be doing that, i just want to make a docker image that doesn't include ghc and an entire build environment |
2022-01-20 13:03:55 +0100 | whatsupdoc | (uid509081@id-509081.hampstead.irccloud.com) (Quit: Connection closed for inactivity) |
2022-01-20 13:04:01 +0100 | Inst | (~delicacie@c-98-208-218-119.hsd1.fl.comcast.net) |
2022-01-20 13:04:08 +0100 | johnjaye | (~pi@173.209.65.233) (Ping timeout: 256 seconds) |
2022-01-20 13:07:39 +0100 | <yushyin> | gmp is lgpl3/gpl2 |
2022-01-20 13:08:29 +0100 | Inst | (~delicacie@c-98-208-218-119.hsd1.fl.comcast.net) (Ping timeout: 256 seconds) |
2022-01-20 13:09:55 +0100 | dut | (~dut@user/dut) (Quit: Leaving) |
2022-01-20 13:10:02 +0100 | Neuromancer | (~Neuromanc@user/neuromancer) (Ping timeout: 240 seconds) |
2022-01-20 13:13:17 +0100 | cyphase | (~cyphase@user/cyphase) (Ping timeout: 240 seconds) |
2022-01-20 13:13:32 +0100 | johnsonz | (~bc8147f2@cerf.good1.com) |
2022-01-20 13:14:37 +0100 | pera | (~pera@user/pera) (Ping timeout: 240 seconds) |
2022-01-20 13:17:29 +0100 | ksqsf | (~user@2001:da8:d800:604:d415:c6b:884d:7d38) |
2022-01-20 13:18:49 +0100 | SummerSonw | (~The_viole@203.77.49.232) (Quit: Leaving) |
2022-01-20 13:19:31 +0100 | chomwitt | (~chomwitt@athedsl-15695.home.otenet.gr) |
2022-01-20 13:20:56 +0100 | Guest8079 | (~Guest80@host-79-36-216-236.retail.telecomitalia.it) (Quit: Client closed) |
2022-01-20 13:21:29 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-20 13:22:04 +0100 | jakalx | (~jakalx@base.jakalx.net) |
2022-01-20 13:25:37 +0100 | lavaman | (~lavaman@98.38.249.169) (Ping timeout: 240 seconds) |
2022-01-20 13:27:13 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) |
2022-01-20 13:42:24 +0100 | Guest9668 | (~Guest96@144-124-99-115.pip.aber.ac.uk) |
2022-01-20 13:43:09 +0100 | <Guest9668> | Anyone able to hop in a dm and help me out with some code? |
2022-01-20 13:45:01 +0100 | cfricke | (~cfricke@user/cfricke) |
2022-01-20 13:45:23 +0100 | <Guest9668> | Hello? |
2022-01-20 13:45:50 +0100 | ski | . o O ( Don't ask to ask ) |
2022-01-20 13:45:52 +0100 | <[exa]> | what's the problem? |
2022-01-20 13:46:17 +0100 | <hpc> | instead ask to ask to ask :D |
2022-01-20 13:46:18 +0100 | <Guest9668> | If I send some code in DM could you help me get it working? |
2022-01-20 13:46:32 +0100 | <hpc> | you can use the paste site in the topic and post it here |
2022-01-20 13:47:13 +0100 | <ski> | i'd think many people would want to know more about the problem, before deciding that they may be able to offer help/advice |
2022-01-20 13:47:57 +0100 | <Guest9668> | https://paste.tomsmeding.com/RCVPaXMr |
2022-01-20 13:48:16 +0100 | <[exa]> | uuh is that an exam? :] |
2022-01-20 13:48:31 +0100 | <Guest9668> | open book |
2022-01-20 13:48:55 +0100 | <ski> | `x' is an element of the list. it has type `a' |
2022-01-20 13:49:07 +0100 | <ski> | what is the expected return type of the function ? |
2022-01-20 13:49:33 +0100 | <Guest9668> | char |
2022-01-20 13:50:20 +0100 | <ski> | it doesn't look to me like `get n xs' would have type `Char' |
2022-01-20 13:50:59 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) (Ping timeout: 256 seconds) |
2022-01-20 13:52:01 +0100 | <Guest9668> | If possible, the function is supposed to return the item at position n in a list |
2022-01-20 13:52:33 +0100 | <ski> | yea, that was already obvious |
2022-01-20 13:52:48 +0100 | Guest52 | (~Guest52@80-100-97-100.ip.xs4all.nl) |
2022-01-20 13:52:48 +0100 | ub | (~Thunderbi@p200300ecdf0994402d77270a91cab57e.dip0.t-ipconnect.de) |
2022-01-20 13:52:49 +0100 | <Guest9668> | My bad, I just thought it would help |
2022-01-20 13:53:11 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) |
2022-01-20 13:53:15 +0100 | <[exa]> | how does the function differentiate between returning "negative" and "positive" answer? |
2022-01-20 13:53:46 +0100 | <[exa]> | for negative you have already Nothign there, what would you expect in the positive case? (danger: it needs to have the same type as Nothing) |
2022-01-20 13:54:28 +0100 | ski | 's pretty sure most of us already know how to fix the code .. the problem is rather, how to guide you towards the answer in the most helpful way, without spoiling it, by simply blurting it out |
2022-01-20 13:55:07 +0100 | <Guest9668> | I understand, I'm not expecting to be spoon fed answers, rather be guided to a correct solution |
2022-01-20 13:55:25 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) (Quit: = "") |
2022-01-20 13:55:34 +0100 | <[exa]> | we might translate the compiler message to something a bit more readable tho |
2022-01-20 13:55:44 +0100 | <Guest9668> | Yeah thats my main struggle with Haskell |
2022-01-20 13:56:12 +0100 | <[exa]> | in short it complains that e.g. `get n [1,2,3,4,5]` can return either `5` or `Nothing` which is not the same type, thus it breaks typechecking |
2022-01-20 13:56:35 +0100 | <Guest9668> | In response to what you said about negative and positive answer, what do you mean? negative as no answer and positive as any int? |
2022-01-20 13:56:44 +0100 | <ski> | yes |
2022-01-20 13:56:51 +0100 | <Guest9668> | thats what I thought, Im just unsure what to do to solve it |
2022-01-20 13:57:02 +0100 | <ski> | failure (to find the element) vs. success (element find) |
2022-01-20 13:57:03 +0100 | <Guest9668> | make it return 0 intead of nothing? |
2022-01-20 13:57:18 +0100 | <ski> | what if there's a `0' as an element in the list ? |
2022-01-20 13:57:32 +0100 | <[exa]> | have a look at the type signature above, what is the _type_ it returns? (googling the definition of that type will guide you) |
2022-01-20 13:57:42 +0100 | <ski> | what if the list doesn't contain numbers ? |
2022-01-20 13:57:47 +0100 | <Hecate> | Guest9668: is Dr. Clare still in charge of the Haskell module at Aberystwyth? |
2022-01-20 13:59:29 +0100 | <Guest9668> | ? |
2022-01-20 13:59:41 +0100 | max22- | (~maxime@2a01cb0883359800fa0f988ba1000107.ipv6.abo.wanadoo.fr) (Ping timeout: 268 seconds) |
2022-01-20 14:00:44 +0100 | Alex_test | (~al_test@94.233.241.14) (Quit: ;-) |
2022-01-20 14:00:47 +0100 | AlexZenon | (~alzenon@94.233.241.14) (Quit: ;-) |
2022-01-20 14:01:03 +0100 | AlexNoo | (~AlexNoo@94.233.241.14) (Quit: Leaving) |
2022-01-20 14:01:41 +0100 | <Guest9668> | Can I just return null? https://wiki.haskell.org/Maybe |
2022-01-20 14:01:53 +0100 | <Guest9668> | [exa] |
2022-01-20 14:02:18 +0100 | <ski> | there is no "null" in Haskell, in the sense of `null' in Java, `NULL' in C, and similar in various other languages |
2022-01-20 14:02:51 +0100 | <ski> | the closest in this context would be `Nothing' (but there's important differences) |
2022-01-20 14:03:17 +0100 | <[exa]> | Guest9668: the "null" is Nothing, that's right, you're having problems with the non-null case |
2022-01-20 14:03:20 +0100 | <ski> | @src Maybe |
2022-01-20 14:03:20 +0100 | <lambdabot> | data Maybe a = Nothing | Just a |
2022-01-20 14:04:04 +0100 | jkaye | (~jkaye@2601:281:200:1958:dab2:e344:8506:e5dc) |
2022-01-20 14:04:21 +0100 | Codaraxis__ | (~Codaraxis@user/codaraxis) |
2022-01-20 14:04:53 +0100 | <Guest9668> | [exa]: So what line is that issue on? `get :: Int -> [a] -> Maybe a` ? |
2022-01-20 14:04:57 +0100 | <ski> | @type [2 :: Int,Nothing,3 :: Int] |
2022-01-20 14:04:58 +0100 | <lambdabot> | error: |
2022-01-20 14:04:58 +0100 | <lambdabot> | • Couldn't match expected type ‘Int’ with actual type ‘Maybe a0’ |
2022-01-20 14:04:58 +0100 | <lambdabot> | • In the expression: Nothing |
2022-01-20 14:05:06 +0100 | <ski> | @type [Just (2 :: Int),Nothing,Just (3 :: Int)] |
2022-01-20 14:05:08 +0100 | <lambdabot> | [Maybe Int] |
2022-01-20 14:05:37 +0100 | <ski> | Guest9668 : the error message indicates that it's found a problem on a specific line |
2022-01-20 14:05:48 +0100 | <Guest9668> | 5 |
2022-01-20 14:05:59 +0100 | <Guest9668> | '5 | get 0 (x:xs) = x' |
2022-01-20 14:06:10 +0100 | <ski> | first task is to understand the problem that it's found |
2022-01-20 14:06:35 +0100 | <ski> | next, to determine whether an appropriate change should be applied there, or perhaps somewhere else (maybe multiple places) |
2022-01-20 14:06:50 +0100 | <Guest9668> | so the nothing is fine, the error is where there's a value to return? |
2022-01-20 14:07:29 +0100 | <ski> | all defining equations ("branches") of a function definition must return values of the same single common return type |
2022-01-20 14:08:20 +0100 | jkaye | (~jkaye@2601:281:200:1958:dab2:e344:8506:e5dc) (Remote host closed the connection) |
2022-01-20 14:08:34 +0100 | jkaye | (~jkaye@2601:281:200:1958:3ec:48cd:412b:4566) |
2022-01-20 14:08:35 +0100 | fef | (~thedawn@user/thedawn) |
2022-01-20 14:09:20 +0100 | <ski> | (also, if there's a type signature, then the specified return type there must also agree with the common return type of the defining equations) |
2022-01-20 14:10:20 +0100 | jkaye | (~jkaye@2601:281:200:1958:3ec:48cd:412b:4566) (Remote host closed the connection) |
2022-01-20 14:10:37 +0100 | fendor_ | (~fendor@178.165.192.6.wireless.dyn.drei.com) |
2022-01-20 14:10:57 +0100 | <Guest9668> | That makes sense in a programmatic sense, I just dont understand how to apply that to haskell |
2022-01-20 14:11:18 +0100 | <ski> | what is the specified return type, in the type signature ? |
2022-01-20 14:11:39 +0100 | <[exa]> | hint: ^this is a good question^ |
2022-01-20 14:12:00 +0100 | <Guest9668> | int? |
2022-01-20 14:12:10 +0100 | <[exa]> | is Nothing an int? |
2022-01-20 14:12:13 +0100 | <ski> | (next question would be : what is the actual return type, for each of the three defining equations ?) |
2022-01-20 14:12:27 +0100 | <Guest9668> | no it is not. THere is no return type? |
2022-01-20 14:12:46 +0100 | <ski> | you know how to read type signatures ? |
2022-01-20 14:13:16 +0100 | fendor | (~fendor@77.119.169.94.wireless.dyn.drei.com) (Ping timeout: 256 seconds) |
2022-01-20 14:14:24 +0100 | <ski> | @type take |
2022-01-20 14:14:25 +0100 | <lambdabot> | Int -> [a] -> [a] |
2022-01-20 14:14:26 +0100 | <Guest9668> | I think so? |
2022-01-20 14:14:45 +0100 | <Guest9668> | idk this shit always makes me doubt what I can actually do... |
2022-01-20 14:14:50 +0100 | <ski> | this means that a corresponding type signature for `take' would be |
2022-01-20 14:15:03 +0100 | <[exa]> | Guest9668: what's the type signature for your `get`? (It's written up there) |
2022-01-20 14:15:17 +0100 | <ski> | take :: Int -> [a] -> [a] |
2022-01-20 14:15:18 +0100 | <ski> | ^^^ |
2022-01-20 14:15:34 +0100 | <ski> | that is the return type, when calling `take n xs' |
2022-01-20 14:15:50 +0100 | <ski> | (assuming `n' is an `Int', and `xs' a list of `a's) |
2022-01-20 14:15:52 +0100 | <Guest9668> | a list of something but it doesnt specify |
2022-01-20 14:15:55 +0100 | CiaoSen | (~Jura@p200300c95737a2002a3a4dfffe84dbd5.dip0.t-ipconnect.de) |
2022-01-20 14:16:06 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) (Ping timeout: 256 seconds) |
2022-01-20 14:16:20 +0100 | <Guest9668> | Would it work if I changed the Nothing to an _? |
2022-01-20 14:16:24 +0100 | <ski> | no |
2022-01-20 14:16:37 +0100 | <Guest9668> | Oh ok |
2022-01-20 14:17:13 +0100 | <ski> | try answering [exa]'s question ? |
2022-01-20 14:17:49 +0100 | <Guest9668> | @type get |
2022-01-20 14:17:50 +0100 | <lambdabot> | MonadState s m => m s |
2022-01-20 14:17:58 +0100 | <ski> | that's another `get', not your `get' |
2022-01-20 14:18:59 +0100 | <ski> | (oh, and functions always have return types) |
2022-01-20 14:19:21 +0100 | <Guest9668> | I know, doesnt haskell 'guess' the type if its not specified? |
2022-01-20 14:19:39 +0100 | <ski> | yes, it infers it (from the code/implementation) |
2022-01-20 14:20:03 +0100 | <[exa]> | it "guesses" it in a very deterministic way |
2022-01-20 14:20:16 +0100 | <[exa]> | (which doesn't really involve much guessing) |
2022-01-20 14:20:16 +0100 | <ski> | (it infers the return type of each defining equation, and checks that they all agree) |
2022-01-20 14:21:08 +0100 | <Guest9668> | yeah I thought so |
2022-01-20 14:22:13 +0100 | <ski> | anyway, you still haven't answered what the type signature of your `get' is |
2022-01-20 14:22:30 +0100 | <Guest9668> | an int or nothing? |
2022-01-20 14:22:53 +0100 | <ski> | `get' is a function, so the answer should look something like `get :: ... -> ...' |
2022-01-20 14:23:37 +0100 | <Guest9668> | oh no it takes an int and outputs an item, so get:: int -> Maybe a? |
2022-01-20 14:23:46 +0100 | <ski> | (`Nothing' is not a type, so it would be incorrect to attempt to include it in a type signature of a function `get') |
2022-01-20 14:23:50 +0100 | <Guest9668> | idk if im being completely stupid rn |
2022-01-20 14:23:56 +0100 | <ski> | well .. |
2022-01-20 14:23:58 +0100 | <Guest9668> | oh no it takes an int and outputs an item, so get:: int -> string? |
2022-01-20 14:24:15 +0100 | <ski> | .. the answer to [exa]'s question is literally spelled out in your paste |
2022-01-20 14:24:16 +0100 | <[exa]> | Guest9668: the questions are easier than they look. Actually you can copypaste the answer from your code |
2022-01-20 14:24:41 +0100 | AlexZenon | (~alzenon@94.233.241.14) |
2022-01-20 14:25:08 +0100 | <Guest9668> | [exa]: I dont understand what you mean by that? |
2022-01-20 14:25:15 +0100 | AlexNoo | (~AlexNoo@94.233.241.14) |
2022-01-20 14:25:42 +0100 | <[exa]> | that the type signature that you should be looking at is already in your code, you just need to read the proper return type out of it |
2022-01-20 14:26:06 +0100 | <ski> | the answer to "what's the type signature for your `get`?" can be copied over from your paste. you just need to understand what is asked for, and understand which part of the paste answers the question |
2022-01-20 14:26:25 +0100 | johnsonz | (~bc8147f2@cerf.good1.com) (Quit: CGI:IRC) |
2022-01-20 14:27:02 +0100 | <Guest9668> | my code paste? |
2022-01-20 14:27:06 +0100 | <ski> | yes |
2022-01-20 14:27:18 +0100 | jackson99 | (~bc8147f2@cerf.good1.com) |
2022-01-20 14:27:27 +0100 | Alex_test | (~al_test@94.233.241.14) |
2022-01-20 14:27:30 +0100 | jackson99 | (~bc8147f2@cerf.good1.com) (Excess Flood) |
2022-01-20 14:27:52 +0100 | <ski> | (oh, and don't worry if things seem confusing at first. it's to a large degree here a matter of becoming used to the terms, concepts, distinctions) |
2022-01-20 14:28:05 +0100 | jackson99 | (~bc8147f2@cerf.good1.com) |
2022-01-20 14:28:19 +0100 | <Guest9668> | yes, im finding it much more difficult than other languages I know |
2022-01-20 14:28:34 +0100 | <Guest9668> | `get :: Int -> [a]` |
2022-01-20 14:28:56 +0100 | <ski> | that claims that `get', if passed an `Int' as argument, will return a list of (`a's) |
2022-01-20 14:29:03 +0100 | <[exa]> | that's not the whole signature |
2022-01-20 14:29:15 +0100 | <Guest9668> | `get :: Int -> [a] -> Maybe a` |
2022-01-20 14:29:18 +0100 | <[exa]> | oh nice |
2022-01-20 14:29:19 +0100 | <ski> | however, your code actually specifies that `get' is to be passed both an `Int', and something else, as input arguments |
2022-01-20 14:29:22 +0100 | <ski> | yes |
2022-01-20 14:29:27 +0100 | <ski> | cheers ! :) |
2022-01-20 14:29:36 +0100 | <[exa]> | now what part of that is the return type? (see ski's spoiler above) |
2022-01-20 14:29:43 +0100 | <ski> | ok. next step .. what [exa] just said |
2022-01-20 14:30:13 +0100 | Vajb | (~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) (Read error: Connection reset by peer) |
2022-01-20 14:30:13 +0100 | <Guest9668> | the last bit is the return type |
2022-01-20 14:30:21 +0100 | <ski> | that last bit being ? |
2022-01-20 14:30:33 +0100 | <Guest9668> | `-> Maybe a` |
2022-01-20 14:30:37 +0100 | <Guest9668> | but maybe isnt a type |
2022-01-20 14:30:37 +0100 | <ski> | almost |
2022-01-20 14:30:39 +0100 | <Guest9668> | so the a |
2022-01-20 14:30:51 +0100 | <ski> | the `->' there is not part of the return type |
2022-01-20 14:30:58 +0100 | <Guest9668> | `a` |
2022-01-20 14:31:00 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) (Remote host closed the connection) |
2022-01-20 14:31:09 +0100 | <ski> | why do you think `Maybe' is not a type ? |
2022-01-20 14:31:24 +0100 | Vajb | (~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) |
2022-01-20 14:31:32 +0100 | <Guest9668> | Oh I got confused by what you said about Nothing not being a type |
2022-01-20 14:31:32 +0100 | <ski> | clearly `Maybe' means *something*, right ? |
2022-01-20 14:31:35 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) |
2022-01-20 14:31:37 +0100 | <Guest9668> | yes |
2022-01-20 14:32:36 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) |
2022-01-20 14:32:38 +0100 | <ski> | take e.g. the list `[Just (2 :: Int),Nothing,Just (3 :: Int)]' from above. it's a list of elements of type `Maybe Int'. each element is "maybe an `Int'" |
2022-01-20 14:32:51 +0100 | <ski> | so, `Maybe Int' is a type here |
2022-01-20 14:33:18 +0100 | <Guest9668> | @type Maybe Int |
2022-01-20 14:33:19 +0100 | <lambdabot> | error: |
2022-01-20 14:33:19 +0100 | <lambdabot> | • Data constructor not in scope: Maybe :: t0 -> t |
2022-01-20 14:33:19 +0100 | <lambdabot> | • Perhaps you meant variable ‘maybe’ (imported from Data.Maybe) |
2022-01-20 14:33:27 +0100 | <Guest9668> | @type Maybe |
2022-01-20 14:33:28 +0100 | <lambdabot> | error: |
2022-01-20 14:33:28 +0100 | <lambdabot> | • Data constructor not in scope: Maybe |
2022-01-20 14:33:28 +0100 | <lambdabot> | • Perhaps you meant variable ‘maybe’ (imported from Data.Maybe) |
2022-01-20 14:34:07 +0100 | <ski> | well, values have types. types have "kinds" |
2022-01-20 14:34:13 +0100 | <ski> | @kind Int |
2022-01-20 14:34:14 +0100 | <lambdabot> | * |
2022-01-20 14:34:15 +0100 | <ski> | @kind Maybe Int |
2022-01-20 14:34:16 +0100 | <lambdabot> | * |
2022-01-20 14:34:17 +0100 | <ski> | @kind Maybe |
2022-01-20 14:34:18 +0100 | <lambdabot> | * -> * |
2022-01-20 14:34:34 +0100 | <Guest9668> | Could you explain that, sorry |
2022-01-20 14:34:38 +0100 | <ski> | `Maybe' is a "type function". given the type `Int' as input, it gives the type `Maybe Int' |
2022-01-20 14:34:56 +0100 | <Guest9668> | ok |
2022-01-20 14:35:37 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) (Ping timeout: 240 seconds) |
2022-01-20 14:35:42 +0100 | <ski> | anyway .. this stuff (kinds) is slightly more advanced than the basic things you're dealing with, in your problem |
2022-01-20 14:35:55 +0100 | razetime | (~quassel@49.207.203.87) |
2022-01-20 14:36:16 +0100 | <Guest9668> | Oh so I shouldn't worry about it then? |
2022-01-20 14:36:21 +0100 | <[exa]> | Guest9668: anyway, can you make up some values that would have type `Maybe Int`? |
2022-01-20 14:36:30 +0100 | Guest52 | (~Guest52@80-100-97-100.ip.xs4all.nl) (Ping timeout: 256 seconds) |
2022-01-20 14:36:45 +0100 | <Guest9668> | 5? |
2022-01-20 14:36:48 +0100 | <ski> | (iow, thinking about kinds probably will not help you much, at this point. i only mentioned it, because you tried `@type Maybe' and `@type Maybe Int') |
2022-01-20 14:36:50 +0100 | <[exa]> | @type 5 |
2022-01-20 14:36:51 +0100 | <lambdabot> | Num p => p |
2022-01-20 14:36:54 +0100 | <[exa]> | no. |
2022-01-20 14:37:24 +0100 | <Guest9668> | ouch |
2022-01-20 14:38:03 +0100 | <ski> | (hint : possible answers to [exa]'s last question follow from stuff which was recently mentioned above) |
2022-01-20 14:38:13 +0100 | <Guest9668> | So either its the value at that index in the list or it's Nothing |
2022-01-20 14:38:34 +0100 | <[exa]> | yes Nothing is a great example value of Maybe Int |
2022-01-20 14:39:03 +0100 | <Guest9668> | so the change I need to make is on line 3? |
2022-01-20 14:39:13 +0100 | <ski> | @type Nothing :: Maybe Int -- checking if `Nothing' can have type `Maybe Int' |
2022-01-20 14:39:14 +0100 | <lambdabot> | Maybe Int |
2022-01-20 14:39:30 +0100 | <[exa]> | now say you want to return 123, but you need it to be compatible with Nothing, because both need to have type `Maybe Int` |
2022-01-20 14:39:55 +0100 | <Guest9668> | so instead of maybe a, I need `Maybe Int`? |
2022-01-20 14:40:12 +0100 | <[exa]> | no, we're just demonstrating it on a==Int, for simplicity |
2022-01-20 14:40:20 +0100 | <ski> | `Int' is just an example. your function is supposed to be able to deal with lists of values of all sorts of types |
2022-01-20 14:40:44 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) (Remote host closed the connection) |
2022-01-20 14:41:38 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) |
2022-01-20 14:42:03 +0100 | <Guest9668> | I understand what you're saying, I'm just even more confused now because I can't see what needs to be change |
2022-01-20 14:42:04 +0100 | <Guest9668> | d |
2022-01-20 14:42:43 +0100 | <ski> | (perhaps it might be nicer to take lists of `String's (to avoid confusion between two different uses of `Int' here, and avoid confusion due to overloaded numeric literals) ..) |
2022-01-20 14:42:55 +0100 | <[exa]> | Guest9668: we're trying to produce an explanation of the error first before jumping to conclusions and fixes |
2022-01-20 14:42:57 +0100 | <ski> | Guest9668 : first step is to understand the problem |
2022-01-20 14:43:34 +0100 | <Guest9668> | I thought the problem was that the types dont match |
2022-01-20 14:43:49 +0100 | <ski> | yes .. but why don't they match ? |
2022-01-20 14:43:57 +0100 | <ski> | what is the underlying cause ? |
2022-01-20 14:44:01 +0100 | <Guest9668> | because they aren't specified? |
2022-01-20 14:44:16 +0100 | <ski> | (or, if you prefer, what is the underlying misconception or confusion ?) |
2022-01-20 14:44:56 +0100 | <Guest9668> | I'm not sure |
2022-01-20 14:45:09 +0100 | <Guest9668> | could you write out a similar example in python or c? |
2022-01-20 14:45:35 +0100 | <ski> | the problem is not that you haven't specified your types enough. the problem is that there's an actual (type) mismatch between locations in your code. an inconsistency, they don't agree about how values are to be treated |
2022-01-20 14:46:02 +0100 | CiaoSen | (~Jura@p200300c95737a2002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
2022-01-20 14:46:13 +0100 | <Guest9668> | do you mean line 4 returns nothing and 5 and 6 return a? |
2022-01-20 14:46:46 +0100 | <[exa]> | hm, in C++, it would be something like: template<typename a> std::optional<a> get(int n, std::list<a> xs) {....} |
2022-01-20 14:47:16 +0100 | <[exa]> | that would return either `std::nullopt` or `std::make_optional(somenumber)` |
2022-01-20 14:48:01 +0100 | <tomsmeding> | [exa]: downside to that example: std::optional has a non-explicit constructor taking an 'a', so the std::make_optional can be elided |
2022-01-20 14:48:16 +0100 | <ski> | you could use something like `struct {enum {nothing,just} tag; union {void *dummy; double value; } u;} get(int n,double xs[n]);', i suppose .. |
2022-01-20 14:48:31 +0100 | <[exa]> | tomsmeding: it was approximate, yeah. |
2022-01-20 14:48:34 +0100 | <Guest9668> | ok those are even more confusing lmao |
2022-01-20 14:48:53 +0100 | <[exa]> | luckily haskell allows very simple encoding of all these things. :] |
2022-01-20 14:49:08 +0100 | <[exa]> | anyway, let's summarize |
2022-01-20 14:49:19 +0100 | <[exa]> | we have a datatype `data Maybe a = Nothing | Just a` |
2022-01-20 14:49:32 +0100 | <[exa]> | then we have a value Nothing that is of type `Maybe Int` |
2022-01-20 14:49:39 +0100 | <[exa]> | then we have `5` that is not of type `Maybe Int` |
2022-01-20 14:50:01 +0100 | <Guest9668> | yes |
2022-01-20 14:50:03 +0100 | <[exa]> | and we need some small helper to convert 5 to a type `Maybe Int` |
2022-01-20 14:50:19 +0100 | <[exa]> | which ski used several times in his examples already |
2022-01-20 14:50:46 +0100 | <[exa]> | btw yeah the problem is simple but most of us are giving exams so we're not going to give the answers for free. :D |
2022-01-20 14:51:02 +0100 | <Guest9668> | giving exams? |
2022-01-20 14:51:12 +0100 | <[exa]> | s/most/many/ <- overestimated here |
2022-01-20 14:51:36 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:405b:7016:7d50:c905) |
2022-01-20 14:51:44 +0100 | <[exa]> | not sure "giving exams" is right in english, sorry. Examining? :D |
2022-01-20 14:52:23 +0100 | <[exa]> | nevermind, focus on that above ^ |
2022-01-20 14:52:24 +0100 | <Guest9668> | yeah examining would work. |
2022-01-20 14:52:34 +0100 | <Guest9668> | do you mean the take thing they mentioned? |
2022-01-20 14:52:48 +0100 | <ski> | you have seen some other example of `data' declarations, i hope |
2022-01-20 14:52:51 +0100 | <Guest9668> | `take :: Int -> [a] -> [a]` |
2022-01-20 14:52:57 +0100 | <[exa]> | no |
2022-01-20 14:53:05 +0100 | <Guest9668> | `Just`? |
2022-01-20 14:53:14 +0100 | <ski> | @type [2 :: Int,Nothing,3 :: Int] |
2022-01-20 14:53:15 +0100 | <ski> | @type [Just (2 :: Int),Nothing,Just (3 :: Int)] |
2022-01-20 14:53:15 +0100 | <lambdabot> | error: |
2022-01-20 14:53:15 +0100 | <lambdabot> | • Couldn't match expected type ‘Int’ with actual type ‘Maybe a0’ |
2022-01-20 14:53:15 +0100 | <lambdabot> | • In the expression: Nothing |
2022-01-20 14:53:16 +0100 | <lambdabot> | [Maybe Int] |
2022-01-20 14:53:18 +0100 | <[exa]> | ok great there we go |
2022-01-20 14:53:22 +0100 | <[exa]> | :t Just |
2022-01-20 14:53:23 +0100 | <lambdabot> | a -> Maybe a |
2022-01-20 14:53:27 +0100 | <Guest9668> | Just (3 :: Int) |
2022-01-20 14:53:40 +0100 | <[exa]> | you don't even need the `:: Int` there |
2022-01-20 14:53:48 +0100 | <ski> | (yea, i added it for clarity) |
2022-01-20 14:53:52 +0100 | <[exa]> | that was just to perfectly show that 3 is Int, yes. |
2022-01-20 14:54:12 +0100 | <Guest9668> | so I need to put just on lines 5 and 6? |
2022-01-20 14:54:20 +0100 | <[exa]> | now you could see why the compiler is complaining that it's expecting `Maybe a` but gets `a` |
2022-01-20 14:54:23 +0100 | <[exa]> | on the certain line |
2022-01-20 14:54:28 +0100 | <Guest9668> | yeah it makes so much sense |
2022-01-20 14:54:36 +0100 | <Guest9668> | I had no idea though |
2022-01-20 14:55:13 +0100 | <ski> | Guest9668 : one answer would be "try it and see ?". another would be "what exactly are the type mismatches ?" (you'd need to answer "what are the actual return types, for each return declaration ?" first) |
2022-01-20 14:55:14 +0100 | <Guest9668> | It compiled |
2022-01-20 14:55:27 +0100 | <ski> | (the second one might be more elucidating) |
2022-01-20 14:55:37 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:405b:7016:7d50:c905) (Ping timeout: 240 seconds) |
2022-01-20 14:56:09 +0100 | <ski> | (er, s/return declaration/defining equation/) |
2022-01-20 14:56:31 +0100 | <Guest9668> | I thought we fixed it? |
2022-01-20 14:56:33 +0100 | geranim0 | (~geranim0@modemcable242.171-178-173.mc.videotron.ca) |
2022-01-20 14:56:45 +0100 | <ski> | anyway, `Just' is used to "convert" from a value of type `a' to a value of type `Maybe a' (in the examples above, `a' was `Int') |
2022-01-20 14:57:02 +0100 | <ski> | Guest9668 : did you change both line 5 and 6 ? |
2022-01-20 14:57:16 +0100 | <Guest9668> | I only changed 5, I expect I need to change 6 too? |
2022-01-20 14:57:24 +0100 | <ski> | why ? / why not ? |
2022-01-20 14:58:20 +0100 | <Guest9668> | I don't because otherwise it would return a Maybe(Maybe a) |
2022-01-20 14:58:26 +0100 | <ski> | correct |
2022-01-20 14:58:36 +0100 | <Guest9668> | `Couldn't match type `a' with `Maybe a' |
2022-01-20 14:58:37 +0100 | <Guest9668> | Expected: Maybe a |
2022-01-20 14:58:37 +0100 | <Guest9668> | Actual: Maybe (Maybe a)` |
2022-01-20 14:58:54 +0100 | <Guest9668> | One sec I need to write this up. |
2022-01-20 15:00:07 +0100 | rusrushal13 | (~rusrushal@2409:4056:193:1b10:a38a:9a8:8f21:e6f1) (Ping timeout: 256 seconds) |
2022-01-20 15:01:02 +0100 | alp | (~alp@user/alp) (Ping timeout: 240 seconds) |
2022-01-20 15:02:07 +0100 | <Guest9668> | What would you call Just? |
2022-01-20 15:02:18 +0100 | <ski> | anyway, this is related to why `Nothing' is not quite like `null'. in e.g. Java, you could have a list (or array, if you prefer) of `Integer's, but some of them might be `null' (since `Integer' is an object type). but in Haskell, the type `Int' (and the type `Integer') includes no value like `null'. if you want to be able to use `Nothing', you must "shift" to using type `Maybe Int' |
2022-01-20 15:02:52 +0100 | <Guest9668> | what is the advantage to doing it the way haskell does? |
2022-01-20 15:03:10 +0100 | <geekosaur> | no unexpected "nulls" |
2022-01-20 15:03:27 +0100 | <geekosaur> | which you have to deal with somehow ir quite possibly get the wrong answer |
2022-01-20 15:03:30 +0100 | <ski> | and then, you don't have "ordinary `Int'", but rather `Int's wrapped in `Just'. then, if you really want, you could go on and have `Maybe (Maybe Int)' (this is occasionally useful). but something like that is not possible with `null' in Java |
2022-01-20 15:03:31 +0100 | <geekosaur> | *or |
2022-01-20 15:04:10 +0100 | <jackson99> | Guest9668 if your function starts returning Maybe Integer instead of Integer you will get compile error instead of null exception |
2022-01-20 15:04:14 +0100 | max22- | (~maxime@2a01cb088335980028de40de497c2de0.ipv6.abo.wanadoo.fr) |
2022-01-20 15:04:44 +0100 | <Guest9668> | jackson99 so its easier to bug test? |
2022-01-20 15:04:45 +0100 | <ski> | Guest9668 : if you get an `Int', you know it can't be `Nothing'. if you get a `Maybe Int', you *must* check whether it's `Just' or not, the language won't let you treat a `Maybe Int' as an `Int'. whereas in Java, you'd get a null exception |
2022-01-20 15:04:54 +0100 | slowButPresent | (~slowButPr@user/slowbutpresent) |
2022-01-20 15:05:05 +0100 | <Guest9668> | ah makes sense |
2022-01-20 15:06:18 +0100 | pera | (~pera@137.221.132.200) |
2022-01-20 15:06:31 +0100 | <ski> | also, you avoid useless input cases to functions. in Java, your array of `Integer's might contain `null's, so either you must check for that, or else the caller must make sure there's no `null's (while getting no help from the language to ensure that), possibly getting weird behaviour if there was some `null' |
2022-01-20 15:06:42 +0100 | <jackson99> | Guest9668, yes, and it is easier to refactor code. compiler will point out all the call sites that expected Int, but are now getting Maybe Int |
2022-01-20 15:06:42 +0100 | pera | Guest1490 |
2022-01-20 15:07:33 +0100 | <ski> | ^ is a very important thing, in practice |
2022-01-20 15:08:41 +0100 | <Guest9668> | It'll take some getting used to but I see why its better |
2022-01-20 15:08:45 +0100 | <jackson99> | another advantage, some people like to employ defensive programming to deal with null exceptions, so they check null everywhere, even if current api doesn't return null. you don't have to (and you actually can't) do that, because Int can't be Nothing |
2022-01-20 15:09:04 +0100 | <maerwald> | it can be 0 though |
2022-01-20 15:09:09 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) |
2022-01-20 15:10:28 +0100 | <ski> | languages like C# have added the concept of "non-nullable types", in order to get some help to ensure there's no `null'. however, there's still a difference in that the type `Maybe (Maybe Int)' contains `Nothing',`Just Nothing',`Just (Just 3)',.. .. while using `null's, the first two cases are conflated .. this is important, e.g. when looking for something that we may fail to find (like your `get' function). |
2022-01-20 15:10:34 +0100 | <ski> | what if the input array contained a `null' ? you can't distinguish that from a `null' indicating failure to find the item |
2022-01-20 15:11:13 +0100 | <ski> | (this general problem is called "domain contagion". we want the indicator for "not found" to *not* be a possible "found" value) |
2022-01-20 15:11:33 +0100 | <Guest9668> | https://paste.tomsmeding.com/EFhDDe5l |
2022-01-20 15:11:46 +0100 | <Guest9668> | Is it supposed to be doing that? |
2022-01-20 15:12:53 +0100 | <geekosaur> | you meant .. not ... |
2022-01-20 15:12:54 +0100 | <ski> | (the 2006-02-03 "Option types, optional parameters" entry at Riastradh's blag, at <https://mumble.net/~campbell/blag.txt>,(RSS) <http://vrici.lojban.org/~cowan/blag.xml>, talks about domain contagion |
2022-01-20 15:12:58 +0100 | <ski> | ) |
2022-01-20 15:13:16 +0100 | <Guest9668> | oh mb |
2022-01-20 15:13:43 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) (Ping timeout: 256 seconds) |
2022-01-20 15:19:09 +0100 | johnjaye | (~pi@173.209.65.233) |
2022-01-20 15:22:42 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) (Ping timeout: 250 seconds) |
2022-01-20 15:22:49 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 15:22:49 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 15:22:49 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 15:28:16 +0100 | Vajb | (~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) (Read error: Connection reset by peer) |
2022-01-20 15:29:06 +0100 | Vajb | (~Vajb@2001:999:50:e6be:1e98:9376:d93e:4506) |
2022-01-20 15:30:03 +0100 | slack1256 | (~slack1256@191.125.99.215) |
2022-01-20 15:30:40 +0100 | ec | (~ec@gateway/tor-sasl/ec) |
2022-01-20 15:30:43 +0100 | yassernasc | (~yassernas@2804:29b8:505a:f33d:7937:b295:da60:ef94) (Ping timeout: 256 seconds) |
2022-01-20 15:32:13 +0100 | <Guest9668> | ski: You still around? https://paste.tomsmeding.com/tl4fhMkH |
2022-01-20 15:34:12 +0100 | yassernasc | (~yassernas@2804:29b8:505a:f33d:7937:b295:da60:ef94) |
2022-01-20 15:34:16 +0100 | <ski> | indentation looks wrong |
2022-01-20 15:34:18 +0100 | <geekosaur> | you can't indent like that; it treats it as a continuation of the type signature |
2022-01-20 15:34:34 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) |
2022-01-20 15:34:37 +0100 | phma | (phma@2001:5b0:212a:d158:6462:9429:37ae:1dd1) |
2022-01-20 15:34:37 +0100 | <geekosaur> | also you'll need to indent the if-then-else |
2022-01-20 15:35:02 +0100 | <ski> | (and then you'll notice a type error) |
2022-01-20 15:35:13 +0100 | <Guest9668> | https://paste.tomsmeding.com/3f5253An |
2022-01-20 15:35:17 +0100 | <Guest9668> | thats how I was given the code |
2022-01-20 15:35:29 +0100 | <ski> | yes, that's properly indented |
2022-01-20 15:36:02 +0100 | Vajb | (~Vajb@2001:999:50:e6be:1e98:9376:d93e:4506) (Read error: Connection reset by peer) |
2022-01-20 15:36:30 +0100 | Vajb | (~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) |
2022-01-20 15:36:38 +0100 | <Guest9668> | thats the next error https://paste.tomsmeding.com/DxhC1QQi |
2022-01-20 15:36:51 +0100 | <ski> | yes, that's the type error i mentioned |
2022-01-20 15:36:58 +0100 | __monty__ | (~toonn@user/toonn) (Quit: leaving) |
2022-01-20 15:37:01 +0100 | yassernasc | (~yassernas@2804:29b8:505a:f33d:7937:b295:da60:ef94) () |
2022-01-20 15:37:26 +0100 | <ski> | it complains that `n' (in `n ++ select f ns') does not have type `[Int]' |
2022-01-20 15:37:26 +0100 | <Guest9668> | so it cant compare a list of int to int? |
2022-01-20 15:37:36 +0100 | <ski> | a list is not an integer |
2022-01-20 15:37:43 +0100 | <ski> | an integer is not a list |
2022-01-20 15:38:28 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-20 15:38:56 +0100 | <Guest9668> | so what needs to be fixed? n needs to be converted to '[Int]' |
2022-01-20 15:39:06 +0100 | <Guest9668> | ?^ |
2022-01-20 15:39:06 +0100 | <lambdabot> | Maybe you meant: v @ ? . |
2022-01-20 15:39:16 +0100 | <ski> | try it ? |
2022-01-20 15:40:11 +0100 | Vajb | (~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) (Read error: Connection reset by peer) |
2022-01-20 15:40:23 +0100 | Vajb | (~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) |
2022-01-20 15:40:51 +0100 | <Guest9668> | do i do that with take? |
2022-01-20 15:41:02 +0100 | <geekosaur> | you could do that, but there's a better way. remember how you construct a list |
2022-01-20 15:41:19 +0100 | <ski> | @type take |
2022-01-20 15:41:19 +0100 | <lambdabot> | Int -> [a] -> [a] |
2022-01-20 15:41:47 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) |
2022-01-20 15:41:55 +0100 | <ski> | doesn't look like `take' will allow you to go from an element (of some type) to a list of elements (of that type) |
2022-01-20 15:42:23 +0100 | <Guest9668> | geekosaur: How does that apply here? |
2022-01-20 15:42:34 +0100 | <ski> | (the `Int' argument to `take' is not an element of the lists it handles, but rather an index) |
2022-01-20 15:42:48 +0100 | lavaman | (~lavaman@98.38.249.169) (Ping timeout: 256 seconds) |
2022-01-20 15:43:10 +0100 | <Guest9668> | So what do I do next? |
2022-01-20 15:43:14 +0100 | <geekosaur> | Guest9668, you are constructing a list from an element and another list |
2022-01-20 15:43:18 +0100 | <ski> | "remember how you construct a list" |
2022-01-20 15:43:22 +0100 | <geekosaur> | does this sound familiar? |
2022-01-20 15:43:45 +0100 | <Guest9668> | `let a = [1, 5, 7, 12, 56]` |
2022-01-20 15:43:56 +0100 | <ski> | how about a list with a single element ? |
2022-01-20 15:44:10 +0100 | <Guest9668> | `let a = 99:[]` |
2022-01-20 15:44:11 +0100 | <geekosaur> | you already used the thing you need as a pattern in your code |
2022-01-20 15:44:18 +0100 | <ski> | that works, yea |
2022-01-20 15:44:32 +0100 | <ski> | > 98:[] |
2022-01-20 15:44:34 +0100 | <lambdabot> | [98] |
2022-01-20 15:45:32 +0100 | caubert_ | (~caubert@136.244.111.235) (Quit: WeeChat 3.3) |
2022-01-20 15:45:35 +0100 | Guest1490 | (~pera@137.221.132.200) (Quit: leaving) |
2022-01-20 15:45:43 +0100 | <Guest9668> | Yeaah that compiles: ) |
2022-01-20 15:45:46 +0100 | caubert | (~caubert@136.244.111.235) |
2022-01-20 15:45:50 +0100 | <ski> | what was the fix ? |
2022-01-20 15:46:14 +0100 | <Guest9668> | `then n:[] ++ select f ns` |
2022-01-20 15:46:38 +0100 | <Guest9668> | Haskell is much easier when you actually understand the errors |
2022-01-20 15:46:49 +0100 | <Guest9668> | they normally just make me contemplate my entire existence |
2022-01-20 15:46:54 +0100 | <Guest9668> | this isnt so bad |
2022-01-20 15:46:57 +0100 | <ski> | well .. i presume you meant `(n:[]) ++ select f ns' .. but it'll amount to the same result, here |
2022-01-20 15:47:23 +0100 | <ski> | (`n:[] ++ select f ns' is parsed as `n:([] ++ select f ns)') |
2022-01-20 15:47:33 +0100 | <Guest9668> | I didnt realise I needed the parenthesis, should I add them for better practice? |
2022-01-20 15:47:44 +0100 | <ski> | you should understand the difference |
2022-01-20 15:47:56 +0100 | stevenxl | (~stevenxl@c-73-72-2-81.hsd1.il.comcast.net) |
2022-01-20 15:47:57 +0100 | <Guest9668> | the same as the mathematical sense I presume? |
2022-01-20 15:48:00 +0100 | <ski> | (a difference that makes no difference (in the end), in this case) |
2022-01-20 15:48:02 +0100 | <Guest9668> | if thats the case, then yes |
2022-01-20 15:49:13 +0100 | <ski> | this is similar to how `2 + 3 - 4' (meaning `(2 + 3) - 4') amounts to the same as `2 + (3 - 4)' |
2022-01-20 15:49:58 +0100 | <Guest9668> | yeah |
2022-01-20 15:50:24 +0100 | <ski> | anyway, just like you can write `[n - 1,n,n + 1]', you can write `[n]' (instead of `n : []') .. this could look more idiomatic/simple |
2022-01-20 15:52:22 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:8850:c936:967:dec3) |
2022-01-20 15:52:34 +0100 | shriekingnoise | (~shrieking@201.231.16.156) |
2022-01-20 15:52:46 +0100 | <Guest9668> | One sec, just writing this up |
2022-01-20 15:53:13 +0100 | <ski> | (but `2 - 3 + 4' (meaning `(2 - 3) + 4') is not the same as `2 - (3 + 4)' .. similarly, in other cases in your Haskell, you'll really need to spell out those grouping brackets -- hence why i said you should understand the difference) |
2022-01-20 15:54:37 +0100 | <ski> | Guest9668 : so .. now the fix becomes ? |
2022-01-20 15:55:47 +0100 | <Guest9668> | `then (n:[]) ++ select f ns` is what I have it as currently |
2022-01-20 15:56:23 +0100 | <ski> | did you understand my "idiomatic" comment ? |
2022-01-20 15:56:37 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:8850:c936:967:dec3) (Ping timeout: 240 seconds) |
2022-01-20 15:57:00 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) |
2022-01-20 15:57:56 +0100 | zmt00 | (~zmt00@user/zmt00) |
2022-01-20 15:58:28 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) (Read error: Connection reset by peer) |
2022-01-20 15:58:32 +0100 | <Guest9668> | I understood it as removing the parenthesis in this case wouldn't change the result but it makes it easier to read, hence idiomatic |
2022-01-20 15:58:34 +0100 | Morrow_ | (~Morrow@ool-1826f675.dyn.optonline.net) |
2022-01-20 15:58:53 +0100 | <ski> | well, that comment was not about removing (or inserting) brackets |
2022-01-20 15:59:14 +0100 | <Guest9668> | oh wait you meant `then (n) ++ select f ns` |
2022-01-20 15:59:26 +0100 | <ski> | (or, at least, not about grouping brackets ..) |
2022-01-20 15:59:32 +0100 | CiaoSen | (~Jura@p200300c95737a2002a3a4dfffe84dbd5.dip0.t-ipconnect.de) |
2022-01-20 15:59:35 +0100 | <ski> | almost |
2022-01-20 15:59:47 +0100 | <Guest9668> | `then (n ++ select f ns)` |
2022-01-20 15:59:56 +0100 | <ski> | no, that's a type error |
2022-01-20 16:00:00 +0100 | <ski> | (what you had initially) |
2022-01-20 16:00:10 +0100 | <Guest9668> | `then (n:[] ++ select f ns)` |
2022-01-20 16:00:15 +0100 | <ski> | round brackets are not square brackets |
2022-01-20 16:01:21 +0100 | <Guest9668> | `then [n] ++ select f ns` |
2022-01-20 16:01:26 +0100 | <ski> | yes |
2022-01-20 16:01:52 +0100 | <geekosaur> | there's another simplification you can do there which is even more idiomatic, though |
2022-01-20 16:01:53 +0100 | <ski> | `[n]' would, usually, be considered a more direct way to write a list with just one element (a singleton list), than `n : []' |
2022-01-20 16:02:00 +0100 | <ski> | also note that `[n] ++ ...' is the same as `n : ...' .. that way, it looks more consistent with the argument pattern `n:ns' .. but it's a matter of taste |
2022-01-20 16:02:41 +0100 | <Guest9668> | so I should change `then (n:[]) ++ select f ns` to `then [n] ++ select f ns` |
2022-01-20 16:02:59 +0100 | <ski> | i think most people would prefer to read the latter over the former, yes |
2022-01-20 16:03:12 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-20 16:03:16 +0100 | <Guest9668> | ok, willdo |
2022-01-20 16:03:21 +0100 | texasmynsted | (~texasmyns@99.96.221.112) |
2022-01-20 16:03:24 +0100 | <ski> | (but then also see mine and geekosaur's last comments) |
2022-01-20 16:03:24 +0100 | <Guest9668> | it reads easier tbf |
2022-01-20 16:04:02 +0100 | faustind | (~faustin@M014008067225.v4.enabler.ne.jp) (Quit: Leaving.) |
2022-01-20 16:05:12 +0100 | <texasmynsted> | Anybody have link/doc recommendations for running Haskell on AWS, especially EC2? I found a 6 year old reddit article, the net being install NixOS in EC2. |
2022-01-20 16:06:01 +0100 | <maerwald> | texasmynsted: better not |
2022-01-20 16:06:09 +0100 | <texasmynsted> | Most things talk about AWS Lambda, which sounds like running Haskell from npm or something... Which seems o_O |
2022-01-20 16:06:31 +0100 | <texasmynsted> | maerwald: So the answer is don't do it? |
2022-01-20 16:07:06 +0100 | <texasmynsted> | So haskell is not a good choice for the cloud? |
2022-01-20 16:07:12 +0100 | <maerwald> | I'm not sure I even understand the question... build a static binary or use docker containers |
2022-01-20 16:07:50 +0100 | <maerwald> | you can also run arbitrary executables in aws lambda (also statically link them) |
2022-01-20 16:09:49 +0100 | Morrow_ | (~Morrow@ool-1826f675.dyn.optonline.net) (Ping timeout: 256 seconds) |
2022-01-20 16:10:08 +0100 | <texasmynsted> | The question is really: Is anybody running Haskell in the cloud? Has this proven to be a good fit? What worked well, or should I stick with other languages on the cloud. |
2022-01-20 16:10:33 +0100 | <merijn> | Define "cloud" define "run", etc |
2022-01-20 16:10:48 +0100 | <merijn> | I mean "the cloud" is just "some machines somewhere in someone's data center" |
2022-01-20 16:11:03 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 16:11:03 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 16:11:03 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 16:11:03 +0100 | <merijn> | I've run Haskell on those, sure. |
2022-01-20 16:11:24 +0100 | <merijn> | I mean, EC2 are just some virtual machines you can run whatever you want on |
2022-01-20 16:11:38 +0100 | <merijn> | I don't really understand how you define "a good fit" in that context |
2022-01-20 16:11:59 +0100 | Sgeo | (~Sgeo@user/sgeo) |
2022-01-20 16:12:02 +0100 | <c_wraith> | Yeah, EC2 is just "computers". You can run haskell on computers. No additional support required. |
2022-01-20 16:12:41 +0100 | <maerwald> | texasmynsted: yes it works well |
2022-01-20 16:12:56 +0100 | <texasmynsted> | okay. |
2022-01-20 16:14:11 +0100 | <merijn> | If you know how to run Haskell on, OS Y locally, then running it in the cloud is "basically the same, except you gotta SSH into those machines" (or use some generic VM management solution if you run many machines...) |
2022-01-20 16:14:33 +0100 | <texasmynsted> | I often run into things where I think, hmm locally this would be a good fit for tiny haskell project. I wonder what kind of uphill battle it would be to host this on aws, or whatever. |
2022-01-20 16:14:46 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) (Remote host closed the connection) |
2022-01-20 16:15:02 +0100 | Guest|24 | (~Guest|24@111.114.191.0) |
2022-01-20 16:15:18 +0100 | <texasmynsted> | Terraform is nice. |
2022-01-20 16:15:40 +0100 | <tomsmeding> | ghcup works also on aws :p |
2022-01-20 16:15:52 +0100 | <c_wraith> | The worst problem you'll run into is that you probably won't want to build on your production application servers. |
2022-01-20 16:15:57 +0100 | alp | (~alp@user/alp) |
2022-01-20 16:15:58 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 268 seconds) |
2022-01-20 16:16:08 +0100 | <texasmynsted> | Hmm. yes |
2022-01-20 16:16:18 +0100 | <merijn> | texasmynsted: I mean, if you run, I dunno, centos on EC2, then running your haskell program on it is just "how hard is it to run a program on centos?" |
2022-01-20 16:16:48 +0100 | kaph | (~kaph@net-2-47-208-144.cust.vodafonedsl.it) (Ping timeout: 256 seconds) |
2022-01-20 16:17:25 +0100 | <maerwald> | texasmynsted: Terraform + a simple ansible playbook to ensure docker is installed and then everything else shipped via containers |
2022-01-20 16:17:28 +0100 | <maerwald> | rather easy |
2022-01-20 16:17:30 +0100 | <texasmynsted> | It seems the difficultly is rarely in the running, but rather in the management of the "deployment" the thing that is run. The build, and deploy, part of the build, deploy, run cycle. |
2022-01-20 16:17:49 +0100 | polyphem | (~rod@2a02:810d:840:8754:e450:3ca3:b389:687a) (Ping timeout: 240 seconds) |
2022-01-20 16:17:59 +0100 | <texasmynsted> | :-) |
2022-01-20 16:18:07 +0100 | <texasmynsted> | Okay. I have not used ansible yet. |
2022-01-20 16:18:10 +0100 | ksqsf | (~user@2001:da8:d800:604:d415:c6b:884d:7d38) (Ping timeout: 250 seconds) |
2022-01-20 16:18:41 +0100 | Guest|24 | (~Guest|24@111.114.191.0) (Client Quit) |
2022-01-20 16:18:41 +0100 | <maerwald> | amazon also has distro images that may have docker pre-installed |
2022-01-20 16:18:57 +0100 | <maerwald> | but if you need a devops, hire one |
2022-01-20 16:19:35 +0100 | <texasmynsted> | (yes. have done that) |
2022-01-20 16:20:50 +0100 | <texasmynsted> | I just see people using interpreted languages like javascript, python, etc in the cloud. I did not know if there was some reason. |
2022-01-20 16:21:04 +0100 | <maerwald> | popularity |
2022-01-20 16:21:09 +0100 | <texasmynsted> | :( |
2022-01-20 16:21:14 +0100 | <maerwald> | no... I'm not being cynical |
2022-01-20 16:21:18 +0100 | <maerwald> | that IS a good reason |
2022-01-20 16:21:36 +0100 | myShoggoth | (~myShoggot@97-120-67-120.ptld.qwest.net) |
2022-01-20 16:21:52 +0100 | <maerwald> | business decisions aren't about "what's the coolest tech?"... at least usually |
2022-01-20 16:22:08 +0100 | max22- | (~maxime@2a01cb088335980028de40de497c2de0.ipv6.abo.wanadoo.fr) (Ping timeout: 268 seconds) |
2022-01-20 16:22:49 +0100 | <texasmynsted> | I remember ages ago writing code for mainframes. For most things I was asked not to write C binaries. Other languages were preferred. |
2022-01-20 16:27:53 +0100 | polyphem | (~rod@2a02:810d:840:8754:e450:3ca3:b389:687a) |
2022-01-20 16:30:35 +0100 | <geekosaur> | mostly it's about maintainability. these days when employers want to be able to swap out employees like replaceable cogs, it's about the tech they're most able to find cogs for, hence popular things like javascript |
2022-01-20 16:31:23 +0100 | <geekosaur> | in the mainframe world it's a little different, they're most able to find people *who can write mainframe software* (a rather different world), so they stick to languages popular on mainframes |
2022-01-20 16:33:16 +0100 | <texasmynsted> | Well to be fair a lot more time is spent maintaining software than writing it. |
2022-01-20 16:37:27 +0100 | Codaraxis_ | (~Codaraxis@user/codaraxis) |
2022-01-20 16:37:46 +0100 | <Guest9668> | how would you comment this? `select :: (Int -> Bool) -> [Int] -> [Int] --Takes an Int input, takes an int input, checks if its true and then converts one list to another?` < thats almost certainly wrong but I'm struggling to describe it |
2022-01-20 16:38:00 +0100 | <Guest9668> | how would you comment this? `select :: (Int -> Bool) -> [Int] -> [Int] --Takes an Int input, checks if its true and then converts one list to another?` < thats almost certainly wrong but I'm struggling to describe it** |
2022-01-20 16:38:19 +0100 | <ski> | what do you mean by "then converts one list to another" ? |
2022-01-20 16:38:28 +0100 | <Guest9668> | adds one item from a list to another |
2022-01-20 16:38:36 +0100 | <ski> | adds it, when ? |
2022-01-20 16:38:49 +0100 | <Guest9668> | if the input is the same as what is found in the list? |
2022-01-20 16:39:18 +0100 | <ski> | hm, i don't understand |
2022-01-20 16:39:49 +0100 | <ski> | perhaps an example could help elucidate .. what should `select even [2,8,5,7,1,4]' evaluate to ? |
2022-01-20 16:40:02 +0100 | <Guest9668> | its the same function as we fixed before, I just procrastinated a bit. https://paste.tomsmeding.com/tRvFCeQj |
2022-01-20 16:40:14 +0100 | <Guest9668> | [2,8,4] |
2022-01-20 16:40:17 +0100 | Codaraxis__ | (~Codaraxis@user/codaraxis) (Ping timeout: 240 seconds) |
2022-01-20 16:40:33 +0100 | <ski> | oh, okay (sorry, i'd already forgotten the function name from your earlier paste) |
2022-01-20 16:40:55 +0100 | <geekosaur> | I recognized both the name and the signature :) |
2022-01-20 16:41:08 +0100 | ski | smiles |
2022-01-20 16:41:18 +0100 | <texasmynsted> | So a filter? |
2022-01-20 16:41:24 +0100 | bontaq | (~user@ool-45779fe5.dyn.optonline.net) |
2022-01-20 16:41:27 +0100 | <ski> | oh. so is your question about how you'd comment / document this function ? |
2022-01-20 16:41:33 +0100 | <Guest9668> | yeah I guess |
2022-01-20 16:42:05 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) (Remote host closed the connection) |
2022-01-20 16:42:09 +0100 | <ski> | well .. i guess it selects some items out of the given list, giving them back in another list |
2022-01-20 16:42:25 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) |
2022-01-20 16:42:37 +0100 | kenran | (~kenran@2001:16b8:2bbb:8500:9219:f13c:5dd0:d93e) |
2022-01-20 16:42:40 +0100 | <texasmynsted> | Like you apply your function f to each element of the input list, generating a new list where f is true for each element of the input list? |
2022-01-20 16:42:50 +0100 | <Guest9668> | texasmynsted: yes |
2022-01-20 16:42:52 +0100 | <Guest9668> | ty |
2022-01-20 16:43:04 +0100 | <ski> | `select f xs' is the list of all ... such that ... |
2022-01-20 16:43:17 +0100 | myShoggoth | (~myShoggot@97-120-67-120.ptld.qwest.net) (Ping timeout: 240 seconds) |
2022-01-20 16:43:25 +0100 | <ski> | (many ways to skin the cat, fwiw) |
2022-01-20 16:43:30 +0100 | vglfr | (~vglfr@88.155.104.216) |
2022-01-20 16:43:36 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480::41) |
2022-01-20 16:43:49 +0100 | <texasmynsted> | How about math, that might be fun. |
2022-01-20 16:44:00 +0100 | ksqsf | (~user@2001:da8:d800:611:b843:c73f:4031:6341) |
2022-01-20 16:44:06 +0100 | ski | idly considers set theory |
2022-01-20 16:44:20 +0100 | <texasmynsted> | yes, please consider that |
2022-01-20 16:44:25 +0100 | <unyu> | Are there examples of type constructors that (a) have more than one type argument, and (b) don't impose any constraints on them in typical usage, (c) serve a concrete use case, rather than being general purpose like Either, (,) or (->)? |
2022-01-20 16:44:45 +0100 | <unyu> | s/\(c\)/ and \(c\)/ |
2022-01-20 16:45:52 +0100 | <unyu> | Data.Map.Map would be a nonexample, because typical usage imposes an Ord constraint on the first type argument. |
2022-01-20 16:46:22 +0100 | <tomsmeding> | unyu: well-typed AST: https://github.com/AccelerateHS/accelerate/blob/master/src/Data/Array/Accelerate/AST.hs#L524 |
2022-01-20 16:46:41 +0100 | <unyu> | Thanks. |
2022-01-20 16:47:07 +0100 | <tomsmeding> | if you want more type parameters: https://github.com/tomsmeding/accelerate/blob/no-explode/src/Data/Array/Accelerate/Trafo/AD/Exp.hs… |
2022-01-20 16:47:37 +0100 | CiaoSen | (~Jura@p200300c95737a2002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
2022-01-20 16:48:39 +0100 | <unyu> | Wow, and there are really no constraints on all of those type parameters? Does it really make sense to plug any type (of the appropriate kind, of course) there? |
2022-01-20 16:48:45 +0100 | <ski> | unyu : well, i guess you could have trees with both internal node and leaf elements. or labelling branches, if you prefer |
2022-01-20 16:49:31 +0100 | <tomsmeding> | unyu: mostly! this is the most important top-level function on that Exp data type: https://github.com/tomsmeding/accelerate/blob/no-explode/src/Data/Array/Accelerate/Trafo/AD/ADExp.… |
2022-01-20 16:49:40 +0100 | <tomsmeding> | the Show is just for debugging and can be removed without much effort |
2022-01-20 16:50:00 +0100 | <unyu> | Wow, cool. |
2022-01-20 16:50:06 +0100 | ec | (~ec@gateway/tor-sasl/ec) (Ping timeout: 276 seconds) |
2022-01-20 16:50:12 +0100 | <tomsmeding> | the () occurrences take on different types throughout the computation |
2022-01-20 16:50:33 +0100 | ec | (~ec@gateway/tor-sasl/ec) |
2022-01-20 16:50:43 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) (Remote host closed the connection) |
2022-01-20 16:50:54 +0100 | kaph | (~kaph@net-2-47-208-144.cust.vodafonedsl.it) |
2022-01-20 16:51:31 +0100 | <tomsmeding> | though 'lab' and 'alab' are normally only two different things, namely Int and (), but if I wanted to give expression nodes string names, then it'd be String |
2022-01-20 16:51:45 +0100 | cfricke | (~cfricke@user/cfricke) (Ping timeout: 256 seconds) |
2022-01-20 16:51:57 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) |
2022-01-20 16:52:26 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) |
2022-01-20 16:52:53 +0100 | gdd | (~gdd@129.199.146.230) (Ping timeout: 256 seconds) |
2022-01-20 16:53:00 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:5cb9:ef3e:81e2:469f) |
2022-01-20 16:53:02 +0100 | ksqsf | (~user@2001:da8:d800:611:b843:c73f:4031:6341) (Ping timeout: 240 seconds) |
2022-01-20 16:53:10 +0100 | <tomsmeding> | unyu: more compact example: https://github.com/tomsmeding/accelerate/blob/no-explode/src/Data/Array/Accelerate/Trafo/AD/Common… |
2022-01-20 16:53:21 +0100 | gdd | (~gdd@129.199.146.230) |
2022-01-20 16:53:33 +0100 | <tomsmeding> | maybe that was more what you're looking for |
2022-01-20 16:54:27 +0100 | <unyu> | Wow. Thanks! |
2022-01-20 16:54:51 +0100 | <ski> | @where IndirectComposite |
2022-01-20 16:54:52 +0100 | <lambdabot> | <http://web.archive.org/web/20051126141834/http://haskell.org/hawiki/IndirectComposite> |
2022-01-20 16:54:56 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) (Remote host closed the connection) |
2022-01-20 16:55:38 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) |
2022-01-20 16:56:41 +0100 | <unyu> | ski: I see, but manually tying fixed points isn't such a compelling use case by itself. |
2022-01-20 16:57:02 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) (Ping timeout: 256 seconds) |
2022-01-20 16:57:17 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:5cb9:ef3e:81e2:469f) (Ping timeout: 240 seconds) |
2022-01-20 16:59:17 +0100 | <ski> | mm |
2022-01-20 17:00:00 +0100 | [itchyjunk] | (~itchyjunk@user/itchyjunk/x-7353470) |
2022-01-20 17:06:08 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) (Remote host closed the connection) |
2022-01-20 17:06:27 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) |
2022-01-20 17:07:22 +0100 | <Guest9668> | https://paste.tomsmeding.com/8d0debTf |
2022-01-20 17:07:28 +0100 | <Guest9668> | this gives me an error because of multiple definitions of Float, why is that an issue if its just a type? theres also probably indentation errors |
2022-01-20 17:07:46 +0100 | <ski> | in `data Radius = Float', `Float' is not the type, but a data constructor |
2022-01-20 17:07:53 +0100 | <geekosaur> | you need a constructor name, not just a tyope |
2022-01-20 17:08:22 +0100 | <Guest9668> | `data Radius = Float r`? |
2022-01-20 17:08:26 +0100 | <ski> | you presumably either meant `dara Radius = MkRadius Float', or else `type Radius = Float' (type synonym, `Radius' is the same type as `Float') |
2022-01-20 17:08:57 +0100 | <Guest9668> | Radius should be the same type as float |
2022-01-20 17:09:02 +0100 | <ski> | (in this case, the former could also be `newtype Radius = MkRadius Float' .. but this is a less important (and more subtle) distinction) |
2022-01-20 17:09:09 +0100 | <ski> | then you want the latter |
2022-01-20 17:09:33 +0100 | <ski> | type Radius = Float -- this |
2022-01-20 17:10:20 +0100 | ardell | (~ardell@user/ardell) (Quit: Konversation terminated!) |
2022-01-20 17:10:21 +0100 | <geekosaur> | this is, by the way, often frowned upon: it serves as documentation, but also gives a false illusion of type safety |
2022-01-20 17:10:26 +0100 | fef | (~thedawn@user/thedawn) (Quit: Leaving) |
2022-01-20 17:10:30 +0100 | <ski> | the general pattern of `data' is `data MyType parameters ... = DataConstructor Types ... | ...' |
2022-01-20 17:10:38 +0100 | Jing | (~hedgehog@240e:390:7c53:a7e1:c8cd:ea83:c8cd:4ca3) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-20 17:10:48 +0100 | <Guest9668> | I am right in saying thats what I need, I want to be able to define a shape with dimensions and then work out the area of these shapes |
2022-01-20 17:10:57 +0100 | <Guest9668> | ? |
2022-01-20 17:11:13 +0100 | <ski> | using `type', your pasted code would work |
2022-01-20 17:11:25 +0100 | <Guest9668> | in the same way though, yes? |
2022-01-20 17:11:28 +0100 | <geekosaur> | there's an additional question of whether you actually want Float; its range is rather small. perhaps you want Double instead |
2022-01-20 17:11:33 +0100 | <ski> | Guest9668 : huh ? |
2022-01-20 17:13:06 +0100 | <ski> | > s ^ 2 |
2022-01-20 17:13:07 +0100 | <lambdabot> | s * s |
2022-01-20 17:13:13 +0100 | <Guest9668> | https://paste.tomsmeding.com/5Fcu7RBR |
2022-01-20 17:13:37 +0100 | <ski> | indentation ? |
2022-01-20 17:13:59 +0100 | <Guest9668> | https://paste.tomsmeding.com/c0vV5gDY |
2022-01-20 17:14:22 +0100 | <ski> | yout defining equations shouldn't be indented more than the type signature |
2022-01-20 17:15:38 +0100 | Guest52 | (~Guest52@80-100-97-100.ip.xs4all.nl) |
2022-01-20 17:15:38 +0100 | feliix42 | (~felix@gibbs.uberspace.de) (Read error: Connection reset by peer) |
2022-01-20 17:16:01 +0100 | <Guest9668> | ski: https://paste.tomsmeding.com/97t0WpPU |
2022-01-20 17:16:23 +0100 | <ski> | what's that question mark ? |
2022-01-20 17:16:29 +0100 | <Guest9668> | `*` |
2022-01-20 17:16:36 +0100 | <ski> | maybe you have some strange unicode symbol in your file ? |
2022-01-20 17:16:53 +0100 | <ski> | you should use the usual ASCII asterisk thing |
2022-01-20 17:16:57 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 240 seconds) |
2022-01-20 17:17:12 +0100 | <Guest9668> | yeah vscode is saying that too actually |
2022-01-20 17:17:35 +0100 | <Guest9668> | That was it |
2022-01-20 17:17:35 +0100 | AWizzArd | (~code@user/awizzard) (Read error: Connection reset by peer) |
2022-01-20 17:17:51 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) (Quit: coot) |
2022-01-20 17:18:39 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) |
2022-01-20 17:18:43 +0100 | feliix42 | (~felix@gibbs.uberspace.de) |
2022-01-20 17:19:59 +0100 | whatif | (~user@123.123.223.41) |
2022-01-20 17:20:17 +0100 | <whatif> | can string list can be sorted by alphabet? |
2022-01-20 17:21:03 +0100 | <whatif> | ["decent", "absurd", "evil"] to ["absurd", "decent", "evil"] |
2022-01-20 17:21:14 +0100 | <geekosaur> | have you tried it? |
2022-01-20 17:21:16 +0100 | <ski> | > sort (words "The quick brown fox jumps over the lazy dog") |
2022-01-20 17:21:17 +0100 | <lambdabot> | ["The","brown","dog","fox","jumps","lazy","over","quick","the"] |
2022-01-20 17:22:11 +0100 | <whatif> | aha, I thought it would be a String function, it should be in List |
2022-01-20 17:22:32 +0100 | <ski> | `String's are lists of `Char'acters. lists can be compared (namely in lexicographic order), if the elements can be compared |
2022-01-20 17:22:35 +0100 | <geekosaur> | @src String |
2022-01-20 17:22:35 +0100 | <lambdabot> | type String = [Char] |
2022-01-20 17:22:56 +0100 | AWizzArd | (~code@gehrels.uberspace.de) |
2022-01-20 17:22:57 +0100 | <geekosaur> | there are other kinds of strings in haskell, whiuch come with their own sort functions |
2022-01-20 17:22:57 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) (Ping timeout: 240 seconds) |
2022-01-20 17:23:23 +0100 | <ski> | yea, and they're also comparable |
2022-01-20 17:23:28 +0100 | fef | (~thedawn@user/thedawn) |
2022-01-20 17:24:03 +0100 | <ski> | (tuples are also compared, in lexicographic order) |
2022-01-20 17:25:08 +0100 | <ski> | > sortBy (comparing length <> compare) (words "The quick brown fox jumps over the lazy dog") -- sort, not by plain lexicographic order, but rather, primarily by length, secondarily lexicographically |
2022-01-20 17:25:09 +0100 | <lambdabot> | ["The","dog","fox","the","lazy","over","brown","jumps","quick"] |
2022-01-20 17:25:55 +0100 | <ski> | (yea, i like bringing up that example, now and then :) |
2022-01-20 17:27:45 +0100 | [itchyjunk] | (~itchyjunk@user/itchyjunk/x-7353470) (Read error: Connection reset by peer) |
2022-01-20 17:28:01 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) (Ping timeout: 256 seconds) |
2022-01-20 17:30:57 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480::41) (Ping timeout: 240 seconds) |
2022-01-20 17:31:42 +0100 | azimut_ | (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 276 seconds) |
2022-01-20 17:32:55 +0100 | Feuermagier | (~Feuermagi@user/feuermagier) |
2022-01-20 17:34:37 +0100 | [itchyjunk] | (~itchyjunk@user/itchyjunk/x-7353470) |
2022-01-20 17:36:03 +0100 | Jing | (~hedgehog@240e:390:7c53:a7e1:819d:3b6a:9a6f:c60e) |
2022-01-20 17:36:50 +0100 | <Guest9668> | ski: Sorry, another basic problem for you:/ https://paste.tomsmeding.com/FNTxzwv4 |
2022-01-20 17:37:24 +0100 | <Guest9668> | So the error is that its returning `(Float -> Float, Float -> Float)` instead of the expected `Float` |
2022-01-20 17:37:30 +0100 | <Guest9668> | and thats about as far as I've gotten |
2022-01-20 17:37:45 +0100 | <ski> | (you know, you could address your questions to the whole channel :) |
2022-01-20 17:38:00 +0100 | <Guest9668> | @thewholechannel |
2022-01-20 17:38:00 +0100 | <lambdabot> | Unknown command, try @list |
2022-01-20 17:38:36 +0100 | <ski> | here, you're confusing curried style with tupled style |
2022-01-20 17:39:22 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) |
2022-01-20 17:39:25 +0100 | <EvanR> | @wowallthenetworks |
2022-01-20 17:39:25 +0100 | <lambdabot> | Unknown command, try @list |
2022-01-20 17:39:42 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) (Remote host closed the connection) |
2022-01-20 17:39:48 +0100 | <ski> | (you may now ask for clarification, if you so desire) |
2022-01-20 17:40:05 +0100 | <ski> | @palomer |
2022-01-20 17:40:05 +0100 | <lambdabot> | woof |
2022-01-20 17:40:56 +0100 | <Guest9668> | could you clarify please |
2022-01-20 17:41:08 +0100 | <ski> | (also, this type error is funny .. and confusing) |
2022-01-20 17:41:50 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) (Remote host closed the connection) |
2022-01-20 17:41:52 +0100 | <ski> | well, to begin with, all Haskell functions take exactly one input argument. there's no such thing as multiple-parameter functions, in Haskell |
2022-01-20 17:41:57 +0100 | cosimone | (~user@93-47-229-195.ip115.fastwebnet.it) |
2022-01-20 17:42:08 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) |
2022-01-20 17:42:47 +0100 | <ski> | now, there's two common *styles* of *encoding* multiple-parameter functions, in such a situation. these are known as tupled style, and curried style |
2022-01-20 17:42:59 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) (Remote host closed the connection) |
2022-01-20 17:43:18 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) |
2022-01-20 17:43:32 +0100 | <Guest9668> | ok |
2022-01-20 17:43:41 +0100 | <ski> | in the tupled style, you pack the "multiple parameters" into a single parameter (usually a tuple, but could be a list or some other structure). then, the function will extract the "multiple parameters" from this single parameter |
2022-01-20 17:43:54 +0100 | <Guest9668> | Yeah I've used that before |
2022-01-20 17:44:05 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480:1b88:50f:dae0:9293) |
2022-01-20 17:44:25 +0100 | <ski> | in the curried style, you instead make a function that takes one parameter, and returns another function that takes the rest (say, one at a time, just with the first one), before giving back the final answer |
2022-01-20 17:45:00 +0100 | <ski> | your problem is that your type signature is trying to use curried style, while your defining equation tries to use tupled style |
2022-01-20 17:45:08 +0100 | <ski> | pick one, or the other, and be consistent |
2022-01-20 17:45:14 +0100 | <Guest9668> | ok, makes sense |
2022-01-20 17:46:01 +0100 | <ski> | (Haskell syntax is designed (syntactic sugar, associativity) to encourage curried style, as a default. but one should be aware that they're just styles of encoding) |
2022-01-20 17:46:17 +0100 | <Guest9668> | I fixed it with this: `hypotenuse :: (Float,Float) -> Float` |
2022-01-20 17:46:27 +0100 | <ski> | yes, that'd be using tupled style |
2022-01-20 17:47:18 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 17:48:33 +0100 | <Guest9668> | ty |
2022-01-20 17:48:35 +0100 | <EvanR> | when using tupled input arguments, does that necessarily mean a tuple is always constructed when the function is used, or are there optimizations that sometimes skip that step |
2022-01-20 17:48:36 +0100 | <ski> | np |
2022-01-20 17:48:51 +0100 | myShoggoth | (~myShoggot@97-120-67-120.ptld.qwest.net) |
2022-01-20 17:49:20 +0100 | <ski> | i'd imagine strictness analysis could possibly elide the boxing |
2022-01-20 17:52:00 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 256 seconds) |
2022-01-20 17:55:38 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) |
2022-01-20 17:56:17 +0100 | troydm | (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 240 seconds) |
2022-01-20 17:56:18 +0100 | otulp | (~otulp@ti0187q162-3172.bb.online.no) (Remote host closed the connection) |
2022-01-20 17:56:28 +0100 | vicfred | (~vicfred@user/vicfred) |
2022-01-20 17:57:29 +0100 | Guest52 | (~Guest52@80-100-97-100.ip.xs4all.nl) (Ping timeout: 256 seconds) |
2022-01-20 17:58:01 +0100 | whatif | (~user@123.123.223.41) (Quit: ERC (IRC client for Emacs 26.3)) |
2022-01-20 17:59:22 +0100 | d0ku | (~d0ku@178.43.152.233.ipv4.supernova.orange.pl) (Ping timeout: 256 seconds) |
2022-01-20 18:02:16 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) |
2022-01-20 18:02:36 +0100 | kenran | (~kenran@2001:16b8:2bbb:8500:9219:f13c:5dd0:d93e) (Quit: WeeChat info:version) |
2022-01-20 18:05:23 +0100 | Midjak | (~Midjak@may53-1-78-226-116-92.fbx.proxad.net) |
2022-01-20 18:05:58 +0100 | max22- | (~maxime@2a01cb08833598008b56a1095c0012ed.ipv6.abo.wanadoo.fr) |
2022-01-20 18:06:25 +0100 | lbseale | (~ep1ctetus@user/ep1ctetus) |
2022-01-20 18:06:44 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) (Ping timeout: 256 seconds) |
2022-01-20 18:07:07 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) |
2022-01-20 18:10:12 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:25fa:6d44:7c2a:d37c) |
2022-01-20 18:10:25 +0100 | <zzz> | i keep seeing this (a ~ SomeType) syntax. what's the context for it and which extension(s) give access to it? |
2022-01-20 18:11:01 +0100 | Guest9668 | (~Guest96@144-124-99-115.pip.aber.ac.uk) (Quit: Client closed) |
2022-01-20 18:11:11 +0100 | <EvanR> | it's a constraint that says a and SomeType are the same type. It's enabled by GADTs I think |
2022-01-20 18:11:27 +0100 | <geekosaur> | it's enabled by several extensions but doesn't have one of its own |
2022-01-20 18:11:54 +0100 | <ski> | it's a (type) equality constraint |
2022-01-20 18:11:59 +0100 | <geekosaur> | (iirc TypeFamilies also enables it?) |
2022-01-20 18:12:06 +0100 | <ski> | iirc, yea |
2022-01-20 18:13:14 +0100 | benin | (~benin@183.82.179.241) (Quit: The Lounge - https://thelounge.chat) |
2022-01-20 18:14:08 +0100 | chele | (~chele@user/chele) (Remote host closed the connection) |
2022-01-20 18:14:44 +0100 | razetime | (~quassel@49.207.203.87) (Ping timeout: 250 seconds) |
2022-01-20 18:14:51 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) |
2022-01-20 18:15:02 +0100 | <zzz> | ski: thanks i can search for the term now |
2022-01-20 18:16:25 +0100 | <zzz> | iiuc i can use it everywhere i use class constraints? |
2022-01-20 18:17:07 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) |
2022-01-20 18:17:38 +0100 | <ski> | you can't instance it |
2022-01-20 18:18:14 +0100 | <EvanR> | > let x :: Int ~ Int => String; x = "foo" in x |
2022-01-20 18:18:15 +0100 | <lambdabot> | "foo" |
2022-01-20 18:18:20 +0100 | <EvanR> | > let x :: Bool ~ Int => String; x = "foo" in x |
2022-01-20 18:18:21 +0100 | <lambdabot> | error: |
2022-01-20 18:18:21 +0100 | <lambdabot> | Couldn't match type ‘Bool’ with ‘Int’ arising from a use of ‘x’ |
2022-01-20 18:18:35 +0100 | <ski> | @let instance Bool ~ Int |
2022-01-20 18:18:35 +0100 | <lambdabot> | Parse failed: Illegal instance declaration |
2022-01-20 18:18:45 +0100 | Guest52 | (~Guest52@80-100-97-100.ip.xs4all.nl) |
2022-01-20 18:19:27 +0100 | <zzz> | @let instance (a ~ b) => Show (a,b) |
2022-01-20 18:19:28 +0100 | <lambdabot> | /sandbox/tmp/.L.hs:175:10: error: |
2022-01-20 18:19:28 +0100 | <lambdabot> | Duplicate instance declarations: |
2022-01-20 18:19:28 +0100 | <lambdabot> | instance [safe] (a ~ b) => Show (a, b) |
2022-01-20 18:19:38 +0100 | <ski> | that'd work, yea |
2022-01-20 18:20:10 +0100 | <zzz> | so wdym by "you can't instance it"? |
2022-01-20 18:20:25 +0100 | <ski> | exactly the example i gave above |
2022-01-20 18:20:34 +0100 | <zzz> | oh |
2022-01-20 18:20:44 +0100 | <EvanR> | you didn't instance it zzz you used as a precondition for another instance |
2022-01-20 18:20:45 +0100 | <zzz> | can you instance class constraints? |
2022-01-20 18:20:46 +0100 | <geekosaur> | https://downloads.haskell.org/ghc/latest/docs/html/users_guide/exts/equality_constraints.html |
2022-01-20 18:20:50 +0100 | Jing | (~hedgehog@240e:390:7c53:a7e1:819d:3b6a:9a6f:c60e) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-20 18:21:04 +0100 | <ski> | `(~)' could be seen as having kind `forall k. k -> k -> Constraint'. but it's not like other classes, you can't instance it |
2022-01-20 18:21:12 +0100 | <Clint> | when did instance become a verb |
2022-01-20 18:21:19 +0100 | Guest92 | (~Guest92@144-124-136-14.pip.aber.ac.uk) |
2022-01-20 18:21:21 +0100 | Guest92 | (~Guest92@144-124-136-14.pip.aber.ac.uk) (Client Quit) |
2022-01-20 18:21:24 +0100 | Guest9647 | (~Guest96@144-124-99-115.pip.aber.ac.uk) |
2022-01-20 18:21:25 +0100 | <EvanR> | when they were added to WoW |
2022-01-20 18:21:26 +0100 | <ski> | for instance, a few minutes ago |
2022-01-20 18:21:30 +0100 | <Clint> | i see, i see |
2022-01-20 18:21:36 +0100 | Guest24 | (~Guest24@144-124-136-14.pip.aber.ac.uk) |
2022-01-20 18:21:37 +0100 | <geekosaur> | we're speaking English, pretty much everything is a verb these days :þ |
2022-01-20 18:21:45 +0100 | <Guest24> | hi |
2022-01-20 18:21:56 +0100 | <EvanR> | we're englishing and everything is verbing |
2022-01-20 18:22:02 +0100 | <byorgey> | hi Guest24 |
2022-01-20 18:22:05 +0100 | <ski> | re, Guest24 |
2022-01-20 18:22:20 +0100 | <Guest24> | would you be able to help me please I can't figure out why I keep getting an indentation erro |
2022-01-20 18:22:34 +0100 | <monochrom> | "happy haskelling" |
2022-01-20 18:22:35 +0100 | <ski> | @where paste |
2022-01-20 18:22:35 +0100 | <lambdabot> | Help us help you: please paste full code, input and/or output at e.g. https://paste.tomsmeding.com |
2022-01-20 18:22:36 +0100 | cyphase | (~cyphase@user/cyphase) |
2022-01-20 18:22:48 +0100 | <Guest24> | https://paste.tomsmeding.com/UfU71afc |
2022-01-20 18:22:58 +0100 | fendor_ | (~fendor@178.165.192.6.wireless.dyn.drei.com) (Ping timeout: 250 seconds) |
2022-01-20 18:23:10 +0100 | <monochrom> | add 2 spaces to all of lines 2-20 |
2022-01-20 18:23:23 +0100 | <monochrom> | Err hrm, actually I may be wrong. |
2022-01-20 18:23:24 +0100 | <ski> | you have `if' after `where', this is illegal syntax |
2022-01-20 18:23:45 +0100 | <ski> | you should have defining equations (and type signatures) after a `where' |
2022-01-20 18:23:46 +0100 | <monochrom> | Ugh += is not a thing. |
2022-01-20 18:23:47 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) (Remote host closed the connection) |
2022-01-20 18:23:53 +0100 | <ski> | well, it could be :) |
2022-01-20 18:24:03 +0100 | <Guest24> | oh |
2022-01-20 18:24:03 +0100 | <EvanR> | probably in the OpenGL library |
2022-01-20 18:24:05 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) |
2022-01-20 18:24:22 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) (Remote host closed the connection) |
2022-01-20 18:24:33 +0100 | <Clint> | alternately, x is not a thing |
2022-01-20 18:24:41 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) |
2022-01-20 18:24:43 +0100 | <Guest24> | what should i use instead of where |
2022-01-20 18:24:58 +0100 | <ski> | depends on what you intend to express |
2022-01-20 18:25:22 +0100 | <monochrom> | Yeah, x is not a thing in this code. |
2022-01-20 18:25:42 +0100 | <Guest24> | i need to add up the price of all the ice creams sold |
2022-01-20 18:25:50 +0100 | <Guest24> | based on on a few conditions |
2022-01-20 18:25:55 +0100 | <ski> | Guest24 : you *could* define `x' to be something, in your `where' |
2022-01-20 18:25:57 +0100 | <monochrom> | And you are supposed to use recursion. |
2022-01-20 18:26:16 +0100 | <ski> | (and that definition could contain an (or a bunch of) `if'-`then'-`else'(s)) |
2022-01-20 18:26:19 +0100 | <Guest24> | i tried to use recursion |
2022-01-20 18:26:23 +0100 | <monochrom> | Ah OK I see. |
2022-01-20 18:27:10 +0100 | <monochrom> | OK, write a recursive function to sum up a list of numbers. A simpler question that shows the same idea. |
2022-01-20 18:27:13 +0100 | <ski> | hm, right. you probably want to use pattern-matching, at least for the `Special' thing |
2022-01-20 18:27:19 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:25fa:6d44:7c2a:d37c) (Remote host closed the connection) |
2022-01-20 18:28:09 +0100 | <ski> | (doing monochrom's exercise would probably help with `totalScoops') |
2022-01-20 18:29:27 +0100 | <Guest24> | ok thank you |
2022-01-20 18:30:13 +0100 | <ski> | Guest24 : oh .. i see. it looks like you intended `x' to be the result of the recursive call `price xs' (? or maybe you intended to first accumulate onto `x', then pass that into the recursive call) .. in that case, you could define `x0' to be that recursive call result, then define `x1' in terms of `x0', updating with the info from the current icecream |
2022-01-20 18:30:22 +0100 | <ski> | (or, the other way around, if you want to do it in the other order) |
2022-01-20 18:30:28 +0100 | <maerwald> | `Q Sqlite DataDB QBaseScope (QRes QBaseScope)` |
2022-01-20 18:30:32 +0100 | <maerwald> | I think I don't like beam. |
2022-01-20 18:31:13 +0100 | <EvanR> | bowl of Qs for breakfast |
2022-01-20 18:31:34 +0100 | <maerwald> | why Haskellers always have to over-engineer things |
2022-01-20 18:31:52 +0100 | <maerwald> | SQL isn't that hard |
2022-01-20 18:31:53 +0100 | <monochrom> | Oh, I thought you were complaining about naming. |
2022-01-20 18:32:02 +0100 | <maerwald> | well, that too |
2022-01-20 18:32:54 +0100 | <monochrom> | Is that a type? Is that a term? |
2022-01-20 18:32:54 +0100 | <EvanR> | DataDB... |
2022-01-20 18:32:58 +0100 | <maerwald> | a type |
2022-01-20 18:33:01 +0100 | <EvanR> | i.e. a DataDataBase |
2022-01-20 18:33:02 +0100 | <maerwald> | haha |
2022-01-20 18:33:15 +0100 | <monochrom> | Well yeah Haskellers over-type things. |
2022-01-20 18:33:24 +0100 | <Sqaure> | "-Phew, that type ended up pretty unreadable, but atleast it compiles." |
2022-01-20 18:33:27 +0100 | <monochrom> | Not sure whether it's over-engineering or over-mathing. |
2022-01-20 18:33:45 +0100 | <kuribas> | maerwald: because if you have fancy types, you need to use them! |
2022-01-20 18:33:47 +0100 | <ski> | @kind Data.Data.Data |
2022-01-20 18:33:48 +0100 | <lambdabot> | * -> Constraint |
2022-01-20 18:33:54 +0100 | <geekosaur> | types are good, therefore more types must be better |
2022-01-20 18:33:55 +0100 | <maerwald> | and when you `>>= \case` it, you have an Either |
2022-01-20 18:34:06 +0100 | <EvanR> | MonadBase BaseDataDataBaseData AllYourBase a |
2022-01-20 18:34:11 +0100 | <geekosaur> | *more betterer |
2022-01-20 18:34:28 +0100 | <kuribas> | maerwald: btw, overengineering is present in any language. underengineering as well :) |
2022-01-20 18:34:33 +0100 | <maerwald> | maybe it makes more sense after I read the tutorial... although I like libraries that "just make sense" |
2022-01-20 18:34:45 +0100 | <EvanR> | I've never heard anyone complain about underengineering, unless that refers to web code |
2022-01-20 18:34:59 +0100 | <EvanR> | which nevermind that last bit |
2022-01-20 18:35:00 +0100 | ski | . o O ( reading the tutorial is admitting defeat ) |
2022-01-20 18:35:37 +0100 | <maerwald> | learn a DSL that's harder than SQL... so you can write SQL |
2022-01-20 18:35:43 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) |
2022-01-20 18:35:49 +0100 | <monochrom> | EvanR: Automatic ATM Teller Machine >:) |
2022-01-20 18:35:50 +0100 | <Guest24> | ski I intended it to be the result of the recursive call, I want x to be the float |
2022-01-20 18:35:59 +0100 | ski | . o O ( Datalog ) |
2022-01-20 18:36:26 +0100 | <ski> | Guest24 : well, nothing's stopping you from going `... where x0 = price xs; x1 = ..x0..', if that's what you wish to try |
2022-01-20 18:37:40 +0100 | <ski> | (over here, "CD disk" (not in english), was pretty common to hear) |
2022-01-20 18:37:47 +0100 | <EvanR> | maerwald, you can't be trusted to pass text arguments to the query properly, sorry |
2022-01-20 18:38:07 +0100 | <Guest24> | ski https://paste.tomsmeding.com/ZE21eja6 |
2022-01-20 18:38:12 +0100 | <EvanR> | you will have to pass a learn this DSL test first |
2022-01-20 18:38:17 +0100 | <Guest24> | do you mean like that? |
2022-01-20 18:38:29 +0100 | <maerwald> | Also... the people who wrote this code are long gone. They successfully escaped maintaining their own work |
2022-01-20 18:38:42 +0100 | <ski> | (bonus points for indenting the module body ;) |
2022-01-20 18:38:52 +0100 | ph88 | (~ph88@tmo-085-109.customers.d1-online.com) |
2022-01-20 18:38:57 +0100 | <ski> | Guest24 : well, it's a start |
2022-01-20 18:39:14 +0100 | <ski> | now move the `if' stuff inside the definition of `x1' (and don't call recursively, twice) |
2022-01-20 18:39:50 +0100 | <ski> | (oh, and you need to indent `x0 = ...' more. and you can replace that semicolon by a newline, if you indent) |
2022-01-20 18:39:59 +0100 | MajorBiscuit | (~MajorBisc@wlan-145-94-218-113.wlan.tudelft.nl) (Ping timeout: 256 seconds) |
2022-01-20 18:40:28 +0100 | mbuf | (~Shakthi@122.174.254.114) (Quit: Leaving) |
2022-01-20 18:41:57 +0100 | Neuromancer | (~Neuromanc@user/neuromancer) |
2022-01-20 18:42:02 +0100 | pretty_dumm_guy | (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) |
2022-01-20 18:42:16 +0100 | Akiva | (~Akiva@user/Akiva) |
2022-01-20 18:44:57 +0100 | Morrow | (~Morrow@ool-1826f675.dyn.optonline.net) (Ping timeout: 240 seconds) |
2022-01-20 18:45:21 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 18:45:21 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 18:45:21 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 18:48:32 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) (Ping timeout: 250 seconds) |
2022-01-20 18:48:45 +0100 | <Guest24> | i jsut realised i just want to work out the price of one icecream |
2022-01-20 18:49:12 +0100 | <Guest24> | so all i need to do is check through the conditions and return the value |
2022-01-20 18:49:18 +0100 | <ski> | oh .. right |
2022-01-20 18:49:24 +0100 | <ski> | so, no recursion |
2022-01-20 18:49:32 +0100 | TheCoffeMaker | (~TheCoffeM@user/thecoffemaker) (Ping timeout: 240 seconds) |
2022-01-20 18:49:37 +0100 | <Guest24> | nope |
2022-01-20 18:50:27 +0100 | <Guest24> | https://paste.tomsmeding.com/sjOWvorr |
2022-01-20 18:51:13 +0100 | <ski> | now you still need to get rid of the `+=' stuff |
2022-01-20 18:52:10 +0100 | <Guest24> | what would i use instead |
2022-01-20 18:52:22 +0100 | <EvanR> | the main issue is x was never introduced so it doesn't refer to anything |
2022-01-20 18:52:36 +0100 | <EvanR> | secondary issue is you can't mutate variables |
2022-01-20 18:52:39 +0100 | <ski> | instead of thinking like `x = a; if ... then x += b0 else x += b1; ...', think like `x = a + (if ... then b0 else b1) + ...' |
2022-01-20 18:53:25 +0100 | wombat875 | (~wombat875@pool-72-89-24-154.nycmny.fios.verizon.net) |
2022-01-20 18:53:32 +0100 | <ski> | (or, if you must, `x = if ... then a + b0 + ... else a + b1 + ...' -- but often, the former, "factored", version is nicer (shorter, more surveyable/understandable, &c.)) |
2022-01-20 18:53:58 +0100 | <EvanR> | and now it kind of makes sense why math students hate math... x often comes out of nowhere, wtf is x |
2022-01-20 18:54:29 +0100 | <ski> | well, Guest24 left out the initialization |
2022-01-20 18:54:46 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-20 18:55:05 +0100 | <ski> | (although, to be fair, in the original version, the initialization (although not spelled out) was intended to come from the recursive call) |
2022-01-20 18:55:42 +0100 | <Guest24> | how do initialise the variable outside the function or within it |
2022-01-20 18:56:18 +0100 | <ski> | x = a + (if ... then b0 else b1) + ... -- this is the initialization (also "finalization", final value. since it never changes) |
2022-01-20 18:56:54 +0100 | <ski> | (but when i said "initialization" above, i was referring to the `x = a' part (the part you left out) in my schema for your code) |
2022-01-20 18:57:37 +0100 | <ski> | in any case, `x = ...' would happen in a `where' (or `let'-`in'), in your defining equation for `price' |
2022-01-20 18:58:23 +0100 | <ski> | (perhaps, in your case, `a' would be zero. i'm nor sure. in that case, `a + ....' would be the same as just `....') |
2022-01-20 18:58:34 +0100 | <Guest24> | https://paste.tomsmeding.com/UttMpsQT |
2022-01-20 18:59:09 +0100 | <ski> | please no `x = x + ...'. that's no better than `x += ...' |
2022-01-20 18:59:28 +0100 | <Guest24> | the what do i do instead :(((( |
2022-01-20 18:59:39 +0100 | <ski> | (what does `x = x + 1' mean ? it means that `x' is one greater than itself. no finite number can be like that) |
2022-01-20 19:00:15 +0100 | <ski> | Guest24 : if you really want to use "multiple `x's", then introduce versions. like `x0 = a', then `x1 = x0 + ...', &c. |
2022-01-20 19:00:35 +0100 | <Guest24> | i want to add to the value of x |
2022-01-20 19:00:42 +0100 | <Guest24> | x is the final price |
2022-01-20 19:00:47 +0100 | <ski> | but, commonly (not always), it's nicer to just incorporate all relevant parts in one go : `x = a + ...' |
2022-01-20 19:01:19 +0100 | <ski> | rather than thinking "add to `x'", think "i define `x' as the sum of ..." |
2022-01-20 19:02:05 +0100 | Guest24 | (~Guest24@144-124-136-14.pip.aber.ac.uk) (Quit: Client closed) |
2022-01-20 19:02:15 +0100 | Guest24 | (~Guest24@144-124-136-14.pip.aber.ac.uk) |
2022-01-20 19:02:16 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-20 19:02:25 +0100 | <ski> | (anyway, i should also saw that in your latest paste, `price x = (f,s,h)' is a regression from before. you want to match the input icecream against `(f,s,h)'. you don't want to return an icecream, while calling the input `x') |
2022-01-20 19:04:01 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:25fa:6d44:7c2a:d37c) |
2022-01-20 19:04:21 +0100 | johnjaye | (~pi@173.209.65.233) (Ping timeout: 256 seconds) |
2022-01-20 19:05:07 +0100 | <Guest24> | https://paste.tomsmeding.com/P1gyZ9Cv |
2022-01-20 19:05:16 +0100 | simendsjo | (~user@84.211.91.241) |
2022-01-20 19:05:40 +0100 | <ski> | ok, let's take an example of what i mean |
2022-01-20 19:05:46 +0100 | <ski> | if h == True |
2022-01-20 19:05:52 +0100 | <ski> | then x = x + 0.50 |
2022-01-20 19:06:01 +0100 | <ski> | else x = x + (1.00 * s) |
2022-01-20 19:06:16 +0100 | <ski> | instead of this, do something like |
2022-01-20 19:06:33 +0100 | <ski> | x2 = if h == True |
2022-01-20 19:06:44 +0100 | <ski> | then x1 + 0.50 |
2022-01-20 19:06:56 +0100 | <ski> | else x1 + (1.00 * s) |
2022-01-20 19:06:57 +0100 | polyphem | (~rod@2a02:810d:840:8754:e450:3ca3:b389:687a) (Ping timeout: 240 seconds) |
2022-01-20 19:07:07 +0100 | <ski> | or (better), using guards |
2022-01-20 19:07:31 +0100 | <ski> | x2 | h == True = x1 + 0.50 |
2022-01-20 19:07:41 +0100 | <ski> | | otherwise = x1 + (1.00 * s) |
2022-01-20 19:08:07 +0100 | polyphem | (~rod@2a02:810d:840:8754:b6f3:5141:3b3:83de) |
2022-01-20 19:08:14 +0100 | <ski> | this way, you define the next version, `x2', in terms of the previous version `x1' (which you need to define as well, of course) |
2022-01-20 19:08:42 +0100 | <ski> | (oh, and it's better to just write `h', rather than `h == True'. but that's a separate issue) |
2022-01-20 19:09:14 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:7985:a982:d93:11f) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-20 19:10:22 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 19:10:22 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 19:10:22 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 19:10:33 +0100 | <ski> | oh, yet another way (a more factored one), would be |
2022-01-20 19:10:35 +0100 | <monochrom> | Uh so many Wordle articles in the Haskell Weekly News today haha |
2022-01-20 19:10:49 +0100 | <ski> | x2 = x1 + (if h == True then 0.50 else 1.00 * s) |
2022-01-20 19:11:07 +0100 | <Guest24> | https://paste.tomsmeding.com/RbRBMuv6 |
2022-01-20 19:11:46 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:7985:a982:d93:11f) |
2022-01-20 19:12:03 +0100 | <ski> | Guest24 : well. now, in the "special" case, you're not getting the part where you check `h' |
2022-01-20 19:12:25 +0100 | <EvanR> | Haskell Weekly News Today |
2022-01-20 19:12:44 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) (Remote host closed the connection) |
2022-01-20 19:12:52 +0100 | <Guest24> | so how do i get it |
2022-01-20 19:12:58 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) |
2022-01-20 19:13:33 +0100 | <ski> | if you wanna do versions (which would be closest to your original `+=' stuff), then define `x0', then `x1', then `x2', and so on |
2022-01-20 19:14:22 +0100 | <ski> | (this can be a little bit verbose, but perhaps would be the simplest way for you to get to a working piece of code that you can understand. then you can worry about reformulations, which may be more idiomatic and nicer in practice) |
2022-01-20 19:14:44 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-20 19:15:22 +0100 | <ski> | (an alternative to versions (each defined in terms of the previous one, except the first one) would be to separately define the contributing terms, then sum those up) |
2022-01-20 19:16:02 +0100 | alp | (~alp@user/alp) (Ping timeout: 240 seconds) |
2022-01-20 19:16:33 +0100 | Guest52 | (~Guest52@80-100-97-100.ip.xs4all.nl) (Quit: Connection closed) |
2022-01-20 19:16:41 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:25fa:6d44:7c2a:d37c) (Remote host closed the connection) |
2022-01-20 19:16:50 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:25fa:6d44:7c2a:d37c) |
2022-01-20 19:17:38 +0100 | <ski> | (usually, if you have a definition like e.g. `f ... = if ... then ... else ...', then using guards would look more pleasant. but there's nothing wrong with using `if'-`then'-`else', especially if they're nested somewhere inside the body (after `='), rather than comprising the whole body) |
2022-01-20 19:19:20 +0100 | SolidusRiver | (~fuag1@174.127.249.180) |
2022-01-20 19:19:48 +0100 | <SolidusRiver> | I need to set conditional flags and conditional extra-deps depending on the host os in a stack.yaml, is this possible? |
2022-01-20 19:19:49 +0100 | econo | (uid147250@user/econo) |
2022-01-20 19:20:34 +0100 | <ski> | hm, i notice that the formula in <https://paste.tomsmeding.com/sjOWvorr> looks different from the one in <https://paste.tomsmeding.com/UttMpsQT> (you've moved an "else" around, or something) .. you should make sure you're computing the right thing (i dunno what it is) |
2022-01-20 19:22:26 +0100 | <ski> | (hm, i guess they're gone) |
2022-01-20 19:22:41 +0100 | <ski> | er .. no. wring guest |
2022-01-20 19:26:55 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:25fa:6d44:7c2a:d37c) (Remote host closed the connection) |
2022-01-20 19:27:07 +0100 | tzh | (~tzh@c-24-21-73-154.hsd1.wa.comcast.net) |
2022-01-20 19:28:36 +0100 | <EvanR> | don't wring the guest! |
2022-01-20 19:29:15 +0100 | ski | brings the quest |
2022-01-20 19:34:00 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) (Remote host closed the connection) |
2022-01-20 19:34:19 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) |
2022-01-20 19:35:46 +0100 | mud | (~mud@user/kadoban) (Ping timeout: 250 seconds) |
2022-01-20 19:35:47 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:7985:a982:d93:11f) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-20 19:35:59 +0100 | mud | (~mud@user/kadoban) |
2022-01-20 19:37:25 +0100 | fef | (~thedawn@user/thedawn) (Quit: Leaving) |
2022-01-20 19:38:17 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-20 19:38:17 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-20 19:38:17 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-20 19:38:26 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) (Remote host closed the connection) |
2022-01-20 19:38:40 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) |
2022-01-20 19:40:12 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-20 19:40:37 +0100 | mtjm | (~mutantmel@2604:a880:2:d0::208b:d001) (Ping timeout: 240 seconds) |
2022-01-20 19:43:04 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-20 19:44:03 +0100 | asivitz | (uid178348@id-178348.tinside.irccloud.com) |
2022-01-20 19:44:08 +0100 | xb0o2 | (~xb0o2@user/xb0o2) (Quit: Client closed) |
2022-01-20 19:44:46 +0100 | lavaman | (~lavaman@98.38.249.169) (Ping timeout: 256 seconds) |
2022-01-20 19:45:16 +0100 | mtjm | (~mutantmel@2604:a880:2:d0::208b:d001) |
2022-01-20 19:47:07 +0100 | mud | (~mud@user/kadoban) (Remote host closed the connection) |
2022-01-20 19:48:18 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-20 19:48:35 +0100 | statusbot5 | (~statusbot@ec2-34-198-122-184.compute-1.amazonaws.com) (Remote host closed the connection) |
2022-01-20 19:48:38 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 19:48:49 +0100 | statusbot | (~statusbot@ec2-34-198-122-184.compute-1.amazonaws.com) |
2022-01-20 19:50:31 +0100 | mud | (~mud@user/kadoban) |
2022-01-20 19:51:59 +0100 | <maerwald> | so... https://hackage.haskell.org/package/beam-core-0.9.0.0/docs/Database-Beam-Query.html#v:references_ |
2022-01-20 19:52:01 +0100 | xb0o2 | (~xb0o2@user/xb0o2) |
2022-01-20 19:52:16 +0100 | <maerwald> | this says it allows me to compare foreign key to a given table... but the type forces a primary key |
2022-01-20 19:52:50 +0100 | wombat875 | (~wombat875@pool-72-89-24-154.nycmny.fios.verizon.net) (Quit: WeeChat 2.2-dev) |
2022-01-20 19:53:16 +0100 | <EvanR> | jeez |
2022-01-20 19:56:57 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480:1b88:50f:dae0:9293) (Ping timeout: 240 seconds) |
2022-01-20 19:59:35 +0100 | fizzsegfaultbuzz | (~segfaultf@135-180-0-138.static.sonic.net) |
2022-01-20 20:00:21 +0100 | kuribas | (~user@ptr-25vy0i99jv0pb0h8fdc.18120a2.ip6.access.telenet.be) (Quit: ERC (IRC client for Emacs 26.3)) |
2022-01-20 20:04:39 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) (Remote host closed the connection) |
2022-01-20 20:05:00 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-20 20:05:03 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) |
2022-01-20 20:05:51 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) |
2022-01-20 20:05:55 +0100 | <romesrf> | hello! |
2022-01-20 20:06:03 +0100 | <ski> | ehĺo |
2022-01-20 20:06:42 +0100 | johnjaye | (~pi@173.209.65.233) |
2022-01-20 20:07:39 +0100 | <romesrf> | could someone help me with some type level magic make this ambiguity error go away? (minimal working problem: https://paste.tomsmeding.com/4ETh7aha) |
2022-01-20 20:08:24 +0100 | <sshine> | romesrf, query "hi" @Text and add {-# LANGUAGE TypeApplications #-} -- does that work? |
2022-01-20 20:08:30 +0100 | <romesrf> | basically, when calling this function with a string literal, the literal type is text (something like IsString a => a ~ Text) |
2022-01-20 20:08:52 +0100 | <sshine> | romesrf, it doesn't know what kinda string "hi" is. OverloadedStrings makes "hi" polymorphic. |
2022-01-20 20:09:01 +0100 | <sshine> | romesrf, so "hi" :: IsString s => s :D |
2022-01-20 20:09:21 +0100 | <monochrom> | There is no defaulting for the Query class. |
2022-01-20 20:09:24 +0100 | <sshine> | romesrf, you can tell it that it's a Text by doing e.g. ("hi" :: Text) |
2022-01-20 20:09:31 +0100 | <romesrf> | hahah yes indeed, what I would like is to enforce in the `query` function that if IsString s then s ~ Text |
2022-01-20 20:10:00 +0100 | <sshine> | romesrf, oh, sorry. I didn't see that "hi" is supposed to have type Query q => q. |
2022-01-20 20:10:10 +0100 | <romesrf> | sshine: thank you, however i was trying to use `magic` to be able to omit :: Text |
2022-01-20 20:10:12 +0100 | <monochrom> | There is no defaulting for the IsString class either. |
2022-01-20 20:10:18 +0100 | <awpr> | how about: turn off OverloadedStrings, change the instance to String, have it use `pack` immediately on its argument, and make sure it gets inlined |
2022-01-20 20:10:27 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480::41) |
2022-01-20 20:10:55 +0100 | <romesrf> | awpr: however i'm expecting people that interact with the api to have overloaded strings on |
2022-01-20 20:11:26 +0100 | <monochrom> | Perhaps eliminate the Query class. |
2022-01-20 20:11:37 +0100 | <romesrf> | ahahahah yes, that would solve the problem as well |
2022-01-20 20:11:49 +0100 | <sshine> | romesrf, you still need to eventually commit to a concrete type, or keep working within functions that have type-class constraining assumptions. |
2022-01-20 20:11:52 +0100 | <romesrf> | yes, first off, my problem is that i wanna have the cake and eat it too |
2022-01-20 20:12:38 +0100 | <romesrf> | right sshine |
2022-01-20 20:13:23 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-20 20:13:40 +0100 | <romesrf> | it's interesting that despite Text being the only IsString instance that instances Query, it cannot be inferred that that literal must be Text for it to work |
2022-01-20 20:13:58 +0100 | <monochrom> | You do not know that Text is the only instance. |
2022-01-20 20:14:16 +0100 | <sshine> | romesrf, not constructive reasoning |
2022-01-20 20:14:17 +0100 | <ski> | % let f :: (Typeable a,Show a => a ~ Rational) => a -> TypeRep; f = typeOf in f 2 |
2022-01-20 20:14:17 +0100 | <yahb> | ski: Ratio Integer |
2022-01-20 20:14:20 +0100 | <ski> | % let f :: (Typeable a,Show a => a ~ Rational) => a -> TypeRep; f = typeOf in f chr |
2022-01-20 20:14:20 +0100 | <yahb> | ski: ; <interactive>:15:77: error:; * Couldn't match type `Int -> Char' with `Rational' arising from a use of `f'; * In the expression: f chr; In the expression:; let; f :: (Typeable a, Show a => a ~ Rational) => a -> TypeRep; f = typeOf; in f chr; In an equation for `it':; it; = let; f :: (Typeable a, Show a => a ~ Ratio |
2022-01-20 20:14:26 +0100 | <monochrom> | The type class system is an open-world system. It does not enjoy a closed world assumption. |
2022-01-20 20:15:20 +0100 | <monochrom> | There is no way to express instance selection by absence of other instances. |
2022-01-20 20:15:32 +0100 | <romesrf> | monochrom: interesting! that's good insight |
2022-01-20 20:16:11 +0100 | ProfSimm | (~ProfSimm@176-12-60-137.pon.spectrumnet.bg) (Remote host closed the connection) |
2022-01-20 20:16:32 +0100 | <romesrf> | right, I do see how that's not constructive reasoning |
2022-01-20 20:16:33 +0100 | ski | . o O ( upwards class mobility ) |
2022-01-20 20:16:52 +0100 | <awpr> | if there are exactly the two instances, or at least a predetermined set of instances, you might be able to abuse closed type families to make GHC conclude anything that's not SQuery must be Text: `type family QueryType a where QueryType SQuery = SQuery; QueryType a = Text` `class Query_ a b where toQuery :: a -> SQuery` `type Query a = Query_ (QueryType a) a` `instance a ~ Text => Query_ Text a where ...` `instance a ~ |
2022-01-20 20:16:52 +0100 | <awpr> | SQuery => Query_ SQuery a` |
2022-01-20 20:16:57 +0100 | <monochrom> | I believe in downwards class mobility. |
2022-01-20 20:17:57 +0100 | ski | idly ponders interior and closure operations on the lower classes |
2022-01-20 20:18:30 +0100 | <awpr> | wait, what about replacing the whole thing with `instance IsString SQuery` |
2022-01-20 20:18:54 +0100 | <romesrf> | awpr: AHAH i'll see |
2022-01-20 20:19:28 +0100 | <ski> | romesrf : you don't know that `Text' is the only simultaneous instance of `IsString' and `Query'. you only know that it's the only *known* (to your current program) instance |
2022-01-20 20:19:31 +0100 | <romesrf> | i do like your first answer btw, i ws trying to understand it |
2022-01-20 20:19:41 +0100 | <awpr> | (also only good if the goal is to allow specifically string literals and not other types to be passed transparently as `SQuery`s) |
2022-01-20 20:20:24 +0100 | <romesrf> | ski: understood, thank you |
2022-01-20 20:20:43 +0100 | neurocyte0917090 | (~neurocyte@IP-045128181031.dynamic.medianet-world.de) |
2022-01-20 20:20:43 +0100 | neurocyte0917090 | (~neurocyte@IP-045128181031.dynamic.medianet-world.de) (Changing host) |
2022-01-20 20:20:43 +0100 | neurocyte0917090 | (~neurocyte@user/neurocyte) |
2022-01-20 20:21:06 +0100 | <monochrom> | Yeah perhaps IsString already does everything Query wants to do. |
2022-01-20 20:21:37 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 240 seconds) |
2022-01-20 20:22:53 +0100 | <romesrf> | monochrom: yes i'm trying it out, it is a nice out of the box idea haha |
2022-01-20 20:24:18 +0100 | polyphem | (~rod@2a02:810d:840:8754:b6f3:5141:3b3:83de) (Ping timeout: 250 seconds) |
2022-01-20 20:25:54 +0100 | Erutuon | (~Erutuon@user/erutuon) |
2022-01-20 20:26:02 +0100 | polyphem | (~rod@2a02:810d:840:8754:b6f3:5141:3b3:83de) |
2022-01-20 20:27:48 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:494b:f936:f65f:424f) |
2022-01-20 20:29:55 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-20 20:31:31 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) (Remote host closed the connection) |
2022-01-20 20:31:44 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) |
2022-01-20 20:31:57 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:494b:f936:f65f:424f) (Ping timeout: 240 seconds) |
2022-01-20 20:33:05 +0100 | gensyst | (gensyst@user/gensyst) |
2022-01-20 20:33:16 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-20 20:34:17 +0100 | <gensyst> | Is it possible to have *really* global variables? Something references globally by an ID, for example. Use case: Create a global variable within a library, without the library users having to create the variable in their main and passing it to all functions. |
2022-01-20 20:35:39 +0100 | <monochrom> | x :: IORef Int; x = unsafePerformIO (newIORef 0); {-# NOINLINE x #-} |
2022-01-20 20:35:51 +0100 | <romesrf> | hahaha |
2022-01-20 20:36:08 +0100 | <monochrom> | That said, read the literature about concurrency and re-entrancy to see why this is bad, even in C. |
2022-01-20 20:36:35 +0100 | <monochrom> | If a man page says that a C library function is "MT unsafe" it is because of that. And only that. |
2022-01-20 20:36:35 +0100 | <romesrf> | gensyst: perhaps you can have the users create the variable just once at the beginning, and then implicitly pass it around all functions with a Reader monad |
2022-01-20 20:37:01 +0100 | <monochrom> | And learn that all MT-safe solutions require the user to create the variable and pass it to all functions. |
2022-01-20 20:37:07 +0100 | <geekosaur> | ^ is how we typically handle this |
2022-01-20 20:37:15 +0100 | <monochrom> | The C people are learning our lessons. Why do you want to repeat history? |
2022-01-20 20:37:58 +0100 | <gensyst> | Okay, so there's no way around that. You just have to live with the fact that the user has the run-time responsibility to create something only once, and not do it twice e.g. |
2022-01-20 20:38:01 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
2022-01-20 20:38:12 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) |
2022-01-20 20:38:14 +0100 | <gensyst> | All I wanted to do what reduce mental burdens for user. |
2022-01-20 20:38:18 +0100 | <monochrom> | Even now "errno" is not a global variable "extern int errno;". It's a macro that refers to a thread-local variable. |
2022-01-20 20:38:19 +0100 | <gensyst> | s/what/was |
2022-01-20 20:38:39 +0100 | <monochrom> | Then the user should not write programs. |
2022-01-20 20:38:41 +0100 | <romesrf> | there are ways around that, but you probably don't want them |
2022-01-20 20:39:01 +0100 | <monochrom> | In this the 21st century of our lord, the bar is raised, yes. |
2022-01-20 20:39:25 +0100 | <monochrom> | Programming requires the mental burden of concurrency awareness and reentrancy awareness. |
2022-01-20 20:39:46 +0100 | <monochrom> | If you don't want it, either quit, or go back to 1960s when it was simpler. |
2022-01-20 20:39:53 +0100 | <romesrf> | gensyst: maybe you can hide that creation from the user, somewhat the way IO monad hides the RealWorld from you |
2022-01-20 20:39:58 +0100 | <gensyst> | monochrom, well in some ways the bar is lowered by Haskell. Haskell makes writing programs possible even for morons, whereas Java is too painful unless you are a genius. |
2022-01-20 20:40:13 +0100 | <gensyst> | I for instance can't code anymore in non-Haskell (except very specific small programs). |
2022-01-20 20:40:30 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:494b:f936:f65f:424f) |
2022-01-20 20:40:36 +0100 | <monochrom> | BTW OOP also advocates the same anti-singleton message. |
2022-01-20 20:40:50 +0100 | <monochrom> | And no one dares to say OOP increases mental burden. |
2022-01-20 20:40:57 +0100 | <EvanR> | gensyst, place the global variable in a server somewhere, make sure it's got 100% uptime. Then access that server from your program(s) using the ID |
2022-01-20 20:41:09 +0100 | <EvanR> | truely global variable |
2022-01-20 20:41:10 +0100 | <SolidusRiver> | monochrom, See: Django |
2022-01-20 20:41:28 +0100 | <gensyst> | EvanR lol |
2022-01-20 20:41:43 +0100 | <EvanR> | romesrf, yes, the Text instance is the only instance now, but down the line someone could make a new instance, breaking all binaries compiled with that assumption |
2022-01-20 20:42:10 +0100 | <romesrf> | yep EvanR you all made me understand why I was reasoning badly about that and expecting Text to be inferred |
2022-01-20 20:42:35 +0100 | <gensyst> | EvanR although to your point, just writing a file to disk could work lol - but probably very much frowned upon |
2022-01-20 20:42:59 +0100 | <romesrf> | gensyst: runReader (yourUniqueIdThatTheUserCreatesOnceAndJustUsesItOnceHere) (yourLogicWithReaderMonad) |
2022-01-20 20:43:11 +0100 | <EvanR> | instances at runtime as basically dictionaries passed in at those places you see whatever =>. The tricky bit is what instance is chosen, and we want that to be a sane decision process. (But you can be insane with some extensions turned on) |
2022-01-20 20:43:33 +0100 | <romesrf> | EvanR: :-) |
2022-01-20 20:44:00 +0100 | <EvanR> | s/as/are/ |
2022-01-20 20:44:09 +0100 | <gensyst> | Okay so here is my actual use case: Create a queue up front. All certain foreign functions must in the future run on only this queue. |
2022-01-20 20:44:21 +0100 | johnjaye | (~pi@173.209.65.233) (Read error: Connection reset by peer) |
2022-01-20 20:44:35 +0100 | <gensyst> | So I should just tell my users to first create the queue (using a func from the library), and then pass this queue into other library funcs? |
2022-01-20 20:44:36 +0100 | <dsal> | Yeah, that's exactly why you'd have a `runQueue` type thing. |
2022-01-20 20:44:40 +0100 | <EvanR> | gensyst, yes don't wanna clog up the client's / user's disk, better to use a server |
2022-01-20 20:44:50 +0100 | <geekosaur> | typically you'd do this with a monad, and wrap your FFI functions t run in that monad |
2022-01-20 20:45:32 +0100 | <EvanR> | runMyForeignStuff $ do -- magically initializes a queue and uses that behind the scenes |
2022-01-20 20:45:33 +0100 | <dsal> | As a bonus, you could have more than one instance of this monad in a process, e.g., during tests, where each test has a well-defined environment. |
2022-01-20 20:46:28 +0100 | <gensyst> | That's the thing with this C library (lmdb). certain funcs must only run on the same thread -- program-wide. |
2022-01-20 20:46:38 +0100 | <gensyst> | so I'm not sure the monad approach would work.. |
2022-01-20 20:46:53 +0100 | <EvanR> | don't run runMyForeignStuff from the wrong thread? |
2022-01-20 20:46:59 +0100 | <romesrf> | haha |
2022-01-20 20:47:33 +0100 | zebrag | (~chris@user/zebrag) |
2022-01-20 20:48:01 +0100 | <romesrf> | gensyst: the monad we're talking about simply "hides" from the user that the queue is created and passed to every function |
2022-01-20 20:48:20 +0100 | <EvanR> | if you want to stop people from using more than one runMyForeignStuff, I wonder if you can use linear types xD |
2022-01-20 20:48:40 +0100 | <romesrf> | #lineartypesareawesome |
2022-01-20 20:49:05 +0100 | <gensyst> | ok i'm starting to get what you mean. runMyForeignStuff should only be called ONCE by the user. got it. |
2022-01-20 20:49:19 +0100 | <EvanR> | yes as an entry point |
2022-01-20 20:49:22 +0100 | alp | (~alp@user/alp) |
2022-01-20 20:49:26 +0100 | <dsal> | You can call it more than once if you want. Each time, it creates a clean environment and starts from the top. |
2022-01-20 20:49:32 +0100 | <dsal> | Your tests will likely call it more than once. |
2022-01-20 20:49:37 +0100 | <gensyst> | The only "drawback" I can think of: Since this will be done in main by the user (most likely), plain IO functions in the program will be have to run with liftIO. |
2022-01-20 20:50:14 +0100 | <dsal> | If you allow such a thing, sure. |
2022-01-20 20:50:16 +0100 | <romesrf> | well yes, |
2022-01-20 20:50:36 +0100 | <dsal> | Last time I did something like this, I didn't provide a liftIO because I didn't want random IO from within my monad. |
2022-01-20 20:50:51 +0100 | <EvanR> | an FFI wrapper that can't do IO would be somewhat comical |
2022-01-20 20:51:23 +0100 | <dsal> | In this case, it could do exactly the IO that it was meant to do. |
2022-01-20 20:51:28 +0100 | <monochrom> | I have showed right at the beginning how to create a global mutable variable before I said why not. |
2022-01-20 20:52:05 +0100 | <monochrom> | You can still do it when there is just cause, for example the fringe case when FFI-binding to a 1960s MT-unsafe library. |
2022-01-20 20:52:27 +0100 | <monochrom> | The broken C library is the one that should have been fixed, but oh well. |
2022-01-20 20:52:33 +0100 | <romesrf> | ahah |
2022-01-20 20:52:49 +0100 | <gensyst> | this lib's author will become truly pissed if you try asking him imo |
2022-01-20 20:52:55 +0100 | <gensyst> | so no point bothering |
2022-01-20 20:53:16 +0100 | <gensyst> | sad state of affairs lol |
2022-01-20 20:53:22 +0100 | <gensyst> | so we're just coping |
2022-01-20 20:53:24 +0100 | <monochrom> | ikr this is why we can't have nice things |
2022-01-20 20:53:31 +0100 | <EvanR> | there was a GLFW bindings tutorial where their game placed globally accessible TVars to mediate the input callbacks with the rest of the program, it was bold |
2022-01-20 20:54:58 +0100 | <EvanR> | so it is possible even in cases where there may not be just cause xD |
2022-01-20 20:57:02 +0100 | fendor | (~fendor@178.165.192.6.wireless.dyn.drei.com) |
2022-01-20 20:57:39 +0100 | zincy_ | (~zincy@host86-151-99-97.range86-151.btcentralplus.com) |
2022-01-20 20:57:56 +0100 | <dsal> | If you're into posix: https://linux.die.net/man/3/hsearch |
2022-01-20 20:58:42 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) (Remote host closed the connection) |
2022-01-20 20:58:55 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) |
2022-01-20 20:59:00 +0100 | <ski> | @wiki Top level mutable state |
2022-01-20 20:59:00 +0100 | <lambdabot> | https://wiki.haskell.org/Top_level_mutable_state |
2022-01-20 20:59:50 +0100 | jackson99 | (~bc8147f2@cerf.good1.com) (Quit: CGI:IRC (Session timeout)) |
2022-01-20 21:00:14 +0100 | <dsal> | Proposal 1: Don't do that |
2022-01-20 21:00:36 +0100 | <zebrag> | [CS vocabulary question] How do you call that sort of construction which is not allowed in every programming languages: `(funcall (intern "my-func-name"))`? (https://stackoverflow.com/questions/29213111/call-a-function-from-a-string-name-in-emacs-lisp) |
2022-01-20 21:01:14 +0100 | <monochrom> | "eval" |
2022-01-20 21:01:18 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-20 21:01:31 +0100 | <ski> | parameterized modules, possibly instantiated at run-time, might be a nice way around some of the awkwardness (?) |
2022-01-20 21:01:39 +0100 | <dsal> | > do eval |
2022-01-20 21:01:41 +0100 | <lambdabot> | "no" |
2022-01-20 21:01:46 +0100 | <dsal> | lambdabot do no eval |
2022-01-20 21:01:54 +0100 | <monochrom> | Hahaha |
2022-01-20 21:02:23 +0100 | <ski> | @eval () |
2022-01-20 21:02:40 +0100 | <zebrag> | monochrom: but `eval` does not work on a string? (like the language compiling itself) |
2022-01-20 21:02:42 +0100 | <monochrom> | @list eval |
2022-01-20 21:02:42 +0100 | <lambdabot> | eval provides: run let define undefine |
2022-01-20 21:03:01 +0100 | <monochrom> | eval takes strings for input. |
2022-01-20 21:03:11 +0100 | <monochrom> | Find it in Lisp Scheme and Javascript. |
2022-01-20 21:03:21 +0100 | <ski> | zebrag : are you referring to the "run-time code (generation and) execution" aspect, or the aspect about looking up the identifier at run-time ? |
2022-01-20 21:03:30 +0100 | <ski> | @help eval |
2022-01-20 21:03:30 +0100 | <lambdabot> | eval. Do nothing (perversely) |
2022-01-20 21:03:38 +0100 | <geekosaur> | typically not found in compiled languages (C, C++, Java, Haskell, etc.) |
2022-01-20 21:03:54 +0100 | <monochrom> | The worst idea ever, but oh well, some people really like ready-made universal turing machines. |
2022-01-20 21:04:13 +0100 | <zebrag> | ski, monochrom: but that wouldn't work in haskell, right? |
2022-01-20 21:04:14 +0100 | <ski> | MetaOCaml has `eval' |
2022-01-20 21:04:15 +0100 | <zebrag> | okay |
2022-01-20 21:04:23 +0100 | <monochrom> | Not in Haskell. |
2022-01-20 21:04:25 +0100 | <zebrag> | ;) |
2022-01-20 21:04:41 +0100 | <monochrom> | OK, only the 2nd worst idea ever. |
2022-01-20 21:04:45 +0100 | <ski> | well .. there's quasiquotations in TH |
2022-01-20 21:04:50 +0100 | <monochrom> | The worst idea ever is self-modifying code. |
2022-01-20 21:05:02 +0100 | <geekosaur> | there are actually ways to do it in Haskell — but you do not get access to the memory of the program that is doing the eval, it runs in its own separate "VM" |
2022-01-20 21:05:14 +0100 | juhp | (~juhp@128.106.188.82) (Ping timeout: 256 seconds) |
2022-01-20 21:05:18 +0100 | ski | idly recalls once writing assembler code which modified machine code which modified machine code |
2022-01-20 21:05:37 +0100 | <ski> | (perhaps there was one more level, i forgot) |
2022-01-20 21:05:41 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) |
2022-01-20 21:06:02 +0100 | <monochrom> | Racket's eval also requires whoever calling eval to customize its namespace (or else the default is very limiting) so it's a bit more tolerable. |
2022-01-20 21:06:19 +0100 | <zebrag> | monochrom: "worst idea ever is self-modifying code", laughing. |
2022-01-20 21:06:25 +0100 | fendor | (~fendor@178.165.192.6.wireless.dyn.drei.com) (Remote host closed the connection) |
2022-01-20 21:06:47 +0100 | juhp | (~juhp@128.106.188.82) |
2022-01-20 21:06:52 +0100 | briandaed | (~briandaed@185.234.208.208.r.toneticgroup.pl) (Quit: Lost terminal) |
2022-01-20 21:07:03 +0100 | <ski> | yea. in MetaML/MetaOCaml, it just uses the lexical environment (hygienically) |
2022-01-20 21:07:31 +0100 | <zebrag> | okay so that answers the vocabulary question: the name is "worst idea ever". |
2022-01-20 21:07:57 +0100 | <monochrom> | or universal turing machine |
2022-01-20 21:08:10 +0100 | <ski> | writing meta-programs can be useful |
2022-01-20 21:08:28 +0100 | <zebrag> | yeah, lots of people like universal Turing machine |
2022-01-20 21:08:43 +0100 | <zebrag> | ski: it does |
2022-01-20 21:09:05 +0100 | <monochrom> | Maybe it's called reflection. Java calls it reflection. |
2022-01-20 21:09:09 +0100 | ski | . o O ( "A Taxonomy of meta-programming systems" by Tim Sheard at <https://web.cecs.pdx.edu/~sheard/staged.html> ) |
2022-01-20 21:10:20 +0100 | <zebrag> | there is a (unrelated thing) "reflection" in category theory? |
2022-01-20 21:10:25 +0100 | <gensyst> | monochrom, https://wiki.haskell.org/Top_level_mutable_state so what could go wrong with your original unsafePerformIO? if all i do is put queue into the IORef first, then subsequence funcs just use this same queue. |
2022-01-20 21:11:01 +0100 | ystael | (~ystael@user/ystael) (Read error: Connection reset by peer) |
2022-01-20 21:11:05 +0100 | <zebrag> | thanks a lot for the help |
2022-01-20 21:11:05 +0100 | <monochrom> | Do you have multiple threads? |
2022-01-20 21:11:17 +0100 | <monochrom> | No, that's the wrong question. |
2022-01-20 21:11:17 +0100 | <ski> | zebrag : hm, there's something called "reflective subcategory", i think, but i dunno what it is |
2022-01-20 21:11:34 +0100 | <monochrom> | Do you know for sure that there won't be multiple threads? |
2022-01-20 21:12:24 +0100 | ukari | (~ukari@user/ukari) (Remote host closed the connection) |
2022-01-20 21:12:41 +0100 | ukari | (~ukari@user/ukari) |
2022-01-20 21:12:57 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480::41) (Ping timeout: 240 seconds) |
2022-01-20 21:13:43 +0100 | <gensyst> | monochrom, on the contrary i know for sure multiple threads will grab that queue. most work will be done on those separate threads, however occasionally certain C functions will have to be executed on the same OS thread (which is the purpose of that queue to begin with) |
2022-01-20 21:13:57 +0100 | <monochrom> | Then atomModifyIORef can help. |
2022-01-20 21:14:00 +0100 | <gensyst> | s/same OS thread/same program-wide OS thread |
2022-01-20 21:14:13 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:7985:a982:d93:11f) |
2022-01-20 21:14:51 +0100 | <monochrom> | Normal read-then-writeIORef invites race condition. atomicModifyIORef solves that. |
2022-01-20 21:15:15 +0100 | <gensyst> | that's really cool :) so this solves my problem. so what's all the fuss about? seems like a breeze |
2022-01-20 21:15:25 +0100 | <monochrom> | Until you have two IORefs to coordinate. Then even atomicModifyIORef doesn't save you, it doesn't know that you have two to coordinate. |
2022-01-20 21:15:39 +0100 | <gensyst> | alright, i'll try to keep only one :D |
2022-01-20 21:15:43 +0100 | <geekosaur> | so, sounds to me like you want that monad, which holds a TChan. requestors write to the TChan. you then make a bound thread to take from the TChan and make calls. |
2022-01-20 21:16:01 +0100 | <monochrom> | You asked a general question so I get to enumerate all problems in the general case? |
2022-01-20 21:16:03 +0100 | Kaiepi | (~Kaiepi@156.34.47.253) (Read error: Connection reset by peer) |
2022-01-20 21:16:09 +0100 | <geekosaur> | if they need to communicate back it becomes harder though, but your global var solution won't help there either |
2022-01-20 21:16:13 +0100 | <gensyst> | monochrom, you are right of course :) |
2022-01-20 21:17:10 +0100 | <geekosaur> | (TVar may work in place of TChan depending on what you're doing) |
2022-01-20 21:17:36 +0100 | Kaiepi | (~Kaiepi@156.34.47.253) |
2022-01-20 21:17:56 +0100 | Kaiepi | (~Kaiepi@156.34.47.253) (Remote host closed the connection) |
2022-01-20 21:18:17 +0100 | vysn | (~vysn@user/vysn) (Ping timeout: 240 seconds) |
2022-01-20 21:18:19 +0100 | Kaiepi | (~Kaiepi@156.34.47.253) |
2022-01-20 21:18:28 +0100 | <dsal> | Reaching for a global variable to make easier is like reaching for a grenade to stop a mugger. It'll kind of work, but you'll spend more on the unintended side effects than the original problem. |
2022-01-20 21:18:30 +0100 | Guest9647 | (~Guest96@144-124-99-115.pip.aber.ac.uk) (Quit: Client closed) |
2022-01-20 21:19:13 +0100 | cfricke | (~cfricke@user/cfricke) |
2022-01-20 21:19:18 +0100 | <gensyst> | monochrom, do you have any ideas on how to create that queue? I found the package immortal-queue that looks interesting. However this doesn't have bound (OS) threads atm, so I might have to modify it. |
2022-01-20 21:21:37 +0100 | stevenxl | (~stevenxl@c-73-72-2-81.hsd1.il.comcast.net) (Ping timeout: 240 seconds) |
2022-01-20 21:21:56 +0100 | zincy_ | (~zincy@host86-151-99-97.range86-151.btcentralplus.com) (Remote host closed the connection) |
2022-01-20 21:22:03 +0100 | <c_wraith> | gensyst: did you know hot-reloading of code is possible in GHC? Do you know how that works with global refs? |
2022-01-20 21:23:32 +0100 | euandreh | (~euandreh@2804:14c:33:9fe5:16af:8d6b:42b4:6731) (Ping timeout: 240 seconds) |
2022-01-20 21:23:52 +0100 | stevenxl | (~stevenxl@c-73-72-2-81.hsd1.il.comcast.net) |
2022-01-20 21:24:08 +0100 | cfricke | (~cfricke@user/cfricke) (Quit: WeeChat 3.3) |
2022-01-20 21:25:32 +0100 | <gensyst> | c_wraith, no i don't know how that works |
2022-01-20 21:25:54 +0100 | euandreh | (~euandreh@2804:14c:33:9fe5:9d95:c71:11e4:3e0f) |
2022-01-20 21:26:27 +0100 | <c_wraith> | It's worth consideration before using a global ref. |
2022-01-20 21:30:10 +0100 | <gensyst> | c_wraith, thanks will look up on it |
2022-01-20 21:30:18 +0100 | <gensyst> | lots of pitfalls to worry about |
2022-01-20 21:30:44 +0100 | stevenxl | (~stevenxl@c-73-72-2-81.hsd1.il.comcast.net) (Ping timeout: 256 seconds) |
2022-01-20 21:32:00 +0100 | stevenxl | (~stevenxl@c-73-72-2-81.hsd1.il.comcast.net) |
2022-01-20 21:33:20 +0100 | simendsjo | (~user@84.211.91.241) (Remote host closed the connection) |
2022-01-20 21:33:57 +0100 | simendsjo | (~user@84.211.91.241) |
2022-01-20 21:34:05 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:494b:f936:f65f:424f) (Remote host closed the connection) |
2022-01-20 21:37:48 +0100 | dhouthoo | (~dhouthoo@178-117-36-167.access.telenet.be) (Quit: WeeChat 3.4) |
2022-01-20 21:38:35 +0100 | ukari | (~ukari@user/ukari) (Remote host closed the connection) |
2022-01-20 21:39:16 +0100 | ukari | (~ukari@user/ukari) |
2022-01-20 21:44:00 +0100 | <monochrom> | My collection of the GHC-API is that I had to call one function to create a record (it contains IORefs), then I had to pass this record to all other functions. |
2022-01-20 21:44:13 +0100 | <monochrom> | So I think ghci does the same, but I haven't checked. |
2022-01-20 21:44:37 +0100 | <monochrom> | So it goes back to the non-global solution. |
2022-01-20 21:45:05 +0100 | <geekosaur> | ghc-api does have its globals though; consider unsafeDynFlags |
2022-01-20 21:45:17 +0100 | <geekosaur> | granting that they're in the process of cleaning that up recently |
2022-01-20 21:45:21 +0100 | <monochrom> | That said, gtk2hs solves multi-threading with a secret global IORef for a queue. |
2022-01-20 21:46:36 +0100 | <monochrom> | It's marvelous. You know how gtk+ is one of those C libraries that "you must choose one thread, and only that thread is allowed to call gtk+ functions". Hell, you're working with such a C library right now. |
2022-01-20 21:47:02 +0100 | <monochrom> | So how does gtk2hs allow you to call gtk2hs functions in any thread you like, every time a different thread? |
2022-01-20 21:48:08 +0100 | <monochrom> | So you are supposed to use postGUISync or postGUISync, depending on whether you want to wait or not. |
2022-01-20 21:48:10 +0100 | Pickchea | (~private@user/pickchea) |
2022-01-20 21:48:54 +0100 | <monochrom> | Both of them enter the thunk that stands for your function call into the global queue. |
2022-01-20 21:49:14 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) (Ping timeout: 250 seconds) |
2022-01-20 21:49:15 +0100 | SolidusRiver | (~fuag1@174.127.249.180) (Ping timeout: 256 seconds) |
2022-01-20 21:49:22 +0100 | <monochrom> | gtk2hs's main loop periodically dequeues and makes the actual call. |
2022-01-20 21:49:39 +0100 | <monochrom> | So all actual calls are made in the same thread as the main loop. |
2022-01-20 21:49:59 +0100 | <monochrom> | But it still requires a global queue. Which is basically your scenerio. |
2022-01-20 21:50:29 +0100 | <monochrom> | Now, how do you make a queue in Haskell? |
2022-01-20 21:50:58 +0100 | <monochrom> | Most people don't mind an immutable queue, and putting it in an IORef if mutability is desired. |
2022-01-20 21:51:43 +0100 | <monochrom> | Furthermore, for an immutable queue, most people don't mind settling for amortized O(1) time, it's simpler. |
2022-01-20 21:52:10 +0100 | <monochrom> | Then it's a tuple of two lists, let's call them "front" and "back". |
2022-01-20 21:52:32 +0100 | <monochrom> | To enter something into the queue, back_new = x : back |
2022-01-20 21:52:58 +0100 | <monochrom> | To dequeue: If front is non-empty, take the head. |
2022-01-20 21:53:24 +0100 | <monochrom> | If front is empty, front_new = reverse back, back_new = []. Now try again. |
2022-01-20 21:53:38 +0100 | <texasmynsted> | I am curious if anybody is doing anything with Haskell and ORC files. I saw this https://www.huwcampbell.com/posts/2020-09-18-announcing-orc-haskell.html |
2022-01-20 21:53:47 +0100 | Gurkenglas | (~Gurkengla@dslb-002-203-144-204.002.203.pools.vodafone-ip.de) (Ping timeout: 256 seconds) |
2022-01-20 21:55:30 +0100 | wombat875 | (~wombat875@pool-72-89-24-154.nycmny.fios.verizon.net) |
2022-01-20 21:56:18 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) |
2022-01-20 21:58:28 +0100 | wombat875 | (~wombat875@pool-72-89-24-154.nycmny.fios.verizon.net) (Client Quit) |
2022-01-20 21:59:00 +0100 | wombat875 | (~wombat875@pool-72-89-24-154.nycmny.fios.verizon.net) |
2022-01-20 22:00:28 +0100 | wombat875 | (~wombat875@pool-72-89-24-154.nycmny.fios.verizon.net) (Client Quit) |
2022-01-20 22:00:37 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) (Ping timeout: 240 seconds) |
2022-01-20 22:00:38 +0100 | Feuermagier | (~Feuermagi@user/feuermagier) (Remote host closed the connection) |
2022-01-20 22:00:51 +0100 | <gensyst> | monochrom, heh it's really that simple? hmm. |
2022-01-20 22:01:35 +0100 | <monochrom> | But you can make a big fuss about "this is not performant! worst case is not O(1)!!!111" |
2022-01-20 22:02:09 +0100 | <gensyst> | monochrom, i will have to create my own channel, recursive IO function, etc. stuff right? |
2022-01-20 22:02:21 +0100 | <monochrom> | I don't know. |
2022-01-20 22:02:26 +0100 | <gensyst> | the "processing loop" so to speak |
2022-01-20 22:02:42 +0100 | <monochrom> | "loop" is a very simple kind of recursion. |
2022-01-20 22:03:16 +0100 | <monochrom> | And maybe "channel" just means queue. |
2022-01-20 22:03:32 +0100 | lavaman | (~lavaman@98.38.249.169) (Ping timeout: 250 seconds) |
2022-01-20 22:04:02 +0100 | wombat875 | (~wombat875@pool-72-89-24-154.nycmny.fios.verizon.net) |
2022-01-20 22:04:25 +0100 | <zebrag> | ski: yes, neither do I. (reflexive subcategory) |
2022-01-20 22:04:28 +0100 | ProfSimm | (~ProfSimm@87.227.196.109) |
2022-01-20 22:04:42 +0100 | _ht | (~quassel@2a02:a468:b619:1:4334:88f2:ba01:c6e) (Remote host closed the connection) |
2022-01-20 22:05:09 +0100 | johnjaye | (~pi@173.209.65.233) |
2022-01-20 22:05:42 +0100 | simendsjo | (~user@84.211.91.241) (Ping timeout: 250 seconds) |
2022-01-20 22:06:33 +0100 | mikoto-chan | (~mikoto-ch@213.177.151.239) |
2022-01-20 22:06:39 +0100 | Guest24 | (~Guest24@144-124-136-14.pip.aber.ac.uk) (Quit: Client closed) |
2022-01-20 22:08:02 +0100 | <gensyst> | c_wraith, can you summarize briefly the hot-reloading issues that could arise? can't find much upon quick search |
2022-01-20 22:09:12 +0100 | troydm | (~troydm@host-176-37-124-197.b025.la.net.ua) |
2022-01-20 22:09:20 +0100 | <c_wraith> | that's because no one actually knows how they interact. or rather - you can see how they interact now, but GHC is unwilling to specify that behavior and prevent changes if someone makes a better suggestion |
2022-01-20 22:10:08 +0100 | <c_wraith> | the current version: when a module is reloaded, all top level values are reallocated. |
2022-01-20 22:10:33 +0100 | <c_wraith> | this can cause problems if a current mutable state gets forgotten |
2022-01-20 22:11:32 +0100 | <c_wraith> | all top level values in that module, that is |
2022-01-20 22:11:54 +0100 | <gensyst> | c_wraith, is this a ghci issue specifically? if i do the unsafePerformIO in my library, users will load that lib precompiled presumably. |
2022-01-20 22:12:00 +0100 | <gensyst> | s/users/users of ghci |
2022-01-20 22:12:34 +0100 | <c_wraith> | ghci is one place code gets reloaded, but not the only such place. |
2022-01-20 22:13:12 +0100 | <c_wraith> | and it makes some effort to prevent weirder things that aren't part of the process, like clearing all current bindings when it reloads code. |
2022-01-20 22:13:47 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) |
2022-01-20 22:14:10 +0100 | SolidusRiver | (~fuag1@174.127.249.180) |
2022-01-20 22:14:19 +0100 | <c_wraith> | in general code in packages probably won't get reloaded, but... I don't know of any guarantees |
2022-01-20 22:14:39 +0100 | ystael | (~ystael@user/ystael) |
2022-01-20 22:15:29 +0100 | notzmv | (~zmv@user/notzmv) (Ping timeout: 268 seconds) |
2022-01-20 22:15:56 +0100 | <zebrag> | (just laughing: in google I type "lisp self m", and google which knows every correct answer complete in "lisp self modifying code". But it is either that, or vim, or vscode.) |
2022-01-20 22:17:12 +0100 | <gensyst> | c_wraith, okay - i'll keep it at the back of my mind in case I encounter some such weirdness |
2022-01-20 22:17:30 +0100 | <gensyst> | monochrom, c_wraith thanks so much all for your great replies! you're saving me big time |
2022-01-20 22:18:54 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 22:20:52 +0100 | mikoto-chan | (~mikoto-ch@213.177.151.239) (Ping timeout: 250 seconds) |
2022-01-20 22:21:25 +0100 | ec | (~ec@gateway/tor-sasl/ec) (Quit: ec) |
2022-01-20 22:21:46 +0100 | ec | (~ec@gateway/tor-sasl/ec) |
2022-01-20 22:22:06 +0100 | gensyst | (gensyst@user/gensyst) (Quit: Leaving) |
2022-01-20 22:22:10 +0100 | <jackdk> | remark: when I first started playing with Haskell, I wanted top-level mutable state. In all my years of using Haskell for work, I never wanted top-level mutable state. |
2022-01-20 22:22:15 +0100 | <jackdk> | ah, he just left =| |
2022-01-20 22:23:28 +0100 | n3t | (n3t@s45.mydevil.net) (Changing host) |
2022-01-20 22:23:28 +0100 | n3t | (n3t@user/n3t) |
2022-01-20 22:23:57 +0100 | <geekosaur> | I used top levelmutable state once. it was with a very early version of gtk2hs, before even the postGUI* stuff monochrom described, and had no good way to deal with what I was doing |
2022-01-20 22:24:12 +0100 | <geekosaur> | next release of gtk2hs did but I'd moved on by then |
2022-01-20 22:25:11 +0100 | __monty__ | (~toonn@user/toonn) |
2022-01-20 22:27:33 +0100 | romesrf | (~romes@44.190.189.46.rev.vodafone.pt) (Quit: WeeChat 3.4) |
2022-01-20 22:28:01 +0100 | cosimone | (~user@93-47-229-195.ip115.fastwebnet.it) (Remote host closed the connection) |
2022-01-20 22:30:07 +0100 | mc47 | (~mc47@xmonad/TheMC47) (Remote host closed the connection) |
2022-01-20 22:33:31 +0100 | xb0o2 | (~xb0o2@user/xb0o2) (Quit: Client closed) |
2022-01-20 22:34:24 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-20 22:34:29 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:494b:f936:f65f:424f) |
2022-01-20 22:35:49 +0100 | <c_wraith> | a pretty common desire for top-level mutable state is for working around C libraries that aren't re-entrant |
2022-01-20 22:36:59 +0100 | <c_wraith> | I ran into that with the curl bindings a long time ago. (curl was re-entrant by itself, but the way it used openssl wasn't) |
2022-01-20 22:38:37 +0100 | eggplantade | (~Eggplanta@2600:1700:bef1:5e10:494b:f936:f65f:424f) (Ping timeout: 240 seconds) |
2022-01-20 22:44:09 +0100 | cosimone | (~user@93-47-229-195.ip115.fastwebnet.it) |
2022-01-20 22:44:24 +0100 | <maerwald> | I use it delibaretly in test code too |
2022-01-20 22:47:27 +0100 | kimjetwav | (~user@2607:fea8:2363:8f00:d445:4a94:576b:ee4c) (Remote host closed the connection) |
2022-01-20 22:49:22 +0100 | Pickchea | (~private@user/pickchea) (Quit: Leaving) |
2022-01-20 22:49:58 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-20 22:51:25 +0100 | sagax | (~sagax_nb@user/sagax) (Ping timeout: 240 seconds) |
2022-01-20 22:52:04 +0100 | deadmarshal | (~deadmarsh@95.38.114.110) (Ping timeout: 250 seconds) |
2022-01-20 22:52:56 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 250 seconds) |
2022-01-20 22:53:22 +0100 | xb0o2 | (~xb0o2@user/xb0o2) |
2022-01-20 22:54:28 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-20 22:56:45 +0100 | <zzz> | are case patterns irrefutable? |
2022-01-20 22:58:39 +0100 | n3rdy1 | (~n3rdy1@2a00:79e1:abc:1564:ccb7:9ff4:1442:61e5) |
2022-01-20 22:58:43 +0100 | <zzz> | this was a stupid question, nevermind |
2022-01-20 22:58:49 +0100 | ubert | (~Thunderbi@p200300ecdf099440f4ae4d8df8b0fc6d.dip0.t-ipconnect.de) (Remote host closed the connection) |
2022-01-20 22:58:49 +0100 | ub | ubert |
2022-01-20 22:59:12 +0100 | <zebrag> | I hope LCF-ML "Object Language Embedding with Quote/Antiquote" (https://www.smlnj.org/doc/quote.html) is not related to lisp-elisp `(funcall (intern "+") 5 2)`. |
2022-01-20 22:59:40 +0100 | takuan | (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
2022-01-20 23:03:29 +0100 | <monochrom> | case patterns and "f [] = ... f (x:xs) = ..." patterns are the very same thing. |
2022-01-20 23:03:47 +0100 | <monochrom> | So, refutable unless you add ~ |
2022-01-20 23:04:16 +0100 | <monochrom> | let patterns are the irrefutable ones, "let x:xs = ..." for example |
2022-01-20 23:04:21 +0100 | wombat875 | (~wombat875@pool-72-89-24-154.nycmny.fios.verizon.net) (Quit: WeeChat 2.2-dev) |
2022-01-20 23:05:19 +0100 | <monochrom> | well, let and where, "where x:xs = ..." has the same semantics as the let version. |
2022-01-20 23:13:34 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) (Remote host closed the connection) |
2022-01-20 23:13:47 +0100 | mmhat | (~mmh@55d49b67.access.ecotel.net) (Quit: WeeChat 3.4) |
2022-01-20 23:14:03 +0100 | xb0o2 | (~xb0o2@user/xb0o2) (Quit: Client closed) |
2022-01-20 23:15:54 +0100 | <EvanR> | all that and gensyst just needed a TVar |
2022-01-20 23:16:16 +0100 | ProfSimm | (~ProfSimm@87.227.196.109) (Remote host closed the connection) |
2022-01-20 23:16:19 +0100 | <EvanR> | not necessarily even globally accessible |
2022-01-20 23:16:30 +0100 | <EvanR> | XY problems |
2022-01-20 23:16:35 +0100 | ProfSimm | (~ProfSimm@87.227.196.109) |
2022-01-20 23:16:54 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) (Remote host closed the connection) |
2022-01-20 23:17:08 +0100 | gehmehgeh | (~user@user/gehmehgeh) (Quit: Leaving) |
2022-01-20 23:17:11 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) |
2022-01-20 23:17:13 +0100 | <geekosaur> | I said that some time back |
2022-01-20 23:17:23 +0100 | <geekosaur> | they wanted their global variable |
2022-01-20 23:17:42 +0100 | <monochrom> | zebrag: LCF-ML quote/antiquote is indeed not (intern "+") at all. |
2022-01-20 23:18:17 +0100 | <monochrom> | (intern "+") really refers to the language's own + |
2022-01-20 23:19:18 +0100 | <monochrom> | quoting allows writing a string literal to be parsed to an ADT, and the ADT can have nothing to do with the host language. |
2022-01-20 23:20:03 +0100 | <monochrom> | And anti-quoting just means "string interpolation" in shell scripts etc. |
2022-01-20 23:20:03 +0100 | <zebrag> | No weird paradox then? |
2022-01-20 23:20:14 +0100 | n3rdy1 | (~n3rdy1@2a00:79e1:abc:1564:ccb7:9ff4:1442:61e5) (Ping timeout: 268 seconds) |
2022-01-20 23:20:38 +0100 | <monochrom> | No, it's just syntax sugar for an ADT. |
2022-01-20 23:21:01 +0100 | <zebrag> | I'm so relieved |
2022-01-20 23:22:39 +0100 | <monochrom> | I have a "data B = E | X Int B B" and I'm tired of writing "X 5 (X 4 E E) (X 3 E E)" so I set up quoting so I can write the string literal "4(5)3" and the compiler desugars that to X 5 (X 4 E E) (X 3 E E) for me. |
2022-01-20 23:23:05 +0100 | <monochrom> | Clearly the B type, nor its values, is not LCF-ML itself. |
2022-01-20 23:24:09 +0100 | <monochrom> | In the actual LCF-ML case, the ADT is the AST of a predicate logic. |
2022-01-20 23:25:07 +0100 | yauhsien_ | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) |
2022-01-20 23:28:34 +0100 | <zebrag> | right, right, thanks |
2022-01-20 23:29:01 +0100 | michalz | (~michalz@185.246.204.37) (Remote host closed the connection) |
2022-01-20 23:29:37 +0100 | yauhsien_ | (~yauhsien@61-231-62-246.dynamic-ip.hinet.net) (Ping timeout: 240 seconds) |
2022-01-20 23:36:54 +0100 | ski | . o O ( SML/NJ ) |
2022-01-20 23:36:59 +0100 | <int-e> | monochrom: heh, what does 1(2)3(4)5 mean in that notation? :P |
2022-01-20 23:37:43 +0100 | <monochrom> | "syntax error" is a possibility! |
2022-01-20 23:38:18 +0100 | <int-e> | pattern synonyms can sometimes help in Haskell. pattern L x = X x E E is an obvious one |
2022-01-20 23:39:01 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) |
2022-01-20 23:39:48 +0100 | <int-e> | monochrom: sure, that's one of three reasonable answers... |
2022-01-20 23:41:43 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) (Remote host closed the connection) |
2022-01-20 23:41:59 +0100 | shapr | (~user@2601:7c0:c37c:46d0:2da1:8e76:2324:a881) |
2022-01-20 23:42:15 +0100 | SolidusRiver | (~fuag1@174.127.249.180) (Quit: Leaving) |
2022-01-20 23:43:15 +0100 | <EvanR> | monochrom went back to their business when suddenly the 2nd of three reasonable answers started banging on the door, let me in, let me in |
2022-01-20 23:45:03 +0100 | ukari | (~ukari@user/ukari) (Remote host closed the connection) |
2022-01-20 23:45:29 +0100 | <monochrom> | I am like one of those pizza places that refuse online orders outside business hours :) |
2022-01-20 23:45:32 +0100 | ukari | (~ukari@user/ukari) |
2022-01-20 23:45:37 +0100 | merijn | (~merijn@c-001-001-018.client.esciencecenter.eduvpn.nl) (Ping timeout: 240 seconds) |
2022-01-20 23:45:45 +0100 | <monochrom> | In fact, even online pre-orders. |
2022-01-20 23:46:14 +0100 | <monochrom> | In fact, the irony being that online pre-orders are accepted during business hours. |
2022-01-20 23:46:46 +0100 | <int-e> | but do the accept pre-orders for non-business hours during business hours |
2022-01-20 23:47:32 +0100 | Flonk | (~Flonk@vps-zap441517-1.zap-srv.com) (Quit: Ping timeout (120 seconds)) |
2022-01-20 23:48:31 +0100 | <int-e> | . o O ( Where's the Amazon Prime pizza service with same day delivery? ) |
2022-01-20 23:48:44 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-20 23:48:54 +0100 | <hpc> | delivered by 11:59PM or your money back |
2022-01-20 23:50:44 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) |
2022-01-20 23:51:34 +0100 | <zzz> | why does g typecheck and h doesn't? https://paste.jrvieira.com/1642719061390 |
2022-01-20 23:51:42 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) (Quit: coot) |
2022-01-20 23:52:15 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) |
2022-01-20 23:52:23 +0100 | <int-e> | because the two components of x have the same type |
2022-01-20 23:52:28 +0100 | <monochrom> | Float=a=Int |
2022-01-20 23:52:28 +0100 | <ski> | `a' and `b' are polymorphic |
2022-01-20 23:52:32 +0100 | cosimone | (~user@93-47-229-195.ip115.fastwebnet.it) (Quit: ERC (IRC client for Emacs 27.1)) |
2022-01-20 23:52:34 +0100 | <ski> | (in `g') |
2022-01-20 23:52:38 +0100 | <int-e> | you can declare x :: (Num a, Num b) => (a, b) |
2022-01-20 23:52:48 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-20 23:52:54 +0100 | <monochrom> | Ah yeah my sentence was explaining just h. |
2022-01-20 23:53:37 +0100 | <int-e> | Oh yes, `let` is polymorphic. Fun example :) |
2022-01-20 23:53:37 +0100 | <monochrom> | "let (a,b) = x" is desugared to "let a = fst x; b = snd x" for all semantic purposes. |
2022-01-20 23:54:21 +0100 | <zzz> | but let w = x in w also doesn't typecheck. isn't w polymorphic? |
2022-01-20 23:54:21 +0100 | <int-e> | g = case x of (a,b) -> (a,b) would fail again |
2022-01-20 23:54:35 +0100 | Flonk | (~Flonk@vps-zap441517-1.zap-srv.com) |
2022-01-20 23:54:45 +0100 | <EvanR> | monomorphism restriction? |
2022-01-20 23:54:58 +0100 | <ski> | zzz : in `g', you're basically invoking `x' twice |
2022-01-20 23:55:01 +0100 | <monochrom> | NoMonomorphismRestriction |
2022-01-20 23:55:09 +0100 | <int-e> | zzz: yes, but w has the same polymorphic type as x |
2022-01-20 23:55:26 +0100 | <int-e> | zzz: let w = x in (fst w, snd w) should work |
2022-01-20 23:55:31 +0100 | <zzz> | EvanR: we are assuming NoMonomorphismRestriction -> https://paste.jrvieira.com/1642719061390 |
2022-01-20 23:55:53 +0100 | <int-e> | zzz: (which is using w at two different types) |
2022-01-20 23:56:07 +0100 | <zzz> | hmm |
2022-01-20 23:56:23 +0100 | <int-e> | :t let x :: Num a => (a,a); x = (0,1) in (fst x, snd x) |
2022-01-20 23:56:24 +0100 | <lambdabot> | (Num a, Num b) => (a, b) |
2022-01-20 23:56:28 +0100 | <int-e> | :t let x :: Num a => (a,a); x = (0,1) in x |
2022-01-20 23:56:29 +0100 | <lambdabot> | Num a => (a, a) |
2022-01-20 23:56:57 +0100 | burnsidesLlama | (~burnsides@dhcp168-042.wadham.ox.ac.uk) (Ping timeout: 240 seconds) |
2022-01-20 23:59:35 +0100 | <int-e> | zzz: it would be sound to automatically generalize Num a => (a, a) to (Num a, Num b) => (a, b), but it's a really bad idea, because the only way to do that is to compute the pair twice. |