Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,804,534 events total
2021-08-27 23:38:47 × azeem quits (~azeem@5.168.199.98) (Ping timeout: 240 seconds)
2021-08-27 23:43:51 × acidjnk_new quits (~acidjnk@p200300d0c72b95925da55fe159cc0756.dip0.t-ipconnect.de) (Ping timeout: 250 seconds)
2021-08-27 23:44:58 azeem joins (~azeem@5.168.199.98)
2021-08-27 23:49:31 × azeem quits (~azeem@5.168.199.98) (Ping timeout: 252 seconds)
2021-08-27 23:50:11 azeem joins (~azeem@5.168.199.98)
2021-08-28 00:01:05 × azeem quits (~azeem@5.168.199.98) (Ping timeout: 248 seconds)
2021-08-28 00:05:56 <hololeap> cycle. thanks
2021-08-28 00:08:51 roboguy_ joins (~roboguy_@2605:a601:afe7:9f00:f142:8765:520:6c04)
2021-08-28 00:09:12 yin[m] joins (~zwromatri@2001:470:69fc:105::1d4)
2021-08-28 00:11:09 × MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 250 seconds)
2021-08-28 00:11:26 MQ-17J joins (~MQ-17J@8.6.144.209)
2021-08-28 00:12:42 azeem joins (~azeem@5.168.221.147)
2021-08-28 00:15:55 × MQ-17J quits (~MQ-17J@8.6.144.209) (Ping timeout: 250 seconds)
2021-08-28 00:16:06 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-08-28 00:21:25 × azeem quits (~azeem@5.168.221.147) (Ping timeout: 252 seconds)
2021-08-28 00:21:34 azeem joins (~azeem@5.168.221.147)
2021-08-28 00:22:06 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-28 00:28:01 × azeem quits (~azeem@5.168.221.147) (Ping timeout: 252 seconds)
2021-08-28 00:28:47 × img quits (~img@user/img) (Quit: ZNC 1.8.2 - https://znc.in)
2021-08-28 00:29:59 × roboguy_ quits (~roboguy_@2605:a601:afe7:9f00:f142:8765:520:6c04) (Remote host closed the connection)
2021-08-28 00:30:31 roboguy_ joins (~roboguy_@2605:a601:afe7:9f00:f142:8765:520:6c04)
2021-08-28 00:31:52 × sim590 quits (~simon@modemcable090.207-203-24.mc.videotron.ca) (Ping timeout: 252 seconds)
2021-08-28 00:34:27 × roboguy_ quits (~roboguy_@2605:a601:afe7:9f00:f142:8765:520:6c04) (Ping timeout: 240 seconds)
2021-08-28 00:37:08 × markpythonicbtc quits (~textual@2601:647:5a00:35:f814:103:43a8:3466) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-08-28 00:37:28 azeem joins (~azeem@5.168.221.147)
2021-08-28 00:38:24 Lord_of_Life_ joins (~Lord@user/lord-of-life/x-2819915)
2021-08-28 00:38:28 × MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 252 seconds)
2021-08-28 00:38:28 × Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 252 seconds)
2021-08-28 00:38:45 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-08-28 00:39:38 Lord_of_Life_ is now known as Lord_of_Life
2021-08-28 00:41:26 img joins (~img@user/img)
2021-08-28 00:50:09 × azeem quits (~azeem@5.168.221.147) (Ping timeout: 248 seconds)
2021-08-28 00:50:17 iqubic joins (~user@c-67-180-134-109.hsd1.ca.comcast.net)
2021-08-28 00:50:24 azeem joins (~azeem@5.168.221.147)
2021-08-28 00:51:32 <iqubic> So, I'm trying to remember how to use parsec, and I'm hitting a roadblock. I would like to be able to parse a string full of only digits (I.E. "1432912902156") into a [Int]. What's the best way to do that?
2021-08-28 00:52:42 <pavonia> To [1,4,3,2,...] in that example?
2021-08-28 00:53:07 <iqubic> Yes. Correct.
2021-08-28 00:53:28 <iqubic> I want to parse it to a [Int] where each element is in the range 0-9 inclusive
2021-08-28 00:53:29 markpythonicbtc joins (~textual@2601:647:5a00:35:c862:7d44:846c:a0b5)
2021-08-28 00:54:13 <pavonia> many1 $ (\c -> ord c - ord '0') <$> satisfy isDigit
2021-08-28 00:55:18 <iqubic> How does that work?
2021-08-28 00:56:04 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 252 seconds)
2021-08-28 00:56:20 <dsal> > ord '3' - ord '0'
2021-08-28 00:56:22 <lambdabot> 3
2021-08-28 00:56:45 <dsal> I think megaparsec has a digit.
2021-08-28 00:57:37 <dsal> > digitToInt '3'
2021-08-28 00:57:39 <lambdabot> 3
2021-08-28 00:57:59 <pavonia> Ah nice
2021-08-28 00:58:21 <dsal> Megaparsec has digitChar. I assume that's `satisfy isDigit`
2021-08-28 00:58:55 <dsal> digitChar = satisfy isDigit <?> "digit"
2021-08-28 00:59:10 <pavonia> Is GHC able to optimize constant function application like ord '0'?
2021-08-28 00:59:32 <eggplant_> yes
2021-08-28 01:00:45 <dsal> digitToInt includes `dec = ord c - ord '0'` but is more complicated with hex and what-not
2021-08-28 01:02:36 <pavonia> > map digitToInt "09afg"
2021-08-28 01:02:38 <lambdabot> [0,9,10,15,*Exception: Char.digitToInt: not a digit 'g'
2021-08-28 01:03:01 <dsal> Yeah, it's also partial
2021-08-28 01:04:15 <pavonia> > digitToInt '0'
2021-08-28 01:04:16 <lambdabot> *Exception: Char.digitToInt: not a digit '\65296'
2021-08-28 01:04:23 <pavonia> Too bad
2021-08-28 01:05:16 <pavonia> There are many Unicode characters that have a numerical value
2021-08-28 01:08:40 roboguy_ joins (~roboguy_@136.37.123.186)
2021-08-28 01:09:39 × roboguy_ quits (~roboguy_@136.37.123.186) (Client Quit)
2021-08-28 01:12:01 neurocyte0 joins (~neurocyte@45.131.39.239)
2021-08-28 01:12:01 × neurocyte0 quits (~neurocyte@45.131.39.239) (Changing host)
2021-08-28 01:12:01 neurocyte0 joins (~neurocyte@user/neurocyte)
2021-08-28 01:12:34 lavaman joins (~lavaman@98.38.249.169)
2021-08-28 01:13:54 × xsperry quits (~as@user/xsperry) ()
2021-08-28 01:14:19 xsperry joins (~as@user/xsperry)
2021-08-28 01:14:25 × neurocyte quits (~neurocyte@user/neurocyte) (Ping timeout: 250 seconds)
2021-08-28 01:14:25 neurocyte0 is now known as neurocyte
2021-08-28 01:15:00 × kimjetwav quits (~user@2607:fea8:235f:9730:98d1:a22e:1d0c:6a1f) (Remote host closed the connection)
2021-08-28 01:15:49 × markpythonicbtc quits (~textual@2601:647:5a00:35:c862:7d44:846c:a0b5) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-08-28 01:17:01 × lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 250 seconds)
2021-08-28 01:22:41 × azeem quits (~azeem@5.168.221.147) (Ping timeout: 248 seconds)
2021-08-28 01:23:01 × MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 252 seconds)
2021-08-28 01:23:14 kimjetwav joins (~user@2607:fea8:235f:9730:4718:18aa:30c8:2ab8)
2021-08-28 01:23:18 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-08-28 01:23:21 <iqubic> So is there no built in megaparsec parser for single digit numbers? I have to roll my own?
2021-08-28 01:27:17 azeem joins (~azeem@5.168.221.147)
2021-08-28 01:27:21 <dsal> @hoogle digitChar
2021-08-28 01:27:21 <lambdabot> Text.Megaparsec.Byte digitChar :: (MonadParsec e s m, Token s ~ Word8) => m (Token s)
2021-08-28 01:27:21 <lambdabot> Text.Megaparsec.Char digitChar :: (MonadParsec e s m, Token s ~ Char) => m (Token s)
2021-08-28 01:27:21 <lambdabot> Toml.Parser.Core digitChar :: (MonadParsec e s m, Token s ~ Char) => m (Token s)
2021-08-28 01:27:44 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-28 01:29:01 <iqubic> What I want is this:
2021-08-28 01:29:03 <iqubic> type Parser = Parsec Void String
2021-08-28 01:29:09 <iqubic> singleDigit :: Num a => Parser a
2021-08-28 01:29:31 <iqubic> Which will parse a single character, and succeed only if that character is a digit.
2021-08-28 01:30:12 markpythonicbtc joins (~textual@2601:647:5a00:35:15d1:827c:596e:b228)
2021-08-28 01:30:16 sim590 joins (~simon@76.65.67.73)
2021-08-28 01:30:19 <iqubic> How can get that?
2021-08-28 01:30:36 <hololeap> iqubic: look at Text.Parsec.Char.alphaNum
2021-08-28 01:30:42 <dsal> You fmap digitToInt over digitChar
2021-08-28 01:31:00 <iqubic> dsal, won't that give me an Int?
2021-08-28 01:31:13 <iqubic> won't I have to then fmap fromIntegral?
2021-08-28 01:31:48 <dsal> OK, then `fmap (fromIntegral . digitToInt) digitChar`
2021-08-28 01:32:05 × aplainzetakind quits (~johndoe@captainludd.powered.by.lunarbnc.net) (Quit: Free ZNC ~ Powered by LunarBNC: https://LunarBNC.net)
2021-08-28 01:32:17 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 248 seconds)
2021-08-28 01:33:26 hololeap meant .digit
2021-08-28 01:35:41 <iqubic> Weird. Megaparsec only has digitChar.

All times are in UTC.