« first day (272 days earlier)      last day (189 days later) » 

9:59 PM
@BartekBanachewicz IMHO you are a little bit biased towards State and RWS and such.
I see you using them all the time, to achieve an imperative like syntax.
 
@Jefffrey have you read bhelikr's answer to my question?
 
The reason why I like writing in Haskell is because it allows me to write in a functional way (partial application, mutation in done by a -> a functions, composition, even monads some times but only when it makes sense).
@BartekBanachewicz Nope, may you link it again here?
 
3
A: Is there any "standard" way to utilize the equivalence of Reader and a normal function?

bheklilrYou can simply use the fact that the function monad (->) r already has an instance for MonadReader r defined in Control.Monad.Reader. You can write functions using just the MonadReader constraint and use them either as normal functions or in other ReaderT monads: f :: MonadReader Int m => m Int...

@Jefffrey do you get the idea?
 
@BartekBanachewicz Yeah, I think.
 
@Jefffrey see, my point is that pure monads aren't different from functions. And a lot of times what appears to be functional code is actually imperative
or at least it's easier to reason about it in imperative way
I don't see it as wrong.
 
10:06 PM
Ok, and I understand that.
I don't like it, though.
 
@Jefffrey Maybe you should read about Kleisli composition
@Jefffrey I don't understand your gripe with it, anyway
 
For me it's actually more important to strive for clean and nice code.
 
State is hard to reason about when it gets scattered across the program
@Jefffrey and instead of doing that you strive for code that only composes effects with ., disregarding other ways completely
 
The challenge for me is to write some nice to and simple to look at, not actually finishing something that is useful.
 
I think that monadic composition is simple to look at
say, take that monadReader
it's functionally equivalent to passing shit around, but the uninteresting details are swept under the context
 
10:10 PM
@BartekBanachewicz I would use State for things that are obviously state. Take random number generators: every time you generate a number you get back a (number, newGen); that's clearly State.
And even then I wouldn't expose it outside of the function.
 
@Jefffrey basically every function in form a -> (a, b)
 
And then one of my goals is to have a clean separation between IO and deterministic algorithms (yeah, IO is deterministic too, I get it).
@BartekBanachewicz Where I actually care about the returned a for something, yes.
 
but you know what's funnier? Every function a -> b can be treated as Reader, as we've demonstrated today
 
@BartekBanachewicz But I'm not interested in that.
I don't like do notation all that much.
Except for IO, there it suits nicely.
 
@Jefffrey you prefer code duplication?
 
10:12 PM
Even with State.
@BartekBanachewicz Not at all.
I prefer pure and simple composition.
 
@Jefffrey fn a x = f a . g a . h a $ x
 
Also it really depends on the case, but the point I'm trying to make is that I do not strive to have everything in a do notation because it looks and feels imperative (as you do).
 
fnM x = pure x >>= h >>= g >>= f
 
@BartekBanachewicz It depends a lot. There's no "I would do this every time".
 
@Jefffrey Well you seem more biased against monadic code than I am towards it
@Jefffrey no, that's not true
I don't write everything in do notation, but so it happens that often it's the simplest way to write and refactor
 
10:15 PM
Ok, well, if I'll ever see it the same way, I'll do the same.
 
because I can move stuff in do around soooo freely
and functions are just a fucking pita to refactor
 
I'm happy that for you do notation is good and nice.
 
with monadic code it's just copy and paste
@Jefffrey I'm talking about real world practical usage here
because, as already pointed out, I'm actually using haskell to build things
 
Why do you always keep bringing this "real world" thing up?
I've built the logic of a snake game at least 3 times now. And I managed to do that with very little monads and/or do notation.
 
@Jefffrey because I think you lack enough experience writing haskell code that actually does something
 
10:17 PM
I've built things with Haskell before too.
 
@Jefffrey this sounds like you had tried really hard
 
But real world experience is totally irrelevant to what we are discussing here, which is design.
 
@Jefffrey I disagree.
 
@BartekBanachewicz I like rewriting code until I'm satisfied with it (which is basically never).
 
striving for unrealistic designs is a waste of time.
if you can't implement it it's worth nothing
 
10:19 PM
I don't see why I can accept your way but you can't accept mine.
@BartekBanachewicz *to you
 
@Jefffrey I'll accept yours when I see actual things written your way by you and working
 
