Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Immutable data

Name: Anonymous 2013-07-25 18:01

What kind of idiot needs to have his data kept constant to keep himself from breaking something? If you can't keep your shit in order without stupid artificial constraints, then you don't know shit about programming.

Name: Anonymous 2013-07-25 18:07

Hah, that's the one thing I don't like about Perl 6, immutable Match objects.

Name: Anonymous 2013-07-25 18:14

What kind of idiot needs to obey a certain restriction meant to reduce programming errors? If you can't keep your shit in order without stupid artificial constraints, then you don't know shit about programming.

Name: Anonymous 2013-07-25 18:16

>>1
Well what happens if the program enters a function *before* the args are bound to the values? How would you control something like that. And if you say use Lisp, I will bitchslap you with your moms dick.

Name: Anonymous 2013-07-25 18:17

What kind of idiot needs to have his data kept mutable to keep himself from building something correctly? If you can't keep your shit in order without stupid artificial mutable data, then you don't know shit about Haskell.

Name: Anonymous 2013-07-25 20:45

>>5
Haskell is not for programming with, it is for circlejerking over. I doesn't even really need any sort of data. In fact, there have been numerous studies done that proved that there has not once in the entire history of Haskell, where it was used for anything practical.

Name: Anonymous 2013-07-25 21:21

I doesn't
This about concludes my argument.

I have written a full-scale deployed botnet using Tor in Haskell.

What was that about,
numerous studies ?

Name: Anonymous 2013-07-25 21:56

Name: Anonymous 2013-07-25 22:53

>>7,8
None of that is useful, nor was it practical to write in Haskell instead of some other language. My thesis is unfalsifiable, you cannot object.

Name: NOT NOT == TRUE 2013-07-26 0:17

>>9
[thesis required]

