Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-16 13:31:46 <curiousgay> yushyin: I mean the behavior without "+RTS" and flags following it, but I guess I simply have to create a 2-line shell script because there is nothing I can do about decisions behind GHC
2021-03-16 13:32:27 × hiroaki1 quits (~hiroaki@2a02:8108:8c40:2bb8:45f7:66d:ca9:84) (Ping timeout: 272 seconds)
2021-03-16 13:32:40 <yushyin> there is a reason we use build tools like cabal
2021-03-16 13:33:15 hiroaki1 joins (~hiroaki@2a02:8108:8c40:2bb8:7b72:cc15:1305:937f)
2021-03-16 13:33:34 × lkurusa quits (~lkurusa@fedora/Levex) (Ping timeout: 276 seconds)
2021-03-16 13:34:06 <curiousgay> you mean cabal and stack build binaries in a way "+RTS" opts are not needed for multiple OS threads?
2021-03-16 13:34:06 <yushyin> curiousgay: maybe you are missing, that you can set rtsopts at compile time?
2021-03-16 13:34:49 <yushyin> curiousgay: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/phases.html#ghc-flag--with-rtsopts=%E2%9F%A8opts%E2%9F%A9
2021-03-16 13:34:53 Otoo joins (590cde70@dynamic-089-012-222-112.89.12.pool.telefonica.de)
2021-03-16 13:35:05 <merijn> curiousgay: "automatically figuring out how many OS threads need to be created" is an unsolved problem
2021-03-16 13:35:29 <Otoo> Hello
2021-03-16 13:35:34 <Otoo> crap I spelt my name wrong
2021-03-16 13:35:57 <curiousgay> yushyin: thanks :)
2021-03-16 13:36:11 × Otoo quits (590cde70@dynamic-089-012-222-112.89.12.pool.telefonica.de) (Client Quit)
2021-03-16 13:37:43 rj_ joins (~x@gateway/tor-sasl/rj)
2021-03-16 13:37:51 coot joins (~coot@37.30.58.223.nat.umts.dynamic.t-mobile.pl)
2021-03-16 13:38:23 <curiousgay> merijn: I guess "what do other projects (like Go) do?" doesn't provide contructive answer
2021-03-16 13:38:45 hexreel joins (~hr@2600:1700:28e2:14d0:cef:c525:4834:4938)
2021-03-16 13:38:47 <merijn> curiousgay: "whatever works as default for Google"
2021-03-16 13:38:56 hexreel parts (~hr@2600:1700:28e2:14d0:cef:c525:4834:4938) ()
2021-03-16 13:39:16 <merijn> curiousgay: I mean, you can hard code something like max(8, num_cores-1) or something and use that
2021-03-16 13:39:42 <merijn> curiousgay: But there isn't really a good way to determine "a good number of OS threads for a problem" automatically
2021-03-16 13:42:38 × cur8or quits (~cur8or@72canterbury.cybersmart.co.za) (Ping timeout: 256 seconds)
2021-03-16 13:43:47 geekosaur joins (82650c7a@130.101.12.122)
2021-03-16 13:46:38 × rj_ quits (~x@gateway/tor-sasl/rj) (Ping timeout: 268 seconds)
2021-03-16 13:50:07 rj_ joins (~x@gateway/tor-sasl/rj)
2021-03-16 13:50:09 molehillish joins (~molehilli@ip98-167-226-26.ph.ph.cox.net)
2021-03-16 13:50:35 × jonathanx_ quits (~jonathan@h-176-109.A357.priv.bahnhof.se) (Remote host closed the connection)
2021-03-16 13:52:23 sajith_ is now known as sajith
2021-03-16 13:52:25 × molehillish quits (~molehilli@ip98-167-226-26.ph.ph.cox.net) (Remote host closed the connection)
2021-03-16 13:52:26 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2021-03-16 13:53:40 molehillish joins (~molehilli@2600:8800:8d06:1800:6cd8:b958:caec:b1dc)
2021-03-16 13:53:46 tinhatcat joins (~tsranso@108-91-101-161.lightspeed.gnvlsc.sbcglobal.net)
2021-03-16 13:54:22 Jd007 joins (~Jd007@162.156.11.151)
2021-03-16 13:55:42 × tinhatcat quits (~tsranso@108-91-101-161.lightspeed.gnvlsc.sbcglobal.net) (Client Quit)
2021-03-16 13:56:30 cole-h joins (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net)
2021-03-16 13:57:00 howdoi joins (uid224@gateway/web/irccloud.com/x-cnfnotqfqspqvzjj)
2021-03-16 13:57:56 Sgeo joins (~Sgeo@ool-18b98aa4.dyn.optonline.net)
2021-03-16 13:59:20 emetrusky joins (561e1a8f@cpc152439-cosh18-2-0-cust142.6-1.cable.virginm.net)
2021-03-16 13:59:37 × Deide quits (~Deide@217.155.19.23) (Quit: Seeee yaaaa)
2021-03-16 14:00:40 Wuzzy joins (~Wuzzy@p57a2ecf2.dip0.t-ipconnect.de)
2021-03-16 14:04:34 × aldum_ quits (~vishera@aldum.pw) (Quit: leaving)
2021-03-16 14:05:36 aldum joins (~vishera@aldum.pw)
2021-03-16 14:06:20 <emetrusky> Write a function:
2021-03-16 14:06:21 <emetrusky> sumDifference :: Int -> Int -> (Int,Int)
2021-03-16 14:06:21 <emetrusky> which returns both the sum and the difference between the first and second arguments.
2021-03-16 14:06:22 <emetrusky> For example, sumDifference 3 7 = (10,-4).
2021-03-16 14:06:22 <emetrusky> How would i do this?
2021-03-16 14:07:29 × LKoen quits (~LKoen@194.250.88.92.rev.sfr.net) (Quit: “It’s only logical. First you learn to talk, then you learn to think. Too bad it’s not the other way round.”)
2021-03-16 14:09:20 <dminuoso> What have you tried?
2021-03-16 14:09:30 <kuribas> :t (+) &&& (-)
2021-03-16 14:09:32 <lambdabot> Num b => b -> (b -> b, b -> b)
2021-03-16 14:09:47 <emetrusky> sumDifference :: Int -> Int -> (Int,Int)
2021-03-16 14:09:47 <emetrusky> sumDifference x y
2021-03-16 14:09:48 <emetrusky> sumDifference x + y | x - y = (x,y)
2021-03-16 14:10:25 <dminuoso> Mmm. That syntax looks weirdly wrong.
2021-03-16 14:10:34 <dminuoso> Can you, with your own words, explain what you think that code even means?
2021-03-16 14:10:46 pehjota joins (~pehjota@217.146.82.202)
2021-03-16 14:11:19 <emetrusky> so it takes in two numbers and then adds them up and then will do the difference between them and spit out the results in a list
2021-03-16 14:11:45 <dminuoso> Really curious about how you envision your code does that.
2021-03-16 14:11:48 <kuribas> :t curry $ (,) <$> uncurry (+) <*> uncurry (-)
2021-03-16 14:11:50 <lambdabot> Num a => a -> a -> (a, a)
2021-03-16 14:12:09 <dminuoso> emetrusky: Other than "that definition is not even remotely valid haskell" Im not sure what to tell you.
2021-03-16 14:12:33 <dminuoso> emetrusky: Let me give you a starting point. Start the definition as follows:
2021-03-16 14:12:41 <dminuoso> sumDifference x y = ...
2021-03-16 14:12:47 <dminuoso> Where `...` is some expression
2021-03-16 14:12:47 <dolio> Also, what text have you been following?
2021-03-16 14:12:58 <kuribas> emetrusky: why do you even have a guard?
2021-03-16 14:13:16 <dminuoso> kuribas: Its not a guard, it's something they believe does something that doesnt work like that in Haskell
2021-03-16 14:13:26 <dminuoso> Perhaps transferring some code style from some other cryptic programming language
2021-03-16 14:13:28 <kuribas> > (curry $ (,) <$> uncurry (+) <*> uncurry (-)) 3 7
2021-03-16 14:13:31 <lambdabot> (10,-4)
2021-03-16 14:14:05 <emetrusky> ye so i give in two number like 3  and 7 and gives out (10,-4) as a tuple
2021-03-16 14:15:12 <dminuoso> Oh I understand what the intended result it.
2021-03-16 14:16:08 <dolio> The only thing I can think of is that this is somehow borrowed from Agda, but that seems impossible. :)
2021-03-16 14:16:26 × thc202 quits (~thc202@unaffiliated/thc202) (Ping timeout: 240 seconds)
2021-03-16 14:16:44 <tomsmeding> dolio: it kind of looks like that, but also not
2021-03-16 14:17:09 <kuribas> emetrusky: for example, you cannot have a declaration without '=' (disregarding template haskell), like your first clause.
2021-03-16 14:17:22 × geekosaur quits (82650c7a@130.101.12.122) (Ping timeout: 240 seconds)
2021-03-16 14:17:35 × peanut_ quits (~peanut@2a02:8388:a101:2600:2ba8:dc0d:2e25:a003) (Quit: Leaving)
2021-03-16 14:18:52 × coot quits (~coot@37.30.58.223.nat.umts.dynamic.t-mobile.pl) (Quit: coot)
2021-03-16 14:19:19 <emetrusky> sumDifference :: Int -> Int -> (Int,Int)
2021-03-16 14:19:19 <emetrusky> sumDifference x y = let sum = x + y | let difference = x - y = (sum,difference)
2021-03-16 14:19:20 <emetrusky> so i got this far but it says parse error on '|'
2021-03-16 14:20:32 <tomsmeding> emetrusky: what tells you that '|' should be valid?
2021-03-16 14:20:39 heatsink joins (~heatsink@2600:1700:bef1:5e10:7c0e:3b57:dfb:2cb4)
2021-03-16 14:20:44 kam1 joins (~kam1@83.123.167.219)
2021-03-16 14:21:06 <emetrusky> idk thought that would act like a guard
2021-03-16 14:21:09 × kam1 quits (~kam1@83.123.167.219) (Read error: Connection reset by peer)
2021-03-16 14:21:16 <tomsmeding> why do you think you need guards here?
2021-03-16 14:21:20 <tomsmeding> (you don't :) )
2021-03-16 14:22:28 <emetrusky> sumDifference :: Int -> Int -> (Int,Int)
2021-03-16 14:22:29 <emetrusky> sumDifference x y = (x+y,x-y)
2021-03-16 14:22:31 <emetrusky> got it
2021-03-16 14:22:43 <tomsmeding> indeed, that should work well
2021-03-16 14:22:44 mouseghost joins (~draco@wikipedia/desperek)
2021-03-16 14:23:03 <tomsmeding> emetrusky: I (and I suppose others here) would still be curious where you got the idea to try your other variants
2021-03-16 14:23:20 <tomsmeding> not as a comment to you, but just to satisfy our curiosity
2021-03-16 14:23:33 <dminuoso> tomsmeding: They are not supposed to be guards.
2021-03-16 14:23:35 <emetrusky> that there is a long story of what uni used in practice marterial

All times are in UTC.