Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 583 584 585 586 587 588 589 590 591 592 593 .. 5022
502,152 events total
2020-10-12 01:56:05 falafel joins (~falafel@2605:e000:1527:d491:1ccf:5c8d:7928:e9cc)
2020-10-12 01:56:19 _vaibhavingale_ joins (~Adium@203.188.228.27)
2020-10-12 01:56:45 × coot quits (~coot@37.30.56.73.nat.umts.dynamic.t-mobile.pl) (Ping timeout: 240 seconds)
2020-10-12 01:57:02 polyrain joins (~polyrain@2001:8003:e501:6901:1d4a:4b8a:8ea1:adc0)
2020-10-12 01:57:08 × _vaibhavingale_ quits (~Adium@203.188.228.27) (Read error: Connection reset by peer)
2020-10-12 01:57:47 <cohn> thanks everyone!
2020-10-12 01:58:22 <proofofme> main = allDivs >>= (\x -> mapM_ print (fromJust x))
2020-10-12 01:58:50 <proofofme> how would you rewrite the fromJust portion? I've been trying to do pattern matching but get a mismatched type error
2020-10-12 01:58:51 <Axman6> formJust is a code smell
2020-10-12 01:59:01 <Axman6> what have you tried?
2020-10-12 01:59:40 <proofofme> https://pastebin.com/HYHRj4PY
2020-10-12 01:59:47 <ski> main = maybe (putStrLn "Oups !") (mapM_ print) =<< allDivs -- one way. you could also use a `case', e.g.
2020-10-12 01:59:56 <Axman6> main = do {divs <- allDivs; case divs of Nothing -> <handle error case>; Just x -> do <things with x> }
2020-10-12 02:00:27 ski can't recall whether proofofme's seen `do' yet
2020-10-12 02:00:47 <proofofme> very briefly ... not an expert
2020-10-12 02:00:48 <ski> main = do divs <- allDivs
2020-10-12 02:00:49 <Axman6> proofofme: what is the type oif handleMaybe?
2020-10-12 02:00:56 <ski> case divs of
2020-10-12 02:01:01 <ski> Nothing -> <handle error case>
2020-10-12 02:01:07 <ski> Just x -> do <things with x>
2020-10-12 02:01:15 Axman6 notes that's the correct spelling of the Australian "of"
2020-10-12 02:02:13 <proofofme> type is [Div] | Nothing, right?
2020-10-12 02:02:23 <proofofme> data Div = Div String deriving (Show, Eq)
2020-10-12 02:02:49 <Axman6> doesn;'t sound right to me, | isn't a thing in types
2020-10-12 02:03:06 <Axman6> "" looks like a String to me though
2020-10-12 02:03:16 justanotheruser joins (~justanoth@unaffiliated/justanotheruser)
2020-10-12 02:03:16 wei2912 joins (~wei2912@unaffiliated/wei2912)
2020-10-12 02:04:02 wroathe_ is now known as wroathe
2020-10-12 02:05:54 olligobber joins (olligobber@gateway/vpn/privateinternetaccess/olligobber)
2020-10-12 02:06:05 da39a3ee5e6b4b0d joins (~textual@n11211935170.netvigator.com)
2020-10-12 02:07:51 rekahsoft joins (~rekahsoft@CPE0008a20f982f-CM64777d666260.cpe.net.cable.rogers.com)
2020-10-12 02:08:01 <Axman6> proofofme: you should start by adding a type signature to handleMaybe, that should help you get your thoughts in order
2020-10-12 02:08:50 × ensyde quits (~ensyde@2600:1702:2e30:1a40:9170:421:4d7b:753d) (Quit: WeeChat 2.9)
2020-10-12 02:14:05 mdunnio joins (~mdunnio@208.59.170.5)
2020-10-12 02:14:22 <cohn> lemmih: can you recommend any good resources on types besides the Typeclassopedia?
2020-10-12 02:14:43 lagothrix is now known as Guest59393
2020-10-12 02:14:43 × Guest59393 quits (~lagothrix@unaffiliated/lagothrix) (Killed (verne.freenode.net (Nickname regained by services)))
2020-10-12 02:14:44 ensyde joins (~ensyde@2600:1702:2e30:1a40:7dd1:8fed:5e86:6369)
2020-10-12 02:14:49 lagothrix joins (~lagothrix@unaffiliated/lagothrix)
2020-10-12 02:15:23 × gehmehgeh quits (~ircuser1@gateway/tor-sasl/gehmehgeh) (Ping timeout: 240 seconds)
2020-10-12 02:18:39 × mdunnio quits (~mdunnio@208.59.170.5) (Ping timeout: 244 seconds)
2020-10-12 02:20:00 mdunnio joins (~mdunnio@208.59.170.5)
2020-10-12 02:20:27 hackage clckwrks 0.26.2 - A secure, reliable content management system (CMS) and blogging platform https://hackage.haskell.org/package/clckwrks-0.26.2 (JeremyShaw)
2020-10-12 02:20:47 × polyrain quits (~polyrain@2001:8003:e501:6901:1d4a:4b8a:8ea1:adc0) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-10-12 02:21:29 × AlterEgo- quits (~ladew@124-198-158-163.dynamic.caiway.nl) (Read error: Connection reset by peer)
2020-10-12 02:23:33 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2020-10-12 02:24:20 × mdunnio quits (~mdunnio@208.59.170.5) (Ping timeout: 244 seconds)
2020-10-12 02:24:29 <proofofme> `main = maybe (putStrLn "Error") (mapM_ print) =<< allDivs` this line ended up working
2020-10-12 02:25:01 Saukk joins (~Saukk@2001:998:f1:3966:96a6:dee2:2e9:fdf3)
2020-10-12 02:26:12 plutoniix joins (~q@175.176.222.7)
2020-10-12 02:27:20 <Axman6> do you understand it though? I still think you should do what I suggested above
2020-10-12 02:27:24 gehmehgeh joins (~ircuser1@gateway/tor-sasl/gehmehgeh)
2020-10-12 02:27:50 <Axman6> because I have a strong feeling you wrote handleMaybe without understanding why it compiled
2020-10-12 02:28:10 <Axman6> and it was not doing hwat you intended it to do
2020-10-12 02:28:32 <proofofme> I understand the maybe function. I was returning the wrong type, yeah?
2020-10-12 02:28:37 × theDon quits (~td@94.134.91.169) (Ping timeout: 258 seconds)
2020-10-12 02:29:04 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds)
2020-10-12 02:29:27 <Axman6> for a hint about what type handleMaybe should have, in the code you had before, change it from main = allDivs >>= (\x -> mapM_ print (handleMaybe x)) main = allDivs >>= (\x -> mapM_ print (_handleMaybe x)) and let the compiler tell you
2020-10-12 02:29:31 × conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.)
2020-10-12 02:30:01 × seanparsons quits (~sean@cpc145088-gill21-2-0-cust281.20-1.cable.virginm.net) (Ping timeout: 244 seconds)
2020-10-12 02:30:16 theDon joins (~td@muedsl-82-207-238-192.citykom.de)
2020-10-12 02:30:33 <Axman6> "I was returning the wrong type" is almost always the answer to why something didn't compile, but you have to understand what types you expect to be returning (and accepting) to be able to do something with that fact
2020-10-12 02:30:58 × fraktor quits (~walt@129.93.191.18) (Ping timeout: 265 seconds)
2020-10-12 02:31:00 mirrorbird joins (~psutcliff@2a00:801:429:5ea0:80af:2bca:f885:1bb9)
2020-10-12 02:32:20 <proofofme> Found hole: _handleMaybe :: Maybe [Div] -> t0 a0
2020-10-12 02:32:20 <proofofme> Where: ‘t0’ is an ambiguous type variable
2020-10-12 02:32:20 <proofofme> ‘a0’ is an ambiguous type variable
2020-10-12 02:32:22 <proofofme> Or perhaps ‘_handleMaybe’ is mis-spelled, or not in scope
2020-10-12 02:32:47 fraktor joins (~walt@193.32.127.227)
2020-10-12 02:33:07 × st8less quits (~st8less@2603:a060:11fd:0:9c66:9b18:c21:60c) (Ping timeout: 244 seconds)
2020-10-12 02:33:14 <Axman6> hmm, slightly less heklpful now mapM_ has a more general type than it used to. read `t0 a0` as [a]
2020-10-12 02:33:20 <proofofme> Couldn't match type ‘Div’ with ‘Char’
2020-10-12 02:33:31 seanparsons joins (~sean@cpc145088-gill21-2-0-cust281.20-1.cable.virginm.net)
2020-10-12 02:33:33 <proofofme> this is when I use it without the `_`
2020-10-12 02:33:59 <Axman6> yep, so your function in the Nothing case returns a String, which is [Char], but you really wanted to return a [Div]
2020-10-12 02:34:29 <proofofme> oh! I see
2020-10-12 02:35:10 <proofofme> trying to fix it now ...
2020-10-12 02:35:37 <Axman6> uh, also, you had ... Just x -> return x, which means you're actually using some monad, which you probably didn't mean to, you probably wanted Just x -> x; Nothing -> <something that is also of tyoe [Div]>
2020-10-12 02:35:47 <Axman6> :t return
2020-10-12 02:35:49 <lambdabot> Monad m => a -> m a
2020-10-12 02:36:13 <Axman6> our return is not the same as everyone else's return
2020-10-12 02:36:20 <proofofme> so exclude the return
2020-10-12 02:36:41 <proofofme> compiled!
2020-10-12 02:36:43 <proofofme> makes sense
2020-10-12 02:37:00 <proofofme> handleMaybe x = case x of
2020-10-12 02:37:00 <proofofme> Just val -> val
2020-10-12 02:37:00 <proofofme> Nothing -> [Div ""]
2020-10-12 02:37:03 <proofofme> I used that
2020-10-12 02:37:12 <Axman6> is there a simpler way to make a [Div]?
2020-10-12 02:37:42 <Axman6> how can we construct lists in Haskell (hint, there are two answers, according to the definition of lists)
2020-10-12 02:37:42 <proofofme> hmm how?
2020-10-12 02:37:52 <Axman6> @src []
2020-10-12 02:37:52 <lambdabot> data [] a = [] | a : [a]
2020-10-12 02:37:53 <proofofme> cons
2020-10-12 02:37:56 xerox_ joins (~xerox@unaffiliated/xerox)
2020-10-12 02:38:20 <proofofme> use data?
2020-10-12 02:38:33 <Axman6> if I say to you "I need a list of Wombles", and you don't have any Wombles, can you give me a list of Wombles?
2020-10-12 02:38:49 <proofofme> I can give [], yeah?
2020-10-12 02:38:54 <Axman6> yep
2020-10-12 02:38:58 hackage clckwrks 0.26.2.1 - A secure, reliable content management system (CMS) and blogging platform https://hackage.haskell.org/package/clckwrks-0.26.2.1 (JeremyShaw)

All times are in UTC.