Home liberachat/#haskell: Logs Calendar

Logs on 2022-01-20 (liberachat/#haskell)

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

All times are in UTC on 2022-01-20.