Creating a Haskell Concatenational Version: Priority Application and Composition

I study the basics of concatenative languages, the original idea of ​​which is that concatenating a function name is the same as composing a function, and not as a functional application, as in Haskell.

Joy, Forth, or Factor are postfix, which means stack-based, but there are some prefix concatenative languages ​​like Om.

I wonder if the Haskell option could theoretically be a concatenative language, simply replacing (or even leveling) the composition priority (now 9) with the application priority (now 10).

If the values ​​in Haskell are only functions with a null argument, then why is the application function different from the function ?, is the application application the same as for a function with a null argument ?.

Is there an easy way to make an interpreter or precompiler that converts concatenative syntax to Haskell syntax, defining new compound and application operators with different priorities and assuming that simple concatenation without parentheses is a composition ?. I think this is just a syntax issue, am I wrong ?, and this will avoid many cases when we have to use brackets or the $ operator in Haskell. Or is it a more fundamental problem, not just syntax and priority?

Hint: Assume that every function and operator in Haskell is a prefix, we can forget about this exercise with respect to infix notation and all kinds of “syntactic sugar”.

+4
2

- , @ , ", - Haskell" , @Jon Purdy, .

" DSL Haskell", , , , .

0

Haskell , - ?, - , ?

Haskell " ". " ". Haskell, , , - ->.

- , .

alwaysOne x = 1

map alwaysOne [1..5] == [1, 1, 1, 1, 1]

0. const , .

map (const 1) [1..5] == [1, 1, 1, 1, 1]

" " , . Haskell . .

foo x y = x + y

foo x = \y -> x + y

foo = \x -> \y -> x + y

( , , GHC .)

, , ?

, , , . , f , g , f g - , , Haskell g . f. . .

. , , , , . , , , .

, Haskell , , DSL Haskell, , .

+5

All Articles