Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-26 18:35:44 <tomsmeding> if it doesn't seem to exist, why not write it :)
2020-11-26 18:36:10 <ski> timCF : are you often short-circuiting the `Left's ?
2020-11-26 18:36:41 × forgottenone quits (~forgotten@176.88.97.75) (Quit: Konversation terminated!)
2020-11-26 18:36:43 <timCF> what do you mean?
2020-11-26 18:36:45 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2020-11-26 18:37:28 × christo quits (~chris@81.96.113.213) (Ping timeout: 256 seconds)
2020-11-26 18:37:56 <ski> like `do x <- foo; case x of Left e -> return (Left e); Right v -> do y <- bar v; case y of Left e -> return (Left e); Right w -> ...'
2020-11-26 18:40:48 <timCF> yeah, I recognize this pattern. Nowdays I'm trying to use `first` `second` and `bimap` to control flow, but often this external IO-like monad complicate things
2020-11-26 18:41:34 <ski> if you find yourself doing that, then it sounds like `ExceptT' would be helpful
2020-11-26 18:41:56 <ski> and then you could write `foo <$> ExceptT x'
2020-11-26 18:42:17 × d068796 quits (~d068796@2a01:c23:8073:b800:8554:936:8b1f:acb4) (Quit: WeeChat 3.0)
2020-11-26 18:42:58 × kritzefitz quits (~kritzefit@212.86.56.80) (Ping timeout: 260 seconds)
2020-11-26 18:42:59 × Alleria_ quits (~AllahuAkb@2604:2000:1484:26:5d86:da4d:584b:848b) (Quit: Textual IRC Client: www.textualapp.com)
2020-11-26 18:43:12 <timCF> Oh, monad transformers :) I'm already writing Haskell code for a while but still not fully understand them, hahah
2020-11-26 18:43:35 d068796 joins (~d068796@x4db56550.dyn.telefonica.de)
2020-11-26 18:43:38 <tomsmeding> someone on reddit noticed that ghc's unused variable warnings seem to have inconsistent behavour regarding transitive propagation of unusedness: https://www.reddit.com/r/haskell/comments/k1dggw/surprising_unused_variable_warnings/
2020-11-26 18:43:43 <tomsmeding> is this a known thing?
2020-11-26 18:43:53 phaul joins (~phaul@ruby/staff/phaul)
2020-11-26 18:43:54 <timCF> But this particular case you desribed happens very often in real code, so maybe it will be easier to understand it for me) Thanks!
2020-11-26 18:43:57 heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net)
2020-11-26 18:44:44 × cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Remote host closed the connection)
2020-11-26 18:45:07 cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd)
2020-11-26 18:46:25 × cr3 quits (~cr3@192-222-143-195.qc.cable.ebox.net) (Ping timeout: 264 seconds)
2020-11-26 18:46:36 Alleria_ joins (~AllahuAkb@2604:2000:1484:26:c82b:bd8e:1bb1:925d)
2020-11-26 18:48:10 × d068796 quits (~d068796@x4db56550.dyn.telefonica.de) (Client Quit)
2020-11-26 18:48:13 <ski> timCF : the related `MaybeT' is also useful in similar circumstances
2020-11-26 18:48:52 × phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 256 seconds)
2020-11-26 18:49:23 × bruce_wayne quits (~prateekpr@94.129.87.184) (Ping timeout: 260 seconds)
2020-11-26 18:50:37 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 264 seconds)
2020-11-26 18:51:29 cr3 joins (~cr3@192-222-143-195.qc.cable.ebox.net)
2020-11-26 18:52:15 bruce_wayne joins (~prateekpr@94.129.87.184)
2020-11-26 18:52:25 × michalz quits (~user@185.246.204.47) (Ping timeout: 264 seconds)
2020-11-26 18:53:28 phaul joins (~phaul@ruby/staff/phaul)
2020-11-26 18:54:29 jk1006 joins (~textual@2a01:c23:8073:b800:8554:936:8b1f:acb4)
2020-11-26 18:55:45 chaosmasttter joins (~chaosmast@p200300c4a7107e01f87538c6eac6d35f.dip0.t-ipconnect.de)
2020-11-26 18:56:16 christo joins (~chris@81.96.113.213)
2020-11-26 18:58:39 × matta quits (~user@24-113-169-116.wavecable.com) (Ping timeout: 256 seconds)
2020-11-26 18:59:16 elliott__ joins (~elliott@pool-108-51-141-12.washdc.fios.verizon.net)
2020-11-26 19:02:10 jonatanb joins (~jonatanb@83.24.220.252.ipv4.supernova.orange.pl)
2020-11-26 19:02:40 × gehmehgeh quits (~ircuser1@gateway/tor-sasl/gehmehgeh) (Remote host closed the connection)
2020-11-26 19:02:49 invaser1 joins (~Thunderbi@31.148.23.125)
2020-11-26 19:03:02 × berberman quits (~berberman@unaffiliated/berberman) (Ping timeout: 264 seconds)
2020-11-26 19:03:19 BRRR joins (5b8169f5@m91-129-105-245.cust.tele2.ee)
2020-11-26 19:03:24 berberman joins (~berberman@unaffiliated/berberman)
2020-11-26 19:03:36 × phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 240 seconds)
2020-11-26 19:04:06 kritzefitz joins (~kritzefit@212.86.56.80)
2020-11-26 19:05:07 juuandyy joins (~juuandyy@90.166.144.65)
2020-11-26 19:05:14 × invaser quits (~Thunderbi@31.148.23.125) (Ping timeout: 272 seconds)
2020-11-26 19:05:14 invaser1 is now known as invaser
2020-11-26 19:06:25 × jonatanb quits (~jonatanb@83.24.220.252.ipv4.supernova.orange.pl) (Ping timeout: 240 seconds)
2020-11-26 19:06:29 gehmehgeh joins (~ircuser1@gateway/tor-sasl/gehmehgeh)
2020-11-26 19:06:30 hackage data-as 0.0.0.2 - Simple extensible sum https://hackage.haskell.org/package/data-as-0.0.0.2 (incertia)
2020-11-26 19:07:57 × cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Remote host closed the connection)
2020-11-26 19:08:20 cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd)
2020-11-26 19:08:29 phaul joins (~phaul@ruby/staff/phaul)
2020-11-26 19:11:29 × Rudd0 quits (~Rudd0@185.189.115.108) (Ping timeout: 265 seconds)
2020-11-26 19:11:49 <timCF> Thanks! I actually have one more noob question. I do often use phantom types to make source code stricter. For example `newtype MoneyAmount a = MoneyAmount Rational'. That's nice because now I can specify the kind of person who owns the money, for example `data Customer` and then `x :: MoneyAmount Customer'. Now I want to go futher and specify the kind of balance money represent `newtype MoneyAmount a b =
2020-11-26 19:11:55 <timCF> MoneyAmount Rational' and then `data Debit; data Credit' and then `x :: MoneyAmount Customer Debit'. That's cool, but I can swap types and it still will be valid term `x :: MoneyAmount Debit Customer' and I even can use just some random types there like `x :: MoneyAmount Int Int' which does not make any sense. I'm not sure how do I call the thing I want, but I kinda want some sort of Class restrictions for
2020-11-26 19:12:01 <timCF> types which can go to N-th position in phantom type. I do want something like this (pseudo code) `(OwnerType a, AccountType b) => newtype MoneyAmount a b = MoneyAmount Rational'. Is there the way to achieve something similar?
2020-11-26 19:12:26 pokid parts (~pokid@unaffiliated/pokid) ()
2020-11-26 19:12:36 pokid joins (~pokid@unaffiliated/pokid)
2020-11-26 19:12:57 × conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.)
2020-11-26 19:14:13 × jk1006 quits (~textual@2a01:c23:8073:b800:8554:936:8b1f:acb4) (Quit: Textual IRC Client: www.textualapp.com)
2020-11-26 19:14:20 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
2020-11-26 19:14:31 conal joins (~conal@64.71.133.70)
2020-11-26 19:14:40 × cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Remote host closed the connection)
2020-11-26 19:14:49 <hpc> data kinds, perhaps?
2020-11-26 19:14:51 × conal quits (~conal@64.71.133.70) (Client Quit)
2020-11-26 19:15:02 <monochrom> timCF: You can enable DataKinds, and maybe you also need KindSignatures. Then you can write: "data CD = Credit | Debit", "newtype M (a :: CD) = ...". Now "M Credit" and "M Debit" are legal, "M Bool" is not.
2020-11-26 19:15:10 cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd)
2020-11-26 19:16:04 conal joins (~conal@64.71.133.70)
2020-11-26 19:16:26 × conal quits (~conal@64.71.133.70) (Client Quit)
2020-11-26 19:17:07 <timCF> @monochrom hmmm, that's interesting, especially the meaning of `data CD = Credit | Debit` it looks like a type with 2 constructors, but it's definitely not what I do want. I want 2 types of CD class with 0 constructors
2020-11-26 19:17:07 <lambdabot> Unknown command, try @list
2020-11-26 19:17:46 <monochrom> That's the magic of DataKinds. You now also have a kind called CD, and it has two types, Credit and Debit.
2020-11-26 19:18:35 <monochrom> And the type called Credit has no possible value, not even bottom, because its kind is CD not *
2020-11-26 19:18:57 <timCF> monochrom: hmm, interesting. But how I do define normal types with constructors in case this extension is enabled?
2020-11-26 19:19:10 <monochrom> You get both
2020-11-26 19:19:11 christo joins (~chris@81.96.113.213)
2020-11-26 19:19:43 <timCF> monochrom: by default it creates both type CD and kind CD?
2020-11-26 19:19:47 <monochrom> Yeah
2020-11-26 19:20:05 × orion quits (~orion@unaffiliated/orion) (Ping timeout: 240 seconds)
2020-11-26 19:20:11 <avdb> Is there a way to just return
2020-11-26 19:20:21 <ski> just return what ?
2020-11-26 19:20:24 <avdb> Didn't mean to send that, stupid tmux
2020-11-26 19:20:25 <monochrom> I don't like this because sometimes you don't want one of them. Also too many name clashes for humans. (Oh the computer has no problem.)
2020-11-26 19:20:40 × juuandyy quits (~juuandyy@90.166.144.65) (Ping timeout: 265 seconds)
2020-11-26 19:20:40 <monochrom> But it does the job. It just has side effects.
2020-11-26 19:20:45 <avdb> It's hard when you confuse Ctrl+w for Vim with Ctrl+b for Tmux
2020-11-26 19:20:50 <timCF> monochrom: so there is no way to have just kind?
2020-11-26 19:20:55 <monochrom> No.
2020-11-26 19:21:20 <monochrom> Just don't use the version you don't want. :)
2020-11-26 19:21:43 <timCF> monochrom: ehhh.. But it's still much better that having blind phantom types `MoneyAmount a b`
2020-11-26 19:22:00 <timCF> monochrom: thanks!
2020-11-26 19:22:03 <monochrom> I think the GHC people did this to avoid creating an extra reserved word such as "kind".
2020-11-26 19:22:14 <xerox_> what's the paper that explains this?
2020-11-26 19:22:25 <tomsmeding> note that GHC wants you to write 'Credit and 'Debit on the type level, as opposed to Credit and Debit on the value level
2020-11-26 19:22:30 × cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Remote host closed the connection)
2020-11-26 19:22:43 <merijn> tomsmeding: Only when ambiguous
2020-11-26 19:22:44 <monochrom> I don't know, but maybe the GHC user's guide has a citation.

All times are in UTC.