Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the term "monadic" in J have anything to do with its Haskell use?

(Sorry, I'm stupid and uneducated, so this is probably a ridiculous question.)

I just started looking at J, and they use the terms "monadic" and "dyadic" for what seems (to me) to be unary and binary operators. Why is this done, and how does it relate to the other place I've heard the term (Haskell)? My guess is they are unrelated homonyms but I'm not sure.

like image 889
J Cooper Avatar asked Jan 10 '12 17:01

J Cooper


People also ask

What is monad in Haskell?

What is a Monad? A monad is an algebraic structure in category theory, and in Haskell it is used to describe computations as sequences of steps, and to handle side effects such as state and IO. Monads are abstract, and they have many useful concrete instances. Monads provide a way to structure a program.

Why is a monad called a monad?

monad, (from Greek monas “unit”), an elementary individual substance that reflects the order of the world and from which material properties are derived. The term was first used by the Pythagoreans as the name of the beginning number of a series, from which all following numbers derived.

What is monadic function?

A monadic function is a function with a single argument, written to its right. It is one of three possible function valences; the other two are dyadic and niladic. The term prefix function is used outside of APL to describe APL's monadic function syntax.

Is Haskell list a monad?

Lists are a fundamental part of Haskell, and we've used them extensively before getting to this chapter. The novel insight is that the list type is a monad too! As monads, lists are used to model nondeterministic computations which may return an arbitrary number of results.


1 Answers

They're unrelated except by both deriving from the Greek root for "one". Monadic and dyadic are indeed terms for unary and binary functions. Specifically, they're the Greek-derived equivalents--using -adic instead of -ary. Consider the word "triad", which is also Greek-derived.

Monad in the sense Haskell uses it has an unclear etymology but probably derives from "monoid".

I would encourage sticking with the Latin-derived "n-ary" terms in Haskell, though. All functions in Haskell technically have one argument because of currying, so using the Greek-derived form could produce arbitrary amounts of confusion.

like image 55
C. A. McCann Avatar answered Oct 15 '22 01:10

C. A. McCann