r/ProgrammingLanguages • Sodigy • Jul 29 '26

Purely functional language with impure script language?

I'm working on a purely functional programming language named Sodigy. It's all about evaluating values, not "executing commands one by one".

It's nice when writing libraries, but it's not easy to write a main function. The main function is supposed to execute commands, but the Sodigy's syntax is not friendly to write a list of commands.

So what I'm trying to do is, 1) Sodigy remains purely functional and 2) add a bash-like script language. The script language can call Sodigy functions. Instead of writing a main function in Sodigy, you write sodigy-script and execute the script.

Has anyone tried similar approach? I'm not sure whether it's a good idea or not...

27 Upvotes

74 comments sorted by

View all comments

Show parent comment

-3

u/JeffB1517 Jul 29 '26
  1. reply =<< getLine that's making the bind explicit rather than implicit.
  2. print is clearer than putStr

put is a weird verb for what you are doing vs. "print" which is pretty clear.

We are talking minor shifts which abstract away the underlying complexity.

2

u/eaho_de_putah Jul 29 '26

How is reply =<< getLine any more explicit than reply $comp input?? It’s literally just a different name/operator for the same operation.

1

u/JeffB1517 Jul 29 '26

It’s literally just a different name/operator for the same operation. Same as print vs putStrLn it is a more natural operator for the same operation. It is translating mentally.

Easing the conceptual burden is good design. What things look like is how they get concieved of. =<< is a binding operator. It is making the user think in terms of bind. reply $comp input is telling the user the reply is computing something on input. It is making them think about the workflow.

1

u/tdammers Jul 29 '26

It's literally just different names. Miranda's $comp is exactly Haskell's >>= operator, and Miranda's print is Haskell's putStr. Changing names is not abstraction, we're still at the exact same abstraction level; the semantic structure is exactly the same.