Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 726 727 728 729 730 731 732 733 734 735 736 .. 18018
1,801,726 events total
2021-07-01 00:58:55 willbush joins (~user@47.183.200.14)
2021-07-01 01:02:28 × MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 272 seconds)
2021-07-01 01:02:46 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-07-01 01:03:54 × pbrisbin quits (~patrick@pool-173-49-147-28.phlapa.fios.verizon.net) (Ping timeout: 240 seconds)
2021-07-01 01:05:14 × chomwitt quits (~Pitsikoko@2a02:587:dc0b:0:d8f7:cdfe:4658:bec4) (Ping timeout: 256 seconds)
2021-07-01 01:05:30 × favonia quits (~favonia@user/favonia) (Ping timeout: 240 seconds)
2021-07-01 01:07:33 <dsal> I have a really dumb basic question. I've been doing a bit of refactoring around an API change I made and I found myself doing `Just x = ...` in a where clause once or twice. I realized I don't exactly understand what that does.
2021-07-01 01:07:43 <dsal> Can someone help my mental model be a bit more complete here?
2021-07-01 01:08:17 machinedgod joins (~machinedg@24.105.81.50)
2021-07-01 01:08:40 <Axman6> it's an irrefutable pattern match, it basically creates code that looks like case ... of Just x -> <define x>; Nothing -> error "pattern match failed"
2021-07-01 01:09:08 <Axman6> it's generally not a safe thing to do, but if you know the result is guaranteed to be Just, it's fine
2021-07-01 01:09:44 <dsal> Yeah, I think I understood the safety of it and stuff, I just had a bit of trouble understanding what it actually did. My mental model isn't quite right there.
2021-07-01 01:09:46 × MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 256 seconds)
2021-07-01 01:10:04 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-07-01 01:10:14 favonia joins (~favonia@user/favonia)
2021-07-01 01:10:35 <Axman6> it's just a pattern match, the same as you can do let (x,y) = (x0+1,y0+2) to give definitions for x and y
2021-07-01 01:11:23 <dsal> I guess it doesn't make sense to ask what to do if it's `Nothing` because there's no `x` to name.
2021-07-01 01:11:39 <c_wraith> Whoa.. it's not like that case expression in one important detail
2021-07-01 01:12:00 <c_wraith> It's an irrefutable match, which means that unlike a case statement, it won't be evaluated before choosing a branch
2021-07-01 01:12:01 <Axman6> it throws an error
2021-07-01 01:12:18 <c_wraith> the pattern match is only done when x is evaluated
2021-07-01 01:12:32 <Nolrai> So, are Control.Lens style lenses worth using? I am using them with a small/medium size project and they just seem to make refactoring harder.
2021-07-01 01:12:38 hammock joins (~Hammock@2600:1700:19a1:3330::625)
2021-07-01 01:12:38 <dsal> I think that's also part of my confusion. So when does stuff break?
2021-07-01 01:12:53 <c_wraith> > let Just x = Nothing in "hello"
2021-07-01 01:12:54 <lambdabot> "hello"
2021-07-01 01:13:05 <c_wraith> > case Nothing of Just x -> "hello"
2021-07-01 01:13:07 <lambdabot> "*Exception: <interactive>:(3,1)-(4,22): Non-exhaustive patterns in case
2021-07-01 01:13:11 <Axman6> > let Just x = Nothing in x + 1 :: Int
2021-07-01 01:13:13 <lambdabot> *Exception: <interactive>:3:5-20: Non-exhaustive patterns in Just x
2021-07-01 01:13:16 <Nolrai> @c_wraith so its more like `do ~(x, y) = `
2021-07-01 01:13:16 <lambdabot> Unknown command, try @list
2021-07-01 01:13:32 <c_wraith> yes, ~ is how you explicitly introduce irrefutable matches
2021-07-01 01:13:42 <c_wraith> > case Nothing of ~(Just x) -> "hello"
2021-07-01 01:13:44 <lambdabot> "hello"
2021-07-01 01:14:14 <dsal> Nolrai: what do you find is harder in refactoring lens?
2021-07-01 01:15:00 × Morrow quits (~MorrowM_@147.161.13.35) (Read error: Connection reset by peer)
2021-07-01 01:15:21 MorrowM joins (~MorrowM_@147.161.13.35)
2021-07-01 01:15:47 falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net)
2021-07-01 01:15:49 <c_wraith> it's funny, the lens laws exist specifically so that you can refactor without thinking about it. (this is the problem law-breaking optics cause - you have to think when you refactor)
2021-07-01 01:16:14 <Axman6> yeah also curious what problems you're running into Nolrai
2021-07-01 01:16:44 × MorrowM quits (~MorrowM_@147.161.13.35) (Remote host closed the connection)
2021-07-01 01:17:30 × xff0x quits (~xff0x@2001:1a81:53f8:b100:933a:3ba5:1174:9474) (Ping timeout: 240 seconds)
2021-07-01 01:17:31 Morrow joins (~MorrowM_@147.161.13.35)
2021-07-01 01:19:34 <Nolrai> Hmm. Actually this is really weird, hmm. I am not sure its the Lens librarie's fault, function arguments just seem to be missing all over the place. What did I do?!?
2021-07-01 01:19:44 xff0x joins (~xff0x@2001:1a81:5237:1000:d9df:afaf:2f58:a5ba)
2021-07-01 01:20:50 <Nolrai> It doesn't help that the VSCode Haskell plugin keeps crashing or hanging.
2021-07-01 01:21:53 <dsal> Every time I `type X = Y` something and then go back and change `X` to a `newtype`, I find all kinds of places I got sloppy. I am beginning to consider `type` harmful.
2021-07-01 01:21:54 × Morrow quits (~MorrowM_@147.161.13.35) (Ping timeout: 240 seconds)
2021-07-01 01:22:14 <Nolrai> I consider type harmful.
2021-07-01 01:22:32 <Cale> Mostly it is, yeah
2021-07-01 01:22:43 <Nolrai> Or rather it should only be used for abreviations.
2021-07-01 01:23:22 <Cale> I think Lens can kind of get away with it only because what its synonyms unfold to is pretty uniform, and you sort of know to expect them
2021-07-01 01:23:30 × favonia quits (~favonia@user/favonia) (Ping timeout: 240 seconds)
2021-07-01 01:23:36 <Nolrai> Yeah.
2021-07-01 01:24:47 <Cale> That said, I do think people overuse lenses to death a lot of the time. They certainly have their places, but if there's a reasonable way to not use Lens in any given scenario, then I probably won't.
2021-07-01 01:24:54 <Nolrai> Hmm. I mean I don't think HSpec's `type Spec = SpecM ()` I think its dumb because it only saves 3 characters, so is a bad abreviation, but its an example of something that isn't harmful the way many uses of `type` are.
2021-07-01 01:25:08 <Nolrai> * is harmful.
2021-07-01 01:25:14 favonia joins (~favonia@user/favonia)
2021-07-01 01:25:47 <Cale> Yeah, why not just rename SpecM to Spec and then get rid of the synonym, and write Spec () a bit?
2021-07-01 01:25:57 <c_wraith> I dislike any type alias that looks like it has a different kind than the expression it expands to
2021-07-01 01:26:11 stevenxl_ joins (~stevenlei@68.235.43.101)
2021-07-01 01:26:29 <c_wraith> kinds are important documentation, too!
2021-07-01 01:26:38 <Nolrai> That makes sense.
2021-07-01 01:27:08 <Cale> Example of that?
2021-07-01 01:27:27 <c_wraith> type Foo m = FooT m ()
2021-07-01 01:27:42 <Cale> ah, yeah, that's kinda gross
2021-07-01 01:27:48 × falafel quits (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) (Ping timeout: 272 seconds)
2021-07-01 01:27:53 <monochrom> Finally my opinion is not unpopular. >:)
2021-07-01 01:28:22 <Nolrai> Is there a less awful way to do this `let [a,b,c,d,e,f] = bitToRB w <$> [0..5] in Cell a b c d e f` ?
2021-07-01 01:29:18 <monochrom> "type alias = failing to make up your mind whether you want an abstraction or not" before it was cool.
2021-07-01 01:29:23 <Nolrai> Heh.
2021-07-01 01:29:28 × stevenxl quits (~stevenlei@68.235.43.157) (Ping timeout: 258 seconds)
2021-07-01 01:30:17 <Nolrai> Yeah, I am pretty sure if it wasn't part of the language from the beginning, it wouldn't be getting put in.
2021-07-01 01:31:44 <Cale> monochrom: Yeah, and the thing is, it perhaps *could* have been a nice means of abstraction in conjunction with the module system, if it were treated a little differently
2021-07-01 01:32:09 <monochrom> That is true. CLU and SML do it properly.
2021-07-01 01:32:27 <c_wraith> Also, I don't understand any of the type aliases in Template Haskell. ExpQ is not better than Q Exp
2021-07-01 01:32:27 × carbolymer quits (~carbolyme@dropacid.net) (Read error: Connection reset by peer)
2021-07-01 01:32:41 <monochrom> internal to your module it's an alias. When exported it's a newtype to your user.
2021-07-01 01:32:55 <Cale> c_wraith: Not only do I agree, but I hate that entire module of lower-cased versions of everything
2021-07-01 01:33:10 <monochrom> CLU is why I like Liskov.
2021-07-01 01:33:17 carbolymer joins (~carbolyme@dropacid.net)
2021-07-01 01:33:25 <Cale> It's like, a module of stuff for people who are uncomfortable with using monads
2021-07-01 01:33:49 <c_wraith> typing "return" adds a bunch of letters!
2021-07-01 01:34:00 <Cale> Which is probably why it exists to begin with, because it was constructed at a time when everyone was not entirely comfortable with monads
2021-07-01 01:34:23 × raoul quits (~raoul@nomnomnomnom.co.uk) (Quit: The Lounge - https://thelounge.github.io)
2021-07-01 01:35:42 <monochrom> Haskellers uncomfortable with monads. Almost sounds like an oxymoron.
2021-07-01 01:36:08 <monochrom> Consider pythonistas uncomfortable with objects and assignment statements.
2021-07-01 01:36:29 <monochrom> Dennis Ritchie uncomfortable with pointers.
2021-07-01 01:36:34 <Cale> We also need to get more actually useful stuf into Template Haskell
2021-07-01 01:36:58 <jao> lispers uncomfortable with parentheses
2021-07-01 01:36:59 <c_wraith> typed template haskell is in a really awkward spot right now. Though at least liftTyped exists now
2021-07-01 01:38:05 <Cale> Like, did you know that reifyInstances, when given a type that has type variables in it, will find all instances which unify with those variables, and if you want those variables not to be specialised, you have to pull some skolemization trickery by hand?
2021-07-01 01:38:11 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-07-01 01:38:50 <Cale> I sure do, since it ends up being something I need to do every time I use TH
2021-07-01 01:39:09 <Axman6> Anyone know if there's an IRC channel for Rel8?
2021-07-01 01:40:13 <Cale> Also, this is quite fancy, but I'd really love to have more ways to interact with the type checker while building declarations and expressions in TH
2021-07-01 01:40:35 <Cale> It would be really nice to be able to build an expression and ask "if I were to declare this, what type would you infer for it"?
2021-07-01 01:41:15 <Cale> 99% of the work of any TH I write is figuring out what constraints go in my instance head.
2021-07-01 01:41:42 × hnOsmium0001 quits (uid453710@id-453710.stonehaven.irccloud.com) (Quit: Connection closed for inactivity)

All times are in UTC.