Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-13 05:45:42 <yahb> Axman6: ; <interactive>:1:26: error:; * Variable not in scope: elements :: a -> LensLike (Data.Functor.Day.Curried.Curried (Data.Functor.Yoneda.Yoneda (Const Control.Monad.RWS.Any)) (Data.Functor.Yoneda.Yoneda (Const Control.Monad.RWS.Any))) s s a0 a0; * Perhaps you meant one of these: `Q.elements' (imported from Test.QuickCheck), `Lens.elements' (imported from Control.Lens), `element' (imported from
2020-11-13 05:45:45 × monochrom quits (trebla@216.138.220.146) (Quit: NO CARRIER)
2020-11-13 05:46:00 hackage trade-journal 0.0.2 - https://hackage.haskell.org/package/trade-journal-0.0.2 (JohnWiegley)
2020-11-13 05:46:24 <koz_> A better question: what does 'lens . has . confusing . elements' do?
2020-11-13 05:46:44 <bqv> that's above my pay grade
2020-11-13 05:46:56 × AbhayAysola quits (312587e9@49.37.135.233) (Remote host closed the connection)
2020-11-13 05:47:17 <dsal> has confuses me without needing confusing
2020-11-13 05:47:50 <koz_> :t has
2020-11-13 05:47:51 <lambdabot> Getting Any s a -> s -> Bool
2020-11-13 05:48:05 <koz_> Isn't that just like, generalized member?
2020-11-13 05:48:22 <koz_> (also, 'Getting Any' makes me giggle)
2020-11-13 05:48:40 <bqv> it's true if the prism matches
2020-11-13 05:48:42 <bqv> that's all i know
2020-11-13 05:49:59 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 258 seconds)
2020-11-13 05:50:11 × benjamingr__ quits (uid23465@gateway/web/irccloud.com/x-jujlikfcmwauxivg) (Quit: Connection closed for inactivity)
2020-11-13 05:50:52 jathan joins (~jathan@69.61.93.38)
2020-11-13 05:57:58 monochrom joins (trebla@216.138.220.146)
2020-11-13 06:00:02 × Guest87092 quits (~variable@139.28.218.148) ()
2020-11-13 06:02:14 × Jeanne-Kamikaze quits (~Jeanne-Ka@66.115.189.209) (Quit: Leaving)
2020-11-13 06:06:51 howdoi joins (uid224@gateway/web/irccloud.com/x-odsmdwwzesbrmhor)
2020-11-13 06:09:07 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 246 seconds)
2020-11-13 06:12:07 × xerox_ quits (~xerox@unaffiliated/xerox) (Ping timeout: 256 seconds)
2020-11-13 06:12:19 × Saukk quits (~Saukk@2001:998:f9:2914:1c59:9bb5:b94c:4) (Remote host closed the connection)
2020-11-13 06:14:28 <dminuoso> jakob_: Do you want to extract all values matching that constructor?
2020-11-13 06:14:45 <dminuoso> Or just determine whether any value in the list was constructed with the given constructor?
2020-11-13 06:16:38 <jakob_> dminuoso i don't care about the values, just about the constructors
2020-11-13 06:17:26 sord937 joins (~sord937@gateway/tor-sasl/sord937)
2020-11-13 06:17:45 <bqv> if you wanna get real spicy, you could probably use Typeable to get the constructor name
2020-11-13 06:18:07 <dminuoso> % anyLeft xs = any [x | Left x <- xs ]
2020-11-13 06:18:08 <yahb> dminuoso: ; <interactive>:88:18: error:; * Couldn't match expected type `a1 -> Bool' with actual type `[a]'; * In the first argument of `any', namely `[x | Left x <- xs]'; In the expression: any [x | Left x <- xs]; In an equation for `anyLeft': anyLeft xs = any [x | Left x <- xs]; * Relevant bindings include; xs :: [Either a b] (bound at <interactive>:88:9); anyLeft :: [Eithe
2020-11-13 06:18:28 <dminuoso> oh
2020-11-13 06:18:39 <dminuoso> % anyLeft xs = not (null [x | Left x <- xs ])
2020-11-13 06:18:39 <yahb> dminuoso:
2020-11-13 06:19:40 thc202 joins (~thc202@unaffiliated/thc202)
2020-11-13 06:19:51 <dminuoso> % anyLeft' = has (folded . _Left)
2020-11-13 06:19:52 <yahb> dminuoso:
2020-11-13 06:20:47 <bqv> % anyLeft [Left 1, Right 2]
2020-11-13 06:20:47 <yahb> bqv: True
2020-11-13 06:20:50 <bqv> neat
2020-11-13 06:20:58 <bqv> list comprehensions are magic
2020-11-13 06:21:21 <dminuoso> They're really just a bit more mathy looking interface for Monad.
2020-11-13 06:21:28 <dminuoso> (And some MonadPlus)
2020-11-13 06:21:59 <bqv> yeah, i've used list in do form
2020-11-13 06:22:07 <bqv> but i didn't realise you could guard in a comprehension
2020-11-13 06:22:14 × reallymemorable quits (~quassel@2601:180:8300:8fd0:c5df:6e57:bcff:c1bb) (Ping timeout: 264 seconds)
2020-11-13 06:22:54 o1lo01ol1o joins (~o1lo01ol1@bl8-213-81.dsl.telepac.pt)
2020-11-13 06:23:06 <jakob_> dminuoso nice! List comprehensions for the win :)
2020-11-13 06:23:10 <jakob_> thx
2020-11-13 06:24:01 × acarrico quits (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net) (Ping timeout: 256 seconds)
2020-11-13 06:26:56 × echoreply quits (~echoreply@unaffiliated/echoreply) (Quit: WeeChat 1.9.1)
2020-11-13 06:27:23 echoreply joins (~echoreply@unaffiliated/echoreply)
2020-11-13 06:27:50 × o1lo01ol1o quits (~o1lo01ol1@bl8-213-81.dsl.telepac.pt) (Ping timeout: 256 seconds)
2020-11-13 06:28:34 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2020-11-13 06:30:37 × Jonkimi727406120 quits (~Jonkimi@119.123.240.220) (Ping timeout: 258 seconds)
2020-11-13 06:31:46 <dsal> I almost never use comprehensions for some reason.
2020-11-13 06:32:20 <bqv> i used a do list yesterday
2020-11-13 06:32:31 <bqv> because feels nicer than comprehension form
2020-11-13 06:32:39 <bqv> and i needed a guard
2020-11-13 06:32:57 <dsal> Haskell and emacs both seem to have this thing in common where there are so many things I can't even remember what all the things are. Not so much that I don't know how to use them, but that I forget they exist.
2020-11-13 06:33:13 <dsal> Yeah, do + guard is pretty awesome for lists.
2020-11-13 06:33:21 ggole joins (~ggole@2001:8003:8119:7200:cd0:562c:261b:241d)
2020-11-13 06:33:26 <jakob_> about list comprehensions: i thought they were implemented in terms of map and concat? Nothing to to with monads
2020-11-13 06:33:56 <bqv> if that were the case, what dminuoso did would be impossible, i think
2020-11-13 06:35:31 × mmohammadi9812 quits (~mmohammad@80.210.53.226) (Quit: Quit)
2020-11-13 06:35:39 <jakob_> https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-420003.11
2020-11-13 06:35:59 <dsal> haskell tutorials often confuse what a thing is with what you can do with the thing.
2020-11-13 06:36:11 <bqv> dsal: i find azure cloud also has that feature. unfortunately it comes in the "everything is constantly broken in an obscure way, and what isn't broken is only working due to the most unsightly of hacks" edition
2020-11-13 06:36:41 <dsal> I can't even read the "new features we've added to AWS" emails anymore.
2020-11-13 06:37:25 <dsal> Does lambdabot have an undo for list comprehensions?
2020-11-13 06:37:43 <dsal> @miscomprehend [x | x <- [1..], odd ]
2020-11-13 06:37:43 <lambdabot> Unknown command, try @list
2020-11-13 06:39:19 <dsal> @undo do { Just x <- xs; pure x }
2020-11-13 06:39:19 <lambdabot> xs >>= \ a -> case a of { Just x -> pure x; _ -> fail ""}
2020-11-13 06:39:45 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2020-11-13 06:40:20 takuan joins (~takuan@178-116-218-225.access.telenet.be)
2020-11-13 06:40:30 <dsal> > let xs = [Left 1, Right 2, Left 3, Right 4] in do { Right x <- xs; pure x }
2020-11-13 06:40:32 <lambdabot> [2,4]
2020-11-13 06:40:41 dbmikus__ joins (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com)
2020-11-13 06:40:50 <dsal> > let xs = [Left 1, Right 2, Left 3, Right 4] in [ x | Left x <- xs ]
2020-11-13 06:40:52 <lambdabot> [1,3]
2020-11-13 06:41:13 feliocrat joins (~feliocrat@95.70.185.239)
2020-11-13 06:43:22 <dsal> I used this mechanism of guarding yesterday, and still don't ever think about it.
2020-11-13 06:43:30 × Sheilong quits (uid293653@gateway/web/irccloud.com/x-kihpfdwzdbjfjvbb) (Quit: Connection closed for inactivity)
2020-11-13 06:44:59 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds)
2020-11-13 06:45:27 × dbmikus__ quits (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com) (Ping timeout: 260 seconds)
2020-11-13 06:49:53 <suzu_> thats pretty cool
2020-11-13 06:50:18 <bqv> "miscomprehend" lmao
2020-11-13 06:53:01 <koz_> uncomprehend, surely?
2020-11-13 06:53:08 <koz_> Which would be like... 'misunderstand'?
2020-11-13 06:54:36 asheshambasta joins (~user@ptr-e1lysawl9rr13i61o92.18120a2.ip6.access.telenet.be)
2020-11-13 06:55:46 × coot quits (~coot@37.30.49.253.nat.umts.dynamic.t-mobile.pl) (Ping timeout: 256 seconds)
2020-11-13 06:56:36 aki_ joins (~aki_@139.28.218.148)
2020-11-13 06:57:49 <dsal> It was the nearest word I could find at the time.
2020-11-13 06:58:54 <dsal> I can't find that thing I thought I did yesterday. It's the one where you use are in a monad and you want a maybe monad real quick that's also a guard, so you `Just x <- pure (some maybe monad stuff)`
2020-11-13 06:59:45 <dsal> @undo do { Just x <- pure someMaybeMonadStuff; do x } -- I guess that's the same, but it feels different.
2020-11-13 06:59:45 <lambdabot> pure someMaybeMonadStuff >>= \ a -> case a of { Just x -> x; _ -> fail ""}
2020-11-13 07:00:20 <dsal> Also, I just said `do x` when I meant `pure x`
2020-11-13 07:00:23 × hekkaidekapus quits (~tchouri@gateway/tor-sasl/hekkaidekapus) (Remote host closed the connection)
2020-11-13 07:00:47 hekkaidekapus joins (~tchouri@gateway/tor-sasl/hekkaidekapus)
2020-11-13 07:01:08 <dsal> @undo do { Just x <- pure maybeGetMeSomeAction; x }

All times are in UTC.