Newest at the top
2024-11-20 17:12:15 +0100 | <bwe> | dminuoso: I am just before that fun bit :). |
2024-11-20 17:12:13 +0100 | <dminuoso> | You decide. :-) |
2024-11-20 17:11:54 +0100 | <dminuoso> | bwe: Hey, we're just exploring for fun, right? |
2024-11-20 17:11:46 +0100 | <dminuoso> | Square2: Are they motivated to learn Haskell? |
2024-11-20 17:11:43 +0100 | <bwe> | dminuoso: so we drop withDict or not? |
2024-11-20 17:11:38 +0100 | <Square2> | dminuoso, Yeah, I feel it could be a uphill battle. Some are probably not up to it. |
2024-11-20 17:11:35 +0100 | <dminuoso> | bwe: I think we just ended up on a fun journey about constraints due to an XY problem. ;) |
2024-11-20 17:10:57 +0100 | <dminuoso> | Square2: Having onboarded a bunch of people onto Haskell, Id say it depends very much on the company culture and the people. |
2024-11-20 17:10:50 +0100 | Alleria | (~Alleria@user/alleria) (Quit: Textual IRC Client: www.textualapp.com) |
2024-11-20 17:10:07 +0100 | <dminuoso> | bwe: Right. |
2024-11-20 17:09:59 +0100 | <Square2> | I might get into the situation of making my department of 50 (12 devs) adapt Haskell. It's a bit scary tbh. How to onboard people who mostly programmed java past 15 years. |
2024-11-20 17:09:56 +0100 | <bwe> | but this will be no more instance but normal function, right? |
2024-11-20 17:09:15 +0100 | <dminuoso> | Ultimately all you need is just `fromHTML :: SiteVariant -> ByteString -> General` of couerse. |
2024-11-20 17:08:58 +0100 | <dminuoso> | This is all getting really strange, at the end. |
2024-11-20 17:08:38 +0100 | <dminuoso> | So Im thinking maybe a HasDict instance. |
2024-11-20 17:08:19 +0100 | <bwe> | ay, what's next? |
2024-11-20 17:07:59 +0100 | <dminuoso> | Right. |
2024-11-20 17:07:55 +0100 | <bwe> | (while `SiteA` and `SiteB` continue to exist on the data level, too) |
2024-11-20 17:06:29 +0100 | <dminuoso> | bwe: DataKind promotes `SiteVariant` into a Kind, and conjures types `SiteA :: SiteVariant` and `SiteB :: SiteVariant` |
2024-11-20 17:05:38 +0100 | alp_ | (~alp@2001:861:8ca0:4940:fc9d:90cc:a5de:4f14) |
2024-11-20 17:05:37 +0100 | <bwe> | is DataKinds just using the type as a type and not to carry its value? |
2024-11-20 17:05:15 +0100 | <bwe> | https://play-haskell.tomsmeding.com/saved/M98rHWtW |
2024-11-20 17:03:56 +0100 | <yahb2> | SiteA :: SiteVariant |
2024-11-20 17:03:56 +0100 | <dminuoso> | % :k SiteA |
2024-11-20 17:03:52 +0100 | <yahb2> | <no output> |
2024-11-20 17:03:52 +0100 | <dminuoso> | % data SiteVariant = SiteA | SiteB |
2024-11-20 17:03:41 +0100 | <yahb2> | <no output> |
2024-11-20 17:03:41 +0100 | <dminuoso> | % :set -XDataKinds |
2024-11-20 17:03:33 +0100 | <dminuoso> | bwe: Then flip on DataKinds, this way you suddenly get these magic types `A` and `B` |
2024-11-20 17:03:15 +0100 | <dminuoso> | bwe: So first, get rid of SiteA and SiteB datatypes. |
2024-11-20 17:02:24 +0100 | <bwe> | so how to apply this now… |
2024-11-20 17:02:09 +0100 | <dminuoso> | Its pretty much the same thing. :) |
2024-11-20 17:02:06 +0100 | <lambdabot> | a -> (a -> c) -> c |
2024-11-20 17:02:05 +0100 | <dminuoso> | :t flip ($) |
2024-11-20 17:02:00 +0100 | <lambdabot> | (a -> b) -> a -> b |
2024-11-20 17:01:59 +0100 | <dminuoso> | :t ($) |
2024-11-20 17:01:56 +0100 | <dminuoso> | Exactly. Its really just like function application |
2024-11-20 17:01:45 +0100 | <bwe> | Whatever Dict carries, withDict discharges from the second argument |
2024-11-20 17:01:44 +0100 | <dminuoso> | With `constraints` you make it explicit and controllable |
2024-11-20 17:01:36 +0100 | <dminuoso> | Except all that dictionary passing happens just invisibly and automatically under the hood. |
2024-11-20 17:01:11 +0100 | <dminuoso> | bwe: Under the hood `C =>` becomes really just some sort of function argument that takes a some actual dictionary. |
2024-11-20 17:01:10 +0100 | <bwe> | now it clicks. Dict __(Bar a) -> (__Bar a__ => Int) -> Int |
2024-11-20 17:00:24 +0100 | <dminuoso> | Yup, thats it. |
2024-11-20 17:00:12 +0100 | <bwe> | withDict :: Dict (Bar a) -> (Bar a => Int) -> Int |
2024-11-20 17:00:11 +0100 | <dminuoso> | "Assuming we have a reified dictionary for constraint c, and some r that needs a dictionary c, this discharges the `c =>` constraint and gives you the r back. |
2024-11-20 16:59:33 +0100 | <dminuoso> | (And in fact there exists an instance that allows you to use it as such) |
2024-11-20 16:59:18 +0100 | <dminuoso> | Which is the simpler form. |
2024-11-20 16:59:13 +0100 | <dminuoso> | bwe: Lets pretend withDict :: Dict c -> (c => r) -> r |
2024-11-20 16:59:12 +0100 | <bwe> | dminuoso: first I want to grasp `withDict` :) |
2024-11-20 16:58:32 +0100 | <bwe> | so what's `e` then? |