Logs: liberachat/#haskell
| 2021-07-04 05:37:38 | <qrpnxz> | the entirety, for my particular case the output of the function |
| 2021-07-04 05:37:45 | → | shanemikel joins (~shanemike@desk.roadwar.net) |
| 2021-07-04 05:38:23 | <davean> | It has to output a type - we're not dependently typed so it can't vary |
| 2021-07-04 05:38:26 | <qrpnxz> | like i want to say that it returns a foldable of something, but i don't want to say what specific instance of foldable |
| 2021-07-04 05:38:33 | <davean> | Sure, right |
| 2021-07-04 05:38:41 | <qrpnxz> | with partial types i don't have to put what it is, but i also can't say it has to be foldable |
| 2021-07-04 05:38:57 | <qrpnxz> | and if i do a normal variable it turns into a forall and doesn't compile |
| 2021-07-04 05:39:24 | <davean> | So *who* decides what foldable? |
| 2021-07-04 05:39:44 | <davean> | which code where |
| 2021-07-04 05:39:54 | <qrpnxz> | the implementation, if i happen to return a list, then it's list, if i return a vector, then it's vector |
| 2021-07-04 05:40:29 | <davean> | are you trying to write a type class? |
| 2021-07-04 05:40:33 | <qrpnxz> | no |
| 2021-07-04 05:40:37 | <qrpnxz> | this is just a normal function |
| 2021-07-04 05:40:41 | <davean> | then theres only one implimentation |
| 2021-07-04 05:40:47 | <qrpnxz> | yes |
| 2021-07-04 05:40:48 | <davean> | so its fully determined |
| 2021-07-04 05:40:50 | <qrpnxz> | yes |
| 2021-07-04 05:41:03 | → | ablutor joins (~quassel@wasscher.com) |
| 2021-07-04 05:41:31 | <davean> | Are you under the illusion PartialTypeSignatures will hide exactly which type it returns from other code? |
| 2021-07-04 05:42:18 | <qrpnxz> | no, but let me think about that |
| 2021-07-04 05:42:31 | <qrpnxz> | yeah i don't have a problem with that |
| 2021-07-04 05:43:01 | × | Erutuon quits (~Erutuon@user/erutuon) (Ping timeout: 258 seconds) |
| 2021-07-04 05:43:03 | <davean> | So if you know the type with PartialTypeSignatures will end up as exatly the infered type, why are you not writing it out directly? |
| 2021-07-04 05:43:51 | <qrpnxz> | because then i'd have to change the type i write out if i changed the implementation, and that type would be part of public api, so then i couldn't change it without breaking users |
| 2021-07-04 05:44:10 | <davean> | So I tihnk you didn't read what I said above then |
| 2021-07-04 05:44:18 | <davean> | PartialTypeSignatures *does* make it part of the public API |
| 2021-07-04 05:44:24 | <davean> | it fills in what you would have writen for you |
| 2021-07-04 05:44:29 | <davean> | it does *not* hide it |
| 2021-07-04 05:45:00 | <qrpnxz> | on the documentation you would just see a hole, once it compiles the code would know which type exactly, but as a user you could only rely on, say, that it was a foldable |
| 2021-07-04 05:45:01 | <davean> | This is exactly why I went through this discussion |
| 2021-07-04 05:45:28 | <davean> | Uh? |
| 2021-07-04 05:45:30 | <davean> | What? |
| 2021-07-04 05:46:03 | <davean> | I tihnk we just found even more to sort out here |
| 2021-07-04 05:46:25 | <qrpnxz> | like when i accept a foldable, at some point that's going to be a specific foldable too, but I'm telling you I accept any foldable, even thought when it compiles it may use like list specific functions |
| 2021-07-04 05:46:57 | <c_wraith> | do you actually want a higher-rank type? |
| 2021-07-04 05:47:01 | <c_wraith> | Is that what's going on? |
| 2021-07-04 05:47:01 | <qrpnxz> | so likewise i want to be able to say i'm gonna give you a foldable, but i'm not gonna tell you (via documentation, via type signature) what exactly it's gonna be. |
| 2021-07-04 05:47:09 | <davean> | qrpnxz: You're very confused |
| 2021-07-04 05:47:16 | <c_wraith> | Oh. that's just not how Haskell works |
| 2021-07-04 05:47:17 | <qrpnxz> | idk about higher-rank types much idk c_wraith |
| 2021-07-04 05:47:21 | <davean> | c_wraith: I assumed he did but knew he was WAY too confused to get there quickly |
| 2021-07-04 05:47:36 | <davean> | c_wraith: Hence trying to sort out where his confusion is first |
| 2021-07-04 05:47:39 | <qrpnxz> | i'm not confused at all, i just don't know if this is possible. If it isn't then okay |
| 2021-07-04 05:47:48 | <davean> | qrpnxz: no, you're clearly confused |
| 2021-07-04 05:48:01 | <qrpnxz> | i'm not confused about what i want to do |
| 2021-07-04 05:48:19 | <davean> | To some degree you are. And you're massively confused about the tools |
| 2021-07-04 05:48:44 | <qrpnxz> | i don't wanna do the tools? what are you saying lol |
| 2021-07-04 05:48:50 | <sm[m]> | There is free floating non local confusion here. I can feel it from thousands of miles away.... |
| 2021-07-04 05:48:54 | <qrpnxz> | what you are saying is confusing haha |
| 2021-07-04 05:48:55 | → | slac32279 joins (~slack1256@191.125.227.213) |
| 2021-07-04 05:48:57 | <davean> | Well like what you think the documentation will be |
| 2021-07-04 05:48:58 | <qrpnxz> | that's for sure |
| 2021-07-04 05:49:03 | → | nate1 joins (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) |
| 2021-07-04 05:49:22 | <davean> | PartialTypeSignatures *only makes the compiler fill it in* it changes nothing else |
| 2021-07-04 05:49:32 | <davean> | you'll get the exact same breakage, etc |
| 2021-07-04 05:49:48 | <davean> | so for something to be any foldable that means you have data *and* a dictionary |
| 2021-07-04 05:49:49 | <qrpnxz> | your code should accept any foldable, so how will it break |
| 2021-07-04 05:50:18 | × | AgentM quits (~agentm@pool-162-83-130-212.nycmny.fios.verizon.net) (Quit: Leaving.) |
| 2021-07-04 05:50:23 | <davean> | qrpnxz: It'll break *exactly* the same as if you'd specified one foldable and changed it to a different foldable *because thats exactly what happens* |
| 2021-07-04 05:50:25 | <c_wraith> | Partial type signatures don't appear in docs |
| 2021-07-04 05:50:27 | <davean> | there is NO illusion |
| 2021-07-04 05:50:36 | <c_wraith> | what they expand to does |
| 2021-07-04 05:50:47 | <davean> | They are *exactly* what it says, a partial type signature |
| 2021-07-04 05:50:54 | <qrpnxz> | c_wraith, maybe you are talking about a particular tool idk, for me i'm just talking about the actual code as documentation |
| 2021-07-04 05:51:04 | × | slack1256 quits (~slack1256@181.203.33.8) (Ping timeout: 252 seconds) |
| 2021-07-04 05:51:05 | <davean> | ok so, if you wanted to return a dictionary and data, you'd need something higher ranked |
| 2021-07-04 05:51:19 | <davean> | like data Foldable a = forall f . Foldable (f a) |
| 2021-07-04 05:51:26 | <davean> | function :: a -> Foldable a |
| 2021-07-04 05:51:27 | <c_wraith> | qrpnxz: you'd better be prepared for your users to use :browse and :type |
| 2021-07-04 05:51:50 | <qrpnxz> | a dynamic type? I'm not talking about binary compatibility, you'd need to recompile your code ofc if i changed my foldable |
| 2021-07-04 05:52:00 | <qrpnxz> | but the recompile would go without a hitch |
| 2021-07-04 05:52:28 | <qrpnxz> | c_wraith, indeed, good point |
| 2021-07-04 05:52:38 | <qrpnxz> | if they did that then they would see the true type |
| 2021-07-04 05:52:42 | <davean> | I mean even if they don't, the code doesn't say it can change |
| 2021-07-04 05:52:45 | <davean> | it just says you didn't type it out |
| 2021-07-04 05:52:49 | <davean> | thats not documenting it may change |
| 2021-07-04 05:53:33 | <qrpnxz> | if you think that's how haskellers would interpret it then i believe you |
| 2021-07-04 05:53:43 | <qrpnxz> | i guess you just have to write a comment then |
| 2021-07-04 05:53:59 | <c_wraith> | Or you could use the type system |
| 2021-07-04 05:54:00 | × | nate1 quits (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 252 seconds) |
| 2021-07-04 05:54:01 | → | falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) |
| 2021-07-04 05:54:11 | <qrpnxz> | i don't wanna do a dynamic type that's not gonna fure |
| 2021-07-04 05:54:13 | <qrpnxz> | *fuse |
| 2021-07-04 05:54:15 | <c_wraith> | there are two completely independent ways to say what you mean in the type |
| 2021-07-04 05:54:25 | × | lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-07-04 05:54:49 | <c_wraith> | Well, then, the higher-rank CPS approach works |
| 2021-07-04 05:55:01 | <qrpnxz> | gonna have to look that up |
| 2021-07-04 05:55:16 | → | fengctor joins (~fengctor@bras-base-ngflon0508w-grc-11-76-68-2-143.dsl.bell.ca) |
| 2021-07-04 05:55:34 | <davean> | (forall r. Foldable f => f a -> r) -> r |
| 2021-07-04 05:55:40 | <davean> | er |
| 2021-07-04 05:55:44 | <davean> | (forall f. Foldable f => f a -> r) -> r |
| 2021-07-04 05:55:53 | nshepperd | . o O (foo = ...; proofFooReturnsSomethingFoldable = (id :: Foldable a => a -> a) foo) |
| 2021-07-04 05:56:13 | <qrpnxz> | lol |
| 2021-07-04 05:56:40 | <nshepperd> | Foldable f => f a -> f a, you know what i mean |
| 2021-07-04 05:57:19 | → | warnz joins (~warnz@2600:1700:77c0:5610:20b2:48fc:c4b7:f8df) |
| 2021-07-04 05:57:55 | → | nate1 joins (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) |
| 2021-07-04 05:58:55 | <davean> | qrpnxz: do you see how (forall f. Foldable f => f a -> r) -> r forms a proof the caller handles any foldable? |
| 2021-07-04 05:59:26 | <qrpnxz> | yeah i can do input any foldable just fine, can't say i could output any foldable though |
| 2021-07-04 05:59:50 | <davean> | No, that says it outputs any foldable |
| 2021-07-04 05:59:59 | <c_wraith> | it's a CPS-transform |
All times are in UTC.