Logs: freenode/#haskell
| 2021-05-17 09:30:04 | <Axman6> | @src Char |
| 2021-05-17 09:30:04 | <lambdabot> | data Char = C# Char# |
| 2021-05-17 09:30:11 | <Axman6> | Use Char# =) |
| 2021-05-17 09:30:31 | <merijn> | that doesn't work |
| 2021-05-17 09:30:46 | <merijn> | Pretty sure you can't read Char# |
| 2021-05-17 09:31:39 | × | heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 245 seconds) |
| 2021-05-17 09:31:52 | → | Qwerky joins (~qwerky@178.197.228.14) |
| 2021-05-17 09:32:54 | <biglama> | I wanted to do ascii conversion in pure Data.Text but it does not seem possible :( |
| 2021-05-17 09:33:14 | <dminuoso> | biglama: sure it is, just tap into the internals of text.. |
| 2021-05-17 09:34:33 | <dminuoso> | Look at the implementation of `singleton` |
| 2021-05-17 09:35:18 | → | raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
| 2021-05-17 09:35:25 | <Axman6> | There's not going to be much you can do that isn't essentially doing exactly what toEnum . read does though |
| 2021-05-17 09:36:53 | <dminuoso> | Though.. the more I look at text, you'll have to go through `Char`, unless you want to break it up internally so far that you're meddling with the internal MutableByteArray's. |
| 2021-05-17 09:36:54 | × | Qwerky quits (~qwerky@178.197.228.14) (Ping timeout: 265 seconds) |
| 2021-05-17 09:37:12 | <dminuoso> | At some point you should ask yourself whether that's really worth saving that single roundtrip through Char |
| 2021-05-17 09:37:27 | <biglama> | There is an `ord2` function it Data.Text.Internal.Encoding.Utf8 but it says "Use at your own risk!" |
| 2021-05-17 09:37:50 | <biglama> | dminuoso: That's not super important, I was just curious. Thanks :) |
| 2021-05-17 09:38:04 | <dminuoso> | biglama: The key function to look at is: https://hackage.haskell.org/package/text-1.2.4.1/docs/src/Data.Text.Internal.Unsafe.Char.html#unsafeWrite |
| 2021-05-17 09:38:17 | <dminuoso> | Essentially you'd have to adapt this to work without a Char |
| 2021-05-17 09:38:24 | <dminuoso> | (unsafeWrite) |
| 2021-05-17 09:40:11 | <biglama> | Looks complicated :/ |
| 2021-05-17 09:40:26 | × | Schrostfutz quits (~Schrostfu@schettlerdck.tkn.tu-berlin.de) (Quit: Leaving) |
| 2021-05-17 09:40:52 | → | ddellacosta joins (~ddellacos@86.106.143.35) |
| 2021-05-17 09:40:56 | → | boxscape joins (54a350dc@p54a350dc.dip0.t-ipconnect.de) |
| 2021-05-17 09:42:14 | <biglama> | Another question : since Data.Text implements Read, why can't I do : |
| 2021-05-17 09:42:14 | <biglama> | read (T.pack "66") :: Int |
| 2021-05-17 09:42:29 | <dminuoso> | % :t read |
| 2021-05-17 09:42:29 | <yahb> | dminuoso: Read a => String -> a |
| 2021-05-17 09:42:46 | <dminuoso> | biglama: You're thinking of `Read` the wrong way |
| 2021-05-17 09:43:09 | <dminuoso> | The fact that Data.Text implements Read means, we can read a String as Text |
| 2021-05-17 09:43:39 | <biglama> | Oh, I see. So can an Int be read to a Text ? I could not find anything on Hoogle |
| 2021-05-17 09:43:47 | <dminuoso> | That is `show` |
| 2021-05-17 09:43:50 | <dminuoso> | rather |
| 2021-05-17 09:43:58 | <dminuoso> | And no, you have to roundtrip through String |
| 2021-05-17 09:44:06 | <dminuoso> | this sort of accident is an unfortunate one |
| 2021-05-17 09:44:19 | <dminuoso> | Several packages on hackage exist to provide read/show using text instead |
| 2021-05-17 09:44:25 | <biglama> | Ok. I'm trying to use one type of string representation but it's hard to avoid String |
| 2021-05-17 09:44:34 | <dminuoso> | https://hackage.haskell.org/package/text-show |
| 2021-05-17 09:44:45 | <dminuoso> | biglama: Is this user-facing output? |
| 2021-05-17 09:44:48 | <dminuoso> | Or just for debugging |
| 2021-05-17 09:45:03 | <biglama> | Debugging. And a side project :p |
| 2021-05-17 09:45:20 | <dminuoso> | there's several options |
| 2021-05-17 09:45:26 | → | pera_ joins (~pera_@94.0.111.239) |
| 2021-05-17 09:45:26 | × | ddellacosta quits (~ddellacos@86.106.143.35) (Ping timeout: 240 seconds) |
| 2021-05-17 09:45:29 | → | elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) |
| 2021-05-17 09:45:40 | × | xwvvvvwx quits (xwvvvvwx@gateway/vpn/mullvad/xwvvvvwx) (Quit: ZNC 1.8.2 - https://znc.in) |
| 2021-05-17 09:45:40 | <dminuoso> | As a quick drop-in solution, I usually write `showT = T.pack . show`, put it into some Utils module and use it |
| 2021-05-17 09:46:16 | <dminuoso> | Other more elaborate options rely on using prettyprinter rather than text |
| 2021-05-17 09:47:52 | → | xwvvvvwx joins (xwvvvvwx@gateway/vpn/mullvad/xwvvvvwx) |
| 2021-05-17 09:49:29 | <kuribas> | biglama: for debugging you shouldn't care |
| 2021-05-17 09:49:37 | → | LKoen joins (~LKoen@lfbn-idf2-1-1523-141.w92-169.abo.wanadoo.fr) |
| 2021-05-17 09:49:52 | <biglama> | dminuoso: The concept of prettyprinter is interesting |
| 2021-05-17 09:50:24 | × | kritzefitz quits (~kritzefit@2003:5b:203b:200::10:49) (Ping timeout: 245 seconds) |
| 2021-05-17 09:54:03 | → | kritzefitz joins (~kritzefit@2003:5b:203b:200::10:49) |
| 2021-05-17 09:57:13 | <biglama> | Thanks a lot anyway ! |
| 2021-05-17 09:57:41 | × | acidjnk_new quits (~acidjnk@p200300d0c72b9554e88f3d58cc93ff66.dip0.t-ipconnect.de) (Ping timeout: 250 seconds) |
| 2021-05-17 10:01:18 | × | boxscape quits (54a350dc@p54a350dc.dip0.t-ipconnect.de) (Quit: Connection closed) |
| 2021-05-17 10:01:35 | → | boxscape joins (54a350dc@p54a350dc.dip0.t-ipconnect.de) |
| 2021-05-17 10:03:07 | × | sqrt2 quits (~ben@unaffiliated/sqrt2) (Ping timeout: 252 seconds) |
| 2021-05-17 10:04:46 | → | sqrt2 joins (~ben@unaffiliated/sqrt2) |
| 2021-05-17 10:06:02 | → | acidjnk_new joins (~acidjnk@p200300d0c72b9554e88f3d58cc93ff66.dip0.t-ipconnect.de) |
| 2021-05-17 10:08:11 | × | rootmolloch quits (~lokitrall@2a02:3038:406:61a7:a13b:9b98:12ef:11db) (Quit: Leaving) |
| 2021-05-17 10:10:53 | × | Pickchea quits (~private@unaffiliated/pickchea) (Ping timeout: 240 seconds) |
| 2021-05-17 10:12:30 | → | ddellacosta joins (~ddellacos@86.106.143.243) |
| 2021-05-17 10:17:16 | × | ddellacosta quits (~ddellacos@86.106.143.243) (Ping timeout: 260 seconds) |
| 2021-05-17 10:26:05 | → | malumore joins (~malumore@151.62.127.105) |
| 2021-05-17 10:37:24 | → | nicholasbulka joins (~nicholasb@2601:900:4301:da0:9c6b:b655:282d:e6b6) |
| 2021-05-17 10:40:18 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Quit: = "") |
| 2021-05-17 10:40:38 | × | Guest36185 quits (~textual@2603-7000-3040-0000-a930-38e4-f357-846f.res6.spectrum.com) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-05-17 10:41:53 | × | nicholasbulka quits (~nicholasb@2601:900:4301:da0:9c6b:b655:282d:e6b6) (Ping timeout: 250 seconds) |
| 2021-05-17 10:43:07 | × | stree quits (~stree@68.36.8.116) (Ping timeout: 265 seconds) |
| 2021-05-17 10:44:26 | × | LKoen quits (~LKoen@lfbn-idf2-1-1523-141.w92-169.abo.wanadoo.fr) (Remote host closed the connection) |
| 2021-05-17 10:45:49 | → | enoq joins (~textual@194-208-146-143.lampert.tv) |
| 2021-05-17 10:49:56 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-05-17 10:51:53 | → | ddellaco_ joins (~ddellacos@ool-44c73afa.dyn.optonline.net) |
| 2021-05-17 10:52:09 | <tdammers> | IME, you usually want an application-specific notion of "stringification" anyway; `show` is really only appropriate for trace debugging IMO |
| 2021-05-17 10:54:43 | × | ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 265 seconds) |
| 2021-05-17 10:56:07 | → | stree joins (~stree@68.36.8.116) |
| 2021-05-17 10:56:19 | → | machinedgod joins (~machinedg@24.105.81.50) |
| 2021-05-17 10:56:34 | → | Qwerky joins (~qwerky@178.197.228.14) |
| 2021-05-17 10:56:39 | × | ddellaco_ quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Ping timeout: 265 seconds) |
| 2021-05-17 11:00:41 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds) |
| 2021-05-17 11:01:18 | × | hyiltiz-M quits (hyiltizkde@gateway/shell/kde/matrix/x-zxgylrwrlsislond) (Quit: Bridge terminating on SIGTERM) |
| 2021-05-17 11:01:19 | × | anandprabhu-M quits (anandprabh@gateway/shell/kde/matrix/x-bvhldoupnbmlqysg) (Quit: Bridge terminating on SIGTERM) |
| 2021-05-17 11:01:30 | → | Benzi-Junior joins (~BenziJuni@88-149-64-251.du.xdsl.is) |
| 2021-05-17 11:01:39 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-05-17 11:02:29 | × | Qwerky quits (~qwerky@178.197.228.14) (Remote host closed the connection) |
| 2021-05-17 11:02:56 | → | hyiltiz-M joins (hyiltizkde@gateway/shell/kde/matrix/x-owzkkkzddiktgsbs) |
| 2021-05-17 11:03:10 | → | zaquest joins (~notzaques@5.128.210.178) |
| 2021-05-17 11:04:25 | → | xenon- joins (~bc817c21@217.29.117.252) |
| 2021-05-17 11:04:29 | → | anandprabhu-M joins (anandprabh@gateway/shell/kde/matrix/x-nrjhpucozlnoitze) |
| 2021-05-17 11:05:08 | <xenon-> | dminuoso how do they do it, they just convert String to Text? or they create new typeclasses |
| 2021-05-17 11:08:08 | <boxscape> | is there a version of error that takes an instance of Show instead of a String? |
| 2021-05-17 11:08:45 | <xenon-> | I don't think so |
| 2021-05-17 11:08:48 | <boxscape> | ok |
| 2021-05-17 11:08:53 | <xenon-> | @hoogle Show a => a -> b |
| 2021-05-17 11:08:54 | <lambdabot> | Protolude show :: (Show a, ConvertText String b) => a -> b |
| 2021-05-17 11:08:54 | <lambdabot> | SPARC.Base largeOffsetError :: Show a => a -> b |
| 2021-05-17 11:08:54 | <lambdabot> | Intro show :: (Show a, ConvertString String s) => a -> s |
| 2021-05-17 11:09:21 | <xenon-> | @hoogle String -> a |
All times are in UTC.