Logs: freenode/#haskell
| 2020-11-14 19:15:14 | <merijn> | There's a Day in Data.Time.Calendar in 1.9 |
| 2020-11-14 19:15:38 | × | borne quits (~fritjof@200116b864edc4004fbf5cd6c83663b1.dip.versatel-1u1.de) (Ping timeout: 264 seconds) |
| 2020-11-14 19:15:45 | × | knupfer quits (~Thunderbi@87.123.206.158) (Ping timeout: 240 seconds) |
| 2020-11-14 19:16:03 | <merijn> | (that Data.Time.Calendar.Day is also in 1.11, but appears to be *different* from OrdinalDate.Day and the 2nd is the only instance in 1.11) |
| 2020-11-14 19:16:16 | <merijn> | The changelog of time is a bit vague about why that happened, though |
| 2020-11-14 19:16:39 | <scasc> | Oof. Yeah, this happens when you just look at the latest documetation on hackage, but have an older GHC set with ghcup. :-/ |
| 2020-11-14 19:17:05 | <merijn> | ah, no |
| 2020-11-14 19:17:23 | <merijn> | It appears (fortunately) that it's the same Day in 1.11 |
| 2020-11-14 19:17:39 | <merijn> | So just import Data.Time.Calendar.Day |
| 2020-11-14 19:18:03 | × | teardown quits (~user@gateway/tor-sasl/mrush) (Ping timeout: 240 seconds) |
| 2020-11-14 19:18:21 | <merijn> | scasc: time is separate from GHC and can be updated, so the version of time you use depends on your cabal file/dependencies, not GHC :p |
| 2020-11-14 19:18:57 | <merijn> | > Data.Time.Format.ISO8601.iso8601ParseM "2020-01-01" :: Maybe Data.Time.Calendar.Day |
| 2020-11-14 19:19:00 | <lambdabot> | error: |
| 2020-11-14 19:19:00 | <lambdabot> | Not in scope: ‘Data.Time.Format.ISO8601.iso8601ParseM’ |
| 2020-11-14 19:19:00 | <lambdabot> | No module named ‘Data.Time.Format.ISO8601’ is imported.error: |
| 2020-11-14 19:19:00 | hackage | streamly-lmdb 0.2.0 - Stream data to or from LMDB databases using the streamly library. https://hackage.haskell.org/package/streamly-lmdb-0.2.0 (shlok) |
| 2020-11-14 19:19:04 | <merijn> | bleh |
| 2020-11-14 19:19:18 | <merijn> | That works on my machine with time 1.9, anyway |
| 2020-11-14 19:19:31 | → | texasmyn_ joins (~texasmyns@212.102.44.36) |
| 2020-11-14 19:20:08 | × | Feuermagier quits (~Feuermagi@213.178.26.41) (Remote host closed the connection) |
| 2020-11-14 19:20:49 | × | texasmynsted quits (~texasmyns@212.102.44.36) (Ping timeout: 256 seconds) |
| 2020-11-14 19:21:13 | × | juuandyy quits (~juuandyy@90.166.144.65) (Ping timeout: 264 seconds) |
| 2020-11-14 19:23:08 | → | hnOsmium0001 joins (uid453710@gateway/web/irccloud.com/x-gzipkezvyztkhjzy) |
| 2020-11-14 19:25:30 | hackage | crdt-event-fold 1.2.1.1 - Garbage collected event folding CRDT. https://hackage.haskell.org/package/crdt-event-fold-1.2.1.1 (rickowens) |
| 2020-11-14 19:25:36 | → | teardown joins (~user@gateway/tor-sasl/mrush) |
| 2020-11-14 19:26:29 | → | neiluj joins (~jco@91-167-203-101.subs.proxad.net) |
| 2020-11-14 19:26:29 | × | neiluj quits (~jco@91-167-203-101.subs.proxad.net) (Changing host) |
| 2020-11-14 19:26:29 | → | neiluj joins (~jco@unaffiliated/neiluj) |
| 2020-11-14 19:28:29 | → | conal joins (~conal@64.71.133.70) |
| 2020-11-14 19:29:36 | × | cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Quit: cosimone) |
| 2020-11-14 19:29:51 | → | Sgeo joins (~Sgeo@ool-18b982ad.dyn.optonline.net) |
| 2020-11-14 19:31:32 | <sim590> | I'm playing with fundamental notions in the haskell wikibook. I've just looked at foldMap (which I never really used before). I'm now understanding that it's sufficient to provide a definition of foldMap in order to make a type an instance of Foldable. I see how foldMap can be written in terms of foldr. However, the inverse is not feasible it seems. Am I right? We cannot write foldr in terms of |
| 2020-11-14 19:31:34 | <sim590> | foldMap since it would require foldr to have the requirement of Monoid in its signature. Therefore, how is foldMap sufficient to make an instance of Foldable, hence providing me a free implementation of foldr? I'm a bit puzzled. I must be missing something. |
| 2020-11-14 19:32:21 | × | fendor quits (~fendor@178.165.130.155.wireless.dyn.drei.com) (Remote host closed the connection) |
| 2020-11-14 19:32:23 | <merijn> | sim590: It helps to realise that the FOldable API is (basically) just "toList" |
| 2020-11-14 19:32:43 | <merijn> | sim590: So you can trivially implement anything by turning it into a list and then using the list version :p |
| 2020-11-14 19:32:50 | → | fendor joins (~fendor@178.165.130.155.wireless.dyn.drei.com) |
| 2020-11-14 19:33:23 | <merijn> | foldr f z xs = Data.List.foldr f z (foldMap (\x -> [x]) xs) |
| 2020-11-14 19:34:21 | <merijn> | :t foldMap (\x -> [x]) |
| 2020-11-14 19:34:22 | <lambdabot> | Foldable t => t a -> [a] |
| 2020-11-14 19:34:55 | × | scasc quits (~szabi@213142096107.public.telering.at) (Remote host closed the connection) |
| 2020-11-14 19:35:20 | → | scasc joins (~szabi@213142096107.public.telering.at) |
| 2020-11-14 19:35:28 | <merijn> | That's dumb and inefficient, but it is "sufficient" :) |
| 2020-11-14 19:35:29 | <sim590> | Oh............................................................. I see. |
| 2020-11-14 19:35:29 | → | banner joins (~banner@220.238.243.193) |
| 2020-11-14 19:35:29 | × | banner quits (~banner@220.238.243.193) (Client Quit) |
| 2020-11-14 19:35:37 | <scasc> | merijn: thanks |
| 2020-11-14 19:35:47 | <scasc> | (sorry, had to be AFK) |
| 2020-11-14 19:36:08 | <merijn> | scasc: When GHC says stuff isn't in scope and Haddock says it is, the first step is always "double check your version" ;) |
| 2020-11-14 19:36:49 | <scasc> | I just spun up ghci btw, without a cabal file or using cabal repl, so it took some (relatively) random library from the global package database, I guess? |
| 2020-11-14 19:37:09 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2020-11-14 19:37:51 | <merijn> | scasc: Probably the one that ships with GHC (because GHC's dependencies and maybe Cabal's should be the only ones in the global package db) |
| 2020-11-14 19:38:12 | <merijn> | The rest should be in the global store |
| 2020-11-14 19:40:01 | <sim590> | merijn: So when we create an instance of Foldable with foldMap, does GHC actually has to make this implementation of foldr by converting to lists? Is it what GHC does? You mentionned that it is not so much efficient, so therefore it may be preferable to implement the Foldable instance with foldr directly instead? |
| 2020-11-14 19:40:12 | → | howdoi joins (uid224@gateway/web/irccloud.com/x-ehddxpzdszkkwuzg) |
| 2020-11-14 19:40:20 | <merijn> | sim590: GHC doesn't do anything automatically |
| 2020-11-14 19:40:23 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-11-14 19:40:32 | <merijn> | sim590: But you can provide default implementations when defining a class |
| 2020-11-14 19:41:03 | <merijn> | sim590: For example: 'class Eq a where x == y = not (x /= y); x /= y = not (x == y)" |
| 2020-11-14 19:41:37 | × | jakalx quits (~jakalx@base.jakalx.net) (Ping timeout: 264 seconds) |
| 2020-11-14 19:41:39 | <merijn> | sim590: Note that those two functions call each other. Now, when you define "class Eq MyData where MyData x == MyData y = x == y", you're done |
| 2020-11-14 19:41:52 | <merijn> | Because /= will call ==, which you just defined and it works out |
| 2020-11-14 19:42:26 | <merijn> | sim590: So Foldable has default implementations writting using (for example) foldMap, so when you only define foldMap those default implementations get used |
| 2020-11-14 19:42:55 | × | aidecoe quits (~aidecoe@unaffiliated/aidecoe) (Remote host closed the connection) |
| 2020-11-14 19:42:56 | <merijn> | sim590: You can see this in the source: https://hackage.haskell.org/package/base-4.14.0.0/docs/src/Data.Foldable.html#Foldable |
| 2020-11-14 19:43:02 | <scasc> | "Probably the one that ships with GHC" -- that's what I was referring to when I referenced GHC version above :-) -- Anyway, as I thought it was something stupid: looking at the wrong documentation version |
| 2020-11-14 19:43:59 | × | jamm_ quits (~jamm@unaffiliated/jamm) (Remote host closed the connection) |
| 2020-11-14 19:44:45 | × | ensyde quits (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) (Ping timeout: 240 seconds) |
| 2020-11-14 19:45:05 | × | jaspervdj quits (~jaspervdj@213.55.241.35) (Quit: leaving) |
| 2020-11-14 19:46:03 | × | pfurla quits (~pfurla@ool-182ed2e2.dyn.optonline.net) (Quit: Textual IRC Client: www.textualapp.com) |
| 2020-11-14 19:46:37 | → | pfurla joins (~pfurla@ool-182ed2e2.dyn.optonline.net) |
| 2020-11-14 19:50:01 | × | elliott_ quits (~elliott_@pool-108-51-141-12.washdc.fios.verizon.net) (Ping timeout: 264 seconds) |
| 2020-11-14 19:50:20 | <tomjaguarpaw> | How do I find out the number of bits in an Int? |
| 2020-11-14 19:50:28 | → | ensyde joins (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) |
| 2020-11-14 19:50:51 | <merijn> | :t finiteBitSize |
| 2020-11-14 19:50:52 | <lambdabot> | FiniteBits b => b -> Int |
| 2020-11-14 19:51:04 | <merijn> | :t finiteBitSize (2 :: Int) |
| 2020-11-14 19:51:06 | <lambdabot> | Int |
| 2020-11-14 19:51:16 | texasmyn_ | is now known as texasmynsted |
| 2020-11-14 19:51:24 | <tomjaguarpaw> | Huh? |
| 2020-11-14 19:51:41 | <tomjaguarpaw> | How come lambdabot said Int? |
| 2020-11-14 19:51:43 | <geekosaur> | > finiteBitSize (2 :: Int) |
| 2020-11-14 19:51:43 | <tomjaguarpaw> | Anyway, thanks merijn! |
| 2020-11-14 19:51:46 | <lambdabot> | 64 |
| 2020-11-14 19:51:46 | <merijn> | > finiteBitSize (2 :: Int) |
| 2020-11-14 19:51:48 | <lambdabot> | 64 |
| 2020-11-14 19:51:49 | <geekosaur> | because he asked :t |
| 2020-11-14 19:51:53 | <tomjaguarpaw> | Oh :t |
| 2020-11-14 19:51:56 | <tomjaguarpaw> | I see, thanks. |
| 2020-11-14 19:52:03 | <merijn> | tomjaguarpaw: Because I'm tired and not paying attention :p |
| 2020-11-14 19:52:18 | <tomjaguarpaw> | Nor me, clearly :D |
| 2020-11-14 19:52:45 | → | hidedagger joins (~nate@125.161.129.195) |
| 2020-11-14 19:52:51 | <geekosaur> | and I made my own (meta) dumb there so I guess that's three >.> |
| 2020-11-14 19:53:52 | <merijn> | Anyway, whenever your question is "something, something bits" the answer is, invariably "Data.Bits" |
| 2020-11-14 19:55:13 | × | ensyde quits (~ensyde@99-185-235-117.lightspeed.chrlnc.sbcglobal.net) (Ping timeout: 260 seconds) |
| 2020-11-14 19:55:40 | → | acarrico joins (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net) |
| 2020-11-14 19:55:55 | → | elliott_ joins (~elliott_@pool-108-51-141-12.washdc.fios.verizon.net) |
| 2020-11-14 19:56:38 | × | vacm quits (~vacwm@70.23.92.191) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2020-11-14 19:57:16 | → | Entertainment joins (~entertain@104.246.132.210) |
| 2020-11-14 19:57:20 | × | mputz quits (~Thunderbi@dslb-084-058-211-084.084.058.pools.vodafone-ip.de) (Quit: mputz) |
All times are in UTC.