(defun useful
do not read my email address, please!

Name: Anonymous 2013-07-26 0:29

>>9
You, sir, are a ("8" ++ (repeat '=') ++ "D").

Name: Anonymous 2013-07-26 14:02

Monads are stupid.

Name: Anonymous 2013-07-26 14:32

>>12
Doesn't understand monads.
Calls them stupid.

Name: Anonymous 2013-07-26 14:37

>>13
Fine sir. May I ask you who the fuck are you quoting?

Name: youtu.be/aP0m-PJozWo 2013-07-26 14:46

>>11
Thank you 3
That is an honour.

>>13
I know right
It should have been typed as:
The usage of Monads for programming is an efficient way to group procedures with the desired outcome.

Name: can't handle these sums 2013-07-26 15:04

Name: Anonymous 2013-07-26 15:15

>>16
The word "monads" doesn't even appear in that text. Please don't quote something that has not been said.

Name: Anonymous 2013-07-26 15:50

>>12

They are over-hyped imho. The structure of a monad is very simple. They are endofunctors with some extra structure. The only thing they work quite well, is that they can represent the idea of sequential computations. 

For example the free monad is a tree like structure, where the nodes are commands and the leaves are values. It is free, in the sense it is the most minimal definition, which follows the monad laws and thus is free of interpretation.

What is this structure? It is an abstract syntax tree. Thus an evaluator for a monad is an interpreter.  With monads we can model most imperative constructs. State? Coroutines? Logging? Exceptions? It is a monad. We can define it by adding structure to the free monad. 


A monad is easy to spot. If you find a functor, which has some operation: prob (prob a) -> prob a, you found yourself prob(ably) a monad.

Why does this all work. Two things. The join operation, allows the compiler to join two contexts together. This is effectively what bind does. It first maps the functor with some action: a -> m a. Thus we get m (m a). In m we can add a lot of extra structure (eg. state). This structure is then collapsed with join: m (m a) -> m a. This way we can hide a lot of effects in the structure of m.

Another reason is that they make code sequential, recall the third law:


(f a >>= g) >>= h = f a >>= (\b -> g b >>= h)


We can read the right side as, before calculating the next step we have to calculate the previous step. 

Monads are simple. This simplicity makes them stupid. It are not very interesting objects from my point of view. 

What is interesting is if their are other categories, which can model computations. Arrows are such a category, but these were a miss.

A lot of arrows are monads too. For example the state arrow:

newtype State a b = State ((s, a) -> (s, b))

is simple the kleisli arrow of the state monad.

Look at the state monad:

(s -> (s, a))

Now throw the kleisli transformer over it, which is an operation (a -> m b) -> (Kleisli m a b)

If we strip the last term we get:

(a -> s -> (s, b))

Which gives the arrow we already had:

(a,s) -> (s,b)

A lot of interesting arrows cannot be implemented, because they can't give arr.

Name: Anonymous 2013-07-26 16:08

>>14,17
You seem to have gotten lost. I believe that this is the imagereddit that you are looking for: http://boards.4chan.org/jp/ .

Name: Anonymous 2013-07-26 16:14

>>18
The Haskell Nomad has returned!

Name: Anonymous 2013-07-26 16:19

>>19
/anus/ ⊆ /jp/

Name: Anonymous 2013-07-26 16:20

>>18
The structure of a monad is very simple. They are endofunctors with some extra structure.
I'm part of the unwashed swines and I found your post funny, because I don't even know what the fuck is an endofunctor and that doesn't look very simple to me.

Name: Anonymous 2013-07-26 16:38

>>22

But it is. An endofunctor is nothing more than saying:

We have an operation fmap : (a -> b) -> f a -> f b

Which should behave as follow:


fmap f . fmap g = fmap (f . g) -- I can fuse computations
fmap id = id -- And I don't change the container


It is endo, because it doesn't send it's objects to another category. It is a functor, because it preserves structure.

A well known functor is an array:


map : (a -> b) -> [a] -> [b]


Which in perl is:


sub map {
 my $f = shift;
 my $xs = shift;
 my $ys = [];
 for my $x(@$xs){
    $ys[] = $f->(x);
 }
 return $ys;
}


Everything which follow these laws is a functor. For the monad we have a couple of extra laws. But again, everything which follow those laws is a monad. It is like a design pattern, but than more defined and thus easier to find and apply.

It is not hard, you only need to forget about all those stupid monad tutorials and grab a book about category theory: www.maths.ed.ac.uk/~aar/papers/maclanecat.pdf‎

Name: Anonymous 2013-07-26 16:42

Actually better take this one, I think many here have a CS background: www.math.mcgill.ca/triples/Barr-Wells-ctcs.pdf‎

And you need to see how to translate the abstraction to a computer program, before you  are able to work with them properly.

Name: Anonymous 2013-07-26 16:44

Name: Anonymous 2013-07-26 17:28

>>25
Yup, Haskell is once again laying the smack down on the mental midgets.

Name: Anonymous 2013-07-26 17:30

>>26
Hip hip, Hurray!

Name: Anonymous 2013-07-26 17:41

>>23
Thank you. I don't have any knowledge about Haskell and would have appreciated it more if it were written in standard notation, but I'll try to find more about that. I haven't taken any course on category theory, which is why I don't understand all this monad sorcery.

>>25
It doesn't really help to know the definition of a functor (a function, says the dictionary, but then how is it any different from f: R -> R; x |-> f(x)?) or the meaning of the prefix endo-, for the aforementioned reasons.

Thank you anyway.

Name: Anonymous 2013-07-26 22:16

29 get

Name: Anonymous 2013-07-28 13:59

30 get

and checked them >>33

Name: Anonymous 2013-07-28 14:03

thank

Name: Anonymous 2013-07-28 14:03

you

Name: Anonymous 2013-07-28 14:03

>>30-san

Name: Anonymous 2013-07-28 14:19

Thread reported.

Name: Anonymous 2013-07-28 14:33

This thread has some interesting information in it >>34-chan.

Name: Anonymous 2013-07-28 14:34

>>35
You realize he probably isn't reporting anything, right?

Name: Anonymous 2013-07-28 14:39

I tink ``Thread reported.'' is a meme.

Name: Anonymous 2013-07-28 14:47

>>35
The I HAVE A GIGANTIC PENIS thread should be reported. It fucks the layout up. This thread has some moderate interesting information.

Name: Anonymous 2013-07-28 15:09

>>38
Where is the GIGANTIC PENIS thread? I want to read it.

Name: Anonymous 2013-07-28 15:21

By reporting everything, it decreases the effectiveness of moderation and forces the mods to examine each thread before clicking delete. Eventually they will stop caring and ignore reports on /prog/. This is a good way to fight the /le bacqseat mod/-faggot.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List