I know designing things my way is difficult and unrealistic. I don't use Haskell to ship fast, I use Haskell to write code I'm proud of.
 
show me things you've built without monadic composition
show me how avoiding monadic composition was beneficial there
I want to see. I want you to tell me everything about them.
 
I don't know if that is a working version, but it's the last version I had.
I'm going to rewrite yet again soon anyway.
 
makeLenses ''Input starts good
in over snake (Snake.rotate ang) p gah why do you use over in prefix form
this like literally kills the meaning
update i s = applyMovement i . applyRotation i . applyExtension i $ s yeah precisely the shit I talked about
repeating i is tedious and boring and unfun and fugly
 
10:24 PM
It's not a problem to me really.
 
should be a State here.
it's clearly a state
it's passed from frame to frame and read and modified
 
I don't see the use of State here to be honest.
 
@Jefffrey uh, to actually model the state you have without the ugly boilerplate?
Or maybe you don't agree that there's actually state keeping going on?
 
s is piped into 3 transformations, of course there's state
 
well in the case of i it should be monadreader
 
10:26 PM
But that is really simple enough and removing i would probably cause more boilerplate to be written in its place.
It's literally 3 characters.
Also I should have written it as update i = applyMovement i . applyRotation i . applyExtension i
 
update i = runReader (applyMovement >> applyRotation >> applyExtension) i
derp
or maybe add \s -> runReader pure s >>= etc
@Jefffrey TL;DR those are fine when they are short
but when the program grows it just becomes a pain in the ass
 
foldr (\i s -> fn i s) [applyMovement, applyRotation, applyeExtension] s
lol
 
ever heard of sequence?
 
Yeah, I don't remember what's that.
 
because you know what it is? a sequence of operations.
@Jefffrey foldl (>>) more or less
see that's the point. You'll do everything to pretend your sequence of operations isn't a sequence of operations
it's not about design, it's about lying to yourself for whatever reason
 
10:31 PM
@BartekBanachewicz Wait, (applyMovement >> applyRotation >> applyExtension) is a Reader?
@BartekBanachewicz They are laid down exactly as the sequence of operations they are. Why do you think I'm lying myself about it?
 
@Jefffrey might need >>= instead, I'd need to typecheck. But more or less yeah
 
a . b . c $ s is not a sequence of operations?
 
@Jefffrey I don't get why are you so reluctant to use contexts, that's all
i is the context of all the functions.
Why are you so keen on passing it explicitely?
 
There could easily be a function that does not depend on i there.
 
@Jefffrey ever heard of lift?
it's trivial to apply contextless functions in contextful areas
 
10:33 PM
So, wait now we would have to use lift to do that?
I don't get it. Are you trying to simplify the code or complicate it?
 
@Jefffrey if you want to put that function in the chain.
 
I just put it in the chain, what's the problem?
 
@Jefffrey What's complicated there? If a function is contextless but you want to treat it as contextful, you either lift it or fmap it or applicatively apply
@Jefffrey You're not using arrows here, that'd be the problem I suppose.
 
I'm using function composition.
 
Yeah and it's rather inflexible
 
10:35 PM
And you suddenly want to use the Reader monad and lift and monadic composition because I'm repeating i 3 times?
 
that was an example vOv
it's certainly easier to add functionality to it later
 
Yeah, and it illustrates what the problem is already.
 
if you expect this thing to grow I'd do that
because I've had this exact situation a lot of times already
and it's just simpler to work with monadic code.
 
@BartekBanachewicz Are you familiar with YAGNI?
 
at least I see clearly what's a context param and what's a function param
 
10:37 PM
@BartekBanachewicz For you it certainly has. When I read your code all I see is mess.
 
@Jefffrey meh, seriously, doing it via reader is trivial
 
Probably because I'm inexperienced with all those things.
 
@Jefffrey maybe because you're avoiding it all the time?
@Jefffrey precisely
 
Yeah, because to me it's complexity. And I try to avoid complexity.
 
by writing things in a primitive way. good job.
 
10:37 PM
And anyway, did you read the rest?
 
that's what C programmers say too you know
 
Have you seen 1 do notation or monad?
 
"I don't write in C++ because it's too complex"
 
Yeah, and C++ is a clusterfuck.
 
@Jefffrey yeah, properly used
update :: Input -> Game -> Game
update i = execState $ do
    player %= Player.update i
 
