« first day (314 days earlier)      last day (332 days later) » 

00:20
@Delfin For the Prelude, table 2 in chapter 4 of the Haskell 2010 Report
@DavidYoung And what is the precedence of <*> and <$>?
...til that backtick infixified functions don't all have the same precedence
that's kind of horrifying
but also kind of makes sense
You can also find the precedence of an operator in GHCi using :i like this :i <*>
This will also tell you where it's defined
(and it works for non-operators as well)
@DavidYoung Haskell does not have operators
00:34
?
what about the operators we were just talking about
@DavidYoung They are infix functions
... did you look at the Haskell Report that was linked to you?
The Haskell Report indeed calls them "operators"
This is also the term that is typically used when I've talked to other Haskell programmers. I've spent a decent amount of time on the Haskell tag on StackOverflow and in the #haskell IRC chatroom, and this is the usual thing to call them
Most of my answers are on the StackOverflow haskell tag, in fact
Yeah; infix functions are functions that is made infix by surrounding graves (`).
@MichaelHomer Only the table 2
@DannyuNDos I think they would better refereed as infixed functions. And we can call the operators infix functions
@DavidYoung Anyway, How are the precedence of infixeed functions defined?
00:43
:(
@Delfin using the infixr and infixl keywords
and infix
@DavidYoung But it would not make them infix all the time except when they are like (+)
?
What do you mean?
@Delfin i meant ==/!=
@DavidYoung That If I write something like infix myFunction, then myFuntion arg1 arg2 is invalid but arg1 myFunction arg2 and (myFunction) arg1 arg2 are valid
00:55
@Delfin Operator names can only consist of non-alphanumeric characters. When you use one of the infix keywords with a regular function name, it applies to the backtick infix syntax and nothing else
(also, we see here a good reason for distinguishing between "operators" and "non-operators". The language itself makes that distinction)
Does anyone know why GHC doesn't define instance Monoid e => Alternative (Either e)?
01:11
@DannyuNDos I'm guessing the reasoning is something like: It's kind of strange to just use the Monoid constraint for mempty and most of the time you should probably use the Maybe instance for Alternative if you want to do this
 
2 hours later…
03:37
@Seggan And is what I assumed to mean
Can you express all the PostgressSQL, GraphQL, Rest and so on in Datalog?
Also document database queries and so on?
04:00
I’m not sure what that means
What are you (conceptually) trying to do?
Can every Query written in SQL (MariaDB, MemSQL, PostgreeSQL), GraphQL, Rest, EdgeQL (docs.edgedb.com/get-started/edgeql) be written in Datalog?
@MichaelHomer Conceptually I am trying to "replace" all query protocols of both SQL an non-SQL databases with Datalog.
Many RDBMS dialects support unbounded loops, so probably not
Maybe you could simulate that for practical cases in Datalog but I am sceptical of it
@MichaelHomer No need to be a problem, either We get a dialect of datalog with added unbounded loops for those case, or it can simply left unsupported (As really is no to replace all with datalog). But most important what would be lose if we remove unbounded loops?
04:18
It’s no longer supporting every query, but I don’t think I’ve ever written a real loop within SQL personally
@MichaelHomer As long nothing important is lose. Is just fine
 
2 hours later…
06:00
CMP: Do you call the design pattern "facade" or "façade"?
06:30
Design Patterns: Elements of Reusable Object-Oriented Software (1994) is a software engineering book describing software design patterns. The book was written by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, with a foreword by Grady Booch. The book is divided into two parts, with the first two chapters exploring the capabilities and pitfalls of object-oriented programming, and the remaining chapters describing 23 classic software design patterns. The book includes examples in C++ and Smalltalk. It has been influential to the field of software engineering and is regarded as a...
I gotta read this
06:45
@DannyuNDos Can work with fachada?
 
1 hour later…
07:52
I call it facade because english doesn't have ç. A word's spelling changes when it's adopted as part of another language
 
1 hour later…
08:56
Is Haskell's Down a proxy class in OOP perspective?
 
6 hours later…
15:09
@DannyuNDos no
idk what ud call it but its def not a proxy
15:23
hmm, I was going to write a Scala version of Down, but it seems a little awkward to get it to be a really close match (partially since you have to single out one particular value as the this, if that makes sense)
but I'm also pretty far from a Scala expert, hah
actually
does Down allow any operations that its wrapper allows?
i.e. can i do foo Down x if foo x is allowed?
@DavidYoung something like this in kotlin
Not unless foo is part of a type class which also happens to be implemented by Down (rather than the original type). Down implements a bunch of common type classes to make that somewhat convenient (and it can be made to implement more later on, since these things are separate from the definition of Down itself)
class Down<T : Comparable<T>>(private val value: T) : Comparable<Down<T>> {
    override fun compareTo(other: Down<T>): Int = -value.compareTo(other.value)
}
@DavidYoung yeah its not a proxy then
^^ code is a pretty accurate translation i think
@Seggan Ahh, yeah that does look right
Probably the main difference is that you can't extend it to implement more traits later on, but that's more due to a fundamentally different tradeoff between OOP-style traits and type classes
15:52
At a high-level, it alters the behavior of the original type on one particular trait (more generally, I guess it could've been on some fixed collection of traits). I'm not sure whether or not that corresponds to a traditional OOP pattern
There are also newtypes that add additional behavior to the original type. Not sure whether that should be considered another example of the same pattern. For instance, with Maybe, if the "original type" A has a combine method, then the combine method for Maybe A will use Nothing as the "do nothing" value and combine two Justs using the original combine.
That's how Maybe takes something with a Semigroup instance (something with a combine, which Haskell calls <>) and gives you something with a Monoid instance (which means it has a combine that has a "do nothing" element, which Haskell calls mempty)
a proxy in OOP exposes all methods that the original type does
so in your case Maybe is a proxy
in kotlin delegates are a type of proxy
Hmm, I might have to think some more about that one
Maybe A wouldn't, in general, have all the operations that A does
16:24
We can just ignore all "Smalltalk" decedent styles of OPP as useless?. Only Comonad OPP style would be fine.
@Delfin Counterpoint to the second sentence: gelisam.blogspot.com/2013/07/…
OOP is not useless
also Java-type OOP is not a descendant of Smalltalk OOP
Smalltalk is prototype based
@Seggan Most of the conventional approaches to it are anti-patterns. To do it well mean, doing code that not resembles most of all OPP written code in existence
@Seggan Haskell Style OPP is a good OPP style.
And with existing OPP code, I mean code that is considered OPP
OOP*
16:35
What is the purpose of such statements as "ignore [...] OOP as useless"? No one is going to see that and think "You know what, I liked OOP before but that sentence has totally changed my mind". Such statements do not address any of the nuance and, therefore, invite un-constructive arguments (since the statement is, itself, un-constructive)
I can only think of negative consequences of making a statement like that.
What about this: Most paradigms of OPP are anti-patterns.
It would be even better to give a specific example
The most trivial one, is inheritance OOP, which is also considered as very much of an do not use by OOP's best pratices.
16:51
@Seggan One example of good OOP is naturally emerging OOP of writing principled coded in a language with ML typing and pure code. youtube.com/watch?v=US8QG9I1XW0
@Delfin Some are nice but I agree a lot of them seem really unnecessary exercises in masochism
Like getters and setters
I like Rust's idea of a struct/trait system
Java OOP is constrained by the distinction it makes between abstract classes and interfaces, and not allowing multiple inheritance of the former
@Ginger It would be a typeclass system
It seems like inheritance should be okay when the Liskov substitution principle holds
example I have encountered in practice: I want to add a new set of blocks to Minecraft in a mod that all share common functionality, so I make an abstract class for the block; unfortunately this means that I cannot have these blocks be integrated with a different mod which uses its own abstract class for its functionality
@DavidYoung what's that? I'm not familiar with it
16:56
@Ginger PHP traits/mixins also solve this problem
@DavidYoung Never understand it, but it certainly would be a hill of success rather than a pit of success
given that they're a PHP feature I doubt they solve it well :p
Ergo, it breaks at the moment a junior is the the team
or someone that does not know the project
They do actually quite nicely. PHP is only 99% bad
ah, a stopped clock
16:58
@mousetail It is not the same that saying that php is bad?
95% of most languages is bad, so it's only a 4% difference
If S is a subtype of T then: When some property P holds for all instances of the class T, then P should also hold for all instances of class S
^ That's LSP
Traits are classes that can just be inserted into any other class, kind of like a macro but safe
@mousetail PHP is fractally terrible, I don't think you can compare it to other languages in badness :b
@mousetail Only 40% of Haskell is bad
16:59
@DavidYoung seems reasonable enough
@Delfin It seems that way because you use it a lot and now know how to avoid the bad parts
the one with the toolbox analogy
It's a good article but PHP has improved a lot since 2012
@Ginger But is not reasonable to expect it to be easily maintainable, expect to have it broken all the time by juniors and newer member of the team
what?
are we talking about the same thing
17:02
@Ginger That the LSP will be broken all the time...
@Delfin This is true of any approach to software development
@DavidYoung This experienced developer disagrees youtube.com/watch?v=US8QG9I1XW0
.-.
He says that it's easy for new people to get started with doing software engineering using functional programming?
and that they don't break good conventions, as long as it's functional programming?
@DavidYoung No. He says that it is a pit of success
ergo it tends to lend you to write correct and maintainable code
@DavidYoung also no
17:04
that video is an hour long, wow
@mousetail out of curiosity, how many things in that article have been fixed?
It's hard to count. A lot of things throw errors now that used to return null or ` false` so that already accounts for quite a lot of the points is the first thing I noticed
@DavidYoung What do you think about this chat.stackexchange.com/transcript/message/65405859#65405859?
my own message?
ah, that one
Don't really know much about Datalog and I don't have much database experience
@Ginger Autoloading basically takes care of the whole module system problem
I know Datalog is a sub-Turing complete restriction of Prolog, but that's about it
17:09
It has it's own weired wtfs though
@mousetail do I still have to check four different configuration files to figure out exactly how my program will behave?
Yes, that's still a thing
lovely
Though it's more like 20 at my job
Also inheritance based OPP is either restrictive or unsound, with the first being only one inheritance of java and the second the style of Python.
17:11
more power to you
What does "unsound" mean?
Python doesn't have a type system to be "sound" with tho
@DavidYoung Diamond inheritance
Also the ini files are slightly different in dev and prod just enough that you don't really consider it untill it brigs down prod every month
@Ginger Then use C++
It has the same problem
17:12
I wouldn't know
C++ lacks soundness for (many) other reasons
@Delfin most people would not consider haskell to be OOP
@Delfin antipatterns are something that actively harms maintainability, etc
i do agree that factories, etc have been way overused in the past and that gave oop a bad name
but oop is good in moderation imo
like kotlin
@mousetail thats why properties were invented
@Delfin a minority
You make these strong black-and-white statements ("<X> is bad"), but I simultaneously get the impression that you don't have much hands-on experience with some of these things. This combination is frustrating for me to see. You can cite "expert" opinions, but you can also often find "experts" that say the opposite
@Ginger You can now type hint function arguments as int or string but can no longer hint them as callable so it's 2 steps forwards 1 step back
You can also hint the return type now
Functions can have named arguments now which is actually amazing and I use all the time. That's one thing I miss in Rust
17:29
Like, I just finished writing a ~8.5k line Haskell program recently and it took me a while to get it to be well-designed. I did two complete rewrites. It is true that features of Haskell made this easier (especially the type checker), but it still takes effort to do good design. It could still certainly be improved, but it serves its purpose. It is very simplified to say "we're using functional programming so it's going to just automatically lead to good design"
@Seggan Kotlin doesn't really do OOP in moderation
you can do a lot without it tho
@Ginger by "im moderation" i mean "not sticking everything into a class" :P
@DavidYoung this
in no language is it hard to write bad code
@Seggan It does no make it wrong.
@Seggan Either for good or for bad Haskell is OOP youtube.com/watch?v=VRlIGV4gl5Q
@Delfin as david said, "You can cite 'expert' opinions, but you can also often find 'experts' that say the opposite"
@Seggan They are not a worse version of the builder pattern in rust?
17:37
factories as in new StringFactory(new Random(1), 42).createString("abc")
AbstractIoServiceFactoryFactory my beloved
(guess the company)
@Seggan What does it?
ah, you found it d:
it was an example of what i meant by factory
objects that are created to create other objects
17:38
@Seggan If not is a builder pattern, it looks like a thing to never use
uuuh builder patterns are the only thing you should use?
@Seggan custom buffer implementation, same library
its API looks like NIO buffers but has absolutely zero relation to them
@Ginger yes company is well known for abusing old java patterns :P
@Seggan In this aspect Haskell need more encapsulation capabilities, and surely a little of Ghost of the departed proofs iohk.io/en/research/library/papers/… would allow haskell to have the perfect encapsulation
@Ginger what
17:40
@Seggan I mean never use factory feels right
I have a 240-line class that wraps that library to make it work with Kotlin coroutines
@Ginger they are async?
@Delfin i agree that factories should be seldom used
// These aren't used for anything, but the interface
// requires them regardless
override fun setInputStream(stream: InputStream) {}
override fun setOutputStream(stream: OutputStream) {}
override fun setErrorStream(stream: OutputStream) {}

// Using putBytes prepends the length of the array. What the fuck, Apache?
buffer.ensureCapacity(array.size)
buffer.putRawBytes(array)

} catch (e: CancellationException) {
    scope.cancel()
what fun we have
three snippets from that class
@DavidYoung It was more like in the long run Haskell will give you very maintainable code if is already good designed, and is hard to force in a bad design.
17:44
@Delfin wdym?
@Ginger that if co-routines are part of async in Kotlin?
contrary to popular myth, we Java/OOP programmers do not worship the Gang of Four or treat Design Patterns as our holy book. we understand that in everything there should be moderation, and that some of them are less desirable in light of newer programming features. however, this does not mean that all OOP is bad, unmaintainable, and doomed to die in AbstractIoServiceFactoryFactory hell. yes patterns have been overused in the early 2000s, but we are better now
@Delfin yes
@Seggan WHat it means?
@Delfin they're the recommended concurrency system, yes
@Delfin i mostly agree with your statement. factories should not be used often
17:47
I love Kotlin coroutines so much btw
coming from Python and asyncio
@Ginger yes
agree
(not being able to close shared flows is annoying tho)
(and the docs are a little unclear on exactly how cancellation and errors propagate)
@Seggan @MichaelHomer mind editing "userused" to "overused" (pinging as ure the most recent mod)
Maybe it also applies to functional, because Having a integer monad, which content is just an integer, to make arithmetic operations sound much like the Factory Pattern in your example. One just have to know which pattern to use and when, for this moderation is not the correct word,
but is easier to understand the functional patterns likewise identify the appropriate occasions to use such patterns in the functional side, which may be interpreted to make the OOP an anti-pattern in comparison.
a lot of programmers i know would say functional is harder to understand
17:54
@Seggan The base is what may be said to be harder, but the good design pattern are which is easier to understand given that you already understood the base.
you can say the same thing about oop
different people find different things easier and harder, of course
what is a integer monad?
@Seggan For some pattern correcty in OOP you need 200 pages. The functional may need 200 pages to introduce you to itself, but the same pattern can be explained in 2 pages in functional.
@DavidYoung A very bad and useless monad
@Delfin uhh which pattern requires 200 pages?
17:59
@Delfin I'm not convinced it exists, though...
@Seggan youtube.com/watch?v=US8QG9I1XW0 someone here it shows an example
Let me define it.
data IntegerMonad = IntegerMonad Integral
You mean Int (or Integer), not Integral. But fixing that, that doesn't even have the right kind to be a monad
@DavidYoung Could you elaborate?
A monad must have the kind * -> *
The type you gave has kind *
and having kind * -> * is a necessary, but not sufficient, condition to be a monad
May be this could fix it
data IntegerMonad = IntegerMonad a -> Int
18:03
@Delfin i dont see it? can u give a timestamp?
@Seggan I will be back in 1 hour
That is syntactically incorrect
@DavidYoung What is the solution?
I mean, I don't think "integer monad" makes sense
so I don't really think there is a solution that makes sense
@DavidYoung It does not have to make sense, it is an strawman
18:06
but I just don't even understand what "integer monad" would mean. Like it really doesn't make sense to me
@DavidYoung l
@DavidYoung Like the State Monad but only with the type Int
or Integer
Ah, okay now that does make sense
(But it's also perfectly fine to use that, depending on the situation)
@DavidYoung Unless you mix it with some capabilities to be bookkeeping precession loss or similar, I cannot believe that such thing can be useful ever.
Here is one example. Imagine that you are writing a compiler. During part of compilation, you sometimes need to generate fresh variable names. You can use an Int to generate a fresh name by putting the Int at the end of a name (I'm leaving out some irrelevant details here). Instead of passing around Ints everywhere by hand, a nice approach is to use the State monad. Then, you can have a fresh name generator action which will take care of all that for you
@Delfin There are many kinds of OO inheritance beyond these.
18:15
The State approach will look much cleaner
in that example
@MichaelHomer For Example?
I’m so glad you asked. Here is 26 pages of inheritance models, not one of which involves classes.
Imagine how many more are out there
Did not the crafting compilers make your own Lux tutorial said that prototype based language is no an inheritance based one?
18:39
One could certainly make that sort of case, although many of those models are not prototype-based. One could see also Taivalsaari, A, Delegation versus concatenation, or cloning is inheritance too, OOPSLA Messenger 6(3), 1995, if we are doing arbitrary appeal to single authority
19:03
@Delfin However, a further advisory: the sort of purposeless, obnoxious, ignorant, arrogant, unjustified belligerence that you have been bringing in this room in the last couple of hours and other times is not welcome, and that has been made very clear to you both previously and from others within that discussion, yet you have persisted and repeated. To be very explicit this time, if you pull this again in here you will be removed.
Anyone is welcome here to learn more about things they don’t know about, but disruptive fight-picking is not helpful to others, even more so when it is just a proxy fight. Rein it in, ok? You don’t have to agree with or like everything, but be constructive about it.
Here's an example I just wrote that does part of an ANF transformation that uses a supply of fresh unique names. Compare the non-State version with the State version. Notice how you need to carefully pass around the current unique identifier in the non-State version which is annoying and error-prone
But this is handled completely automatically in the version that uses State.
@MichaelHomer tbf they are getting better
19:19
(I'm sure it could still be cleaned up, I just want to illustrate how much manual plumbing the non-State version needs that the other one doesn't have at all)
 
3 hours later…
22:24
My advisor says the paradigm of FP doesn't mix well to Unity. Unsure whether that's true, but I'll see soon.
yeah
unity is very OOPy
22:39
Today is the day to ask him whether CPS mixes to Unity well...
Though, I'm still yet to understand the Cont monad in Haskell.
Writer, Reader, and State are relatively easy to understand. But Cont and Select? These are mind breakers.
probably also no
if in OOP land, do as the OOPers do
He says callbacks are the heart of OOP. Isn't CPS the result from abusing callbacks?
22:54
eh
sorta i guess
*Cough* Soon to be time to break his mind as well.
23:29
A week late but Java 22 is out
With statements before super(..);, stabilized new FFI, unnamed variables/patterns, in-memory compilation, the seventh incubator of the vector api, and a bunch more previews

« first day (314 days earlier)      last day (332 days later) »