Logs: freenode/#haskell
| 2020-11-26 17:57:53 | <gehmehgeh> | Well, that is counterintuitive |
| 2020-11-26 17:58:07 | <gehmehgeh> | Because you can pass "-O2" directly to cabal and will reflect that |
| 2020-11-26 17:58:16 | <merijn> | Build profile is, presumably reflecting whether you set "optimisation: 2" in ~/.cabal/config |
| 2020-11-26 17:58:26 | <ski> | ezzieyguywuf : any luck ? |
| 2020-11-26 17:58:37 | <gehmehgeh> | I actually put -O2 in ~/.cabal/config :D |
| 2020-11-26 17:58:53 | <monochrom> | For -O2, with only a few exceptions, you shouldn't set in *.cabal at all. |
| 2020-11-26 17:58:57 | <merijn> | gehmehgeh: Doing that would involve parsing flags from ghc-options would involve cabal actually knowing all GHC options |
| 2020-11-26 17:59:18 | <merijn> | gehmehgeh: Also, setting -O2 on everything is great way too spend *a lot* of time waiting for compilation for very marginal gains |
| 2020-11-26 17:59:41 | ski | . o O ( `SuppressUnusedWarnings ((<=?@#@$$) a6989586621679473158 :: TyFun Nat Bool -> Type)' ) |
| 2020-11-26 17:59:43 | <merijn> | -O2 isn't recommended unless you *know* -O2 is significantly better than -O1 |
| 2020-11-26 17:59:53 | <gehmehgeh> | ij |
| 2020-11-26 17:59:56 | <gehmehgeh> | ok |
| 2020-11-26 18:00:40 | <gehmehgeh> | You know what's a bit eerie? I also tried putting "-Werror=incomplete-patterns" there with the result that some dependencies won't build anymore... |
| 2020-11-26 18:00:48 | → | oish joins (~charlie@228.25.169.217.in-addr.arpa) |
| 2020-11-26 18:01:04 | <merijn> | Well, sure |
| 2020-11-26 18:02:05 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-11-26 18:02:08 | <merijn> | Turns out that not every random dependency on the internet has the same engineering standards :p |
| 2020-11-26 18:02:43 | → | pokid joins (~pokid@unaffiliated/pokid) |
| 2020-11-26 18:02:43 | <gehmehgeh> | Still... |
| 2020-11-26 18:06:24 | <gehmehgeh> | monochrom, merijn: Thanks for the help :) |
| 2020-11-26 18:06:48 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds) |
| 2020-11-26 18:10:01 | → | Ariakenom joins (~Ariakenom@h-98-128-229-104.NA.cust.bahnhof.se) |
| 2020-11-26 18:10:18 | → | electricityZZZZ joins (~electrici@108-216-157-17.lightspeed.sntcca.sbcglobal.net) |
| 2020-11-26 18:10:39 | × | alp quits (~alp@2a01:e0a:58b:4920:2df3:524d:ce61:8fe1) (Ping timeout: 272 seconds) |
| 2020-11-26 18:10:43 | → | cole-h joins (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net) |
| 2020-11-26 18:14:01 | × | Tario quits (~Tario@200.119.184.39) (Ping timeout: 264 seconds) |
| 2020-11-26 18:15:10 | → | Tario joins (~Tario@201.192.165.173) |
| 2020-11-26 18:15:49 | → | blah20 joins (45fbee6a@c-69-251-238-106.hsd1.md.comcast.net) |
| 2020-11-26 18:19:00 | × | christo quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2020-11-26 18:19:13 | <avdb> | Is there a Haskell function that does "f n [x] = [x,x,x, ... x]", basically returning a list of the original element multiplied with n? |
| 2020-11-26 18:19:19 | <koz_> | :t replicate |
| 2020-11-26 18:19:21 | <lambdabot> | Int -> a -> [a] |
| 2020-11-26 18:19:26 | × | royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed) |
| 2020-11-26 18:19:30 | <koz_> | > replicate 10 "foo" |
| 2020-11-26 18:19:32 | <lambdabot> | ["foo","foo","foo","foo","foo","foo","foo","foo","foo","foo"] |
| 2020-11-26 18:19:39 | <avdb> | Thanks! |
| 2020-11-26 18:19:50 | × | Alleria_ quits (~AllahuAkb@2604:2000:1484:26:f085:e9f5:38cf:432d) (Ping timeout: 264 seconds) |
| 2020-11-26 18:19:52 | → | royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) |
| 2020-11-26 18:20:00 | → | jneira joins (02896ac0@gateway/web/cgi-irc/kiwiirc.com/ip.2.137.106.192) |
| 2020-11-26 18:20:01 | <avdb> | Been stuck on this problem for longer than a month lol |
| 2020-11-26 18:20:14 | <yushyin> | lol |
| 2020-11-26 18:20:18 | <xerox_> | @hoogle Int -> a -> [a] |
| 2020-11-26 18:20:19 | <lambdabot> | Prelude replicate :: Int -> a -> [a] |
| 2020-11-26 18:20:19 | <lambdabot> | Data.List replicate :: Int -> a -> [a] |
| 2020-11-26 18:20:19 | <lambdabot> | GHC.List replicate :: Int -> a -> [a] |
| 2020-11-26 18:20:30 | <xerox_> | if you can give your idea a type sometimes you can find them like that |
| 2020-11-26 18:20:39 | <avdb> | I didn't bother to try Hoogle yet, I'm still too much of a noob :P |
| 2020-11-26 18:21:15 | × | knupfer quits (~Thunderbi@i59F7FFCD.versanet.de) (Ping timeout: 256 seconds) |
| 2020-11-26 18:21:24 | <koz_> | avdb: You can roll 'replicate' recursively without too much trouble. |
| 2020-11-26 18:22:10 | × | tumdedum quits (~tumdedum@unaffiliated/espiral) (Ping timeout: 272 seconds) |
| 2020-11-26 18:22:21 | → | tumdedum joins (~tumdedum@unaffiliated/espiral) |
| 2020-11-26 18:24:30 | ← | blah20 parts (45fbee6a@c-69-251-238-106.hsd1.md.comcast.net) () |
| 2020-11-26 18:24:43 | <avdb> | koz_: I know, I need to practice recursion a lot because I still suck at it! |
| 2020-11-26 18:24:48 | → | Alleria_ joins (~AllahuAkb@2604:2000:1484:26:5d86:da4d:584b:848b) |
| 2020-11-26 18:25:00 | × | royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 256 seconds) |
| 2020-11-26 18:25:23 | → | timCF joins (~i.tkachuk@m91-129-105-245.cust.tele2.ee) |
| 2020-11-26 18:25:25 | <koz_> | avdb: Basically, the trick is to treat it like a proof by induction. First, what's the simplest case you could ever see? Then, assuming you have a smaller answer, how do you get a bigger answer? |
| 2020-11-26 18:26:30 | <avdb> | I do indeed always handle the base cases like x == 0 and x == 0, afterwards I start on the otherwise case |
| 2020-11-26 18:26:47 | <koz_> | So for 'replicate', what's your base case? |
| 2020-11-26 18:26:53 | <avdb> | Matching types is also a pain but that's where Haskell shines |
| 2020-11-26 18:27:01 | <avdb> | Wait I'll send you a paste of my program |
| 2020-11-26 18:28:17 | <avdb> | http://codepad.org/KHd73y9L |
| 2020-11-26 18:28:17 | × | timCF quits (~i.tkachuk@m91-129-105-245.cust.tele2.ee) (Client Quit) |
| 2020-11-26 18:28:35 | → | timCF joins (~i.tkachuk@m91-129-105-245.cust.tele2.ee) |
| 2020-11-26 18:28:59 | <avdb> | koz_: Here you go, not sure if I should handle "arr == []" yet |
| 2020-11-26 18:29:00 | × | timCF quits (~i.tkachuk@m91-129-105-245.cust.tele2.ee) (Remote host closed the connection) |
| 2020-11-26 18:29:20 | → | timCF joins (~i.tkachuk@m91-129-105-245.cust.tele2.ee) |
| 2020-11-26 18:29:47 | <merijn> | You should avoid using "== []" that won't work for lists that are missing an Eq instance |
| 2020-11-26 18:30:01 | <koz_> | Yeah, 'null' or pattern matching is what you want. |
| 2020-11-26 18:30:17 | × | asheshambasta quits (~user@ptr-e1lysauiv50il654lwl.18120a2.ip6.access.telenet.be) (Ping timeout: 272 seconds) |
| 2020-11-26 18:30:42 | → | ishutin_ joins (~Ishutin@193-110-63-35.cable-modem.hdsnet.hu) |
| 2020-11-26 18:31:02 | × | phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 272 seconds) |
| 2020-11-26 18:31:08 | <avdb> | Ah lol that's why the last element doesn't print I suppose |
| 2020-11-26 18:31:30 | <avdb> | merijn: I did but forgot to change it in my paste, ALE suggested it :) |
| 2020-11-26 18:32:21 | <timCF> | Hi guys! Often I do operate with some value of monadic type, for example `Either a b` but inside some other monad `m` for example `IO`. To apply a function to internal `b` value I often write constructions like `(foo <$>) <$> x`. Is there other better/simpler way? |
| 2020-11-26 18:32:42 | → | christo joins (~chris@81.96.113.213) |
| 2020-11-26 18:32:42 | × | chkno quits (~chkno@75-7-2-127.lightspeed.sntcca.sbcglobal.net) (Read error: Connection reset by peer) |
| 2020-11-26 18:32:47 | <koz_> | timCF: So you have IO (Either a b) as the type you're trying to work with? |
| 2020-11-26 18:32:55 | <timCF> | Yes |
| 2020-11-26 18:32:57 | → | chkno joins (~chkno@75-7-2-127.lightspeed.sntcca.sbcglobal.net) |
| 2020-11-26 18:33:27 | tomsmeding | would write `fmap foo <$> x`, but that's the same |
| 2020-11-26 18:33:44 | <timCF> | `(foo <$>) <$> x` works but looks ugly |
| 2020-11-26 18:33:56 | × | Lycurgus quits (~niemand@98.4.114.74) (Ping timeout: 240 seconds) |
| 2020-11-26 18:33:56 | <merijn> | eh |
| 2020-11-26 18:33:57 | × | ishutin quits (~Ishutin@77-234-92-253.pool.digikabel.hu) (Ping timeout: 260 seconds) |
| 2020-11-26 18:34:01 | <merijn> | "fmap foo <$> x"? :p |
| 2020-11-26 18:34:12 | <timCF> | well, it's the same) |
| 2020-11-26 18:34:17 | <tomsmeding> | looks nicer |
| 2020-11-26 18:34:25 | <ski> | timCF : maybe `ExceptT a', depending ? |
| 2020-11-26 18:34:36 | <timCF> | I was looking for something like magic `<$$>` if it exists haha |
| 2020-11-26 18:34:47 | <tomsmeding> | % let <$$> = fmap . fmap |
| 2020-11-26 18:34:48 | <yahb> | tomsmeding: ; <interactive>:27:5: error: parse error on input `<$$>' |
| 2020-11-26 18:34:49 | <ski> | (fmap . fmap) foo x |
| 2020-11-26 18:34:52 | <tomsmeding> | % let (<$$>) = fmap . fmap |
| 2020-11-26 18:34:52 | <yahb> | tomsmeding: |
| 2020-11-26 18:34:58 | → | bruce_wayne joins (~prateekpr@94.129.87.184) |
| 2020-11-26 18:35:00 | → | d068796 joins (~d068796@2a01:c23:8073:b800:8554:936:8b1f:acb4) |
| 2020-11-26 18:35:01 | <tomsmeding> | % :t (<$$>) |
| 2020-11-26 18:35:01 | <yahb> | tomsmeding: (Functor f1, Functor f2) => (a -> b) -> f1 (f2 a) -> f1 (f2 b) |
| 2020-11-26 18:35:35 | <timCF> | well, looks like it will work? |
All times are in UTC.