10:38 PM
I certainly don't want to write C++ in Haskell.
 
@Jefffrey neither do I
but avoiding monads in haskell is hilarious
@Jefffrey of course that do is useless there
people who think monads and "do" are the same thing are just uneducated
you can write perfectly functional code with monads without a hit of imperativeness
 
do is intrinsically linked to monads
 
Without the monadic interface you don't have do notation.
 
@Jefffrey but you can have monads without the do notation perfectly fine
 
10:41 PM
Yeah, who said otherwise?
 
apparently you, trying to convince me that using State means your code is imperative and complex
or at least that's what's mostly shouting out from your statements
 
Never said that State is imperative
I said it looks imperative.
 
@Jefffrey okey, let's sum it up
 
Maybe using IORef would actually make Haskell more imperative, but I'm not even sure about that.
 
f i = a i . b i . c i  -- purely functional
g i = runState (c >>= b >>= a) i -- imperative
is the above right?
 
10:43 PM
Never said g i = runState (c >>= b >>= a) i is imperative.
 
@Jefffrey you just said State looks imperative
what's runState if not using of State
 
1 min ago, by Jefffrey
Never said that State is imperative
 
meh, you have some weird idea of "things looking like things" then
 
@BartekBanachewicz Yeah, using State with do notation looks imperative. State can be used to make code look imperative.
 
@Jefffrey lol the point is that in the whole mess it's do notation that's imperative, not State
 
10:45 PM
I'm not sure why are you even nit picking on these things.
@BartekBanachewicz do notation is still not imperative btw
 
@Jefffrey because you keep trying to throw monads and do notation into the same bucket
 
It certainly can look like it.
 
...
and it's me who's nitpicking
 
Yeah, it's called nitpicking back.
 
well I dunno what to tell you
I hope you'll get more fluent with monads and start to appreciate them
 
10:46 PM
@BartekBanachewicz Because they are intrinsically linked and I'm talking about do notation which inevitably takes monads in account?
 
because they're really beautiful
 
As I said, I'm sure you think so.
 
@Jefffrey nah, it doesn't, you're just trying to justify your unwillingness to learn monads properly with saying that do is imperative and as such you'll avoid it for some reason
at least that's what I'm getting out of this.
 
@BartekBanachewicz do notation doesn't inevitably take monads in account? Are you serious?
 
Well, whatever, I'm tired and you keep mixing the concepts
You keep bringing do into the discussion over and over again
 
10:48 PM
@BartekBanachewicz And it's the 27th time you are trying to cripple my words.
I'm kind of tired of that.
 
for no apparent reason other than "it exists and uses monads"
 
@BartekBanachewicz That's pretty much 80% of the discussion. Of course I mention it.
 
well fuck look there's Parsec and it uses do for declarative programming
where's your god now
 
lol
 
10:49 PM
do notation can be used to write nice and clean things
Sure.
In some applications it can really be useful.
Everywhere at any time? Probably not.
 
like expressing contextful operations
@Jefffrey of course not, noone said that
and certainly not me
 
@BartekBanachewicz What is the percentage of code that uses do notation in your codebase for Hate?
Give an estimate.
 
@Jefffrey dude, I've no idea, do I look like I'm counting the fucking thing
it's a library that is built 90% of OpenGL interoperability
 
I'll take that as "many more than I care to admit right now".
 
what do you think the implementation of that looks like
have you ever like used opengl at all
 
10:51 PM
Why are you so aggressive?
I'm trying to have a clean discussion here, after days and days of fighting.
 
@Jefffrey probably a lot, because it's required in a lot of places
 
I'm coming towards you and you still have that condescending tone and keep getting mad for no reason whatsoever.
It has become actually painful to follow your discussions.
 
2 mins ago, by Jefffrey
@BartekBanachewicz What is the percentage of code that uses do notation in your codebase for Hate?
lol, at least have the balls to say it was a provocation
 
It's just "hey, you don't know shit about real world", "are you familiar with <basic thing>?", "you need to code more".
What the fuck, I have a patience limit too
Holy shit.
 
inb4 ragequit
 
10:54 PM
@BartekBanachewicz Not at all, You just said you do not strive for writing monads everywhere, and I asked you how many times you use monads in your code.
 
@Jefffrey a lot.
 
Then you use monads a lot?
 
@Jefffrey yes, I use monads a lot.
 
