Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-19 08:20:45 <GutsTheme> and if that's not possible what is the functional equivalend of a while(n--) in haskell ?
2021-04-19 08:21:09 ddellacosta joins (~ddellacos@86.106.143.183)
2021-04-19 08:21:17 <Taneb> :t mapAccumL
2021-04-19 08:21:18 enoq joins (~textual@194-208-146-143.lampert.tv)
2021-04-19 08:21:19 <lambdabot> Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
2021-04-19 08:22:11 × oo_miguel quits (~miguel@89-72-187-203.dynamic.chello.pl) (Quit: WeeChat 2.3)
2021-04-19 08:22:41 zariuq joins (~zar@fw1.ciirc.cvut.cz)
2021-04-19 08:22:53 × aVikingTrex quits (~aVikingTr@2001:8003:340d:d00:b2de:b98:7a93:b0ea) (Ping timeout: 258 seconds)
2021-04-19 08:22:55 kritzefitz joins (~kritzefit@2003:5b:203b:200::10:49)
2021-04-19 08:22:56 <Maxdamantus> (eg, you don't have referential ambiguities in Haskell, because you always refer to things by unambiguously resolvable variables, rather than having constructs like "that" or "it" which could refer to one of multiple things)
2021-04-19 08:22:57 <Taneb> GutsTheme: you can use something like mapAccumL, or you can use the StateT monad transformer from the transformers library
2021-04-19 08:23:15 <merijn> Maxdamantus: I suggest taking the remaining discussion to #haskell-offtopic
2021-04-19 08:23:33 <GutsTheme> yeah idk what any of that means, let's me just give you the problem that I'm trying to solve
2021-04-19 08:24:03 fendor joins (~fendor@178.115.130.32.wireless.dyn.drei.com)
2021-04-19 08:25:02 <tdammers> Maxdamantus: English does have first-person singular / plural, it just so happens that the verb forms are the same for almost all verbs (however: "I am" / "we are"!@)
2021-04-19 08:25:49 × ddellacosta quits (~ddellacos@86.106.143.183) (Ping timeout: 252 seconds)
2021-04-19 08:27:34 <GutsTheme> https://paste.tomsmeding.com/oQtvZQW2 here, I am trying to append all the points to an array and then i'll process them but the cords arrays is empty after an "iteration"
2021-04-19 08:29:51 nut joins (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr)
2021-04-19 08:30:58 <merijn> You probably don't want replicateM but just a recursive loop
2021-04-19 08:31:08 <gnumonic> Ooh if we're talking about Haskell I have a haskell question: What's an indexed cartesian store comonad?
2021-04-19 08:31:20 <gnumonic> You can assume I know what a regular store comonad is
2021-04-19 08:31:56 <gnumonic> And have a vague idea about what an indexed normal monad is
2021-04-19 08:32:32 × DTZUZU quits (~DTZUZO@205.ip-149-56-132.net) (Ping timeout: 240 seconds)
2021-04-19 08:33:34 × GutsTheme quits (1b04cef3@27.4.206.243) (Quit: Connection closed)
2021-04-19 08:36:07 × fiedlr quits (~fiedlr@83.148.33.254) (Remote host closed the connection)
2021-04-19 08:36:23 fiedlr joins (~fiedlr@83.148.33.254)
2021-04-19 08:36:41 <joel135> Is a store comonad something like (a, _) ?
2021-04-19 08:37:56 <joel135> Oh I see it is this structure https://hackage.haskell.org/package/comonads-fd-4.0/docs/Control-Comonad-Store.html
2021-04-19 08:39:34 <gnumonic> Ya. an "indexed cartesian store comonad" is... something mentioned in the lens internals. I'm trying to figure out if I didn't patch this type-level lens library right or if it just can't do what I want, but I don't really understand what the point of an indexed store comonad is exactly :-(
2021-04-19 08:39:41 _xor joins (~xor@74.215.46.133)
2021-04-19 08:40:39 <gnumonic> It has something to do with traversals and holes and whether there are more of them or not, and something to do with how "extend" combines with a type/kind index... i think?
2021-04-19 08:42:50 × charukiewicz quits (~quassel@irouteince04.i.subnet.rcn.com) (Ping timeout: 252 seconds)
2021-04-19 08:43:07 geowiesnot joins (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr)
2021-04-19 08:43:27 charukiewicz joins (~quassel@irouteince04.i.subnet.rcn.com)
2021-04-19 08:43:47 DTZUZU joins (~DTZUZO@205.ip-149-56-132.net)
2021-04-19 08:44:16 <joel135> Ok and Env e = (e, _) and Store s = (s -> _, s) are instances...
2021-04-19 08:47:57 × Mrbuck quits (~Mrbuck@gateway/tor-sasl/mrbuck) (Ping timeout: 240 seconds)
2021-04-19 08:48:53 × geowiesnot quits (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr) (Ping timeout: 240 seconds)
2021-04-19 08:49:00 bb010g_ joins (uid21050@gateway/web/irccloud.com/x-onettvptumlyxjvo)
2021-04-19 08:49:10 × bb010g_ quits (uid21050@gateway/web/irccloud.com/x-onettvptumlyxjvo) (Client Quit)
2021-04-19 08:49:43 bb010g joins (uid21050@gateway/web/irccloud.com/x-onrynoluckjwobrc)
2021-04-19 08:51:20 <gnumonic> I never could figure out what the point of the Env comonad was. Store is neat though. It holds a function (s -> a) and an s and spits out an a. I've been using it to simulate "reversible" effectful functions, so s = Map k (x -> m x) and a = m x, and an accessor function that folds the map with (>=>) over some initial value
2021-04-19 08:52:02 <gnumonic> i dunno if that made any sense :p
2021-04-19 08:55:33 <gnumonic> Everyone wanna talk about pronouns, no one wanna talk about comonads :-(
2021-04-19 08:56:11 <joel135> I want to talk about comonads but I have to hoogle 5 things before I understand what you mean :P
2021-04-19 08:56:50 × drbean_ quits (~drbean@TC210-63-209-68.static.apol.com.tw) (Quit: ZNC 1.8.2+cygwin2 - https://znc.in)
2021-04-19 08:57:20 trcc joins (~trcc@2-104-60-169-cable.dk.customer.tdc.net)
2021-04-19 08:58:14 <trcc> In some cases, you can only implement one function and then you actually get two functions. I.e. something if simple, if it is not complex. Something is complex, if it is not simple. In such a case it is only necessary to define either complex or simple, but you do not have to define two. What is this concept called?
2021-04-19 08:58:33 <joel135> gnumonic: Is k like the Σ of a finite automaton? Could you show me an example?
2021-04-19 08:58:48 ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta)
2021-04-19 08:59:50 <joel135> trcc: contrapositive ?
2021-04-19 09:00:07 <trcc> joel135: I will try and look it up and see if that is what I mean
2021-04-19 09:00:07 × Cesionaut[m] quits (cesionautm@gateway/shell/matrix.org/x-sdjhygltyhtlomgg) (Quit: Idle for 30+ days)
2021-04-19 09:00:43 <trcc> I am thinking of the haskell term of this, not necessarily the abstract logic term
2021-04-19 09:02:39 <joel135> I am not aware that you can implement one function and get two in haskell.
2021-04-19 09:03:38 <trcc> i.e. if you make a typeclass that subclasses Eq, then you only have to implement == or \= right?
2021-04-19 09:03:44 × ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 268 seconds)
2021-04-19 09:03:50 <trcc> but you also get the other
2021-04-19 09:04:02 <trcc> My terminology might be off
2021-04-19 09:04:17 <joel135> hackage uses the term 'Minimal complete definition'
2021-04-19 09:04:58 × nut quits (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Ping timeout: 268 seconds)
2021-04-19 09:05:06 <trcc> perfect! thank you!
2021-04-19 09:05:08 <joel135> for Applicative this is pure, ((<*>) | liftA2)
2021-04-19 09:05:21 <trcc> Minimal complete definition: either == or /=.
2021-04-19 09:05:27 <trcc> this was exactly what I was looking for
2021-04-19 09:05:28 <merijn> trcc: "default implementations"
2021-04-19 09:05:28 <joel135> yes
2021-04-19 09:05:29 <trcc> https://hackage.haskell.org/package/base-4.15.0.0/docs/Data-Eq.html
2021-04-19 09:06:21 <merijn> trcc: The minimal complete definition is the set of things you need to define for a typeclass to work. The reason why you don't have to implement them all is because some typeclasses have default implementations for functions
2021-04-19 09:06:45 <trcc> Yes I think I understand that, I just needed the term "minimal complete definition"
2021-04-19 09:06:54 <trcc> thank you both
2021-04-19 09:07:11 <merijn> ok, just checking, because that wasn't quite what you asked, but if it's what you wanted, good :p
2021-04-19 09:07:24 <trcc> hehe i agree with both :D
2021-04-19 09:07:57 <trcc> I cannot find the time to work with haskell because of other obligations, but we have a different employee who is beginning to show some interest
2021-04-19 09:08:11 <trcc> so I can live out my haskell wild life through him ^^
2021-04-19 09:08:13 <gnumonic> Er in my last message k is just a key (i.e. Ord k), I was just trying to point out an application of Store. If you have a map of monadic functions in the store, and the accessor function folds the map monadically, it provides a nice interface for "looking at" the output object under various combinations of the functions in the map
2021-04-19 09:08:13 <joel135> https://hackage.haskell.org/package/comonads-fd-4.0/docs/Control-Comonad-Trans-Identity.html LOL
2021-04-19 09:08:34 <merijn> trcc: If you want mathier terminology there's also "necessary and sufficient"
2021-04-19 09:09:07 <gnumonic> The concrete problem I used it to solve is is like, incredibly stupid, but Store is an order of magnitude less ugly than anything else I could come up with to solve it
2021-04-19 09:09:41 nut joins (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr)
2021-04-19 09:10:43 lambdaman joins (~lambdaman@s66-183-152-156.bc.hsia.telus.net)
2021-04-19 09:10:57 <joel135> ok so you have one way to access m x before and one way to access it after applying a subset of the things in the map
2021-04-19 09:11:18 Guest78317 joins (~laudiacay@67.176.215.84)
2021-04-19 09:12:03 <gnumonic> yeah. and you can manipulate the map with seeks or peeks
2021-04-19 09:12:17 <trcc> merijn: what is mathier terminology? not familiar iwth that
2021-04-19 09:15:11 × lambdaman quits (~lambdaman@s66-183-152-156.bc.hsia.telus.net) (Ping timeout: 240 seconds)
2021-04-19 09:15:18 <joel135> gnumonic: is this instance of ComonadStore provided by some library ?
2021-04-19 09:15:26 × Guest78317 quits (~laudiacay@67.176.215.84) (Ping timeout: 240 seconds)
2021-04-19 09:16:26 <merijn> trcc: "necessary and sufficient"
2021-04-19 09:17:06 <joel135> noun - math, adjective - mathy mathier mathiest
2021-04-19 09:17:20 × vv8 quits (~egp_@2.95.117.163) (Remote host closed the connection)
2021-04-19 09:17:35 <gnumonic> Exactly what I'm using with the map and whatnot? Don't think so. I wasn't sure if it was generally useful enough to make it into a library and throw on hackage. Uh gimme a sec and I'll show you the code though (it's not super pretty/highly experimental/etc)
2021-04-19 09:17:56 <joel135> good :D
2021-04-19 09:17:58 <merijn> trcc: in mathspeak something is "necessary" if no solution/proof/whatever of a problem can be made without it (but you might need more than just the *necessary* things). And "sufficient" means that a proof can be constructed using just what you have (although it may include unnecessary/redundant things)
2021-04-19 09:18:15 LKoen joins (~LKoen@77.168.9.109.rev.sfr.net)
2021-04-19 09:18:23 <merijn> trcc: So "necessary and sufficient" describes a, well, "minimal and complete" set of requirements for something
2021-04-19 09:18:39 <trcc> ahh now I get it
2021-04-19 09:18:56 Synthetica joins (uid199651@gateway/web/irccloud.com/x-lrjabllucnezjrom)
2021-04-19 09:20:37 <trcc> it was the adjective thing I did not get. "mathier" I was looking it up in dictionaries and stuff hehe
2021-04-19 09:21:07 × forell quits (~forell@unaffiliated/forell) (Quit: ZNC - https://znc.in)

All times are in UTC.