Logs: liberachat/#haskell
| 2021-06-07 13:28:37 | × | maralorn quits (~maralorn@2001:470:69fc:105::251) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | ServerStatsDisco quits (~serversta@2001:470:69fc:105::1a) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | fabfianda[m] quits (~fabfianda@2001:470:69fc:105::6db) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | the-coot[m] quits (~the-cootm@2001:470:69fc:105::95f) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | Las[m] quits (~lasmatrix@2001:470:69fc:105::74e) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | hjulle[m] quits (~hjullemat@2001:470:69fc:105::1dd) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | srid[m] quits (~sridmatri@2001:470:69fc:105::1c2) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | Morrow[m] quits (~morrowmma@2001:470:69fc:105::1d0) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | jaror[m] quits (~jaror@2001:470:69fc:105::265) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | adziahel[m] quits (~adziahelm@2001:470:69fc:105::b4d) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | tomferon[m] quits (~tomferon@2001:470:69fc:105::268) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | ru0mad[m] quits (~ru0madmat@2001:470:69fc:105::9b2) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | bb010g quits (~bb010gmat@2001:470:69fc:105::9a5) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | Drezil quits (~drezilkif@2001:470:69fc:105::7f8) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:37 | × | Artem[m] quits (~artemtype@2001:470:69fc:105::75b) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:38 | × | cdsmith quits (~cdsmithma@2001:470:69fc:105::284) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:38 | × | marinelli[m] quits (~marinelli@2001:470:69fc:105::2d8) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:38 | × | zwro[m] quits (~zwromatri@2001:470:69fc:105::1d4) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:38 | × | cdepillabout[m] quits (~cdepillab@2001:470:69fc:105::3d3) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:38 | × | amesgen[m] quits (~amesgenam@2001:470:69fc:105::82b) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:38 | × | kosmikus[m] quits (~andresloe@2001:470:69fc:105::95d) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:38 | × | Soft quits (~soft-matr@2001:470:69fc:105::c75) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:38 | × | oak- quits (~oakuniver@2001:470:69fc:105::fcd) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:39 | × | vaibhavsagar[m] quits (~vaibhavsa@2001:470:69fc:105::ffe) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:39 | × | eddiemundo quits (~eddiemund@2001:470:69fc:105::a9c) (Quit: node-irc says goodbye) |
| 2021-06-07 13:28:46 | → | safinaskar2 joins (~safinaska@109-252-90-89.nat.spd-mgts.ru) |
| 2021-06-07 13:28:52 | <tomsmeding> | % :t (deepseq, join (==) `seq` (), \a -> length (show a) `seq` ()) |
| 2021-06-07 13:28:52 | <yahb> | tomsmeding: ; <interactive>:1:2: error: Variable not in scope: deepseq |
| 2021-06-07 13:29:03 | <tomsmeding> | :t (deepseq, join (==) `seq` (), \a -> length (show a) `seq` ()) |
| 2021-06-07 13:29:04 | <lambdabot> | error: Variable not in scope: deepseq |
| 2021-06-07 13:29:26 | <dminuoso> | tomsmeding: as in, `s == s` is a poor-mans deepseq without NFData? |
| 2021-06-07 13:29:38 | <dminuoso> | assuming a sensible Eq instance? |
| 2021-06-07 13:29:53 | <tomsmeding> | yeah |
| 2021-06-07 13:30:08 | <tomsmeding> | and an ADT structure |
| 2021-06-07 13:30:44 | <dminuoso> | What does "an ADT structure" mean? Is there a precise definition? Sorry to ask this many questions, Im just a bit clueless. :) |
| 2021-06-07 13:32:09 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:90fb:e693:9986:91e0) (Ping timeout: 245 seconds) |
| 2021-06-07 13:32:31 | × | jmcarthur quits (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net) (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
| 2021-06-07 13:32:58 | × | ddellacosta quits (~ddellacos@86.106.121.74) (Remote host closed the connection) |
| 2021-06-07 13:33:26 | → | ddellacosta joins (~ddellacos@86.106.121.74) |
| 2021-06-07 13:34:24 | → | ddellaco_ joins (~ddellacos@89.46.62.69) |
| 2021-06-07 13:34:45 | <guest61> | dminuoso ski, https://paste.ubuntu.com/p/MGC3RvDPY9/ |
| 2021-06-07 13:35:07 | × | hylisper quits (~ykm@111.119.208.67) (Ping timeout: 264 seconds) |
| 2021-06-07 13:35:09 | × | shryke quits (~shryke@91.103.43.254) (Quit: WeeChat 3.1) |
| 2021-06-07 13:35:19 | <dminuoso> | This looks ripe for improvements. |
| 2021-06-07 13:35:24 | → | GIANTWORLDKEEPER joins (~pjetcetal@2.95.204.25) |
| 2021-06-07 13:35:34 | <dminuoso> | Packet with error bombs. :) |
| 2021-06-07 13:35:36 | <guest61> | trying to create a bunch of variables |
| 2021-06-07 13:35:51 | → | hylisper joins (~ykm@111.119.208.67) |
| 2021-06-07 13:36:26 | <guest61> | how you call creat a variable? |
| 2021-06-07 13:36:32 | → | jmcarthur joins (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net) |
| 2021-06-07 13:36:49 | <guest61> | bind something? identity? |
| 2021-06-07 13:36:57 | × | jmcarthur quits (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net) (Client Quit) |
| 2021-06-07 13:36:58 | <guest61> | declare a variable? |
| 2021-06-07 13:37:13 | ← | safinaskar parts (~user@109.252.90.89) () |
| 2021-06-07 13:37:20 | → | ikex joins (~ash@user/ikex) |
| 2021-06-07 13:37:26 | safinaskar2 | is now known as safinaskar |
| 2021-06-07 13:37:53 | <dminuoso> | guest61: In Haskell, a variable is not a mutable store/reference |
| 2021-06-07 13:38:02 | <dminuoso> | Perhaps, think of it as a name for an expression. |
| 2021-06-07 13:38:03 | × | ddellacosta quits (~ddellacos@86.106.121.74) (Ping timeout: 252 seconds) |
| 2021-06-07 13:38:40 | <guest61> | why expression? could not be a statement? |
| 2021-06-07 13:38:46 | <dminuoso> | We dont have statements in the language |
| 2021-06-07 13:39:03 | <guest61> | an IO action is not a statement? |
| 2021-06-07 13:40:05 | <guest61> | the code I paste, how to change it? |
| 2021-06-07 13:40:18 | <safinaskar> | is there pointer equality in Haskell, which fail backs to normal equality? is it okey to use (reallyUnsafePtrEquality# a b == 1# || a == b)? (this code looks scary) |
| 2021-06-07 13:41:00 | <dminuoso> | guest61: IO actions model statements, but they are not part of the syntax. |
| 2021-06-07 13:41:09 | <dminuoso> | Or rather, >>=/>> for IO models statements. |
| 2021-06-07 13:41:13 | → | Topsi joins (~Tobias@dyndsl-095-033-093-145.ewe-ip-backbone.de) |
| 2021-06-07 13:41:32 | <dminuoso> | guest61: So there's a number of things to improve in your code. Would you like to hear about them? |
| 2021-06-07 13:41:41 | <guest61> | yes |
| 2021-06-07 13:41:59 | <dminuoso> | Then let's go through them all, alongside we will find a more elegant solution for your problem, |
| 2021-06-07 13:42:21 | <guest61> | ok |
| 2021-06-07 13:42:25 | → | __monty__ joins (~toonn@user/toonn) |
| 2021-06-07 13:42:26 | <dminuoso> | First off, you make use of functions dubbed "unsafe". Namely `fromJust` and (!!). Both you should really forget about., |
| 2021-06-07 13:42:51 | <dminuoso> | Part of the reason is, they have a failure mode that you cannot sensibly recover from. |
| 2021-06-07 13:43:04 | <dminuoso> | % n :: Maybe Int |
| 2021-06-07 13:43:04 | <yahb> | dminuoso: ; <interactive>:89:1: error: Variable not in scope: n :: Maybe Int |
| 2021-06-07 13:43:07 | <dminuoso> | % n :: Maybe Int; n = Nothing |
| 2021-06-07 13:43:07 | <yahb> | dminuoso: |
| 2021-06-07 13:43:09 | <safinaskar> | guest61: it seems you don't know basic things. i suggest reading http://learnyouahaskell.com/ |
| 2021-06-07 13:43:09 | <guest61> | but I already check Nothing first |
| 2021-06-07 13:43:29 | <dminuoso> | guest61: Great, but you threw this knowledge away. |
| 2021-06-07 13:44:10 | <guest61> | checkParameters :: [Maybe a] |
| 2021-06-07 13:44:38 | <guest61> | the first line, I use elemIndices to check if there is Nothing in it |
| 2021-06-07 13:44:43 | <guest61> | then I use fromJust |
| 2021-06-07 13:44:51 | <guest61> | so its safe I think |
| 2021-06-07 13:44:58 | × | Sose quits (~username@mobile-access-6df047-172.dhcp.inet.fi) (Ping timeout: 268 seconds) |
| 2021-06-07 13:45:05 | <dminuoso> | guest61: Probably, until you restructure your code slightly - then the type system cannot warn you. |
| 2021-06-07 13:45:21 | <dminuoso> | It's highly idiomatic and brittle to write code in this style |
| 2021-06-07 13:45:25 | <dminuoso> | *unidiomatic |
| 2021-06-07 13:45:37 | <guest61> | also that checkParameters length is fixed, so !! won't out of the index, that's safe too |
| 2021-06-07 13:46:06 | <dminuoso> | guest61: Perhaps, but you are in IO. So we can still error out with a better diagnostic. |
| 2021-06-07 13:46:38 | <dminuoso> | guest61: Im guessing the data comes from a file, right? |
| 2021-06-07 13:46:41 | <guest61> | wait a sec, I can paste the code old way, more ugly |
| 2021-06-07 13:46:54 | <dminuoso> | Presumably something you grab from `lines <$> readLines`? |
| 2021-06-07 13:47:02 | <dminuoso> | err `lines <$> readFile path` |
| 2021-06-07 13:47:27 | → | fluffyballoon joins (~fluffybal@2620:72:0:6480::e5) |
| 2021-06-07 13:47:40 | <dminuoso> | guest61: So lets ignore the (!!) right now. What you could do is this: |
| 2021-06-07 13:48:19 | <guest61> | https://paste.ubuntu.com/p/GPGT3VWZcH/ |
| 2021-06-07 13:48:58 | <guest61> | see that's more ugly... |
| 2021-06-07 13:49:21 | <guest61> | yes, read data from a file and parse |
All times are in UTC.