Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 777 778 779 780 781 782 783 784 785 786 787 .. 18021
1,802,077 events total
2021-07-04 06:00:06 × cheater quits (~Username@user/cheater) (Ping timeout: 272 seconds)
2021-07-04 06:00:11 <qrpnxz> which, the one you just quoted? where is the foldable constraint on r?
2021-07-04 06:00:20 cheater joins (~Username@user/cheater)
2021-07-04 06:00:25 <davean> qrpnxz: theres no foldable constraint on r, waht r is is up to the caller
2021-07-04 06:00:40 <qrpnxz> wot
2021-07-04 06:00:59 <davean> I didn't pin r at all
2021-07-04 06:01:07 <davean> r is completely open in that statement
2021-07-04 06:01:10 <c_wraith> qrpnxz: what's the difference between a value of type String and a value of type forall r. (String -> r) -> r ?
2021-07-04 06:01:13 <qrpnxz> ok but i want to say that an output is any foldable, so how does this help me do that
2021-07-04 06:01:24 takuan joins (~takuan@178-116-218-225.access.telenet.be)
2021-07-04 06:01:30 × warnz quits (~warnz@2600:1700:77c0:5610:20b2:48fc:c4b7:f8df) (Ping timeout: 240 seconds)
2021-07-04 06:01:34 <davean> qrpnxz: the output is "f a"
2021-07-04 06:01:48 <qrpnxz> c_wraith, a string is a string, and that thing is a function that takes a function that takes a string and returns and r and then returns an r
2021-07-04 06:02:07 <qrpnxz> davean, looks like the output is r
2021-07-04 06:02:10 <c_wraith> qrpnxz: that's just mechanics. What's the difference?
2021-07-04 06:02:26 × nate1 quits (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 256 seconds)
2021-07-04 06:02:26 <c_wraith> qrpnxz: what can you do with one representation that you can't do with the other?
2021-07-04 06:02:46 <qrpnxz> you can do list stuff with a string and you can call a function
2021-07-04 06:03:05 <c_wraith> there is no difference
2021-07-04 06:03:11 <qrpnxz> :|
2021-07-04 06:03:23 <qrpnxz> they are totally different types i don't get it
2021-07-04 06:03:35 <nshepperd> qrpnxz: they are inter convertible
2021-07-04 06:03:38 <davean> They're different types, sure, but they are semanticly equivilent
2021-07-04 06:03:47 <qrpnxz> i don't see how
2021-07-04 06:03:56 <nshepperd> you turn the function into the string by applying it to id
2021-07-04 06:04:03 Morrow joins (~MorrowM_@147.161.9.15)
2021-07-04 06:04:09 <monochrom> "any" is informationless. The question is always: Does the user choose? Does the implementer choose?
2021-07-04 06:04:14 <qrpnxz> if i apply it to id i just get the function back
2021-07-04 06:04:31 <davean> qrpnxz: no, you get String back
2021-07-04 06:04:32 <nshepperd> no that's if you apply id to the function
2021-07-04 06:04:47 <davean> f :: (String -> r) -> r
2021-07-04 06:04:55 <davean> f id :: String
2021-07-04 06:05:19 <c_wraith> :t secret
2021-07-04 06:05:19 <nshepperd> you convert the string to the function by making (\f -> f my_string)
2021-07-04 06:05:20 <qrpnxz> oh apply it to id one sec
2021-07-04 06:05:21 <lambdabot> ([Char] -> b) -> b
2021-07-04 06:05:31 <c_wraith> > secret length
2021-07-04 06:05:32 <lambdabot> error:
2021-07-04 06:05:33 <lambdabot> Ambiguous occurrence ‘length’
2021-07-04 06:05:33 <lambdabot> It could refer to
2021-07-04 06:06:05 <c_wraith> > secret Data.List.length
2021-07-04 06:06:06 <lambdabot> 19
2021-07-04 06:06:36 <qrpnxz> alright, cool type i guess, but how does it help me type that i could return any foldable
2021-07-04 06:06:57 chris_ joins (~chris@81.96.113.213)
2021-07-04 06:07:02 <davean> qrpnxz: Look at it? Its litterly a proof the caller ca handle any foldable
2021-07-04 06:07:05 <c_wraith> Well, you see how returning a value of type (String -> r) -> r is the same as returning a String?
2021-07-04 06:07:15 <davean> because it litterly had to provide the fact it can handle any foldable
2021-07-04 06:07:34 slack1256 joins (~slack1256@181.203.33.8)
2021-07-04 06:08:00 <davean> I tihnk I've been noobed out for the night, c_wraith you take it away
2021-07-04 06:08:07 <davean> I'll try to just shup up at this point
2021-07-04 06:08:12 <qrpnxz> ohhhhh, interesting, but won't that be a total pain to use?, well i guess passing id isn't too bad? Does this get optimized?
2021-07-04 06:08:28 <qrpnxz> that's pretty galaxy brain tbh guys
2021-07-04 06:08:32 <c_wraith> Well, if the return type is (forall f. f a -> r) -> r, you can't pass in id
2021-07-04 06:08:42 <c_wraith> the forall constraint on the f prevents it
2021-07-04 06:08:56 <qrpnxz> will id not take an f a
2021-07-04 06:09:46 × slac32279 quits (~slack1256@191.125.227.213) (Ping timeout: 252 seconds)
2021-07-04 06:09:52 <nshepperd> it has to return some r that doesn't depend on f, but id will return f a
2021-07-04 06:10:03 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
2021-07-04 06:10:07 <c_wraith> it's that id won't unify
2021-07-04 06:10:07 <c_wraith> f a and r can't be the same types
2021-07-04 06:10:07 <c_wraith> because f is higher-rank
2021-07-04 06:10:15 <nshepperd> i think this CPS thing is probably overkill for your case tbh
2021-07-04 06:10:31 <c_wraith> It's the only solution to the constraints that are claimed
2021-07-04 06:10:49 <c_wraith> not that I think those constraints are a good choice :)
2021-07-04 06:11:01 dunkeln_ joins (~dunkeln@188.70.44.28)
2021-07-04 06:11:22 <qrpnxz> i mean, it's not like i'm writing world changing code here, but i believe in backwards compatibility, and how can you have that and not get locked into representation without being able to return a constrained type?
2021-07-04 06:11:37 <c_wraith> I think it's far better to just return the type you produce and let consumers use that type
2021-07-04 06:11:41 <qrpnxz> (other than some kind of dynamic type)
2021-07-04 06:11:58 <c_wraith> if you have an important reason to change the type, it must be important for the callers to know too
2021-07-04 06:13:05 <qrpnxz> it only has to be important if it's difficult to change, if it didn't break anything you could change it even if it wasn't that important, but did make measurable improvement
2021-07-04 06:13:18 <monochrom> If you are into not locking into a representation, use a newtype wrapper and a well-designed and complete API. Not pile up a ton of obscuring foralls. Especially when you have proved that you don't understand foralls.
2021-07-04 06:13:51 <davean> Yah, a newtype seems right here
2021-07-04 06:13:56 <davean> if you really want that
2021-07-04 06:14:12 <davean> Though oppinionwise I think its missguided
2021-07-04 06:14:36 <davean> for example, if you change it for performance reasons, it will neccissarily impact the performance of the calling code.
2021-07-04 06:14:57 <davean> Good code already is as general as it can be without being wrong
2021-07-04 06:14:57 jmorris joins (uid433911@id-433911.stonehaven.irccloud.com)
2021-07-04 06:15:07 <davean> if they pinned the Foldable its because it mattered
2021-07-04 06:15:55 <nshepperd> just tell your users if their code stops compiling because you changed the type it's their own problem
2021-07-04 06:16:30 <qrpnxz> hmmm, yeah a newtype sounds good, but for now i will listen and not do that. nshepperd, yeah i was saying earlier you could just put it in a comment worse case haha
2021-07-04 06:18:47 <nshepperd> misguided addition of restrictions is probably the second most common reason for me to patch a library locally
2021-07-04 06:18:47 × fengctor quits (~fengctor@bras-base-ngflon0508w-grc-11-76-68-2-143.dsl.bell.ca) (Read error: Connection reset by peer)
2021-07-04 06:19:23 <nshepperd> (after 'bugs')
2021-07-04 06:19:24 <davean> Its the thing that most quickly calls out noob coding
2021-07-04 06:19:45 <davean> Its not a mistake that ever persists
2021-07-04 06:20:02 <davean> I guess we can be thankful for that
2021-07-04 06:22:31 turlando joins (~turlando@93-42-250-112.ip89.fastwebnet.it)
2021-07-04 06:22:31 × turlando quits (~turlando@93-42-250-112.ip89.fastwebnet.it) (Changing host)
2021-07-04 06:22:31 turlando joins (~turlando@user/turlando)
2021-07-04 06:23:38 yauhsien joins (~yauhsien@61-231-45-160.dynamic-ip.hinet.net)
2021-07-04 06:28:15 × yauhsien quits (~yauhsien@61-231-45-160.dynamic-ip.hinet.net) (Ping timeout: 258 seconds)
2021-07-04 06:29:21 × turlando quits (~turlando@user/turlando) (Remote host closed the connection)
2021-07-04 06:29:38 turlando joins (~turlando@93-42-250-112.ip89.fastwebnet.it)
2021-07-04 06:29:38 × turlando quits (~turlando@93-42-250-112.ip89.fastwebnet.it) (Changing host)
2021-07-04 06:29:38 turlando joins (~turlando@user/turlando)
2021-07-04 06:29:56 × slowButPresent quits (~slowButPr@user/slowbutpresent) (Quit: leaving)
2021-07-04 06:30:56 × justsomeguy quits (~justsomeg@user/justsomeguy) (Ping timeout: 258 seconds)
2021-07-04 06:33:45 × turlando quits (~turlando@user/turlando) (Remote host closed the connection)
2021-07-04 06:34:07 turlando joins (~turlando@93-42-250-112.ip89.fastwebnet.it)
2021-07-04 06:34:07 × turlando quits (~turlando@93-42-250-112.ip89.fastwebnet.it) (Changing host)

All times are in UTC.