Newest at the top
2024-04-29 18:58:51 +0200 | demon-cat | (~demon-cat@dund-15-b2-v4wan-169642-cust1347.vm6.cable.virginm.net) (Ping timeout: 256 seconds) |
2024-04-29 18:56:54 +0200 | Square | (~Square@user/square) |
2024-04-29 18:56:03 +0200 | <gaff> | ncf: thanks |
2024-04-29 18:55:47 +0200 | <ncf> | let's go with no |
2024-04-29 18:54:26 +0200 | <EvanR> | outlook unclear call again |
2024-04-29 18:54:12 +0200 | Square3 | (~Square4@user/square) (Ping timeout: 252 seconds) |
2024-04-29 18:54:11 +0200 | <ncf> | :( |
2024-04-29 18:53:55 +0200 | <lambdabot> | Unknown command, try @list |
2024-04-29 18:53:55 +0200 | <ncf> | @8ball |
2024-04-29 18:52:35 +0200 | tri | (~tri@ool-18bbef1a.static.optonline.net) (Ping timeout: 260 seconds) |
2024-04-29 18:52:15 +0200 | <gaff> | Consider the following example. you are writing a bunch of parser combinators, and many of these combinators use `get` and `put`. Is that circumventing the State monad? |
2024-04-29 18:52:07 +0200 | <ncf> | i mean you are asking for a general yes/no answer to something that is essentially a value judgement (bookkeeping) and highly context-dependent |
2024-04-29 18:50:28 +0200 | <gaff> | ncf: I am not really clear what you meant there. |
2024-04-29 18:49:44 +0200 | <ncf> | but other than that get and put are just part of the normal State interface |
2024-04-29 18:49:14 +0200 | <ncf> | if you end up using get and put in between every function call then i would say you are bookkeeping and defeating the purpose of State |
2024-04-29 18:48:55 +0200 | justsomeguy | (~justsomeg@user/justsomeguy) |
2024-04-29 18:48:26 +0200 | <ncf> | that's not a well-defined concept, just a vibe |
2024-04-29 18:47:57 +0200 | tri | (~tri@ool-18bbef1a.static.optonline.net) |
2024-04-29 18:47:53 +0200 | <gaff> | ncf: well, I want to be clear about what is state "bookkeeping" (which you would have to do if you didn't use the State monad) vs the use of these functions `get` and `put`. |
2024-04-29 18:47:50 +0200 | Lears | (~Leary]@user/Leary/x-0910699) (Remote host closed the connection) |
2024-04-29 18:47:11 +0200 | noumenon | (~noumenon@113.51-175-156.customer.lyse.net) (Quit: Leaving) |
2024-04-29 18:46:46 +0200 | <EvanR> | I say* |
2024-04-29 18:46:39 +0200 | <EvanR> | you say boilerplate and say can you move the boilerplate to a function which can be called |
2024-04-29 18:46:38 +0200 | <geekosaur> | the state monad would be pretty useless if you couldn't access or update the state |
2024-04-29 18:45:33 +0200 | <ncf> | why else would they be exported |
2024-04-29 18:45:10 +0200 | <ncf> | sure |
2024-04-29 18:44:26 +0200 | rvalue | (~rvalue@user/rvalue) |
2024-04-29 18:44:25 +0200 | <gaff> | ncf: thanks. I know. But i am asking that structure I presented, or more generally the use of `get` and `put`, are expected monadic operations in code dealing with the State monad? |
2024-04-29 18:43:56 +0200 | rvalue | (~rvalue@user/rvalue) (Read error: Connection reset by peer) |
2024-04-29 18:42:34 +0200 | remedan | (~remedan@ip-78-102-118-253.bb.vodafone.cz) |
2024-04-29 18:42:11 +0200 | <ncf> | f = state g |
2024-04-29 18:41:52 +0200 | <lambdabot> | MonadState s m => (s -> (a, s)) -> m a |
2024-04-29 18:41:51 +0200 | <ncf> | :t state |
2024-04-29 18:41:50 +0200 | <ncf> | in that specific case you could perhaps just use `state` |
2024-04-29 18:41:24 +0200 | jumper149 | (~jumper149@base.felixspringer.xyz) (Quit: WeeChat 4.2.1) |
2024-04-29 18:40:09 +0200 | <gaff> | here is an example: `f = do { s <- get; let (a, b) = g s; put b; return a }` and similar stuff in perhaps other functions as well. |
2024-04-29 18:39:53 +0200 | gmg | (~user@user/gehmehgeh) |
2024-04-29 18:39:52 +0200 | stiell_ | (~stiell@gateway/tor-sasl/stiell) |
2024-04-29 18:39:38 +0200 | chiselfuse | (~chiselfus@user/chiselfuse) |
2024-04-29 18:38:47 +0200 | stiell_ | (~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection) |
2024-04-29 18:38:46 +0200 | chiselfuse | (~chiselfus@user/chiselfuse) (Read error: Connection reset by peer) |
2024-04-29 18:38:46 +0200 | gmg | (~user@user/gehmehgeh) (Remote host closed the connection) |
2024-04-29 18:38:13 +0200 | <ncf> | i don't know how i'm supposed to answer that without seeing any code! |
2024-04-29 18:38:07 +0200 | lortabac | (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Ping timeout: 255 seconds) |
2024-04-29 18:36:20 +0200 | <gaff> | ncf: that repeated use of `get` and `put` in functions involved wouldn't be considered "state bookkeeping" boilerplate code then? |
2024-04-29 18:34:57 +0200 | <ncf> | gaff: sure, if that's the API you're using |
2024-04-29 18:31:33 +0200 | <ncf> | famubu: rep should only parse {n,m} and return the function \r -> Rep r n m |
2024-04-29 18:29:51 +0200 | <gaff> | Using the State monad helps in threading the state through computations behind the scenes, but you will/may still need to use get and put in individual functions involved, right? |
2024-04-29 18:29:12 +0200 | <ncf> | it's a postfix operator |
2024-04-29 18:28:10 +0200 | tzh | (~tzh@c-73-164-206-160.hsd1.or.comcast.net) |