Logs: liberachat/#haskell
| 2021-06-01 05:43:37 | → | Bartosz joins (~textual@24.35.90.211) |
| 2021-06-01 05:43:37 | × | Bartosz quits (~textual@24.35.90.211) (Client Quit) |
| 2021-06-01 05:44:41 | × | mustafa quits (~mustafa@rockylinux/releng/mstg) (Ping timeout: 264 seconds) |
| 2021-06-01 05:45:19 | <hololeap> | ok, here's a question that should get to the crux of the issue: if I have a heterogeneous list of types with a Show instance, how can I convert it to a regular list of type [String] ? |
| 2021-06-01 05:45:46 | <hololeap> | *each type in the heterogeneous list has a Show instance |
| 2021-06-01 05:47:47 | <hololeap> | data HList (ts :: [Type]) where ; HNil :: HList '[] ; (:-:) :: Show t => t -> HList ts -> HList (t ': ts) |
| 2021-06-01 05:48:01 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds) |
| 2021-06-01 05:51:33 | → | Bartosz joins (~textual@24.35.90.211) |
| 2021-06-01 05:55:05 | → | nschoe joins (~quassel@91-162-58-134.subs.proxad.net) |
| 2021-06-01 05:57:02 | × | beka quits (~beka@104.193.170-254.PUBLIC.monkeybrains.net) (Ping timeout: 244 seconds) |
| 2021-06-01 05:57:14 | <int-e> | hololeap: https://paste.debian.net/1199557/ ...that doesn't seem to raise any difficulties |
| 2021-06-01 05:58:20 | <int-e> | (well, the function is terribly named) |
| 2021-06-01 05:59:51 | × | nschoe quits (~quassel@91-162-58-134.subs.proxad.net) (Ping timeout: 272 seconds) |
| 2021-06-01 06:00:34 | <Bartosz> | dy: I thought about it and I think real world is not a perfect model for functors. A functor can contain an arbitrary type inside, so as a container it has to be enormous. It must be able to hold an aircraft carrier, the sun, the galaxy, etc. |
| 2021-06-01 06:00:41 | → | Guest6538 joins (~Guest65@2400:8902::f03c:92ff:fe60:98d8) |
| 2021-06-01 06:01:10 | <Guest6538> | I have a simple Parsec question, how to filter comment on this code https://paste.ubuntu.com/p/tSbwNBNxhw/ |
| 2021-06-01 06:02:03 | <int-e> | hololeap: fromHListWith :: (forall a. Show a => a -> b) -> HList ts -> [b] <--this type may be more to the point. |
| 2021-06-01 06:02:03 | <Guest6538> | it parses something like "a=b" is ok, but I'd like to ignore like "--comment" |
| 2021-06-01 06:03:02 | → | vicentius joins (~vicentius@user/vicentius) |
| 2021-06-01 06:04:49 | <dy> | Bartosz: so functors are hammerspace :p |
| 2021-06-01 06:04:59 | × | amk quits (~amk@176.61.106.150) (Ping timeout: 252 seconds) |
| 2021-06-01 06:05:53 | → | amk joins (~amk@176.61.106.150) |
| 2021-06-01 06:08:46 | <hololeap> | hm, actually my original idea seems to work without the (forall ts. ...) surrounding the tree and forest data types |
| 2021-06-01 06:09:49 | × | vicentius quits (~vicentius@user/vicentius) (Quit: Leaving) |
| 2021-06-01 06:11:28 | → | manicennui joins (uid349235@id-349235.tinside.irccloud.com) |
| 2021-06-01 06:15:34 | → | _ht joins (~quassel@82-169-194-8.biz.kpn.net) |
| 2021-06-01 06:15:42 | <hololeap> | dy: I think comonads are hammerspace. those are things you can always pull something out of |
| 2021-06-01 06:16:24 | <dminuoso> | Guest6538: https://hackage.haskell.org/package/parsec-3.1.14.0/docs/Text-Parsec-Token.html |
| 2021-06-01 06:18:19 | <dminuoso> | Guest6538: Alternatively you can just reimplement the `space` combinator from megaparsec, it's really trivial |
| 2021-06-01 06:18:43 | <dminuoso> | And adopt the rule that you always use `space` before or after (pick one!) each lexeme |
| 2021-06-01 06:20:54 | <dy> | More concretely (hah) you can also just parse a CST (concrete syntax tree) first and then map it to the AST you want. |
| 2021-06-01 06:21:26 | <dy> | The distinction with a CST is that there exists a bijection from it to/from the original source. |
| 2021-06-01 06:21:38 | → | danso joins (~danso@23-233-111-52.cpe.pppoe.ca) |
| 2021-06-01 06:21:40 | → | dyeplexer joins (~dyeplexer@user/dyeplexer) |
| 2021-06-01 06:22:10 | → | nschoe joins (~quassel@91-162-58-134.subs.proxad.net) |
| 2021-06-01 06:22:24 | <dminuoso> | Mmm, usually a CST does not contain whitespace or comments. |
| 2021-06-01 06:24:09 | <Guest6538> | dminuoso, can I just use parsec to implement that? I don't install megaparsec yet |
| 2021-06-01 06:24:13 | <dminuoso> | Guest6538: Yes. |
| 2021-06-01 06:24:20 | <dy> | They don't contain whitespace but they do contain token positions you could recreate the whitespace from |
| 2021-06-01 06:24:26 | <dminuoso> | https://hackage.haskell.org/package/megaparsec-9.0.1/docs/src/Text.Megaparsec.Lexer.html#space |
| 2021-06-01 06:24:31 | <dy> | Comments otoh are usually in CSTs, at least in my e Irwin en |
| 2021-06-01 06:24:31 | × | Bartosz quits (~textual@24.35.90.211) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-06-01 06:24:35 | <dy> | My experience* |
| 2021-06-01 06:26:13 | <hololeap> | hm, here's an interesting one: a class function where instances occasionally need extra arguments passed in, in order to produce the desired output. |
| 2021-06-01 06:26:41 | <dy> | hololeap: as an example of...? |
| 2021-06-01 06:27:01 | × | nschoe quits (~quassel@91-162-58-134.subs.proxad.net) (Ping timeout: 268 seconds) |
| 2021-06-01 06:27:14 | <hololeap> | I'm just thinking of ways to implement this |
| 2021-06-01 06:27:26 | <dy> | I missed the context/not in my backlog |
| 2021-06-01 06:27:34 | <hololeap> | no context :p |
| 2021-06-01 06:27:45 | <dy> | What are you trying to implement? |
| 2021-06-01 06:27:55 | <hololeap> | what I just described |
| 2021-06-01 06:28:14 | <dy> | Do you mean class as in typeclass? |
| 2021-06-01 06:28:18 | <dy> | Or like more traditional class? |
| 2021-06-01 06:28:23 | <hololeap> | no, a typeclass |
| 2021-06-01 06:28:32 | <dy> | I'm reminded of how printf works in Haskell |
| 2021-06-01 06:28:51 | <hololeap> | hm, yeah that should be a good example to look at |
| 2021-06-01 06:29:23 | → | nschoe joins (~quassel@91-162-58-134.subs.proxad.net) |
| 2021-06-01 06:29:57 | <dy> | The trick there is recursion at the instance definition level I believe |
| 2021-06-01 06:30:34 | <dy> | But I don't think Printf is actually properly type safe. |
| 2021-06-01 06:30:55 | → | leeb_ joins (~leeb@KD111239153130.au-net.ne.jp) |
| 2021-06-01 06:30:59 | <dy> | Would require dependent types to be properly type safe I think. |
| 2021-06-01 06:31:16 | → | cheater1__ joins (~Username@user/cheater) |
| 2021-06-01 06:31:20 | → | lortabac joins (~lortabac@2a01:e0a:541:b8f0:bdf8:f228:7df7:147f) |
| 2021-06-01 06:31:31 | × | cheater quits (~Username@user/cheater) (Ping timeout: 272 seconds) |
| 2021-06-01 06:31:34 | <hololeap> | I have 23 language extensions enabled in my module right now :p |
| 2021-06-01 06:31:37 | cheater1__ | is now known as cheater |
| 2021-06-01 06:31:59 | <dy> | I think I heard something about dependent typing coming to mainline GHC? |
| 2021-06-01 06:32:03 | <dy> | I feel like that's... probably going to be messy. |
| 2021-06-01 06:32:12 | <dy> | Refinement types seem a better Pareto optimal choice. |
| 2021-06-01 06:32:25 | <hololeap> | nah |
| 2021-06-01 06:32:30 | → | Toast52 joins (~Toast52@151.192.167.120) |
| 2021-06-01 06:32:48 | <Guest6538> | why there's char in parsec, but not string? use satisfy to match a string? |
| 2021-06-01 06:32:54 | <dy> | Refinement types are a bit more intuitive and map nicely to more traditional notions of code contracts. |
| 2021-06-01 06:32:55 | <hololeap> | most of them are quite safe, except maybe AllowAmbiguousTypes and NoMonomorphismRestriction |
| 2021-06-01 06:33:29 | <dy> | There comes a day in every Haskell programmer's life when they just have to give up and enable NoMonomorphismRestricfion :p |
| 2021-06-01 06:33:35 | × | leeb quits (~leeb@KD111239155018.au-net.ne.jp) (Ping timeout: 252 seconds) |
| 2021-06-01 06:33:35 | <dy> | Perhaps for reasons they do not understand. |
| 2021-06-01 06:33:44 | → | mustafa joins (~mustafa@rockylinux/releng/mstg) |
| 2021-06-01 06:33:47 | <dminuoso> | Uh. No? |
| 2021-06-01 06:34:01 | <dy> | It's a joke. |
| 2021-06-01 06:34:12 | <[exa]> | Guest6538: https://hackage.haskell.org/package/megaparsec-9.0.1/docs/Text-Megaparsec-Char.html#v:string ? |
| 2021-06-01 06:34:19 | <dy> | Just one of those extensions I've seen people enable blindly after seeing error messages mentioning it a lot. |
| 2021-06-01 06:34:26 | <Guest6538> | [exa] I mean in parsec |
| 2021-06-01 06:34:30 | <dminuoso> | Curious, I have not seen this behavior. |
| 2021-06-01 06:34:42 | <[exa]> | Guest6538: uh sorry I'm aliasing the names automatically now :D |
| 2021-06-01 06:34:43 | → | ru0mad joins (~ru0mad@82-64-17-144.subs.proxad.net) |
| 2021-06-01 06:34:45 | <dminuoso> | Guest6538: https://hackage.haskell.org/package/parsec-3.1.14.0/docs/Text-Parsec-Char.html#v:string |
| 2021-06-01 06:35:05 | <Guest6538> | ok, my mistake |
| 2021-06-01 06:35:06 | × | nschoe quits (~quassel@91-162-58-134.subs.proxad.net) (Ping timeout: 264 seconds) |
| 2021-06-01 06:35:22 | <[exa]> | yap there it is :] |
| 2021-06-01 06:36:24 | <[exa]> | even if not, you could easily construct it, roughly as `traverse char` |
| 2021-06-01 06:37:20 | → | neceve joins (~quassel@2a02:c7f:607e:d600:a95a:ecd2:e57a:3130) |
| 2021-06-01 06:37:58 | <dminuoso> | string s = tokens show updatePosString s |
| 2021-06-01 06:38:29 | × | mustafa quits (~mustafa@rockylinux/releng/mstg) (Ping timeout: 272 seconds) |
| 2021-06-01 06:38:32 | <dminuoso> | If you naively just parse each character, you'll get horrid error messages. |
| 2021-06-01 06:38:41 | → | sondre joins (~sondrelun@cm-84.212.100.140.getinternet.no) |
| 2021-06-01 06:39:11 | → | azeem joins (~azeem@dynamic-adsl-84-220-228-254.clienti.tiscali.it) |
| 2021-06-01 06:39:26 | <dminuoso> | Rather than `expected "foobar"`, it would tell you `expected 'b'`, which for more complex strings is not going to be very helpful |
| 2021-06-01 06:39:56 | <dminuoso> | And if there's any <|>, you might not even know what's going on if the character could come from any of the choices. |
| 2021-06-01 06:40:22 | <[exa]> | yeah that's the "roughly" warning. :] |
All times are in UTC.