Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-11 16:57:56 <boxscape> would you say there's a relationship between purely functional programming and not using null references?
2020-11-11 16:58:10 <hc> I think so
2020-11-11 16:58:30 <boxscape> I guess trying to do something with a null reference that you can't do usually results in side effects?
2020-11-11 16:58:48 texasmynsted joins (~texasmyns@64.44.55.44)
2020-11-11 16:58:55 × adm_ quits (~adm@43.229.89.44) (Ping timeout: 258 seconds)
2020-11-11 16:59:04 <hc> you don't have/use regularily references in purely functional programming languages ;)
2020-11-11 16:59:15 × timCF quits (~i.tkachuk@m91-129-105-245.cust.tele2.ee) (Client Quit)
2020-11-11 16:59:17 <hc> at least not directly; it's all hidden away by smart compilers
2020-11-11 16:59:19 <maerwald> hc: why not?
2020-11-11 16:59:26 <hc> maerwald: less need
2020-11-11 16:59:35 timCF joins (~i.tkachuk@m91-129-105-245.cust.tele2.ee)
2020-11-11 16:59:54 <hc> maerwald: due to referential transparency mostly, i think
2020-11-11 17:00:01 <maerwald> boxscape: only practically. I don't think it matters theoretically?
2020-11-11 17:00:03 × texasmynsted quits (~texasmyns@64.44.55.44) (Client Quit)
2020-11-11 17:00:37 <boxscape> Just thinking about whether I can find a good segway to talk about avoiding null pointers in a talk about purely functional programming :)
2020-11-11 17:00:49 <boxscape> er
2020-11-11 17:00:51 <boxscape> segue
2020-11-11 17:01:15 <maerwald> that is, it isn't obvious to me why you can't have a purely functional programming language with null pointers
2020-11-11 17:01:16 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Read error: Connection reset by peer)
2020-11-11 17:01:59 <p0a> scheme right?
2020-11-11 17:02:08 <hc> maerwald: because what's the use of a null pointer when you don't have pointers/references in the first place?
2020-11-11 17:02:09 <boxscape> I guess having "null pointers" doesn't necessarily mean regular variables/constant can have a value of null, which is how I was thinking about it
2020-11-11 17:02:26 <maerwald> hc: I'm not talking about the use, but the definition
2020-11-11 17:02:31 <maerwald> I don't think there's a hard correlation
2020-11-11 17:02:40 <hc> agree, it's a soft correlation ;)
2020-11-11 17:02:44 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2020-11-11 17:03:39 <hc> maerwald: do pointers/references make sense in a purely functional language?
2020-11-11 17:03:42 <Chousuke> null pointers aren't really the problem, it's when any pointer type can have null values that you run into trouble
2020-11-11 17:03:54 × jorjoro quits (4f70b8ab@79.112.184.171) (Remote host closed the connection)
2020-11-11 17:03:56 <timCF> Hello guys! I know it sounds stupid, but I'll ask anyway. For whatever reason my linker is extremely slow, when stack do linking phase - I literally can have time for a cup of tea or two. Maybe I'm missing something. How to make it fast?
2020-11-11 17:04:09 Lycurgus joins (~niemand@cpe-45-46-134-163.buffalo.res.rr.com)
2020-11-11 17:04:25 <boxscape> Chousuke so you're saying the type of the pointer should indicate whether it can point to null?
2020-11-11 17:04:55 <bqv> p0a: i think you can do it by modifying the c-indent family of variables
2020-11-11 17:05:09 <bqv> but i just avoid asking emacs to indent for me
2020-11-11 17:05:17 <bqv> because it always does it 'wrong'
2020-11-11 17:05:19 <Chousuke> boxscape: essentially, yes. Or in other words, just support Optional/Maybe
2020-11-11 17:05:21 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
2020-11-11 17:05:26 <boxscape> yeah, that makes sense
2020-11-11 17:05:29 <hc> maerwald: i'm not saying by any means i'm right about this... i merely want to understand it :)
2020-11-11 17:05:36 <p0a> bqv: what do you do instead?
2020-11-11 17:05:43 <bqv> use my spacebar? :p
2020-11-11 17:05:53 <p0a> hc: yes they do
2020-11-11 17:05:59 <p0a> hc: You can have tape and ... pointers on it
2020-11-11 17:06:05 <hc> timCF: i'm regularily waiting for 5 minutes for the rust linker to finish in release/optimizing mode
2020-11-11 17:06:19 <maerwald> hc: purely function is defined as: call-by-name, call-by-need and call-by-value are weakly equivalent in that language (modulo bottom)
2020-11-11 17:06:32 <maerwald> I don't see why you can't meet that criteria with null pointers
2020-11-11 17:06:52 <hc> maerwald: what use would a null pointer be if you can never assign another value to the variable that holds it?
2020-11-11 17:06:59 <maerwald> because it's bottom if you deref it
2020-11-11 17:07:09 <hc> hmm, so an error case?
2020-11-11 17:07:43 <bqv> hc: i mean i'm currently using a pointerlike thing using the Store comonad, and as it happens my keys are 'Ptr a' so i'm abusing nullptr to be a zero value rather than Maybe-ing it
2020-11-11 17:07:45 <p0a> hc: what use are pointers if you can't manipulate the pointees?
2020-11-11 17:07:54 <maerwald> what matters is that the expressions are equivalent under different eval strategies if there is NO bottom
2020-11-11 17:08:05 __monty__ joins (~toonn@unaffiliated/toonn)
2020-11-11 17:08:06 <int-e> p0a: they allow sharing
2020-11-11 17:08:24 <hc> p0a: precisely. they aren't of any use as far as i can see it
2020-11-11 17:08:28 <p0a> int-e: Not sure what you mean :) but I was trying to say that hc's point is not a good point
2020-11-11 17:08:51 <int-e> pah, context
2020-11-11 17:09:00 × lawr3nce quits (~lawr3nce@gateway/tor-sasl/lawr3nce) (Quit: Leaving)
2020-11-11 17:09:04 <bqv> i prefer lualatex
2020-11-11 17:09:07 <hc> okay, different question: *how* do i make a pointer of something in haskell?
2020-11-11 17:09:10 <p0a> hc: Haskell is not "without side effects"
2020-11-11 17:09:20 <timCF> hc, do you think it's normal for dev environment, without O2 flag, which is supposed to be fast I guess..
2020-11-11 17:09:22 <hc> p0a: i know about iorefs
2020-11-11 17:09:24 ransom joins (~c4264035@undergraduate-jvossen-9690.mines.edu)
2020-11-11 17:09:42 <maerwald> p0a: IO has no side effects =)
2020-11-11 17:10:03 <maerwald> the only side effect in haskell is unsafePerformIO (yes, that breaks the language)
2020-11-11 17:10:04 <p0a> maerwald: yeah it's fair to say that. C has no side effects either
2020-11-11 17:10:16 <maerwald> p0a: it does
2020-11-11 17:10:20 <p0a> Ah I see, alright. I misunderstood you
2020-11-11 17:10:20 geekosaur joins (82659a09@host154-009.vpn.uakron.edu)
2020-11-11 17:10:34 <int-e> Oh, I think I see... Well, most haskell implementations pass values by reference which are pointers. There's hardly a point in exposing this implementation detail to the user.
2020-11-11 17:10:39 × asheshambasta quits (~user@ptr-e1lysawl9rr13i61o92.18120a2.ip6.access.telenet.be) (Ping timeout: 272 seconds)
2020-11-11 17:10:52 × Lycurgus quits (~niemand@cpe-45-46-134-163.buffalo.res.rr.com) (Quit: Exeunt)
2020-11-11 17:10:59 <maerwald> but they could
2020-11-11 17:11:07 <int-e> Unless you bring actual mutation to the table, for which you'll need IO or ST.
2020-11-11 17:11:47 <boxscape> maerwald non-terminating programs don't count as side-effecting either?
2020-11-11 17:12:13 <maerwald> boxscape: dunno, that term is a bit more fuzzy
2020-11-11 17:12:31 <int-e> boxscape: the usual formal semantics will treat that case as bottom.
2020-11-11 17:12:39 <bqv> IO at least has the side effect of p***ing me off a lot
2020-11-11 17:12:45 <int-e> the structure of bottoms... is rarely captured formally.
2020-11-11 17:12:45 <boxscape> oh, right, I guess that makes sense
2020-11-11 17:12:57 × v_m_v_ quits (~vm_v@2a02:aa12:3200:6480:fc4f:fb56:796a:9a4a) (Remote host closed the connection)
2020-11-11 17:13:16 v_m_v_ joins (~vm_v@2a02:aa12:3200:6480:fc4f:fb56:796a:9a4a)
2020-11-11 17:13:40 jamm_ joins (~jamm@unaffiliated/jamm)
2020-11-11 17:13:44 Sanchayan joins (~Sanchayan@122.181.216.76)
2020-11-11 17:13:51 invaser joins (~Thunderbi@128-124-107-154.mobile.vf-ua.net)
2020-11-11 17:13:57 <hekkaidekapus> boxscape: If your talk is not geared to any particular language, you can mention ATS about sound pointer manipulation.
2020-11-11 17:13:58 <hc> bqv: oh i thought that was io's main purpose? ;p
2020-11-11 17:14:12 <hc> timCF: nah, that should be much faster
2020-11-11 17:14:33 <bqv> hdh
2020-11-11 17:14:35 <bqv> heh*
2020-11-11 17:14:59 <int-e> hope dat helps?
2020-11-11 17:15:00 <int-e> :)
2020-11-11 17:15:16 <boxscape> hekkaidekapus it is geared towards, of all things, Java :)
2020-11-11 17:15:22 <hekkaidekapus> For NULL, you handle it as a Maybe like Chousuke said, specifically using a dataview.
2020-11-11 17:15:25 <maerwald> boxscape: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.106.364&rep=rep1&type=pdf
2020-11-11 17:15:29 <p0a> If I do import Data.Text (Text) followed by import qualified Data.Text as T, does it make sense?
2020-11-11 17:15:40 <maerwald> it doesn't properly define side effect either
2020-11-11 17:15:45 <bqv> p0a: yes
2020-11-11 17:15:50 <p0a> thank you bq

All times are in UTC.