2024/11/20

Newest at the top

2024-11-20 19:21:04 +0100 <tomsmeding> well, not really
2024-11-20 19:20:52 +0100 <tomsmeding> no
2024-11-20 19:20:39 +0100 <bwe> that would be type level programming, correct?
2024-11-20 19:20:09 +0100 <tomsmeding> then the return type of fromDBEntry is linked to the _value_ inside the DBEntry
2024-11-20 19:19:54 +0100 <tomsmeding> you could give Variant and DBEntry a type argument indicating what the variant is for (SiteA or SiteB)
2024-11-20 19:19:34 +0100 <tomsmeding> the caller is allowed to choose a1
2024-11-20 19:19:29 +0100 <tomsmeding> same problem
2024-11-20 19:19:17 +0100 <bwe> https://play-haskell.tomsmeding.com/saved/TXQ84gHu
2024-11-20 19:19:01 +0100Unicorn_Princess(~Unicorn_P@user/Unicorn-Princess/x-3540542) Unicorn_Princess
2024-11-20 19:18:49 +0100 <tomsmeding> so this ain't going to work: _you_ want to choose, based on a value inside the DBEntry, what 'a' is, but the type signature of fromDBEntry allows the caller of fromDBEntry to choose 'a'
2024-11-20 19:18:20 +0100 <tomsmeding> bwe: this is getting closer, but something else is still off: in fromDBEntry, you're deciding which variant to return based on siteVariant from the DBEntry, but the _type_ you hvae to return, 'a', is from that Dict (IntoGeneral a) argument
2024-11-20 19:16:57 +0100 <bwe> (it's not compiling, ofc)
2024-11-20 19:16:02 +0100 <bwe> so reversing DataKinds for a moment: https://play-haskell.tomsmeding.com/saved/eaWYsjTO
2024-11-20 19:15:44 +0100tzh(~tzh@c-76-115-131-146.hsd1.or.comcast.net) tzh
2024-11-20 19:13:59 +0100 <tomsmeding> where SiteA and SiteB are actual data types with fields
2024-11-20 19:13:54 +0100 <tomsmeding> bwe: are you perhaps confused because you actually intended to write `data SiteVariant = SiteA SiteA | SiteB SiteB`?
2024-11-20 19:12:45 +0100ash3en(~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) ash3en
2024-11-20 19:12:33 +0100 <tomsmeding> (if you're posting playground snippets, you can check them with a click on a button -- do so ;) )
2024-11-20 19:12:16 +0100 <bwe> so that will be then SiteVariant
2024-11-20 19:12:15 +0100 <tomsmeding> this doesn't typecheck
2024-11-20 19:11:57 +0100 <tomsmeding> still an 'a' left in the return type of fromHTML
2024-11-20 19:11:43 +0100 <bwe> https://play-haskell.tomsmeding.com/saved/hi8Hh5MO
2024-11-20 19:11:35 +0100 <bwe> tomsmeding: You got me :).
2024-11-20 19:10:57 +0100 <tomsmeding> if you want to return the _constructor_ SiteA instead, it should be initSiteA :: SiteVariant
2024-11-20 19:10:28 +0100 <tomsmeding> it is _impossible_ to write an initSiteA that is not undefined
2024-11-20 19:10:14 +0100 <tomsmeding> that function has no definition
2024-11-20 19:10:10 +0100 <tomsmeding> how are you going to write initSiteA?
2024-11-20 19:09:57 +0100 <bwe> tomsmeding: https://play-haskell.tomsmeding.com/saved/dfb9mlT9
2024-11-20 19:09:31 +0100 <tomsmeding> SiteA is not a type of kind Type
2024-11-20 19:09:22 +0100 <tomsmeding> ah with your latest paste, GHC complains as I expect
2024-11-20 19:08:33 +0100 <bwe> so, I had three initiations recently: Proxy, Constraints / withDict and DataKinds
2024-11-20 19:08:19 +0100 <tomsmeding> a _value of type SiteA_, to be precise?
2024-11-20 19:08:09 +0100 <tomsmeding> how are you going to create a SiteA?
2024-11-20 19:08:03 +0100euleritian(~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de)
2024-11-20 19:08:02 +0100 <tomsmeding> bwe: that 'a' return value from fromHTML is suspect
2024-11-20 19:07:48 +0100euleritian(~euleritia@dynamic-176-001-003-233.176.1.pool.telefonica.de) (Read error: Connection reset by peer)
2024-11-20 19:07:32 +0100 <tomsmeding> I see, I haven't followed the discussion, just saw your last post :)
2024-11-20 19:07:06 +0100 <tomsmeding> a type that has no values (because it's not a type of kind Type), hence you can't ask for a value of it in the type of fromHTML
2024-11-20 19:07:02 +0100 <bwe> tomsmeding: yup, but I've started out using withDict before dminuoso proposed to switch to DataKinds
2024-11-20 19:06:26 +0100 <tomsmeding> that SiteA there is in the position where a type is expected, but it's a data constructor; DataKinds lifts it to a type
2024-11-20 19:06:06 +0100 <tomsmeding> bwe: the moment you write `IntoGeneral SiteA` you're using DataKinds
2024-11-20 19:06:03 +0100euleritian(~euleritia@dynamic-176-001-003-233.176.1.pool.telefonica.de)
2024-11-20 19:05:49 +0100 <tomsmeding> bwe: what do you mean with "because not using DataKinds"?
2024-11-20 19:05:23 +0100euleritian(~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 245 seconds)
2024-11-20 19:05:12 +0100 <bwe> tomsmeding: withDict because not using DataKinds
2024-11-20 19:04:13 +0100 <bwe> tomsmeding: https://play-haskell.tomsmeding.com/saved/1d6dIp1u <- actually, if fromHTML generates `SiteVariant` inbetween on the way to produce `General`, I'd like `fromHTML` to return that, too, for debugging purposes.
2024-11-20 19:02:41 +0100 <bwe> tomsmeding: yep, that's what I was after. thanks for the solution.
2024-11-20 18:59:18 +0100lxsameer(~lxsameer@Serene/lxsameer) lxsameer
2024-11-20 18:57:20 +0100peterbecich(~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 260 seconds)
2024-11-20 18:56:58 +0100euleritian(~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de)