Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-06 01:32:28 × m0rphism quits (~m0rphism@HSI-KBW-095-208-098-207.hsi5.kabel-badenwuerttemberg.de) (Ping timeout: 260 seconds)
2020-11-06 01:32:45 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2020-11-06 01:33:03 <Mela> wow, not at all?
2020-11-06 01:33:24 × xff0x quits (~fox@2001:1a81:522f:7b00:1cd6:2f35:f89:eebf) (Ping timeout: 244 seconds)
2020-11-06 01:33:24 <Axman6> well, it of course can be done, using functions
2020-11-06 01:33:49 <monochrom> That's different from the stated question.
2020-11-06 01:33:59 __xor is now known as _xor
2020-11-06 01:34:11 <Axman6> it can also be made to look like a constructor by using pattern synonyms
2020-11-06 01:34:14 × joaj quits (~joaj@2001:818:e326:8200:9fc:6bde:c18a:1771) (Ping timeout: 264 seconds)
2020-11-06 01:34:23 xff0x joins (~fox@2001:1a81:522f:7b00:9577:da4f:61ac:7ef2)
2020-11-06 01:34:29 <monochrom> I'm pretty sure the course is not at a point ready for pattern synonyms.
2020-11-06 01:34:31 <Axman6> but that's definitely way outside the skope of your course
2020-11-06 01:34:38 <monochrom> So why bring it up?
2020-11-06 01:34:58 <Axman6> you said it can't be done, but it can
2020-11-06 01:36:12 <Mela> right, so what motivates the question is that right now I have a lot of functions where each of them makes this kind of "if m > n, then replace with Empty" check
2020-11-06 01:36:26 <Mela> I'm looking for a way to achieve that in one place, since it's repetitive
2020-11-06 01:37:14 rekahsoft joins (~rekahsoft@cpe0008a20f982f-cm64777d666260.cpe.net.cable.rogers.com)
2020-11-06 01:37:17 o1lo01ol1o joins (~o1lo01ol1@bl8-213-81.dsl.telepac.pt)
2020-11-06 01:37:46 <monochrom> Write a function f such that f (IV (5,3)) = Empty, f xxx = xxx for other cases.
2020-11-06 01:37:57 <monochrom> Then you can reuse f everywhere.
2020-11-06 01:38:18 <monochrom> This is not the same as making i1 and i2 equivalent.
2020-11-06 01:39:11 <JohnnyL> What platforms would be supported by SDL2 and Haskell?
2020-11-06 01:40:45 thir joins (~thir@p200300f27f0b7e00f4e9381c2bf90854.dip0.t-ipconnect.de)
2020-11-06 01:42:31 × o1lo01ol1o quits (~o1lo01ol1@bl8-213-81.dsl.telepac.pt) (Ping timeout: 256 seconds)
2020-11-06 01:44:42 dbmikus__ joins (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com)
2020-11-06 01:46:18 <texasmyn_> is it possible to alter the pandoc table of contents with a filter? I can't tell from the docs in Hackage but I do not know the Pandoc module well.
2020-11-06 01:47:06 × twopoint718 quits (~cjw@fsf/member/twopoint718) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-11-06 01:47:23 texasmyn_ is now known as texasmynsted
2020-11-06 01:48:58 <Mela> I'm not sure that I understand. Here's the implementation of 'show' as an example - https://paste.tomsmeding.com/BQhdNEnr
2020-11-06 01:49:56 × thir quits (~thir@p200300f27f0b7e00f4e9381c2bf90854.dip0.t-ipconnect.de) (Ping timeout: 244 seconds)
2020-11-06 01:50:25 Stanley00 joins (~stanley00@unaffiliated/stanley00)
2020-11-06 01:51:22 × stonebrige quits (~stonebrig@4e69b241.skybroadband.com) (Ping timeout: 256 seconds)
2020-11-06 01:52:10 <monochrom> Do you mind writing an ordinary function showIntervalDumb outside "instance Show Intervel".
2020-11-06 01:52:31 <monochrom> showIntervalDumb :: Interval -> String.
2020-11-06 01:53:18 <Mela> what would be the advantage?
2020-11-06 01:53:18 <monochrom> It doesn't do anything smart. It always converts IV(m,n) to "<" ++ (show m) ++ "," ++ (show n) ++ ">"
2020-11-06 01:53:38 × darjeeling_ quits (~darjeelin@115.215.43.51) (Ping timeout: 256 seconds)
2020-11-06 01:53:41 <monochrom> Then your instance goes "show i = showIntervalDumb (f i)"
2020-11-06 01:54:22 <monochrom> Since f already does the smart normalization, showIntervalDumb has nothing to worry about.
2020-11-06 01:54:33 <monochrom> And f can also be reused elsewhere
2020-11-06 01:55:00 stonebridge joins (~stonebrig@4e69b241.skybroadband.com)
2020-11-06 01:55:24 justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311)
2020-11-06 01:56:00 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2020-11-06 01:56:01 <Mela> oh, I see
2020-11-06 01:56:17 × pera quits (~pera@unaffiliated/pera) (Ping timeout: 265 seconds)
2020-11-06 01:57:15 <Mela> Do I need an extra function? Couldn't I just write show i = show (f i) as the top priority definition? then after that define show as I usually would?
2020-11-06 01:57:45 <monochrom> That's an infinite loop.
2020-11-06 01:58:56 <Mela> oh
2020-11-06 01:59:36 <Mela> I guess I could not define anything for the case of m > n and put show i = show (f i) as least priority to catch it?
2020-11-06 01:59:53 × solonarv quits (~solonarv@astrasbourg-653-1-263-62.w92-161.abo.wanadoo.fr) (Ping timeout: 260 seconds)
2020-11-06 02:02:27 <Mela> alright, but I think using this sort of wrapper function to normalize the intervals is a nice enough solution :D thanks for helping!
2020-11-06 02:05:12 Stanley|00 joins (~stanley00@unaffiliated/stanley00)
2020-11-06 02:05:38 <Mela> I still wonder why my original idea doesn't work in Haskell though. a value constructor ("IV" here) is just another function (that results in a type "Interval" here), no? So why can't I pattern match and put up a rule for a specific case, as long as I assign the proper type (and Empty is an Interval type here)?
2020-11-06 02:05:39 × luke quits (~luke@bitnomial/staff/luke) (Quit: sleep)
2020-11-06 02:06:45 × Stanley00 quits (~stanley00@unaffiliated/stanley00) (Ping timeout: 240 seconds)
2020-11-06 02:06:50 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
2020-11-06 02:08:00 <monochrom> You are confusing "a function I can write and rewrite" with "a function that the computer auto-generates for me".
2020-11-06 02:08:36 <monochrom> IV can play the role of a function, but that function came from the computer, not you. It's coding is already done, you cannot change it.
2020-11-06 02:08:49 <monochrom> s/It's/Its/
2020-11-06 02:11:21 <JohnnyL> monochrom: didn't you used to hang in #lisp?
2020-11-06 02:11:33 <monochrom> No.
2020-11-06 02:11:52 slack1256 joins (~slack1256@191.126.150.2)
2020-11-06 02:12:34 <Mela> yes, that's indeed a new concept to me. I thought I could just add to any function that exists
2020-11-06 02:13:09 <Mela> thanks for clarifying!
2020-11-06 02:13:33 × catchme quits (uid355354@gateway/web/irccloud.com/x-wmqwbwgtbuzhjsjg) (Quit: Connection closed for inactivity)
2020-11-06 02:14:49 × stonebridge quits (~stonebrig@4e69b241.skybroadband.com) (Ping timeout: 256 seconds)
2020-11-06 02:15:41 × Mela quits (3eb2acf9@62-178-172-249.cable.dynamic.surfer.at) (Remote host closed the connection)
2020-11-06 02:20:50 × slack1256 quits (~slack1256@191.126.150.2) (Ping timeout: 256 seconds)
2020-11-06 02:21:18 × tromp quits (~tromp@dhcp-077-249-230-040.chello.nl) (Read error: Connection reset by peer)
2020-11-06 02:21:27 slack1256 joins (~slack1256@191.126.150.2)
2020-11-06 02:21:58 tromp joins (~tromp@dhcp-077-249-230-040.chello.nl)
2020-11-06 02:23:07 × howdoi quits (uid224@gateway/web/irccloud.com/x-pkptafzrpfqhbpar) (Quit: Connection closed for inactivity)
2020-11-06 02:23:23 <JohnnyL> What platforms does Hackage support?
2020-11-06 02:28:05 × slack1256 quits (~slack1256@191.126.150.2) (Ping timeout: 240 seconds)
2020-11-06 02:29:27 × Entertainment quits (~entertain@104.246.132.210) (Quit: Leaving.)
2020-11-06 02:29:59 conal joins (~conal@107.181.166.217)
2020-11-06 02:32:58 <sm[m]> JohnnyL: all platforms you can install cabal on
2020-11-06 02:32:59 <sm[m]> but if you're on Windows, you need to check package dependencies for certain packages that won't build easily there (like "unix")
2020-11-06 02:34:06 × adamCS quits (~adamCS@ec2-34-207-160-255.compute-1.amazonaws.com) (Ping timeout: 256 seconds)
2020-11-06 02:34:17 Black joins (~Benett@unaffiliated/benett)
2020-11-06 02:34:18 × acarrico quits (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net) (Ping timeout: 260 seconds)
2020-11-06 02:34:24 adamCS joins (~adamCS@ec2-34-207-160-255.compute-1.amazonaws.com)
2020-11-06 02:34:40 × fre quits (~freusque@104.238.190.229) (Ping timeout: 256 seconds)
2020-11-06 02:34:40 × dredozubov quits (~dredozubo@37.139.21.214) (Ping timeout: 256 seconds)
2020-11-06 02:34:40 × feuerbach quits (~feuerbach@unaffiliated/feuerbach) (Ping timeout: 256 seconds)
2020-11-06 02:34:40 × mr_yogurt quits (~mr_yogurt@5.61.211.35.bc.googleusercontent.com) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × NieDzejkob quits (~quassel@188.123.215.55) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × hongminhee quits (~dahlia@207.148.91.209) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × obfusk quits (~quassel@a82-161-150-56.adsl.xs4all.nl) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × hive-mind quits (~hivemind@rrcs-67-53-148-69.west.biz.rr.com) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × AWizzArd quits (~code@unaffiliated/awizzard) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × laxask quits (~lax@unaffiliated/laxask) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × Benett quits (~Benett@unaffiliated/benett) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × freeside quits (~ubuntu@ec2-52-58-69-57.eu-central-1.compute.amazonaws.com) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × Cheery quits (~cheery@7-239-179-185.static.tentacle.fi) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × tureba quits (~tureba@tureba.org) (Ping timeout: 256 seconds)
2020-11-06 02:35:14 × cynick quits (~worm@ec2-52-206-86-1.compute-1.amazonaws.com) (Ping timeout: 256 seconds)
2020-11-06 02:35:21 hongminhee joins (~dahlia@207.148.91.209)
2020-11-06 02:35:28 fre joins (~freusque@104.238.190.229)
2020-11-06 02:35:34 feuerbach joins (~feuerbach@unaffiliated/feuerbach)

All times are in UTC.