Logs: freenode/#haskell
| 2020-11-14 11:36:47 | <HaskellYogi> | modval and total are in the same column |
| 2020-11-14 11:37:00 | <kuribas> | where is a bit more idiomatic IMO |
| 2020-11-14 11:37:19 | → | chidy joins (~chidy@95.145.58.105) |
| 2020-11-14 11:37:36 | <merijn> | I would say that most (like, 90%) people only use let when they absolutely have to because "where" can't work |
| 2020-11-14 11:38:01 | <merijn> | Properly indenting let always becomes an ugly mess |
| 2020-11-14 11:38:31 | <HaskellYogi> | Ok got it, so where would have done, makes sense. |
| 2020-11-14 11:38:57 | <kuribas> | let is more lispy, or ocamly... |
| 2020-11-14 11:38:59 | × | Benzi-Junior quits (~BenziJuni@dsl-149-67-198.hive.is) (Ping timeout: 256 seconds) |
| 2020-11-14 11:39:02 | × | chidy quits (~chidy@95.145.58.105) (Remote host closed the connection) |
| 2020-11-14 11:39:07 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds) |
| 2020-11-14 11:39:25 | <merijn> | Also, note that the parenthesis are redundant |
| 2020-11-14 11:39:56 | <merijn> | function application *always* binds tighter than operators do, so "(modChr char) + (getKeyToInt key )" is the same as "modChr char + getKeyToInt key" |
| 2020-11-14 11:40:00 | → | indolering joins (~indolerin@178.162.212.214) |
| 2020-11-14 11:40:09 | <HaskellYogi> | Thanks @kuribas and @merijn will take care in future |
| 2020-11-14 11:40:58 | <HaskellYogi> | I just use that, cause I read some where that it makes the intent clear to someone reading your code |
| 2020-11-14 11:41:40 | <merijn> | HaskellYogi: In cases where it's ambiguous (like mixing many operators) then it can be useful, yes |
| 2020-11-14 11:42:23 | <merijn> | But since function application always wins from operators it's best to just get used to that quickly :) |
| 2020-11-14 11:43:01 | → | LKoen joins (~LKoen@9.253.88.92.rev.sfr.net) |
| 2020-11-14 11:43:55 | <kuribas> | I never know which of (>>=), (<$>), (<*>), binds more tightly |
| 2020-11-14 11:44:11 | <kuribas> | so there parens are more clear. |
| 2020-11-14 11:44:56 | → | royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) |
| 2020-11-14 11:49:44 | → | Feuermagier joins (~Feuermagi@213.178.26.41) |
| 2020-11-14 11:50:34 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2020-11-14 11:50:58 | <Feuermagier> | how do I find the (integer in a list) closest to a (target integer) elegantly? |
| 2020-11-14 11:52:07 | <merijn> | Feuermagier: Do you care about it staying a list? |
| 2020-11-14 11:52:13 | <Feuermagier> | nope |
| 2020-11-14 11:52:39 | × | directhex1 quits (~directhex@139.28.218.148) (Remote host closed the connection) |
| 2020-11-14 11:52:57 | <Feuermagier> | i guess i can just brute force elements out of it and compare each time, then pass the so-far-best through recursively through |
| 2020-11-14 11:52:58 | → | Alleria_ joins (~AllahuAkb@2604:2000:1484:26:b962:7f95:ab02:6d5a) |
| 2020-11-14 11:53:04 | → | Lycurgus joins (~niemand@cpe-45-46-134-163.buffalo.res.rr.com) |
| 2020-11-14 11:53:11 | <merijn> | Feuermagier: Put it into a Set and use lookupLE and lookupGE? :) |
| 2020-11-14 11:53:26 | <merijn> | Feuermagier: https://hackage.haskell.org/package/containers-0.6.4.1/docs/Data-Set.html#v:lookupLE |
| 2020-11-14 11:53:46 | <merijn> | Then it becomes a matter of checking which of those 2 items has the smallest difference from your target |
| 2020-11-14 11:54:01 | hackage | uusi 0.2.0.0 - Tweak dependencies in .cabal files https://hackage.haskell.org/package/uusi-0.2.0.0 (berberman) |
| 2020-11-14 11:54:01 | × | carlomagno quits (~cararell@148.87.23.6) (Remote host closed the connection) |
| 2020-11-14 11:54:52 | → | carlomagno joins (~cararell@148.87.23.10) |
| 2020-11-14 11:54:52 | × | jakalx quits (~jakalx@base.jakalx.net) (Ping timeout: 260 seconds) |
| 2020-11-14 11:57:12 | <Feuermagier> | merijn, very interesting - thx! |
| 2020-11-14 12:01:05 | × | nckx quits (~nckx@tobias.gr) (Ping timeout: 256 seconds) |
| 2020-11-14 12:02:14 | <kuribas> | :i <$!> |
| 2020-11-14 12:02:44 | <kuribas> | no strict fmap? |
| 2020-11-14 12:04:58 | × | olligobber quits (olligobber@gateway/vpn/privateinternetaccess/olligobber) (Ping timeout: 246 seconds) |
| 2020-11-14 12:05:31 | <merijn> | Feuermagier: That's O(log n) complexity too! (well, there's an initial O(n log n) for creating the set, but afterwards all queries are O(log n)) |
| 2020-11-14 12:07:11 | <Feuermagier> | merijn, nice! - however i'm still unsure if haskell can actually be a productive language :) |
| 2020-11-14 12:08:15 | <merijn> | Whether it *can* be productive isn't really up for debate, since many people are productive in it :p The question is more whether *you* can be productive in Haskell :) |
| 2020-11-14 12:08:18 | <kuribas> | Feuermagier: it can be! If it will be for you depends on how eager you are to learn, and if the language suits you well. |
| 2020-11-14 12:08:24 | × | baidobz quits (2d56c95b@45.86.201.91) (Ping timeout: 245 seconds) |
| 2020-11-14 12:09:30 | <kuribas> | IMO in the beginning you are less productive than in other language, but after some threshold you become more productive. |
| 2020-11-14 12:11:19 | <Feuermagier> | merijn, thats a good point. choosing the right tool for the job i guess. right now i'm still in the learning phase. i hope to take concepts away for my other languages (like rust, which shares the majority of its functional part with haskell) |
| 2020-11-14 12:12:04 | <merijn> | I'm...not sure I agree with Rust sharing the majority :p |
| 2020-11-14 12:13:56 | <int-e> | merijn: majority(functional_part(rust)) subset Haskell |
| 2020-11-14 12:14:01 | <int-e> | is how I'd parse it |
| 2020-11-14 12:14:05 | <Lycurgus> | Feuermagier, you wholly misappraised haskell, it's far and away the premier functional language in this time in the strict sense |
| 2020-11-14 12:14:27 | <merijn> | Unrelatedly |
| 2020-11-14 12:14:41 | <Lycurgus> | you really shouldn't compare it to other langs since it's something of sui generis |
| 2020-11-14 12:15:17 | <merijn> | A few weeks ago there was a post on /r/haskell for exhaustive conversions between two types, but I forgot the name/URL. Anyone remember? |
| 2020-11-14 12:15:42 | <merijn> | Lycurgus: I disagree, there's a ton of languages you can easily compare Haskell with |
| 2020-11-14 12:16:18 | <merijn> | SML, Miranda, Clean, Lazy ML... |
| 2020-11-14 12:16:39 | <Lycurgus> | merijn, i didn say you couldn't I said you shouldn't |
| 2020-11-14 12:16:44 | <merijn> | It's not like Haskell was invented in a vacuum. Like a solid 2/3rd of the report are just straight up copied from other languages |
| 2020-11-14 12:17:27 | <merijn> | Let's not go put Haskell on a pedestal as some unique divine deliverance on programming >.> |
| 2020-11-14 12:18:11 | <Lycurgus> | nothing comes close in that set to the qualities of haskell in term of acceptance and development of a practical ecosystem, ocaml and the others in a second tier |
| 2020-11-14 12:18:31 | <Lycurgus> | *terms |
| 2020-11-14 12:18:55 | <Feuermagier> | right now I just can't identify that target "group of projects" I'd choose haskell for. But maybe I'll see that once I know it better. |
| 2020-11-14 12:19:15 | <Lycurgus> | but to Feuermagier's point, the time to become acculturated to the lang and that ecosys maybe prohibitive in some cases |
| 2020-11-14 12:19:28 | <solonarv> | heh, that's the situation I'm in regarding rust (and is why I have yet to properly learn it) |
| 2020-11-14 12:19:30 | <Lycurgus> | *may be |
| 2020-11-14 12:21:00 | <merijn> | Feuermagier: tbh, personally I'd choose Haskell for "everything that's not realtime/games/GUI" :p |
| 2020-11-14 12:21:26 | <arahael> | merijn: That makes me sad! Why not GUI? |
| 2020-11-14 12:21:34 | <merijn> | If I ever embarked on one of those categories I'd probably consider Rust |
| 2020-11-14 12:21:49 | <merijn> | arahael: So far none of the GUI things I've seen seem worth the hassle |
| 2020-11-14 12:21:50 | <arahael> | merijn: I mean, I haven't found a way to use Haskell well for GUI, but I'm still figuring this out. |
| 2020-11-14 12:21:54 | <arahael> | merijn: Yeah, same. :( |
| 2020-11-14 12:22:00 | <arahael> | merijn: But _why_. ;) |
| 2020-11-14 12:22:10 | <Uniaika> | never forget: https://www.reddit.com/r/rust/comments/5penft/parallelizing_enjarify_in_go_and_rust/dcsgk7n/ |
| 2020-11-14 12:22:25 | <merijn> | I don't think nice Haskell gui stuff is impossible, it's just not been done yet |
| 2020-11-14 12:22:33 | <merijn> | And I don't wanna be the one that does it :p |
| 2020-11-14 12:22:43 | Lycurgus | 's spin https://eg.meansofproduction.biz/eg/index.php/Troika |
| 2020-11-14 12:22:44 | <merijn> | I'd rather writing a GUI in something simpler and then call Haskell from that :p |
| 2020-11-14 12:23:40 | <arahael> | merijn: "simpler". Honestly, I suspect that GUi should be done in "whatever" the native framework proposes, for various reasons. |
| 2020-11-14 12:25:05 | <merijn> | Anyway, back to solving *my* problems. I've got a bijection between my type and string/text, are there existing things for nicely encoding that, or should I hack something together using my own Map/typeclass? |
| 2020-11-14 12:25:39 | <Lycurgus> | i'd be surprised if there wasn't |
| 2020-11-14 12:25:58 | <merijn> | So would I, but the only stuff I've found has ugly TH death machines |
| 2020-11-14 12:26:04 | <merijn> | I was hoping something fairly lightweight |
| 2020-11-14 12:26:16 | <Lycurgus> | ur scared of th? |
| 2020-11-14 12:26:29 | <merijn> | No, but it slows down my built and is unnecessary |
| 2020-11-14 12:27:00 | <Lycurgus> | i c |
| 2020-11-14 12:27:34 | <Feuermagier> | merijn, the rust and the haskell compiler are equally aggeressive regarding types. (however since rust has no garbage collection the compiler will force you to RAII, whereas in haskell you don't have to worry about it) |
| 2020-11-14 12:27:38 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-11-14 12:28:48 | <merijn> | Feuermagier: For 95% of programs (possibly more...) GC isn't something to worry about it |
| 2020-11-14 12:29:08 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2020-11-14 12:29:37 | <merijn> | I like Rust (conceptually, at least), but *in practice* the overhead of GC isn't a problem for stuff I write, therefore ownership and RAII does nothing but "make life more complicated" for no good reason |
| 2020-11-14 12:30:00 | <Feuermagier> | merijn, whats the state of haskell on multithreading? |
| 2020-11-14 12:30:08 | <merijn> | Easy-peasy |
| 2020-11-14 12:30:44 | <Feuermagier> | merijn, i assume races are impossible cause functional? |
| 2020-11-14 12:30:46 | × | Lycurgus quits (~niemand@cpe-45-46-134-163.buffalo.res.rr.com) (Quit: Exeunt) |
| 2020-11-14 12:31:31 | <merijn> | Since everything is immutable by default you can't have races unless you "opt-in" to them |
| 2020-11-14 12:31:52 | <merijn> | Feuermagier: There's a bunch of different mutable types you can use in concurrent code, some of which are racy |
| 2020-11-14 12:32:05 | <merijn> | But then you need to decide to explicitly include those racy types in your code |
| 2020-11-14 12:32:15 | <merijn> | (IORef is one example that's racy) |
All times are in UTC.