« first day (2575 days earlier)      last day (2388 days later) » 

4:01 PM
TryParse should have returned a nullable value type, but historical reasons vOv
 
that is by far the most elegant solution I know
@milleniumbug on a side note, does C-harp have an equivalent of an Optional<T> in Jaba?
Nullable<T> is specifically for non nullable types to become nullable
its basically Boxed<T>
 
not in the standard library :(
 
hmm...
Guess I'll make my own :D
 
there's github.com/AndreyTsvetkov/Functional.Maybe if you want to use a library
 
maybe sounds odd
its a "maybe"
we have 17 maybes
 
4:08 PM
It "maybe" has a value
 
it violates many conventions though
Nullable is better in that perspective
except it has an interface name
and it is odd to have a Nullable<Object> as object is nullable already
still searching for a good name :(
anyway, im off
 
4:22 PM
What is your least favourite C# feature
One that you believe you would not mind breaking backwards compatibility
 
@MoonOwl22 Perhaps non-nullable reference types (the proposed implementation, not the concept)
Other than that, it's basically the lack of features.
 
What is wrong with the implementation?
 
All types should be non-nullable by default
 
What features would you add that you believe would cover the use cases for less powerful or expressive features that are already present
@KendallFrey Why?
Even in F# we end up having the Option type. In the Haskell world, that's the Maybe type
It's often said, "There's no null in F#"
 
Foo!: non-nullable reference type
Foo: nullable reference type
Foo: non-nullable value type
Foo?: nullable value type
crazy
 
4:26 PM
Why would you have nullable value types?
 
I don't understand the premise of this question
Why would you make an exception to nullability for value types?
 
Sorry
Typo
 
@MoonOwl22 a.) It's opt-in b.) It can nest (IOW Option<Option<T>> is a thing)
 
Why wouldn't you have nullable value types
 
That's what I asked
 
4:27 PM
@milleniumbug Yep it is but I don't see it used often
Oh so we are on the same boat
sorry
 
@milleniumbug Nesting isn't useful, so much as monadic behaviour
 
What is the state of monads in F#?
 
nullability is a great monadic behaviour
 
Could someone please define monad for the pleb
Conceptually
Actually
I'll just have to learn abstract algebra
 
Nesting is a desirable feature. It allows you to write generic functions without dumb workarounds
 
4:30 PM
One more learned person gives one less uninformed voter
I have always believed that even in my code if I need something to be null, I did something wrong
 
@MoonOwl22 A monad is a type that has two operations. The "return" operation creates a monad with a value. The "bind" operation creates a monad from the value inside a monad.
The bind operation is where the magic happens, since it defines how a monad type "works"
 
And the monad created by the return operation also has two operations as well right?
 
yes
Specifically each monad always returns its own kind
 
So you can use it to chain operations in a specific sequence right?
 
4:34 PM
So if we were to express this using pure functions, how would we go about it?
 
hard to explain without code
@MoonOwl22 Express a monad?
 
I'm guessing you'd need a product type?
 
Not entirely sure what that is, but no
Option is an easy one
 
@KendallFrey Express is a bad word. Suppose you were to define what a monad is
How would you go about it
 
typeclasses
 
4:35 PM
I'd use a typeclass, or an interface with a thistype
 
F# doesn't have typeclasses
Computation expressions are monads right?
 
Monad<T> Return<T>(T value)
Monad<T> Bind<T>(Monad<T> monad, Func<T, Monad<T>> func)
In pseudo-C#
@MoonOwl22 The docs say they're used with monads, idk
I can give you an example of how Option/Maybe is monadic, if you want
 
I am looking at this example en.wikipedia.org/wiki/… but you more than welcome to provide one
 
return x = Just x
bind x f = if x == Nothing then
                   Nothing
               else
                   f x
The rule for Maybe is that Nothing always cascades into Nothing, everything else follows the chain of functions
 
I see
 
4:45 PM
The rule for Task is that each link in the chain waits for the completion of the previous
 
So I'm guessing it's useful for simulating synchrony to a degree?
 
Without the monad's rules, you'd have something like Nullable<Nullable<Nullable<int>>> for a chain
The monad type defines how the elements of the chain compose together
 
I'm going to read this further tonight
From first principles
 
I recommend looking at examples of monads, rather than trying to figure out what they actually are.
That's what made it click for me.
 
Which language were they first implemented in?
 
4:48 PM
Also the signature of return and bind
@MoonOwl22 Not a clue, but I wouldn't be surprised if they existed before anyone even knew about the pattern
C# has plenty of monadic types, but no actual concept of a monad
 
Can a monad be used to specify how types can be used in combination?
 
in query syntax I read from x in a from y in b as monadic too.
 
If you mean for example how Nullable and Task compose together, no
 
Sort of like creating rules that determine what valid operations are and what aren't given a set of types?
 
4:51 PM
Monads are types that compose with themselves
There's probably a name for typeclasses that define how types compose together
@ntohl Roughly speaking, yeah
 
This feels like generics taken further than where C# ends
 
though from y in x would be proper hardcore monadic
 
yeah
 
@MoonOwl22 Monads aren't really related to generics, although they do depend on some kind of generics
Since each monad instance represents a "value"
 
Isn't the goal to have generic types that behave a certain way
 
4:53 PM
though in some cases, like Option, the value might not exist
@MoonOwl22 If by generic you don't mean Foo<T>, then yeah, "monad" is a generic term to describe a certain pattern
In Haskell, it's formalized, to allow language/syntax support for monads
Much like C# formalizes disposable types to provide using syntax
 
I see
The more I get into functional programming, it's like I'm learning pseudo-math
 
Fun fact: async/await is just like Haskell's do blocks, but Haskell works with any monad, not just Tasks
 
So Haskell is more abstract than C# as a result with regards to monads?
And more flexible as a result?
 
Idk if "abstract" is the right word
Haskell in general is very polymorphic
 
Bad word
Higher level?
I've been told that C# and Python's type systems are horrible
By Haskell programmers
 
5:01 PM
Haskell's type inference is super
And the type system is somewhat stronger than C#
 
I've always wanted to formally study the theory behind type systems
So I have an instrument to gauge how good a type system is for a given class of solutions
 
in Scala You need only map, flatMap, and something to consider it to be monad. Like in subsequent from close You need Select, and SelectMany in C#. Do You know what is the third?
 
This definition of type theory causes cognitive dissonance in me
In mathematics, logic, and computer science, a type theory is any of a class of formal systems, some of which can serve as alternatives to set theory as a foundation for all mathematics. In type theory, every "term" has a "type" and operations are restricted to terms of a certain type. Type theory is closely related to (and in some cases overlaps with) type systems, which are a programming language feature used to reduce bugs. Type theory was created to avoid paradoxes in a variety of formal logics and rewrite systems. Two well-known type theories that can serve as mathematical foundations are...
 
@ntohl Select doesn't count as monadic afaict
 
I am given the definition for a type theory and then the entry starts talking about Type Theory
 
5:06 PM
@KendallFrey it's not monadic, but when I try to write the first from x in ThatShouldBeMonadic, it doesn't compile if it doesn't have Select
 
Not a type theory
 
user7480455
Hi all
 
Hi James Bond
 
@ntohl from isn't a monad thing, it's an IEnumerable thing
 
user7480455
Hi Mr. Moon
 
5:06 PM
Monads are allowed to have non-monadic behaviour
 
Select can be implemented with .SelectMany(x => Return(f(x)))
 
well not quite
you didn't use the selector function
 
@KendallFrey I believe to test if something is monadic You may just throw it into from x in ThatShouldBeMonadic from y in x, and check if it compiles.
 
@ntohl In what language?
 
C#
 
5:08 PM
No, C# doesn't know anything about monads
 
...right
 
That will just check if it's IEnumerable
 
Suppose you were to write a monad library for C# how would it work
 
@milleniumbug now if only we had a function composition operator
 
like the same, You can check in haskell, if You can use x <- ThatShouldBeMonadic \n y <- x, that should be monadic
 
5:09 PM
select f = selectMany (return . f)
 
i don't like the pointless style :/
 
@MoonOwl22 It wouldn't because C# can't define a proper monad contract/interface
@milleniumbug Good thing I didn't try to remove f as well then
also lol I got the names mixed up
 
What does typeclass equate to in C#
 
I mean, it's probably ok here, but some people take it too far
 
@ntohl do notation is specifically about monads though, which is why that only works with monads
 
5:11 PM
I mean what is the equivalent of typeclasses in C#
 
there is none vOv
 
@MoonOwl22 The closest thing is an interface, but they're not as expressive
C# would require at least a thistype for interfaces to define monads, I think
 
So how the heck was Haskell implemented for the CLR?
 
Oh, also the ability to define static methods
 
It was?
 
5:13 PM
^
 
@KendallFrey I believe it's the same thing with Scala's unit + map + flatMap = baam... able to use do notation. And C#'s Select + SelectMany = baam... able to use from x in ... from y in x
 
> Question:

Can I use Haskell with the Common Language Runtime (CLR). In other words .Net / Mono / CoreCLR?

Answer:

If you're looking for a way to run Haskell on (aka target) the CLR, then the short answer is you can't.
 
So it wasn't
:(
 
so that is the closest to get to check monadic interface
 
So the CLR is only as powerful as C# allows
 
5:15 PM
@ntohl So scala's do-notation only works for types that are both functors and monads?
Or does that only work with lists/arrays?
 
My goal is to become an intense Haskeller
My program data shall not be modified
 
Google tells me map in scala is for collections, not arbitrary functors
@MoonOwl22 Until you IORef, of course
 
And everyone I shall encourage to learn to code will beta reduction and WILL love referential transparency
 
Aren't all monads functors?
 
Other people can be hired for that
 
5:18 PM
@milleniumbug In Haskell, Monad : Applicative : Functor, so yes
I don't remember monads being functors in general
 
I will keep my students in a boarding school where they have no access to the Internet
 
user7480455
Hi all sorry I have a silly question...
 
user7480455
if you have a console application and build it... where is the exe going?
 
user7480455
I did this before but now I can;t recall how to find the file
 
They will only be allowed Internet access once they can demonstrate they will not be poisoned by the world
 
5:20 PM
@007 To the output folder
 
medium.com/@sinisalouc/… in that I read it wrong. For monadity only unit + flatMap needed
 
bin\Debug or wherever
 
And they will only be allowed to lookup documentation and file bugs
 
user7480455
in properties correct is where I find thatcorrect
 
I have found the third thing. withFilter
 
5:20 PM
They won't be told data is immutable
 
@MoonOwl22 Don't be a cult leader, mmkay?
 
@007 can i just ask, Do you google this stuff before you come here or do you just ask in here?
 
user7480455
ok i look there but the date is not updated
 
They will be told they can shadow their data
BUT the data is not changing
 
so if You have map + flatMap + withFilter, it's not required to be monadic, but You have a very supported "for comprehensions" (do notation)
 
user7480455
5:21 PM
should I see a new date for a newly rebuilt file (complied)
 
gtg
 
@KendallFrey There are good cults. Cults that cultivate good thinking are good
 
@ntohl, Huh, apparently Haskell wasn't always this way
At one point, Monad was independent of Applicative and Functor
@MoonOwl22 Those aren't cults
 
Yeah, the cult of the Mythic Dawn are great! Hail Mehrunes Dagon
 
user7480455
should I delete the old out put? May be that is why the dates are not updating? sorry for the question I just don;t know how it all works
 
5:23 PM
@007 You should be fine to delete the bin folder and rebuild
 
user7480455
ok thanks
 
user7480455
I deleted the bin and obj directories... they did not come back on rebuild...
 
> cultivate good thinking
lol
your supreme leader requests you to stop with your bad thinking
 
user7480455
and to Keran yes I search the internet first for help... but it is though that if helpful people may know the solution as everything on the internet is not as helpful. If you have a problem with that tactic... I am not sure how to make you feel better about it.
 
@007 Is the build actually succeeding?
 
user7480455
5:27 PM
yes
 
user7480455
oh it says in the output window where it went
 
user7480455
im sorry I did not see that until you just asked if it was successful
 
user7480455
so sorry... I never noticed that
 
@007 I have no issue with it, I was just curious.
 
user7480455
ok thanks kieran
 
user7480455
5:29 PM
thanks kendall
 
user7480455
one of my programmers put on the web based source controller and it moved the output locations to something called check out areas... very odd but now I know.
 
5:42 PM
Type classes were inly invented in 1988
So the ideas we have in C# for example are pretty old
 
 
1 hour later…
7:13 PM
Is there a coined definition for "feature developer" and "business developer"?
 
hwat
 
updated
have you ever heard about something like this?
 
user7480455
in some countries there are feature programming options if the student has the aptitude.
 
user7480455
or if a worker shows they have the skill... they can get into a program that will allow them to enter a programmers factory and occupation route
 
user7480455
or are you asking about Feature Driven Development ?
 
user7480455
7:20 PM
that is different from my text
 
user7480455
IF that is what you are looking for you can look up FDD as the key term
 
take this example, Business developer who is responsible for developing the Accounts module in an ERP application, but the feature developer can for example develop a log feature in the application, of course there is no formal titles for them, but they describe the potentials of a developer
 
user7480455
I see
 
8:01 PM
Can you not apply encryption to an entire S3 bucket? All I'm finding is stuff about encrypting an object within a bucket but I want everything that goes into this bucket to be encrypted.
 
8:20 PM
Never mind - I actually had found what I needed but the Dunning-Kruger levels of my knowledge of S3 kept me from realizing it. docs.aws.amazon.com/AmazonS3/latest/dev/…
 
butt developer
 
 
1 hour later…
9:40 PM
https://stackoverflow.com/a/47104065/6197785
need to know why it got these downvotes
 
1) Because you're killing a fly with a nuke and 2) you don't explain your code or why you would use that over any other option.
But I'm just guessing.
 
dealing with dynamic object is not a fly btw
 
I didn't even read the question, I just know that you suggested using reflection for a problem that was solved with a left join.
 
Why the hell, List<dynamic> is not like new[], I've just noticed that?!
 
user7442629
10:44 PM
Is anyone aware of a way to write the following method as one statement?

         double CalculateDamage(string operators) {
               double damage = 5;

                foreach (char character in operators.Where(character => "*/".Contains(character)))
                {
                    if (character == '*') damage *= 2;
                    else damage /= 2;
                }

                return damage;
          }
 
@Aleksbgbg hint: Aggregate
 
user7442629
Well I thought so but how the hell
 
user7442629
What does the aggregate attach to
 
Attach?
 
user7442629
I need an enumerable to attach it to
 
10:57 PM
the one you're looping over
 
user7442629
So basically this
 
user7442629
damage = operators.Aggregate(damage, (total, nextItem) => nextItem == '*' ? total *= 2 : total /= 2);
 
user7442629
I can write it as one statement later but my total isn't being used
 
user7442629
According to ReSharper
 
user7442629
And I get the wrong result
 
11:02 PM
You don't need *= and /=, just * and /
And you forgot the Where
 
user7442629
Yeah sorry I removed the where for clarity but it was the *= thanks
 
user7442629
Well I'm surprised
 
user7442629
I tried it initially but ended up discarding
 
user7442629
Thanks
 

« first day (2575 days earlier)      last day (2388 days later) »