Would it be a stretch to say that you are using monads almost everywhere?
Of course literally "everywhere" was not what I meant in that context.
 
@Jefffrey yes. There's also a substantial part of Hate that doesn't use them.
Like shader building, vertex processing and drawing API
 
10:55 PM
5 mins ago, by Bartek Banachewicz
@Jefffrey of course not, noone said that
 
oh and math stuff obviously
 
Then what is the meaning of the above stuff?
@BartekBanachewicz I'm so near the edge right now, that it's hard for me not to ragequit.
 
@Jefffrey that using monads for contextless things is dumb most of the time, same for the reverse
IOW not using monads for contextful stuff is dumb
@Jefffrey I've calmed down a bit.
 
You have been provocating me all along in this discussion.
 
@Jefffrey I'm a dick.
 
10:57 PM
I'm so happy you are proud of that.
 
I'm not.
I'm just stating the fact.
 
You certainly don't seem ashamed by it.
 
anyway, no, I don't think that using monads everywhere is good
@Jefffrey It's hard to feel ashamed in an internet chat.
 
But you are doing it.
@BartekBanachewicz wat
 
@Jefffrey doing what
@Jefffrey can we drop the meta thread
 
10:58 PM
@BartekBanachewicz Using monads everywhere.
 
3 mins ago, by Bartek Banachewicz
@Jefffrey yes. There's also a substantial part of Hate that doesn't use them.
 
"everywhere" clearly does not mean every line of the program
 
I'd say about 50% of files right now have monad use in them
and those are in 90% dealing with OGL/GLFW
10% is user and library state.
but those are rough estimates
 
Listen it's just an intuition I have. I trust my intuitions a lot. And I'd really like to concretize it with a project that uses those principles I told you about. Until then I won't be able to even remotely win this discussion.
While I value your experience, I don't think your primary goal when writing code is the same as mine (I write for the pleasure of writing code, to the point where having a product in the end is just a side effect; you do it to ship things with it).
 
I like both writing and shipping.
It's not that I hate my code; I just learned how to clench my teeth and get over hairy implementations.
It's not perfect at places, I prolly overused do somewhere, but it renders 1000 polar bears and I love it for it.
 
11:09 PM
As I said, I'm happy for you and I wish you finish your library; but my path is directed somewhere else.
 
damnit, rankntypes
@Jefffrey Do you really value writing code that doesn't work that much?
 
Yeah.
 
I really don't.
 
I remember spending my first 5 years with PHP trying to find the best design for a framework. I've rewritten it so many times and experimented with it so many times.
Never nearly finished though.
 
there's nothing wrong in looking for good designs
but if you don't get it to work in the end, you're a fucking rightfold
reinventing useless languages on daily basis
 
11:11 PM
I'm kind of obsessed to the point where I have also panic attacks, bit a part from that I like it.
 
panic attacks?
 
I actually love "code theory" if you like. Much more than "code practice".
 
With the expectations of perfection you are kind of destined to reach closed ends and need to retreat and that caused a couple of small panic attacks.
 
@Jefffrey code theory is cool once you can apply it in practice
like Functor
it's the greatest thing on the planet
 
11:13 PM
@BartekBanachewicz That becomes code practice then.
 
it's a perfect mathematical model that works so well when you actually use it
 
I don't like actually writing stuff that much.
 
@Jefffrey i can tell lol
 
Not right now at least.
 
I've just implemented sprite sheets
I think.
 
11:14 PM
That's also why I'm more tempted to learn Agda than to write any game.
 
well, nothing wrong in that
but OTOH going into a rampage discussion with me ears deep in an opengl library implementation wasn't the wisest thing :P
 
Some day I'll change, don't worry.
 
you don't have to change
you're perfect for me like you are
 
I'll do anyway. People change every time.
 
it's really fine by me
as long as you keep providing me with useful remarks :P
@Jefffrey also Maybe/Either monad instances are cool
 
11:28 PM
> I am a complete novice in both, but Haskell practically forces you to separate your IO from the rest of your logic which is an interesting thing to tackle as a technical challenge.
> You are correct. Haskell is more pure, but that's why I said pure-ish. It is interesting the stricter mode Haskell pushes you to. If it's worth it is debatable
 
@Jefffrey what about it?
 
It's what I said yesterday (or the day before) in the argument with robot.
 
11:46 PM
Robot is right
 

« first day (272 days earlier)      last day (189 days later) »