2024/11/20

Newest at the top

2024-11-20 19:28:05 +0100peterbecich(~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich
2024-11-20 19:26:13 +0100ljdarj1(~Thunderbi@user/ljdarj) ljdarj
2024-11-20 19:26:10 +0100 <tomsmeding> just make a new sum type with the possible pages inside
2024-11-20 19:25:32 +0100 <tomsmeding> bwe: what about a low-tech option? https://play-haskell.tomsmeding.com/saved/au6S9SPc
2024-11-20 19:23:44 +0100 <bwe> are we getting closer to X of XY :) ?
2024-11-20 19:23:25 +0100 <bwe> then loading that from DB, channelling it into different parsing machinery depending on `Variant`, which eventually culminates into `General` which is abstract, again
2024-11-20 19:22:50 +0100euleritian(~euleritia@ip4d16fc9f.dynamic.kabel-deutschland.de) (Ping timeout: 244 seconds)
2024-11-20 19:22:31 +0100 <tomsmeding> right, so you're getting untyped data from the database, and you want to "create" more typing info?
2024-11-20 19:22:09 +0100 <bwe> oh, storing multiple pages of different websites to a DB, differentiated by Variant
2024-11-20 19:22:03 +0100 <tomsmeding> there are various ways something _like_ this can typecheck, but they all result in different designs of the program
2024-11-20 19:21:29 +0100 <tomsmeding> what is the context?
2024-11-20 19:21:23 +0100 <tomsmeding> where does DBEntry come from?
2024-11-20 19:21:16 +0100 <tomsmeding> what is the X problem here (as in X-Y problem) :p
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 :)