Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 550 551 552 553 554 555 556 557 558 559 560 .. 18007
1,800,686 events total
2021-06-20 09:05:49 <qrpnxz> obv i don't want to repeat myself is the point of the question
2021-06-20 09:06:20 <boxscape> qrpnxz there have been some efforts in the past to allow branches that match multiple patterns, but they haven't gone anywhere so far
2021-06-20 09:06:31 elf_fortrez joins (~elf_fortr@adsl-64-237-239-58.prtc.net)
2021-06-20 09:06:54 <qrpnxz> of all things, didn't expect the good ol' switch statement to be the thing haskell didn't have
2021-06-20 09:06:56 <qrpnxz> amazin
2021-06-20 09:07:32 <boxscape> in practice I tend to something like `case x of A -> foo; B -> something; C -> foo; D -> foo where foo = ...`
2021-06-20 09:07:42 <boxscape> s/to/to do
2021-06-20 09:07:44 yd502_ joins (~yd502@114.85.148.68)
2021-06-20 09:08:25 <qrpnxz> yeah i was planning pretty much doing that thx
2021-06-20 09:08:38 × yd502 quits (~yd502@114.85.148.68) (Ping timeout: 252 seconds)
2021-06-20 09:09:02 <boxscape> qrpnxz this is the proposal btw which got a lot of support but was given up on by the author https://github.com/ghc-proposals/ghc-proposals/pull/43
2021-06-20 09:12:27 <qrpnxz> hmm, seems like they had trouble adding it, maybe one day
2021-06-20 09:12:29 × sh9 quits (~sh9@softbank060116136158.bbtec.net) (Read error: Connection reset by peer)
2021-06-20 09:13:02 fendor joins (~fendor@77.119.128.145.wireless.dyn.drei.com)
2021-06-20 09:13:19 <boxscape> yeah
2021-06-20 09:13:48 <dminuoso> Im just a bit sad that we have to retrofit this into existing syntax. :(
2021-06-20 09:14:09 ddellacosta joins (~ddellacos@86.106.121.100)
2021-06-20 09:14:25 × Kaiepi quits (~Kaiepi@nwcsnbsc03w-47-54-173-93.dhcp-dynamic.fibreop.nb.bellaliant.net) (Remote host closed the connection)
2021-06-20 09:14:51 <boxscape> that's fair, but I actually think the proposed syntax isn't too bad
2021-06-20 09:15:01 <boxscape> I suppose ideally you'd be able to use | instead of ;
2021-06-20 09:15:05 <boxscape> which isn't possible anymore
2021-06-20 09:15:25 <dminuoso> Can you align ; with the opening ( in all cases?
2021-06-20 09:15:35 <boxscape> hmm that's a good question, I don't know
2021-06-20 09:15:37 <dminuoso> If not, I will refuse to use this. :-)
2021-06-20 09:15:45 <dminuoso> Can't break my indention/alignment habits
2021-06-20 09:16:05 <dminuoso> Was pretty annoyed when I couldn't do this with do-pattern matching
2021-06-20 09:17:19 <boxscape> just use explicit layout and you can indent however you want :P
2021-06-20 09:18:01 <qrpnxz> > (flip.when) :: Bool -> b -> (b -> ()) -> ()
2021-06-20 09:18:01 <qrpnxz> wtf?
2021-06-20 09:18:03 <lambdabot> error:
2021-06-20 09:18:03 <lambdabot> • No instance for (Typeable b0)
2021-06-20 09:18:03 <lambdabot> arising from a use of ‘show_M72879048522121107737’
2021-06-20 09:18:17 _ht joins (~quassel@82-169-194-8.biz.kpn.net)
2021-06-20 09:18:32 × ddellacosta quits (~ddellacos@86.106.121.100) (Ping timeout: 252 seconds)
2021-06-20 09:18:41 <dminuoso> qrpnxz: lambdabot tries to show that function.
2021-06-20 09:18:51 <qrpnxz> ok
2021-06-20 09:19:13 <boxscape> :t (flip.when)
2021-06-20 09:19:14 <lambdabot> Bool -> b -> (b -> ()) -> ()
2021-06-20 09:19:16 <dminuoso> qrpnxz: and lambdabot presumably has some (Show a, Typeable b) => Show (b -> a)` instance
2021-06-20 09:19:29 <dminuoso> Or some such?
2021-06-20 09:20:06 <qrpnxz> :t when
2021-06-20 09:20:08 <lambdabot> Applicative f => Bool -> f () -> f ()
2021-06-20 09:20:17 <qrpnxz> this makes no sense
2021-06-20 09:20:25 <boxscape> > \'a' -> 'b'
2021-06-20 09:20:27 <lambdabot> <Char -> Char>
2021-06-20 09:20:30 <dminuoso> qrpnxz: anyway. The problem is you're trying to evaluate it, so that means lamdabot tries to "wrap it with show"
2021-06-20 09:20:32 <boxscape> I didn't even know lambdabot does that
2021-06-20 09:20:42 <qrpnxz> i mean the type of flip.when makes no sense
2021-06-20 09:20:46 <dminuoso> % :t flip.when
2021-06-20 09:20:47 <yahb> dminuoso: Bool -> b -> (b -> ()) -> ()
2021-06-20 09:20:48 <qrpnxz> not really paying attention to lambdabot
2021-06-20 09:20:52 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 258 seconds)
2021-06-20 09:21:01 <dminuoso> % :t when
2021-06-20 09:21:01 <yahb> dminuoso: Applicative f => Bool -> f () -> f ()
2021-06-20 09:21:12 <dminuoso> % :t flip
2021-06-20 09:21:13 <yahb> dminuoso: (a -> b -> c) -> b -> a -> c
2021-06-20 09:21:30 <dminuoso> qrpnxz: There is an Applicative instance for ((->) a)
2021-06-20 09:21:55 <qrpnxz> rip
2021-06-20 09:22:02 <qrpnxz> what a freak even
2021-06-20 09:22:06 <qrpnxz> gonna have to do it by hand
2021-06-20 09:22:07 <qrpnxz> :(
2021-06-20 09:22:10 <qrpnxz> *event
2021-06-20 09:23:30 <dminuoso> qrpnxz: Consider: when returns something `f ()`, if we set `f ~ ((a) ->), when :: (a -> ()) -> a -> ()
2021-06-20 09:23:46 <dminuoso> Oh, missing a Bool
2021-06-20 09:23:53 <dminuoso> when :: Bool -> (a -> ()) -> a -> ()
2021-06-20 09:24:01 × Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer)
2021-06-20 09:24:17 × justsomeguy quits (~justsomeg@user/justsomeguy) (Quit: WeeChat 3.0.1)
2021-06-20 09:26:45 <dminuoso> boxscape: Admit, this just looks wrong: https://gist.github.com/dminuoso/a211db82b4ec14e12941bfcbaf1815b6
2021-06-20 09:26:57 <boxscape> yes
2021-06-20 09:27:12 <dminuoso> In my code I just make the pattern match irrefutable just to satisfy my need to align everything nicely
2021-06-20 09:27:13 sh9 joins (~sh9@softbank060116136158.bbtec.net)
2021-06-20 09:27:34 mcglk joins (~mcglk@131.191.49.120)
2021-06-20 09:27:40 <boxscape> hm nice trick
2021-06-20 09:29:18 <dminuoso> To be honest, the real reason for all of this is because Im too lazy to create intermediate data types. In the original code just have `pure Foo{..}` at the end
2021-06-20 09:30:07 <dminuoso> The code to the right of the bind uses a nested section parser that needs to be wrapped, so I cant just have `foo <- ...; bar <- ...; baz <- ...;`
2021-06-20 09:31:10 <dminuoso> Plus, if you want to do this inside ApplicativeDo, you must have the irrefutable pattern match anyway. And I use this trick in optparse-applicative in the very same project as well..
2021-06-20 09:32:17 <boxscape> The _real_ reason for all this is that we still use ASCII strings to notate programs when we could be using interfaces actually based on ASTs :P
2021-06-20 09:32:39 fizbin joins (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net)
2021-06-20 09:33:36 <dminuoso> Reminds me of the Haskell Weekly episode with Sandy Maguire, talking about Wingman
2021-06-20 09:33:51 <dminuoso> They talked about exactly this situation, part of what inspired Wingman
2021-06-20 09:34:58 <boxscape> there was someone a few years ago who made an interface like that which worked with a subset of haskell, but I don't remember what it was called
2021-06-20 09:37:09 × fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Ping timeout: 265 seconds)
2021-06-20 09:37:56 <dminuoso> The argument made in the podcast, was that one of the main things making writing Haskell on a tablet in the parket problematic, is how we denote so much of a program as just strings
2021-06-20 09:38:26 <dminuoso> (And apparently wingman was born out of the idea "couldn't we make it possible to write haskell programs on a tablet")
2021-06-20 09:40:42 × _xor quits (~xor@74.215.46.133) (Quit: brb)
2021-06-20 09:41:30 <boxscape> The main issue I see is that you probably still have to write down names of things, which would be much slower on a tablet, at least for me
2021-06-20 09:42:24 <boxscape> I've been idly wondering if you could get some benefit from a VR-based interface, but the same thing about names applies, unless you manage to make naming based on voice recognition work or something
2021-06-20 09:45:59 <dminuoso> For a lot of code we usually refer to existing names.
2021-06-20 09:46:17 <dminuoso> And the AST structure is fixed, which is why a string to represent programs is not ideal
2021-06-20 09:46:24 × nilof quits (~olofs@90-227-86-119-no542.tbcn.telia.com) (Ping timeout: 252 seconds)
2021-06-20 09:46:34 <dminuoso> Like, if you write a case-of, you can only ever write whatever production rules the grammar has for you
2021-06-20 09:46:47 <dminuoso> So you could just offer these production rules with some nice interface
2021-06-20 09:46:53 <boxscape> yeah
2021-06-20 09:48:14 × micro quits (~micro@user/micro) (Remote host closed the connection)
2021-06-20 09:50:41 micro joins (~micro@user/micro)
2021-06-20 09:52:21 × hendursa1 quits (~weechat@user/hendursaga) (*.net *.split)
2021-06-20 09:52:21 × gehmehgeh quits (~user@user/gehmehgeh) (*.net *.split)
2021-06-20 09:52:21 × chexum quits (~chexum@gateway/tor-sasl/chexum) (*.net *.split)
2021-06-20 09:52:21 × bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (*.net *.split)
2021-06-20 09:52:21 × adanwan quits (~adanwan@gateway/tor-sasl/adanwan) (*.net *.split)

All times are in UTC.