Logs: freenode/#haskell
| 2020-10-31 09:46:16 | → | dbmikus joins (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com) |
| 2020-10-31 09:52:46 | → | xsperry joins (~as@unaffiliated/xsperry) |
| 2020-10-31 09:53:25 | × | Varis quits (~Tadas@unaffiliated/varis) (Remote host closed the connection) |
| 2020-10-31 09:56:11 | → | cassier joins (~cassier@195.140.213.38) |
| 2020-10-31 09:56:26 | × | dbmikus quits (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com) (Ping timeout: 264 seconds) |
| 2020-10-31 09:57:20 | × | vonfry` quits (~user@181.115.198.104.bc.googleusercontent.com) (Quit: ERC (IRC client for Emacs 27.1)) |
| 2020-10-31 09:58:25 | → | Varis joins (~Tadas@unaffiliated/varis) |
| 2020-10-31 09:59:41 | <PerseusPlease> | very basic question, if I have a function type declaration like "convertOrError :: String -> String -> a" how can I get the type "a" as a string e.g. "Int" |
| 2020-10-31 10:00:34 | × | andi- quits (~andi-@NixOS/user/andi-) (Ping timeout: 260 seconds) |
| 2020-10-31 10:01:14 | <Rembane> | PerseusPlease: I think that's a bit tricky, what's the thing you really want to solve? |
| 2020-10-31 10:02:16 | → | fendor joins (~fendor@77.119.131.204.wireless.dyn.drei.com) |
| 2020-10-31 10:02:44 | × | justanotheruser quits (~justanoth@unaffiliated/justanotheruser) (Ping timeout: 240 seconds) |
| 2020-10-31 10:02:48 | <PerseusPlease> | I'm reading a config using ConfigFile and have a string which I want to convert into appropriate types such as Int |
| 2020-10-31 10:03:43 | → | m0rphism joins (~m0rphism@HSI-KBW-046-005-177-122.hsi8.kabel-badenwuerttemberg.de) |
| 2020-10-31 10:03:59 | <PerseusPlease> | I could use "read" and have the default exception message, but it's rubbish, so I'd rather write a function that outputs a sensible exception including the type conversion that failed. |
| 2020-10-31 10:04:14 | → | Rudd0 joins (~Rudd0@185.189.115.108) |
| 2020-10-31 10:04:33 | <Rembane> | PerseusPlease: Got it, there's a better version here: https://hackage.haskell.org/package/base-4.14.0.0/docs/Text-Read.html#v:readMaybe |
| 2020-10-31 10:04:45 | <Rembane> | PerseusPlease: It has another variant here: https://hackage.haskell.org/package/base-4.14.0.0/docs/Text-Read.html#v:readEither |
| 2020-10-31 10:04:49 | <PerseusPlease> | Rembane, that's what I'm using. |
| 2020-10-31 10:05:16 | <PerseusPlease> | I also saw that, but I actually want to throw an exception. |
| 2020-10-31 10:05:45 | → | andi- joins (~andi-@NixOS/user/andi-) |
| 2020-10-31 10:05:49 | <Rembane> | PerseusPlease: Why do you want to throw an exception? |
| 2020-10-31 10:05:53 | → | petersen joins (~petersen@redhat/juhp) |
| 2020-10-31 10:06:26 | <PerseusPlease> | Why does anyone ever want to throw an exception, the program can't continue |
| 2020-10-31 10:09:22 | <Rembane> | PerseusPlease: You can instead have a function that returns a Left with an error message if the parsing fails and if it succeeds you return a Right with the configuration record. |
| 2020-10-31 10:09:43 | <PerseusPlease> | Rembane, sure. |
| 2020-10-31 10:09:52 | → | dhil joins (~dhil@195.213.192.85) |
| 2020-10-31 10:10:32 | <PerseusPlease> | I think we're concentrating on the wrong bit. I would still have the problem of getting a message that included the type I was trying to convert |
| 2020-10-31 10:10:50 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 264 seconds) |
| 2020-10-31 10:11:21 | <joel135> | You want to say something like (convertOrError "(20, 5, True)" "Unable to interpret the missile parameters")? |
| 2020-10-31 10:12:02 | × | rprije quits (~rprije@194-193-168-77.tpgi.com.au) (Ping timeout: 264 seconds) |
| 2020-10-31 10:12:57 | <joel135> | And then the error message should say something like "E: Unable to interpret the missile parameters (expected (Integer, Integer, Bool))"? |
| 2020-10-31 10:13:00 | <PerseusPlease> | joel135, well... convertOrError "port" "foo123" gives error "port is not Int" |
| 2020-10-31 10:14:06 | → | sam___ joins (~sam@112.107.204.77.rev.sfr.net) |
| 2020-10-31 10:15:51 | <PerseusPlease> | ^^ that probably needs an ":: Int" |
| 2020-10-31 10:17:13 | → | rusua joins (uid124537@gateway/web/irccloud.com/x-eqeurrcaunytkiar) |
| 2020-10-31 10:17:55 | <joel135> | Did you see this? https://hackage.haskell.org/package/model-0.4.2/docs/Data-Model-Util.html#v:convertOrError |
| 2020-10-31 10:25:23 | <PerseusPlease> | joel135, thanks. that is close to what I am looking for but a bit on the noisy side. |
| 2020-10-31 10:27:04 | <PerseusPlease> | this isn't pretty but works "drop 6 $ show $ typeOf (Nothing :: Maybe Int)" |
| 2020-10-31 10:27:59 | <joel135> | What do you import for that? |
| 2020-10-31 10:28:10 | <PerseusPlease> | import Data.Typeable |
| 2020-10-31 10:28:33 | <joel135> | nice |
| 2020-10-31 10:35:13 | × | lxsameer quits (~lxsameer@unaffiliated/lxsameer) (Ping timeout: 260 seconds) |
| 2020-10-31 10:38:24 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-31 10:39:30 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-10-31 10:43:05 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds) |
| 2020-10-31 10:43:35 | → | AlterEgo- joins (~ladew@124-198-158-163.dynamic.caiway.nl) |
| 2020-10-31 10:44:05 | × | petersen quits (~petersen@redhat/juhp) (Ping timeout: 240 seconds) |
| 2020-10-31 10:44:24 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds) |
| 2020-10-31 10:45:55 | <jil`> | hello |
| 2020-10-31 10:46:32 | <simon> | hi |
| 2020-10-31 10:48:54 | → | lxsameer joins (lxsameer@gateway/vpn/protonvpn/lxsameer) |
| 2020-10-31 10:53:15 | → | ahmr88 joins (~ahmr88@cpc85006-haye22-2-0-cust131.17-4.cable.virginm.net) |
| 2020-10-31 10:57:34 | <jil`> | I'm trying a code example from a book and I don't understand why I get an error in ghci when I try it. https://paste.debian.net/1169336/ |
| 2020-10-31 10:57:59 | <jil`> | It has to do with the notation of the operator |
| 2020-10-31 10:58:04 | → | dansho joins (~dansho@ip68-108-167-185.lv.lv.cox.net) |
| 2020-10-31 10:58:25 | × | ahmr88 quits (~ahmr88@cpc85006-haye22-2-0-cust131.17-4.cable.virginm.net) (Ping timeout: 264 seconds) |
| 2020-10-31 10:58:36 | <jil`> | but do you see something wrong with fsum = foldr (+) 0 ? |
| 2020-10-31 10:59:28 | <byorgey> | jil`: there's nothing wrong with the definition of fsum, the problem is 'fsum 1 2' |
| 2020-10-31 10:59:36 | <byorgey> | fsum must be applied to a list |
| 2020-10-31 10:59:57 | <byorgey> | so you could say 'fsum [1,2]' for example. |
| 2020-10-31 11:02:26 | → | petersen joins (~petersen@redhat/juhp) |
| 2020-10-31 11:04:47 | → | acidjnk_new joins (~acidjnk@p200300d0c72260940830e3b8f3af47a8.dip0.t-ipconnect.de) |
| 2020-10-31 11:05:23 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-10-31 11:05:41 | <jil`> | I see . Thak you. |
| 2020-10-31 11:06:15 | → | tolt_ joins (~weechat-h@li219-154.members.linode.com) |
| 2020-10-31 11:09:17 | → | christo joins (~chris@81.96.113.213) |
| 2020-10-31 11:10:36 | × | ensyde quits (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) (Ping timeout: 265 seconds) |
| 2020-10-31 11:12:13 | × | alx741 quits (~alx741@181.196.68.193) (Ping timeout: 264 seconds) |
| 2020-10-31 11:12:53 | × | Varis quits (~Tadas@unaffiliated/varis) (Remote host closed the connection) |
| 2020-10-31 11:13:14 | × | tolt_ quits (~weechat-h@li219-154.members.linode.com) (Quit: WeeChat 2.9) |
| 2020-10-31 11:13:57 | → | Varis joins (~Tadas@unaffiliated/varis) |
| 2020-10-31 11:14:01 | → | thir joins (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) |
| 2020-10-31 11:14:33 | → | tolt_ joins (~weechat-h@li219-154.members.linode.com) |
| 2020-10-31 11:16:14 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-10-31 11:17:11 | × | tolt_ quits (~weechat-h@li219-154.members.linode.com) (Client Quit) |
| 2020-10-31 11:18:31 | → | tolt_ joins (~weechat-h@li219-154.members.linode.com) |
| 2020-10-31 11:20:27 | × | mananamenos quits (~mananamen@84.122.202.215.dyn.user.ono.com) (Ping timeout: 260 seconds) |
| 2020-10-31 11:21:04 | × | nschoe quits (~quassel@2a01:e0a:3c4:c7b0:b8f0:6b21:1cae:fc94) (Ping timeout: 240 seconds) |
| 2020-10-31 11:21:23 | × | psj quits (~psj@193.22.133.82) (Remote host closed the connection) |
| 2020-10-31 11:21:50 | → | nschoe joins (~quassel@91-175-19-30.subs.proxad.net) |
| 2020-10-31 11:23:34 | → | carlomagno1 joins (~cararell@148.87.23.4) |
| 2020-10-31 11:23:34 | × | carlomagno quits (~cararell@148.87.23.4) (Remote host closed the connection) |
| 2020-10-31 11:25:11 | → | alx741 joins (~alx741@186.178.110.132) |
| 2020-10-31 11:29:32 | × | thir quits (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) (Remote host closed the connection) |
| 2020-10-31 11:29:39 | → | thir joins (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) |
| 2020-10-31 11:29:42 | × | thir quits (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) (Remote host closed the connection) |
| 2020-10-31 11:29:44 | → | idhugo joins (~idhugo@80-62-116-101-mobile.dk.customer.tdc.net) |
| 2020-10-31 11:30:41 | → | thir joins (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) |
| 2020-10-31 11:32:17 | × | jrqc quits (~rofl@96.78.87.197) (Ping timeout: 268 seconds) |
| 2020-10-31 11:32:58 | × | dansho quits (~dansho@ip68-108-167-185.lv.lv.cox.net) (Ping timeout: 260 seconds) |
| 2020-10-31 11:33:55 | × | christo quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2020-10-31 11:34:59 | → | Franciman joins (~francesco@host-79-36-167-172.retail.telecomitalia.it) |
| 2020-10-31 11:35:14 | → | jrqc joins (~rofl@96.78.87.197) |
| 2020-10-31 11:36:58 | → | christo joins (~chris@81.96.113.213) |
| 2020-10-31 11:38:30 | → | jedws joins (~jedws@101.184.150.81) |
| 2020-10-31 11:40:15 | × | coot quits (~coot@37.30.51.206.nat.umts.dynamic.t-mobile.pl) (Quit: coot) |
| 2020-10-31 11:43:04 | × | jedws quits (~jedws@101.184.150.81) (Ping timeout: 256 seconds) |
| 2020-10-31 11:44:08 | × | hekkaidekapus quits (~tchouri@gateway/tor-sasl/hekkaidekapus) (Remote host closed the connection) |
| 2020-10-31 11:44:30 | → | hekkaidekapus joins (~tchouri@gateway/tor-sasl/hekkaidekapus) |
All times are in UTC.