Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 897 898 899 900 901 902 903 904 905 906 907 .. 5022
502,152 events total
2020-10-27 19:03:15 cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd)
2020-10-27 19:03:25 × berberman_ quits (~berberman@unaffiliated/berberman) (Ping timeout: 240 seconds)
2020-10-27 19:03:35 berberman joins (~berberman@unaffiliated/berberman)
2020-10-27 19:03:43 heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net)
2020-10-27 19:03:48 × z0_ quits (~z0@bl15-160-182.dsl.telepac.pt) (Read error: Connection reset by peer)
2020-10-27 19:04:16 × kish quits (~oracle@unaffiliated/oracle) (Ping timeout: 256 seconds)
2020-10-27 19:04:34 dbmikus joins (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com)
2020-10-27 19:09:21 × ggole quits (~ggole@2001:8003:8119:7200:b94d:2b16:8058:a9b7) (Quit: Leaving)
2020-10-27 19:09:39 acarrico joins (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net)
2020-10-27 19:09:54 aarvar joins (~foewfoiew@50.35.43.33)
2020-10-27 19:11:02 <falsifian> I'm trying to understand how to work around the monomorphism restriction. If I write (in a .hs file) "x = let f = show in (f 1, f ())", I get an error, which matches my understanding ("No instance for (Num ()) arising from the literal ‘1’"). But what confuses me is that if I write "x = let f = show :: Show a => a -> String in (f 1, f ())" I get the same error. Can I not explicitly tell the compiler
2020-10-27 19:11:08 <falsifian> the let-bound identifier f should be polymorphic?
2020-10-27 19:12:42 <thblt> I *think* you need to be explicit about the type of 1, because number literals are polymorphic too.
2020-10-27 19:13:05 × kritzefitz quits (~kritzefit@212.86.56.80) (Ping timeout: 265 seconds)
2020-10-27 19:13:15 <geekosaur> > let f :: Show a => a -> String; f = show in (f 1, f ())
2020-10-27 19:13:17 <lambdabot> ("1","()")
2020-10-27 19:13:31 <falsifian> Replacing 1 with (1::Int) just changes the error to "Couldn't match expected type ‘Int’ with actual type ‘()’"
2020-10-27 19:13:35 <geekosaur> you assigned a type to show, not to f
2020-10-27 19:14:01 <merijn> falsifian: "write a type signature"? :)
2020-10-27 19:14:39 <merijn> falsifian: "f y = show y" should also work
2020-10-27 19:14:48 <merijn> iirc
2020-10-27 19:14:49 × Franciman quits (~francesco@host-82-54-10-114.retail.telecomitalia.it) (Quit: Leaving)
2020-10-27 19:15:20 <falsifian> geekosaur, merijn: Thanks. It hadn't occurred to me that I wasn't giving f a type signature.
2020-10-27 19:15:45 <falsifian> Yes, "f x = show x" fixes it too.
2020-10-27 19:17:38 <merijn> monomorphism only apply when something "looks like a value" (i.e. no arguments) *and* has no type signature *and* is typeclass polymorphic
2020-10-27 19:18:45 × mirrorbird quits (~psutcliff@2a00:801:42b:7891:16b1:e53f:55b2:15e1) (Ping timeout: 272 seconds)
2020-10-27 19:20:25 justsomeguy joins (~justsomeg@216.186.218.241)
2020-10-27 19:20:25 × justsomeguy quits (~justsomeg@216.186.218.241) (Changing host)
2020-10-27 19:20:25 justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311)
2020-10-27 19:21:40 chenshen joins (~chenshen@2620:10d:c090:400::4:bbc)
2020-10-27 19:22:02 × wroathe_ quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Quit: leaving)
2020-10-27 19:22:16 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2020-10-27 19:23:51 thblt parts (~thblt@unaffiliated/thblt) ("ERC (IRC client for Emacs 27.1)")
2020-10-27 19:24:27 ahmr88 joins (~ahmr88@cpc85006-haye22-2-0-cust131.17-4.cable.virginm.net)
2020-10-27 19:24:54 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 258 seconds)
2020-10-27 19:24:59 acidjnk_new joins (~acidjnk@p200300d0c7237845ecd50ba376a38a54.dip0.t-ipconnect.de)
2020-10-27 19:27:52 _vaibhavingale_ joins (~Adium@42.106.218.208)
2020-10-27 19:29:31 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2020-10-27 19:29:36 jlamothe joins (~jlamothe@198.251.55.207)
2020-10-27 19:29:57 hackage aur 7.0.5 - Access metadata from the Arch Linux User Repository. https://hackage.haskell.org/package/aur-7.0.5 (fosskers)
2020-10-27 19:30:28 jneira joins (501e64fa@gateway/web/cgi-irc/kiwiirc.com/ip.80.30.100.250)
2020-10-27 19:30:57 hackage aura 3.2.0 - A secure package manager for Arch Linux and the AUR. https://hackage.haskell.org/package/aura-3.2.0 (fosskers)
2020-10-27 19:31:30 thir joins (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de)
2020-10-27 19:34:37 britva joins (~britva@31-10-157-156.cgn.dynamic.upc.ch)
2020-10-27 19:34:52 teardown joins (~user@unaffiliated/mrush)
2020-10-27 19:35:11 × teardown quits (~user@unaffiliated/mrush) (Client Quit)
2020-10-27 19:37:17 × thir quits (~thir@p200300f27f0b7e004c18ab60065ea01b.dip0.t-ipconnect.de) (Ping timeout: 260 seconds)
2020-10-27 19:38:56 × _vaibhavingale_ quits (~Adium@42.106.218.208) (Read error: Connection reset by peer)
2020-10-27 19:39:17 fraktor joins (~walt@129.93.191.18)
2020-10-27 19:39:59 <fraktor> :t foldr (&&) True . map
2020-10-27 19:40:00 <lambdabot> error:
2020-10-27 19:40:00 <lambdabot> • Couldn't match type ‘[b]’ with ‘Bool’
2020-10-27 19:40:00 <lambdabot> Expected type: (a -> b) -> [a] -> Bool
2020-10-27 19:40:08 <fraktor> I don't understand why this is happening.
2020-10-27 19:40:57 <xerox_> map takes 2 arguments
2020-10-27 19:41:08 <xerox_> :t (foldr (&&) True .) . map
2020-10-27 19:41:09 <lambdabot> (a -> Bool) -> [a] -> Bool
2020-10-27 19:41:21 <fraktor> Oh I see, it's a composition rule thing.
2020-10-27 19:41:38 <fraktor> Why is the additional `.` required inside the parentheses?
2020-10-27 19:41:44 alp joins (~alp@2a01:e0a:58b:4920:95e9:ca1e:6b04:cf54)
2020-10-27 19:42:31 <tomsmeding> '(f . g) x' is equivalent to 'f (g x)', so '(foldr (&&) True . map) x' is equivalent to 'foldr (&&) True (map x)'
2020-10-27 19:42:33 <tomsmeding> that won't work :)
2020-10-27 19:42:58 <fraktor> I see. Thank you!
2020-10-27 19:43:08 <xerox_> f . g = \x -> f (g x) so (foldr (&&) True .) . map = \f -> (foldr (&&) True .) (map f) = (foldr (&&) True) . (map f) = \xs -> foldr (&&) True (map f xs)
2020-10-27 19:43:08 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 260 seconds)
2020-10-27 19:43:09 <fraktor> Also I know that `all` exists, I just wanted to see how I might implement it.
2020-10-27 19:43:44 <tomsmeding> however, '(((foldr (&&) True .) . map) x) y' is equivalent to '((foldr (&&) True .) (map x)) y', which is '(foldr (&&) True . map x) y', which is 'foldr (&&) True (map x y)'
2020-10-27 19:44:03 <tomsmeding> @src .
2020-10-27 19:44:03 <lambdabot> (f . g) x = f (g x)
2020-10-27 19:44:14 <tomsmeding> equational reasoning allows you to write it all out :)
2020-10-27 19:44:45 <fraktor> I didn't know about the `src` thing, that's really cool! Is that lambdabot or ghci?
2020-10-27 19:44:47 <fraktor> @src all
2020-10-27 19:44:47 <lambdabot> all p = and . map p
2020-10-27 19:44:53 <fraktor> :t all
2020-10-27 19:44:54 <lambdabot> Foldable t => (a -> Bool) -> t a -> Bool
2020-10-27 19:44:59 × cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Remote host closed the connection)
2020-10-27 19:45:02 <tomsmeding> that's lambdabot; it gives you an idealised definition
2020-10-27 19:45:13 <tomsmeding> the real definition might be more complicated for performance or generality reasons
2020-10-27 19:45:18 <fraktor> "Idealized"?
2020-10-27 19:45:29 <fraktor> Like, someone went and wrote these, or it generates them?
2020-10-27 19:45:36 <tomsmeding> someone wrote these :p
2020-10-27 19:45:52 macrover joins (~macrover@ip70-189-231-35.lv.lv.cox.net)
2020-10-27 19:45:53 <fraktor> I was going to say...
2020-10-27 19:46:00 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
2020-10-27 19:46:02 <fraktor> :t (and .) . map
2020-10-27 19:46:03 <lambdabot> (a -> Bool) -> [a] -> Bool
2020-10-27 19:46:19 <geekosaur> the actual definitions are often optimized or generalized
2020-10-27 19:46:27 teardown joins (~user@unaffiliated/mrush)
2020-10-27 19:46:35 <tomsmeding> for example, for (.) : https://hackage.haskell.org/package/base-4.14.0.0/docs/src/GHC.Base.html#line-1443
2020-10-27 19:47:21 × mmohammadi9812 quits (~mmohammad@5.238.178.31) (Read error: Connection reset by peer)
2020-10-27 19:47:28 <tomsmeding> (the comment helpfully explains why it's not the intuitive definition; 'base' is generally well-written like that)
2020-10-27 19:49:00 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2020-10-27 19:49:04 mmohammadi9812 joins (~mmohammad@5.238.178.31)
2020-10-27 19:50:02 <merijn> fraktor: The definitions are lambdabot are mostly the ones copied from the Haskell Report
2020-10-27 19:50:21 jakob_ joins (~textual@p57b0eae0.dip0.t-ipconnect.de)
2020-10-27 19:50:30 <maerwald> tomsmeding: didn't you say ALE is good wrt LSP?
2020-10-27 19:50:46 <tomsmeding> maerwald: in my very limited experience, yes
2020-10-27 19:50:58 <merijn> maerwald: "works for me"
2020-10-27 19:51:01 <maerwald> It does nothing here lol
2020-10-27 19:51:14 christo joins (~chris@81.96.113.213)

All times are in UTC.